1 #include "../machine/system16.c"
2 #include "../sndhrdw/system16.c"
3 #include "../vidhrdw/system16.c"
4 
5 /*
6 
7 
8 --------
9   ASTORMBL
10           3. In the ending, the 3 heroes are floating into a half bubble. (see picture). Also colour problems during ending as well.
11           4. In the later Shooting gallery stage (like inside the car shop and the factory (mission 3)),
12 		  there is some garbage graphics (sprite of death monsters that appear where they should not)
13 
14 
15 	working:
16 		Alex Kidd
17 		Alien Storm (bootleg)
18 		Alien Syndrome
19 		Altered Beast (Ver 1)
20 		Altered Beast (Ver 2)	(No Sound)
21 		Atomic Point			(No Sound)
22 		Aurail					(Speech quality sounds poor)
23 		Aurail (317-0168)
24 		Bay Route
25 		Body Slam
26 	    Dump Matsumoto (Japan, Body Slam)
27 		Dynamite Dux (bootleg)
28 		Enduro Racer (bootleg)
29 		Enduro Racer (custom bootleg)
30 		E-Swat (bootleg)
31 		Fantasy Zone (Old Ver.)
32 		Fantasy Zone (New Ver.)
33 		Flash Point  (bootleg)
34 		Golden Axe (Ver 1)
35 		Golden Axe (Ver 2)
36 		Hang-on
37 		Heavyweight Champ: some minor graphics glitches
38 		Major League: No game over.
39 		Moonwalker (bootleg): Music Speed varies
40 		Outrun (set 1)
41 		Outrun (set 2)
42 		Outrun (custom bootleg)
43 		Passing Shot (bootleg)
44 		Passing Shot (4 player bootleg)
45 		Quartet: Glitch on highscore list
46 		Quartet (Japan): Glitch on highscore list
47 		Quartet 2: Glitch on highscore list
48 		Riot City
49 		SDI
50 		Shadow Dancer
51 		Shadow Dancer (Japan)
52 		Shinobi
53 		Shinobi (Sys16A Bootleg?)
54 		Space Harrier
55 		Super Hangon (bootleg)
56 		Tetris (bootleg)
57 		Time Scanner
58 		Toryumon
59 		Tough Turf (Japan)			(No Sound)
60 		Tough Turf (US)				(No Sound)
61 		Tough Turf (bootleg)	(No Speech Roms)
62 		Wonderboy 3 - Monster Lair
63 		Wonderboy 3 - Monster Lair (bootleg)
64 		Wrestle War
65 
66 	not really working:
67 		Shadow Dancer (bootleg)
68 
69 	protected:
70 		Alex Kidd (jpn?)
71 		Alien Syndrome
72 		Alien Syndrome
73 		Alien Syndrome (Japan)
74 		Alien Storm
75 		Alien Storm (2 Player)
76 		Bay Route (317-0116)
77 		Bay Route (protected bootleg 1)
78 		Bay Route (protected bootleg 2)
79 		Enduro Racer
80 		E-Swat
81 		Flash Point
82 		Golden Axe (Ver 1 317-0121 Japan)
83 		Golden Axe (Ver 2 317-0110)
84 		Golden Axe (Ver 2 317-0122)
85 		Golden Axe (protected bootleg)
86 		Jyuohki (Japan, altered beast)
87 		Moonwalker (317-0158)
88 		Moonwalker (317-0159)
89 		Passing Shot (317-0080)
90 		Shinobi (Sys16B 317-0049)
91 		Shinobi (Sys16A 317-0050)
92 		SDI (Japan, old version)
93 		Super Hangon
94 		Tetris (Type A)
95 		Tetris (Type B 317-0092)
96 		Wonderboy 3 - Monster Lair (317-0089)
97 
98 	protected (No driver):
99 		Ace Attacker
100 		Action Fighter
101 		Bloxeed
102 		Clutch Hitter
103 		Cotton (Japan)
104 		Cotton
105 		DD Crew
106 		Dunk Shot
107 		Excite League
108 		Laser Ghost
109 		Line of Fire
110 		MVP
111 		Ryukyu
112 		Super Leagu
113 		Thunder Blade
114 		Thunder Blade (Japan)
115 		Turbo Outrun
116 		Turbo Outrun (Set 2)
117 
118 	not working (No driver):
119 		After Burner
120 		After Burner II
121 
122 */
123 
124 #define SYS16_CREDITS \
125 	"Thierry Lescot & Nao (Hardware Info)\n" \
126 	"Mirko Buffoni (MAME driver)\n" \
127 	"Andrew Prime\n" \
128 	"Phil Stroffolino"
129 
130 
131 //#define SPACEHARRIER_OFFSETS
132 
133 
134 /*
135 This should be enabled when the sprite manager fully handles the special
136 left/right side markers. This will fix graphics glitches in several games,
137 including ESwat, Alien Storm and Altered Beast.
138 */
139 #define SPRITE_SIDE_MARKERS
140 #define TRANSPARENT_SHADOWS
141 
142 #ifdef TRANSPARENT_SHADOWS
143 #define NumOfShadowColors 32
144 #define ShadowColorsMultiplier 2
145 extern int sys16_sh_shadowpal;
146 #else
147 #define ShadowColorsMultiplier 1
148 #endif
149 #ifdef TRANSPARENT_SHADOWS
150 extern int sys16_MaxShadowColors;
151 #endif
152 
153 #include "driver.h"
154 #include "vidhrdw/generic.h"
155 #include "cpu/z80/z80.h"
156 #include "cpu/i8039/i8039.h"
157 
158 /***************************************************************************/
159 
160 READ_HANDLER( sys16_tileram_r );
161 WRITE_HANDLER( sys16_tileram_w );
162 READ_HANDLER( sys16_textram_r );
163 WRITE_HANDLER( sys16_textram_w );
164 extern int sys16_vh_start( void );
165 extern void sys16_vh_stop( void );
166 extern void sys16_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
167 WRITE_HANDLER( sys16_paletteram_w );
168 
169 extern int sys16_ho_vh_start( void );
170 extern void sys16_ho_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
171 
172 extern int sys16_or_vh_start( void );
173 extern void sys16_or_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
174 
175 extern int sys18_vh_start( void );
176 extern void sys18_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
177 
178 /* video driver constants (vary with game) */
179 extern int sys16_spritesystem;
180 extern int sys16_sprxoffset;
181 extern int sys16_bgxoffset;
182 extern int sys16_fgxoffset;
183 extern int *sys16_obj_bank;
184 extern int sys16_textmode;
185 extern int sys16_textlayer_lo_min;
186 extern int sys16_textlayer_lo_max;
187 extern int sys16_textlayer_hi_min;
188 extern int sys16_textlayer_hi_max;
189 extern int sys16_dactype;
190 extern int sys16_bg1_trans;
191 extern int sys16_bg_priority_mode;
192 extern int sys16_fg_priority_mode;
193 extern int sys16_bg_priority_value;
194 extern int sys16_fg_priority_value;
195 extern int sys16_spritelist_end;
196 extern int sys16_tilebank_switch;
197 extern int sys16_rowscroll_scroll;
198 extern int sys16_quartet_title_kludge;
199 void (* sys16_update_proc)( void );
200 
201 /* video driver registers */
202 extern int sys16_refreshenable;
203 extern int sys16_clear_screen;
204 extern int sys16_tile_bank0;
205 extern int sys16_tile_bank1;
206 extern int sys16_bg_scrollx, sys16_bg_scrolly;
207 extern int sys16_bg_page[4];
208 extern int sys16_fg_scrollx, sys16_fg_scrolly;
209 extern int sys16_fg_page[4];
210 
211 extern int sys16_bg2_scrollx, sys16_bg2_scrolly;
212 extern int sys16_bg2_page[4];
213 extern int sys16_fg2_scrollx, sys16_fg2_scrolly;
214 extern int sys16_fg2_page[4];
215 
216 extern int sys18_bg2_active;
217 extern int sys18_fg2_active;
218 extern unsigned char *sys18_splittab_bg_x;
219 extern unsigned char *sys18_splittab_bg_y;
220 extern unsigned char *sys18_splittab_fg_x;
221 extern unsigned char *sys18_splittab_fg_y;
222 
223 #ifdef SPACEHARRIER_OFFSETS
224 extern unsigned char *spaceharrier_patternoffsets;
225 #endif
226 extern unsigned char *gr_ver;
227 extern unsigned char *gr_hor;
228 extern unsigned char *gr_pal;
229 extern unsigned char *gr_flip;
230 extern int gr_palette;
231 extern int gr_palette_default;
232 extern unsigned char gr_colorflip[2][4];
233 extern unsigned char *gr_second_road;
234 
235 /* video driver has access to these memory regions */
236 unsigned char *sys16_tileram;
237 unsigned char *sys16_textram;
238 unsigned char *sys16_spriteram;
239 
240 /* other memory regions */
241 static unsigned char *sys16_workingram;
242 static unsigned char *sys16_extraram;
243 static unsigned char *sys16_extraram2;
244 static unsigned char *sys16_extraram3;
245 static unsigned char *sys16_extraram4;
246 static unsigned char *sys16_extraram5;
247 
248 // 7751 emulation
249 WRITE_HANDLER( sys16_7751_audio_8255_w );
250  READ_HANDLER( sys16_7751_audio_8255_r );
251  READ_HANDLER( sys16_7751_sh_rom_r );
252  READ_HANDLER( sys16_7751_sh_t1_r );
253  READ_HANDLER( sys16_7751_sh_command_r );
254 WRITE_HANDLER( sys16_7751_sh_dac_w );
255 WRITE_HANDLER( sys16_7751_sh_busy_w );
256 WRITE_HANDLER( sys16_7751_sh_offset_a0_a3_w );
257 WRITE_HANDLER( sys16_7751_sh_offset_a4_a7_w );
258 WRITE_HANDLER( sys16_7751_sh_offset_a8_a11_w );
259 WRITE_HANDLER( sys16_7751_sh_rom_select_w );
260 
261 
262 // encryption decoding
263 void endurob2_decode_data(unsigned char *dest,unsigned char *source,int size);
264 void endurob2_decode_data2(unsigned char *dest,unsigned char *source,int size);
265 void enduror_decode_data(unsigned char *dest,unsigned char *source,int size);
266 void enduror_decode_data2(unsigned char *dest,unsigned char *source,int size);
267 
268 void aurail_decode_data(unsigned char *dest,unsigned char *source,int size);
269 void aurail_decode_opcode1(unsigned char *dest,unsigned char *source,int size);
270 void aurail_decode_opcode2(unsigned char *dest,unsigned char *source,int size);
271 
272 /***************************************************************************/
273 
274 #define MWA_PALETTERAM	sys16_paletteram_w, &paletteram
275 #define MRA_PALETTERAM	paletteram_word_r
276 
277 #define MRA_WORKINGRAM	MRA_BANK1
278 #define MWA_WORKINGRAM	MWA_BANK1,&sys16_workingram
279 
280 #define MRA_SPRITERAM	MRA_BANK2
281 #define MWA_SPRITERAM	MWA_BANK2,&sys16_spriteram
282 
283 #define MRA_TILERAM		sys16_tileram_r
284 #define MWA_TILERAM		sys16_tileram_w,&sys16_tileram
285 
286 #define MRA_TEXTRAM		sys16_textram_r
287 #define MWA_TEXTRAM		sys16_textram_w,&sys16_textram
288 
289 #define MRA_EXTRAM		MRA_BANK3
290 #define MWA_EXTRAM		MWA_BANK3,&sys16_extraram
291 
292 #define MRA_EXTRAM2		MRA_BANK4
293 #define MWA_EXTRAM2		MWA_BANK4,&sys16_extraram2
294 
295 #define MRA_EXTRAM3		MRA_BANK5
296 #define MWA_EXTRAM3		MWA_BANK5,&sys16_extraram3
297 
298 #define MRA_EXTRAM4		MRA_BANK6
299 #define MWA_EXTRAM4		MWA_BANK6,&sys16_extraram4
300 
301 #define MRA_EXTRAM5		MRA_BANK7
302 #define MWA_EXTRAM5		MWA_BANK7,&sys16_extraram5
303 
304 /***************************************************************************/
305 
306 #define MACHINE_DRIVER( GAMENAME,READMEM,WRITEMEM,INITMACHINE,GFXSIZE) \
307 static struct MachineDriver GAMENAME = \
308 { \
309 	{ \
310 		{ \
311 			CPU_M68000, \
312 			10000000, \
313 			READMEM,WRITEMEM,0,0, \
314 			sys16_interrupt,1 \
315 		}, \
316 		{ \
317 			CPU_Z80 | CPU_AUDIO_CPU, \
318 			4096000, \
319 			sound_readmem,sound_writemem,sound_readport,sound_writeport, \
320 			ignore_interrupt,1 \
321 		}, \
322 	}, \
323 	60, DEFAULT_60HZ_VBLANK_DURATION, \
324 	1, \
325 	INITMACHINE, \
326 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
327 	GFXSIZE, \
328 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier, \
329 	0, \
330 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE, \
331 	0, \
332 	sys16_vh_start, \
333 	sys16_vh_stop, \
334 	sys16_vh_screenrefresh, \
335 	SOUND_SUPPORTS_STEREO,0,0,0, \
336 	{ \
337 		{ \
338 			SOUND_YM2151, \
339 			&ym2151_interface \
340 		} \
341 	} \
342 };
343 
344 #define MACHINE_DRIVER_7759( GAMENAME,READMEM,WRITEMEM,INITMACHINE,GFXSIZE, UPD7759INTF ) \
345 static struct MachineDriver GAMENAME = \
346 { \
347 	{ \
348 		{ \
349 			CPU_M68000, \
350 			10000000, \
351 			READMEM,WRITEMEM,0,0, \
352 			sys16_interrupt,1 \
353 		}, \
354 		{ \
355 			CPU_Z80 | CPU_AUDIO_CPU, \
356 			4096000, \
357 			sound_readmem_7759,sound_writemem,sound_readport,sound_writeport_7759, \
358 			ignore_interrupt,1 \
359 		}, \
360 	}, \
361 	60, DEFAULT_60HZ_VBLANK_DURATION, \
362 	1, \
363 	INITMACHINE, \
364 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
365 	GFXSIZE, \
366 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier, \
367 	0, \
368 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE, \
369 	0, \
370 	sys16_vh_start, \
371 	sys16_vh_stop, \
372 	sys16_vh_screenrefresh, \
373 	SOUND_SUPPORTS_STEREO,0,0,0, \
374 	{ \
375 		{ \
376 			SOUND_YM2151, \
377 			&ym2151_interface \
378 		}, { \
379 			SOUND_UPD7759, \
380 			&UPD7759INTF \
381 		} \
382 	} \
383 };
384 
385 
386 #define MACHINE_DRIVER_7751( GAMENAME,READMEM,WRITEMEM,INITMACHINE,GFXSIZE ) \
387 static struct MachineDriver GAMENAME = \
388 { \
389 	{ \
390 		{ \
391 			CPU_M68000, \
392 			10000000, \
393 			READMEM,WRITEMEM,0,0, \
394 			sys16_interrupt,1 \
395 		}, \
396 		{ \
397 			CPU_Z80 | CPU_AUDIO_CPU, \
398 			4096000, \
399 			sound_readmem_7751,sound_writemem,sound_readport_7751,sound_writeport_7751, \
400 			ignore_interrupt,1 \
401 		}, \
402 		{ \
403 			CPU_N7751 | CPU_AUDIO_CPU, \
404 			6000000/15,        /* 6Mhz crystal */ \
405 			readmem_7751,writemem_7751,readport_7751,writeport_7751, \
406 			ignore_interrupt,1 \
407 		} \
408 	}, \
409 	60, DEFAULT_60HZ_VBLANK_DURATION, \
410 	1, \
411 	INITMACHINE, \
412 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
413 	GFXSIZE, \
414 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier, \
415 	0, \
416 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE, \
417 	0, \
418 	sys16_vh_start, \
419 	sys16_vh_stop, \
420 	sys16_vh_screenrefresh, \
421 	SOUND_SUPPORTS_STEREO,0,0,0, \
422 	{ \
423 		{ \
424 			SOUND_YM2151, \
425 			&ym2151_interface \
426 		}, \
427 		{ \
428 			SOUND_DAC, \
429 			&sys16_7751_dac_interface \
430 		} \
431 	} \
432 };
433 
434 
435 #define MACHINE_DRIVER_18( GAMENAME,READMEM,WRITEMEM,INITMACHINE,GFXSIZE) \
436 static struct MachineDriver GAMENAME = \
437 { \
438 	{ \
439 		{ \
440 			CPU_M68000, \
441 			10000000, \
442 			READMEM,WRITEMEM,0,0, \
443 			sys16_interrupt,1 \
444 		}, \
445 		{ \
446 			CPU_Z80 | CPU_AUDIO_CPU, \
447 			4096000*2, /* overclocked to fix sound, but wrong! */ \
448 			sound_readmem_18,sound_writemem_18,sound_readport_18,sound_writeport_18, \
449 			ignore_interrupt,1 \
450 		}, \
451 	}, \
452 	60, DEFAULT_60HZ_VBLANK_DURATION, \
453 	1, \
454 	INITMACHINE, \
455 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
456 	GFXSIZE, \
457 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier, \
458 	0, \
459 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE, \
460 	0, \
461 	sys18_vh_start, \
462 	sys16_vh_stop, \
463 	sys18_vh_screenrefresh, \
464 	SOUND_SUPPORTS_STEREO,0,0,0, \
465 	{ \
466 		{ \
467 			SOUND_YM3438, \
468 			&ym3438_interface \
469 		}, \
470 		{ \
471 			SOUND_RF5C68, \
472 			&rf5c68_interface, \
473 		} \
474 	} \
475 };
476 
477 
478 
479 static void (*sys16_custom_irq)(void);
480 
sys16_onetime_init_machine(void)481 static void sys16_onetime_init_machine(void)
482 {
483 	sys16_bg1_trans=0;
484 	sys16_rowscroll_scroll=0;
485 	sys18_splittab_bg_x=0;
486 	sys18_splittab_bg_y=0;
487 	sys18_splittab_fg_x=0;
488 	sys18_splittab_fg_y=0;
489 
490 	sys16_quartet_title_kludge=0;
491 
492 	sys16_custom_irq=NULL;
493 
494 #ifdef TRANSPARENT_SHADOWS
495 	sys16_MaxShadowColors=NumOfShadowColors;
496 #endif
497 
498 #ifdef SPACEHARRIER_OFFSETS
499 	spaceharrier_patternoffsets=0;
500 #endif
501 }
502 
503 /***************************************************************************/
504 
sys16_interrupt(void)505 int sys16_interrupt( void ){
506 	if(sys16_custom_irq) sys16_custom_irq();
507 	return 4; /* Interrupt vector 4, used by VBlank */
508 }
509 
510 /***************************************************************************/
511 
sound_cause_nmi(int chip)512 static void sound_cause_nmi(int chip)
513 {
514 	cpu_set_nmi_line(1, PULSE_LINE);
515 }
516 
517 static struct MemoryReadAddress sound_readmem[] =
518 {
519 	{ 0x0000, 0x7fff, MRA_ROM },
520 	{ 0xe800, 0xe800, soundlatch_r },
521 	{ 0xf800, 0xffff, MRA_RAM },
522 	{ -1 }  /* end of table */
523 };
524 
525 static struct MemoryWriteAddress sound_writemem[] =
526 {
527 	{ 0x0000, 0x7fff, MWA_ROM },
528 	{ 0xf800, 0xffff, MWA_RAM },
529 	{ -1 }  /* end of table */
530 };
531 
532 static struct IOReadPort sound_readport[] =
533 {
534 	{ 0x01, 0x01, YM2151_status_port_0_r },
535 	{ 0xc0, 0xc0, soundlatch_r },
536 	{ -1 }	/* end of table */
537 };
538 
539 static struct IOWritePort sound_writeport[] =
540 {
541 	{ 0x00, 0x00, YM2151_register_port_0_w },
542 	{ 0x01, 0x01, YM2151_data_port_0_w },
543 	{ -1 }
544 };
545 
546 
547 
548 // 7751 Sound
549 
550 static struct MemoryReadAddress sound_readmem_7751[] =
551 {
552 	{ 0x0000, 0x7fff, MRA_ROM },
553 	{ 0xe800, 0xe800, soundlatch_r },
554 	{ 0xf800, 0xffff, MRA_RAM },
555 	{ -1 }  /* end of table */
556 };
557 
558 static struct IOReadPort sound_readport_7751[] =
559 {
560 	{ 0x01, 0x01, YM2151_status_port_0_r },
561 //    { 0x0e, 0x0e, sys16_7751_audio_8255_r },
562 	{ 0xc0, 0xc0, soundlatch_r },
563 	{ -1 }	/* end of table */
564 };
565 
566 
567 
568 static struct IOWritePort sound_writeport_7751[] =
569 {
570 	{ 0x00, 0x00, YM2151_register_port_0_w },
571 	{ 0x01, 0x01, YM2151_data_port_0_w },
572 	{ 0x80, 0x80, sys16_7751_audio_8255_w },
573 	{ -1 }
574 };
575 
576 static struct MemoryReadAddress readmem_7751[] =
577 {
578         { 0x0000, 0x03ff, MRA_ROM },
579         { -1 }  /* end of table */
580 };
581 
582 static struct MemoryWriteAddress writemem_7751[] =
583 {
584         { 0x0000, 0x03ff, MWA_ROM },
585         { -1 }  /* end of table */
586 };
587 
588 static struct IOReadPort readport_7751[] =
589 {
590         { I8039_t1,  I8039_t1,  sys16_7751_sh_t1_r },
591         { I8039_p2,  I8039_p2,  sys16_7751_sh_command_r },
592         { I8039_bus, I8039_bus, sys16_7751_sh_rom_r },
593         { -1 }  /* end of table */
594 };
595 
596 static struct IOWritePort writeport_7751[] =
597 {
598         { I8039_p1, I8039_p1, sys16_7751_sh_dac_w },
599         { I8039_p2, I8039_p2, sys16_7751_sh_busy_w },
600         { I8039_p4, I8039_p4, sys16_7751_sh_offset_a0_a3_w },
601         { I8039_p5, I8039_p5, sys16_7751_sh_offset_a4_a7_w },
602         { I8039_p6, I8039_p6, sys16_7751_sh_offset_a8_a11_w },
603         { I8039_p7, I8039_p7, sys16_7751_sh_rom_select_w },
604         { -1 }  /* end of table */
605 };
606 
607 static struct DACinterface sys16_7751_dac_interface =
608 {
609         1,
610         { 100 }
611 };
612 
613 
614 // 7759
615 
616 
617 static struct MemoryReadAddress sound_readmem_7759[] =
618 {
619 	{ 0x0000, 0x7fff, MRA_ROM },
620 	{ 0x8000, 0xdfff, UPD7759_0_data_r },
621 	{ 0xe800, 0xe800, soundlatch_r },
622 	{ 0xf800, 0xffff, MRA_RAM },
623 	{ -1 }  /* end of table */
624 };
625 
626 // some games (aurail, riotcity, eswat), seem to send different format data to the 7759
627 // this function changes that data to what the 7759 expects, but it sounds quite poor.
WRITE_HANDLER(UPD7759_process_message_w)628 static WRITE_HANDLER( UPD7759_process_message_w )
629 {
630 	if((data & 0xc0) == 0x40) data=0xc0;
631 	else data&=0x3f;
632 
633 	UPD7759_message_w(offset,data);
634 }
635 
636 static struct IOWritePort sound_writeport_7759[] =
637 {
638 	{ 0x00, 0x00, YM2151_register_port_0_w },
639 	{ 0x01, 0x01, YM2151_data_port_0_w },
640 	{ 0x40, 0x40, UPD7759_process_message_w },
641 	{ 0x80, 0x80, UPD7759_0_start_w },
642 	{ -1 }
643 };
644 
645 static struct UPD7759_interface upd7759_interface =
646 {
647 	1,			/* 1 chip */
648 	UPD7759_STANDARD_CLOCK,
649 	{ 60 }, 	/* volumes */
650 	{ REGION_CPU2 },			/* memory region 3 contains the sample data */
651     UPD7759_SLAVE_MODE,
652 	{ sound_cause_nmi },
653 };
654 
655 // SYS18 Sound
656 
657 unsigned char *sys18_SoundMemBank;
658 
READ_HANDLER(system18_bank_r)659 static READ_HANDLER( system18_bank_r )
660 {
661 	return sys18_SoundMemBank[offset];
662 }
663 
664 static struct MemoryReadAddress sound_readmem_18[] =
665 {
666 	{ 0x0000, 0x9fff, MRA_ROM },
667 	{ 0xa000, 0xbfff, system18_bank_r },
668 	/**** D/A register ****/
669 	{ 0xd000, 0xdfff, RF5C68_r },
670 	{ 0xe000, 0xffff, MRA_RAM },
671 	{ -1 }  /* end of table */
672 };
673 
674 static struct MemoryWriteAddress sound_writemem_18[] =
675 {
676 	{ 0x0000, 0xbfff, MWA_ROM },
677 	/**** D/A register ****/
678 	{ 0xc000, 0xc008, RF5C68_reg_w },
679 	{ 0xd000, 0xdfff, RF5C68_w },
680 	{ 0xe000, 0xffff, MWA_RAM },	//??
681 	{ -1 }  /* end of table */
682 };
683 
684 static struct RF5C68interface rf5c68_interface = {
685   //3580000 * 2,
686   3579545*2,
687   100
688 };
689 
690 
WRITE_HANDLER(sys18_soundbank_w)691 static WRITE_HANDLER( sys18_soundbank_w )
692 {
693 // select access bank for a000~bfff
694 	unsigned char *RAM = memory_region(REGION_CPU2);
695 	int Bank=0;
696 
697 	switch (data&0xc0)
698 	{
699 		case 0x00:
700 			Bank = data<<13;
701 			break;
702 		case 0x40:
703 			Bank = ((data&0x1f) + 128/8)<<13;
704 			break;
705 		case 0x80:
706 			Bank = ((data&0x1f) + (256+128)/8)<<13;
707 			break;
708 		case 0xc0:
709 			Bank = ((data&0x1f) + (512+128)/8)<<13;
710 			break;
711 	}
712 	sys18_SoundMemBank = &RAM[Bank+0x10000];
713 }
714 
715 static struct IOReadPort sound_readport_18[] =
716 {
717 	{ 0x80, 0x80, YM2612_status_port_0_A_r },
718 //	{ 0x82, 0x82, YM2612_status_port_0_B_r },
719 //	{ 0x90, 0x90, YM2612_status_port_1_A_r },
720 //	{ 0x92, 0x92, YM2612_status_port_1_B_r },
721 	{ 0xc0, 0xc0, soundlatch_r },
722 	{ -1 }	/* end of table */
723 };
724 
725 
726 static struct IOWritePort sound_writeport_18[] =
727 {
728 	{ 0x80, 0x80, YM2612_control_port_0_A_w },
729 	{ 0x81, 0x81, YM2612_data_port_0_A_w },
730 	{ 0x82, 0x82, YM2612_control_port_0_B_w },
731 	{ 0x83, 0x83, YM2612_data_port_0_B_w },
732 	{ 0x90, 0x90, YM2612_control_port_1_A_w },
733 	{ 0x91, 0x91, YM2612_data_port_1_A_w },
734 	{ 0x92, 0x92, YM2612_control_port_1_B_w },
735 	{ 0x93, 0x93, YM2612_data_port_1_B_w },
736 	{ 0xa0, 0xa0, sys18_soundbank_w },
737 	{ -1 }
738 };
739 
740 static struct YM2612interface ym3438_interface =
741 {
742 	2,	/* 2 chips */
743 	8000000,
744 	{ 40,40 },
745 	{ 0 },	{ 0 },	{ 0 },	{ 0 }
746 };
747 
748 
749 // Sega 3D Sound
750 
751 
752 static struct YM2203interface ym2203_interface =
753 {
754 	1,	/* 1 chips */
755 	4096000,	/* 3.58 MHZ ? */
756 	{ YM2203_VOL(50,50) },
757 	{ 0 },
758 	{ 0 },
759 	{ 0 },
760 	{ 0 },
761 	{ 0 }
762 };
763 
764 static struct YM2203interface ym2203_interface2 =
765 {
766 	3,	/* 1 chips */
767 	4096000,	/* 3.58 MHZ ? */
768 	{ YM2203_VOL(50,50),YM2203_VOL(50,50),YM2203_VOL(50,50) },
769 	{ 0 },
770 	{ 0 },
771 	{ 0 },
772 	{ 0 },
773 	{ 0 }
774 };
775 
776 static struct SEGAPCMinterface segapcm_interface_15k = {
777 	SEGAPCM_SAMPLE15K,
778 	BANK_256,
779 	REGION_SOUND1,		// memory region
780 	50
781 };
782 
783 static struct SEGAPCMinterface segapcm_interface_15k_512 = {
784 	SEGAPCM_SAMPLE15K,
785 	BANK_512,
786 	REGION_SOUND1,		// memory region
787 	50
788 };
789 
790 static struct SEGAPCMinterface segapcm_interface_32k = {
791 	SEGAPCM_SAMPLE32K,
792 	BANK_256,
793 	REGION_SOUND1,
794 	50
795 };
796 
797 
798 // Super hang-on, outrun
799 
800 // hopefully this is endian safe!
801 static unsigned char *sound_shared_ram;
READ_HANDLER(sound_shared_ram_r)802 static READ_HANDLER( sound_shared_ram_r )
803 {
804 	return (sound_shared_ram[offset] << 8) + sound_shared_ram[offset+1];
805 }
806 
WRITE_HANDLER(sound_shared_ram_w)807 static WRITE_HANDLER( sound_shared_ram_w )
808 {
809 	int val=(sound_shared_ram[offset] << 8) + sound_shared_ram[offset+1];
810 	val=(val & (data>>16)) | (data &0xffff);
811 
812 	sound_shared_ram[offset] = val>>8;
813 	sound_shared_ram[offset+1] = val&0xff;
814 }
815 
816 
READ_HANDLER(sound2_shared_ram_r)817 static READ_HANDLER( sound2_shared_ram_r ) { return sound_shared_ram[offset]; }
WRITE_HANDLER(sound2_shared_ram_w)818 static WRITE_HANDLER( sound2_shared_ram_w ) { sound_shared_ram[offset] = data; }
819 
WRITE_HANDLER(sound_command_w)820 static WRITE_HANDLER( sound_command_w ){
821 	//logerror("SOUND COMMAND %04x <- %02x\n", offset, data&0xff );
822 	soundlatch_w( 0,data&0xff );
823 	cpu_cause_interrupt( 1, 0 );
824 }
825 
WRITE_HANDLER(sound_command_nmi_w)826 static WRITE_HANDLER( sound_command_nmi_w ){
827 	//logerror("SOUND COMMAND %04x <- %02x\n", offset, data&0xff );
828 	soundlatch_w( 0,data&0xff );
829 	cpu_set_nmi_line(1, PULSE_LINE);
830 }
831 
832 static struct YM2151interface ym2151_interface =
833 {
834 	1,			/* 1 chip */
835 	4096000,	/* 3.58 MHZ ? */
836 	{ YM3012_VOL(40,MIXER_PAN_LEFT,40,MIXER_PAN_RIGHT) },
837 	{ 0 }
838 };
839 
840 
841 
842 
843 /***************************************************************************/
844 
845 static struct GfxLayout charlayout1 =
846 {
847 	8,8,	/* 8*8 chars */
848 	8192,	/* 8192 chars */
849 	3,	/* 3 bits per pixel */
850 	{ 0x20000*8, 0x10000*8, 0 },
851 		{ 0, 1, 2, 3, 4, 5, 6, 7 },
852 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
853 	8*8	/* every sprite takes 8 consecutive bytes */
854 };
855 
856 static struct GfxLayout charlayout2 =
857 {
858 	8,8,	/* 8*8 chars */
859 	16384,	/* 16384 chars */
860 	3,	/* 3 bits per pixel */
861 	{ 0x40000*8, 0x20000*8, 0 },
862 		{ 0, 1, 2, 3, 4, 5, 6, 7 },
863 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
864 	8*8	/* every sprite takes 8 consecutive bytes */
865 };
866 
867 static struct GfxLayout charlayout4 =
868 {
869 	8,8,	/* 8*8 chars */
870 	32768,	/* 32768 chars */
871 	3,	/* 3 bits per pixel */
872 	{ 0x80000*8, 0x40000*8, 0 },
873 		{ 0, 1, 2, 3, 4, 5, 6, 7 },
874 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
875 	8*8	/* every sprite takes 8 consecutive bytes */
876 };
877 
878 static struct GfxLayout charlayout8 =
879 {
880 	8,8,	/* 8*8 chars */
881 	4096,	/* 4096 chars */
882 	3,	/* 3 bits per pixel */
883 	{ 0x10000*8, 0x08000*8, 0 },
884 		{ 0, 1, 2, 3, 4, 5, 6, 7 },
885 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
886 	8*8	/* every sprite takes 8 consecutive bytes */
887 };
888 
889 static struct GfxDecodeInfo gfx1[] =
890 {
891 	{ REGION_GFX1, 0x00000, &charlayout1,	0, 256 },
892 	{ -1 } /* end of array */
893 };
894 
895 static struct GfxDecodeInfo gfx2[] =
896 {
897 	{ REGION_GFX1, 0x00000, &charlayout2,	0, 256 },
898 	{ -1 } /* end of array */
899 };
900 
901 static struct GfxDecodeInfo gfx4[] =
902 {
903 	{ REGION_GFX1, 0x00000, &charlayout4,	0, 256 },
904 	{ -1 } /* end of array */
905 };
906 
907 static struct GfxDecodeInfo gfx8[] =
908 {
909 	{ REGION_GFX1, 0x00000, &charlayout8,	0, 256 },
910 	{ -1 } /* end of array */
911 };
912 
913 /***************************************************************************/
914 
set_refresh(int data)915 static void set_refresh( int data ){
916 	sys16_refreshenable = data&0x20;
917 	sys16_clear_screen  = data&1;
918 }
919 
set_refresh_18(int data)920 static void set_refresh_18( int data ){
921 	sys16_refreshenable = data&0x2;
922 //	sys16_clear_screen  = data&4;
923 }
924 
set_refresh_3d(int data)925 static void set_refresh_3d( int data ){
926 	sys16_refreshenable = data&0x10;
927 }
928 
929 
set_tile_bank(int data)930 static void set_tile_bank( int data ){
931 	sys16_tile_bank1 = data&0xf;
932 	sys16_tile_bank0 = (data>>4)&0xf;
933 }
934 
set_tile_bank18(int data)935 static void set_tile_bank18( int data ){
936 	sys16_tile_bank0 = data&0xf;
937 	sys16_tile_bank1 = (data>>4)&0xf;
938 }
939 
set_fg_page(int data)940 static void set_fg_page( int data ){
941 	sys16_fg_page[0] = data>>12;
942 	sys16_fg_page[1] = (data>>8)&0xf;
943 	sys16_fg_page[2] = (data>>4)&0xf;
944 	sys16_fg_page[3] = data&0xf;
945 }
946 
set_bg_page(int data)947 static void set_bg_page( int data ){
948 	sys16_bg_page[0] = data>>12;
949 	sys16_bg_page[1] = (data>>8)&0xf;
950 	sys16_bg_page[2] = (data>>4)&0xf;
951 	sys16_bg_page[3] = data&0xf;
952 }
953 
set_fg_page1(int data)954 static void set_fg_page1( int data ){
955 	sys16_fg_page[1] = data>>12;
956 	sys16_fg_page[0] = (data>>8)&0xf;
957 	sys16_fg_page[3] = (data>>4)&0xf;
958 	sys16_fg_page[2] = data&0xf;
959 }
960 
set_bg_page1(int data)961 static void set_bg_page1( int data ){
962 	sys16_bg_page[1] = data>>12;
963 	sys16_bg_page[0] = (data>>8)&0xf;
964 	sys16_bg_page[3] = (data>>4)&0xf;
965 	sys16_bg_page[2] = data&0xf;
966 }
967 
set_fg2_page(int data)968 static void set_fg2_page( int data ){
969 	sys16_fg2_page[0] = data>>12;
970 	sys16_fg2_page[1] = (data>>8)&0xf;
971 	sys16_fg2_page[2] = (data>>4)&0xf;
972 	sys16_fg2_page[3] = data&0xf;
973 }
974 
set_bg2_page(int data)975 static void set_bg2_page( int data ){
976 	sys16_bg2_page[0] = data>>12;
977 	sys16_bg2_page[1] = (data>>8)&0xf;
978 	sys16_bg2_page[2] = (data>>4)&0xf;
979 	sys16_bg2_page[3] = data&0xf;
980 }
981 
982 
983 /***************************************************************************/
984 /*	Important: you must leave extra space when listing sprite ROMs
985 	in a ROM module definition.  This routine unpacks each sprite nibble
986 	into a byte, doubling the memory consumption. */
987 
sys16_sprite_decode(int num_banks,int bank_size)988 static void sys16_sprite_decode( int num_banks, int bank_size ){
989 	unsigned char *base = memory_region(REGION_GFX2);
990 	unsigned char *temp = (unsigned char*)malloc( bank_size );
991 	int i;
992 
993 	if( !temp ) return;
994 
995 	for( i = num_banks; i >0; i-- ){
996 		unsigned char *finish	= base + 2*bank_size*i;
997 		unsigned char *dest = finish - 2*bank_size;
998 
999 		unsigned char *p1 = temp;
1000 		unsigned char *p2 = temp+bank_size/2;
1001 
1002 		unsigned char data;
1003 
1004 		memcpy (temp, base+bank_size*(i-1), bank_size);
1005 
1006 /*
1007 	note: both pen#0 and pen#15 are transparent.
1008 	we replace references to pen#15 with pen#0, to simplify the sprite rendering
1009 */
1010 		do {
1011 			data = *p2++;
1012 #ifdef SPRITE_SIDE_MARKERS
1013 			if( (data&0x0f) == 0x0f )
1014 			{
1015 				if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
1016 					*dest++ = data >> 4;
1017 				else
1018 					*dest++ = 0xff;
1019 				*dest++ = 0xff;
1020 			}
1021 			else if( (data&0xf0) == 0xf0 )
1022 			{
1023 				*dest++ = 0x00;
1024 				if( (data&0x0f) == 0x0f ) data &= 0xf0;
1025 				*dest++ = data &0xf;
1026 			}
1027 			else
1028 			{
1029 				*dest++ = data >> 4;
1030 				*dest++ = data & 0xF;
1031 			}
1032 #else
1033 			{
1034 				if( (data&0xf0) == 0xf0 ) data &= 0x0f;
1035 				if( (data&0x0f) == 0x0f ) data &= 0xf0;
1036 				*dest++ = data >> 4;
1037 				*dest++ = data & 0xF;
1038 			}
1039 #endif
1040 
1041 			data = *p1++;
1042 #ifdef SPRITE_SIDE_MARKERS
1043 			if( (data&0x0f) == 0x0f )
1044 			{
1045 				if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
1046 					*dest++ = data >> 4;
1047 				else
1048 					*dest++ = 0xff;
1049 				*dest++ = 0xff;
1050 			}
1051 			else if( (data&0xf0) == 0xf0 )
1052 			{
1053 				*dest++ = 0x00;
1054 				if( (data&0x0f) == 0x0f ) data &= 0xf0;
1055 				*dest++ = data &0xf;
1056 			}
1057 			else
1058 			{
1059 				*dest++ = data >> 4;
1060 				*dest++ = data & 0xF;
1061 			}
1062 #else
1063 			{
1064 				if( (data&0xf0) == 0xf0 ) data &= 0x0f;
1065 				if( (data&0x0f) == 0x0f ) data &= 0xf0;
1066 				*dest++ = data >> 4;
1067 				*dest++ = data & 0xF;
1068 			}
1069 #endif
1070 		} while( dest<finish );
1071 	}
1072 	free( temp );
1073 }
1074 
sys16_sprite_decode2(int num_banks,int bank_size,int side_markers)1075 static void sys16_sprite_decode2( int num_banks, int bank_size, int side_markers ){
1076 	unsigned char *base = memory_region(REGION_GFX2);
1077 	unsigned char *temp = (unsigned char*)malloc( bank_size );
1078 	int i;
1079 
1080 	if( !temp ) return;
1081 
1082 	for( i = num_banks; i >0; i-- ){
1083 		unsigned char *finish	= base + 2*bank_size*i;
1084 		unsigned char *dest = finish - 2*bank_size;
1085 
1086 		unsigned char *p1 = temp;
1087 		unsigned char *p2 = temp+bank_size/4;
1088 		unsigned char *p3 = temp+bank_size/2;
1089 		unsigned char *p4 = temp+bank_size/4*3;
1090 
1091 		unsigned char data;
1092 
1093 		memcpy (temp, base+bank_size*(i-1), bank_size);
1094 
1095 /*
1096 	note: both pen#0 and pen#15 are transparent.
1097 	we replace references to pen#15 with pen#0, to simplify the sprite rendering
1098 */
1099 		do {
1100 			data = *p4++;
1101 #ifdef SPRITE_SIDE_MARKERS
1102 			if( side_markers )
1103 			{
1104 				if( (data&0x0f) == 0x0f )
1105 				{
1106 					if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
1107 						*dest++ = data >> 4;
1108 					else
1109 						*dest++ = 0xff;
1110 					*dest++ = 0xff;
1111 				}
1112 				else if( (data&0xf0) == 0xf0 )
1113 				{
1114 					*dest++ = 0x00;
1115 					if( (data&0x0f) == 0x0f ) data &= 0xf0;
1116 					*dest++ = data &0xf;
1117 				}
1118 				else
1119 				{
1120 					*dest++ = data >> 4;
1121 					*dest++ = data & 0xF;
1122 				}
1123 			}
1124 			else
1125 #endif
1126 			{
1127 				if( (data&0xf0) == 0xf0 ) data &= 0x0f;
1128 				if( (data&0x0f) == 0x0f ) data &= 0xf0;
1129 				*dest++ = data >> 4;
1130 				*dest++ = data & 0xF;
1131 			}
1132 
1133 			data = *p3++;
1134 #ifdef SPRITE_SIDE_MARKERS
1135 			if( side_markers )
1136 			{
1137 				if( (data&0x0f) == 0x0f )
1138 				{
1139 					if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
1140 						*dest++ = data >> 4;
1141 					else
1142 						*dest++ = 0xff;
1143 					*dest++ = 0xff;
1144 				}
1145 				else if( (data&0xf0) == 0xf0 )
1146 				{
1147 					*dest++ = 0x00;
1148 					if( (data&0x0f) == 0x0f ) data &= 0xf0;
1149 					*dest++ = data &0xf;
1150 				}
1151 				else
1152 				{
1153 					*dest++ = data >> 4;
1154 					*dest++ = data & 0xF;
1155 				}
1156 			}
1157 			else
1158 #endif
1159 			{
1160 				if( (data&0xf0) == 0xf0 ) data &= 0x0f;
1161 				if( (data&0x0f) == 0x0f ) data &= 0xf0;
1162 				*dest++ = data >> 4;
1163 				*dest++ = data & 0xF;
1164 			}
1165 
1166 
1167 			data = *p2++;
1168 #ifdef SPRITE_SIDE_MARKERS
1169 			if( side_markers )
1170 			{
1171 				if( (data&0x0f) == 0x0f )
1172 				{
1173 					if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
1174 						*dest++ = data >> 4;
1175 					else
1176 						*dest++ = 0xff;
1177 					*dest++ = 0xff;
1178 				}
1179 				else if( (data&0xf0) == 0xf0 )
1180 				{
1181 					*dest++ = 0x00;
1182 					if( (data&0x0f) == 0x0f ) data &= 0xf0;
1183 					*dest++ = data &0xf;
1184 				}
1185 				else
1186 				{
1187 					*dest++ = data >> 4;
1188 					*dest++ = data & 0xF;
1189 				}
1190 			}
1191 			else
1192 #endif
1193 			{
1194 				if( (data&0xf0) == 0xf0 ) data &= 0x0f;
1195 				if( (data&0x0f) == 0x0f ) data &= 0xf0;
1196 				*dest++ = data >> 4;
1197 				*dest++ = data & 0xF;
1198 			}
1199 
1200 			data = *p1++;
1201 #ifdef SPRITE_SIDE_MARKERS
1202 			if( side_markers )
1203 			{
1204 				if( (data&0x0f) == 0x0f )
1205 				{
1206 					if((data&0xf0) !=0xf0 && (data&0xf0) !=0)
1207 						*dest++ = data >> 4;
1208 					else
1209 						*dest++ = 0xff;
1210 					*dest++ = 0xff;
1211 				}
1212 				else if( (data&0xf0) == 0xf0 )
1213 				{
1214 					*dest++ = 0x00;
1215 					if( (data&0x0f) == 0x0f ) data &= 0xf0;
1216 					*dest++ = data &0xf;
1217 				}
1218 				else
1219 				{
1220 					*dest++ = data >> 4;
1221 					*dest++ = data & 0xF;
1222 				}
1223 			}
1224 			else
1225 #endif
1226 			{
1227 				if( (data&0xf0) == 0xf0 ) data &= 0x0f;
1228 				if( (data&0x0f) == 0x0f ) data &= 0xf0;
1229 				*dest++ = data >> 4;
1230 				*dest++ = data & 0xF;
1231 			}
1232 
1233 		} while( dest<finish );
1234 	}
1235 	free( temp );
1236 }
1237 
1238 int gr_bitmap_width;
1239 
generate_gr_screen(int w,int bitmap_width,int skip,int start_color,int end_color,int source_size)1240 static void generate_gr_screen(int w,int bitmap_width,int skip,int start_color,int end_color,int source_size)
1241 {
1242 	UINT8 *buf;
1243 	UINT8 *gr = memory_region(REGION_GFX3);
1244 	UINT8 *grr = NULL;
1245     int i,j,k;
1246     int center_offset=0;
1247 
1248 
1249 	buf=(UINT8*)malloc(source_size);
1250 	if(buf==NULL) return;
1251 
1252 	gr_bitmap_width = bitmap_width;
1253 
1254 	memcpy(buf,gr,source_size);
1255 	memset(gr,0,256*bitmap_width);
1256 
1257 	if (w!=gr_bitmap_width)
1258 	{
1259 		if (skip>0) // needs mirrored RHS
1260 			grr=gr;
1261 		else
1262 		{
1263 			center_offset=(gr_bitmap_width-w);
1264 			gr+=center_offset/2;
1265 		}
1266 	}
1267 
1268     // build gr_bitmap
1269 	for (i=0; i<256; i++)
1270 	{
1271 		UINT8 last_bit;
1272 		UINT8 color_data[4];
1273 
1274 		color_data[0]=start_color; color_data[1]=start_color+1;
1275 		color_data[2]=start_color+2; color_data[3]=start_color+3;
1276 		last_bit=((buf[0]&0x80)==0)|(((buf[0x4000]&0x80)==0)<<1);
1277 		for (j=0; j<w/8; j++)
1278 		{
1279 			for (k=0; k<8; k++)
1280 			{
1281 				UINT8 bit=((buf[0]&0x80)==0)|(((buf[0x4000]&0x80)==0)<<1);
1282 				if (bit!=last_bit && bit==0 && i>1)
1283 				{ // color flipped to 0,advance color[0]
1284 					if (color_data[0]+end_color <= end_color)
1285 					{
1286 						color_data[0]+=end_color;
1287 					}
1288 					else
1289 					{
1290 						color_data[0]-=end_color;
1291 					}
1292 				}
1293 				*gr = color_data[bit];
1294 				last_bit=bit;
1295 				buf[0] <<= 1; buf[0x4000] <<= 1; gr++;
1296 			}
1297 			buf++;
1298 		}
1299 
1300 		if (grr!=NULL)
1301 		{ // need mirrored RHS
1302 			UINT8 *_gr=gr-1;
1303 			_gr -= skip;
1304 			for (j=0; j<w-skip; j++)
1305 			{
1306 				*gr++ = *_gr--;
1307 			}
1308 			for (j=0; j<skip; j++) *gr++ = 0;
1309 		}
1310 		else if (center_offset!=0)
1311 		{
1312 			gr+=center_offset;
1313 		}
1314 	}
1315 
1316 	i=1;
1317 	while ( (1<<i) < gr_bitmap_width ) i++;
1318 	gr_bitmap_width=i; // power of 2
1319 
1320 }
1321 
1322 
1323 /***************************************************************************/
1324 
1325 #define io_player1_r input_port_0_r
1326 #define io_player2_r input_port_1_r
1327 #define io_player3_r input_port_5_r
1328 #define io_player4_r input_port_6_r
1329 #define io_service_r input_port_2_r
1330 
1331 #define io_dip1_r input_port_3_r
1332 #define io_dip2_r input_port_4_r
1333 #define io_dip3_r input_port_5_r
1334 
1335 /***************************************************************************/
1336 
1337 
patch_codeX(int offset,int data,int cpu)1338 static void patch_codeX( int offset, int data, int cpu ){
1339 	int aligned_offset = offset&0xfffffe;
1340 	unsigned char *RAM = memory_region(REGION_CPU1+cpu);
1341 	int old_word = READ_WORD( &RAM[aligned_offset] );
1342 
1343 	if( offset&1 )
1344 		data = (old_word&0xff00)|data;
1345 	else
1346 		data = (old_word&0x00ff)|(data<<8);
1347 
1348 	WRITE_WORD (&RAM[aligned_offset], data);
1349 }
1350 
patch_code(int offset,int data)1351 static void patch_code( int offset, int data ) {patch_codeX(offset,data,0);}
1352 //static void patch_code2( int offset, int data ) {patch_codeX(offset,data,2);}
1353 
patch_z80code(int offset,int data)1354 static void patch_z80code( int offset, int data ){
1355 	unsigned char *RAM = memory_region(REGION_CPU2);
1356 	RAM[offset] = data;
1357 }
1358 
1359 /***************************************************************************/
1360 
1361 #define SYS16_JOY1 PORT_START \
1362 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) \
1363 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) \
1364 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) \
1365 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1366 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY ) \
1367 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY ) \
1368 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY ) \
1369 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
1370 
1371 #define SYS16_JOY2 PORT_START \
1372 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL ) \
1373 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL ) \
1374 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL ) \
1375 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1376 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL ) \
1377 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL ) \
1378 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL ) \
1379 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
1380 
1381 #define SYS16_JOY3 PORT_START \
1382 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 ) \
1383 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 ) \
1384 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 ) \
1385 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1386 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3 ) \
1387 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER3 ) \
1388 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 ) \
1389 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER3 )
1390 
1391 #define SYS16_JOY1_SWAPPEDBUTTONS PORT_START \
1392 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) \
1393 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) \
1394 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) \
1395 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1396 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY ) \
1397 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY ) \
1398 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY ) \
1399 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
1400 
1401 #define SYS16_JOY2_SWAPPEDBUTTONS PORT_START \
1402 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL ) \
1403 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL ) \
1404 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL ) \
1405 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1406 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL ) \
1407 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL ) \
1408 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL ) \
1409 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
1410 
1411 #define SYS16_SERVICE PORT_START \
1412 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) \
1413 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) \
1414 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE ) \
1415 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 ) \
1416 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) \
1417 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) \
1418 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1419 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1420 
1421 #define SYS16_COINAGE PORT_START \
1422 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) \
1423 	PORT_DIPSETTING(    0x07, DEF_STR( 4C_1C ) ) \
1424 	PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) ) \
1425 	PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) ) \
1426 	PORT_DIPSETTING(    0x05, "2 Coins/1 Credit 5/3 6/4") \
1427 	PORT_DIPSETTING(    0x04, "2 Coins/1 Credit 4/3") \
1428 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) ) \
1429 	PORT_DIPSETTING(    0x01, "1 Coin/1 Credit 2/3") \
1430 	PORT_DIPSETTING(    0x02, "1 Coin/1 Credit 4/5") \
1431 	PORT_DIPSETTING(    0x03, "1 Coin/1 Credit 5/6") \
1432 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) ) \
1433 	PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) ) \
1434 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) ) \
1435 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) ) \
1436 	PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) ) \
1437 	PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) ) \
1438 	PORT_DIPSETTING(    0x00, "Free Play (if Coin B too) or 1/1") \
1439 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) \
1440 	PORT_DIPSETTING(    0x70, DEF_STR( 4C_1C ) ) \
1441 	PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) ) \
1442 	PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) ) \
1443 	PORT_DIPSETTING(    0x50, "2 Coins/1 Credit 5/3 6/4") \
1444 	PORT_DIPSETTING(    0x40, "2 Coins/1 Credit 4/3") \
1445 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) ) \
1446 	PORT_DIPSETTING(    0x10, "1 Coin/1 Credit 2/3") \
1447 	PORT_DIPSETTING(    0x20, "1 Coin/1 Credit 4/5") \
1448 	PORT_DIPSETTING(    0x30, "1 Coin/1 Credit 5/6") \
1449 	PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) ) \
1450 	PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) ) \
1451 	PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) ) \
1452 	PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) ) \
1453 	PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) ) \
1454 	PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) ) \
1455 	PORT_DIPSETTING(    0x00, "Free Play (if Coin A too) or 1/1")
1456 
1457 
1458 
1459 /***************************************************************************/
1460 // sys16A
1461 ROM_START( alexkidd )
1462 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
1463 	ROM_LOAD_EVEN( "epr10429.42", 0x000000, 0x10000, 0xbdf49eca )
1464 	ROM_LOAD_ODD ( "epr10427.26", 0x000000, 0x10000, 0xf6e3dd29 )
1465 	ROM_LOAD_EVEN( "epr10430.43", 0x020000, 0x10000, 0x89e3439f )
1466 	ROM_LOAD_ODD ( "epr10428.25", 0x020000, 0x10000, 0xdbed3210 )
1467 
1468 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
1469 	ROM_LOAD( "10431.95", 0x00000, 0x08000, 0xa7962c39 )
1470 	ROM_LOAD( "10432.94", 0x08000, 0x08000, 0xdb8cd24e )
1471 	ROM_LOAD( "10433.93", 0x10000, 0x08000, 0xe163c8c2 )
1472 
1473 	ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites */
1474 	ROM_LOAD( "10437.10", 0x000000, 0x008000, 0x522f7618 )
1475 	ROM_LOAD( "10441.11", 0x008000, 0x008000, 0x74e3a35c )
1476 	ROM_LOAD( "10438.17", 0x010000, 0x008000, 0x738a6362 )
1477 	ROM_LOAD( "10442.18", 0x018000, 0x008000, 0x86cb9c14 )
1478 	ROM_LOAD( "10439.23", 0x020000, 0x008000, 0xb391aca7 )
1479 	ROM_LOAD( "10443.24", 0x028000, 0x008000, 0x95d32635 )
1480 	ROM_LOAD( "10440.29", 0x030000, 0x008000, 0x23939508 )
1481 	ROM_LOAD( "10444.30", 0x038000, 0x008000, 0x82115823 )
1482 //	ROM_LOAD( "10437.10", 0x040000, 0x008000, 0x522f7618 ) twice?
1483 //	ROM_LOAD( "10441.11", 0x048000, 0x008000, 0x74e3a35c ) twice?
1484 
1485 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
1486 	ROM_LOAD( "10434.12", 0x0000, 0x8000, 0x77141cce )
1487 
1488 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
1489 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
1490 
1491 	ROM_REGION( 0x10000, REGION_SOUND1 ) /* 7751 sound data (not used yet) */
1492 	ROM_LOAD( "10435.1", 0x0000, 0x8000, 0xad89f6e3 )
1493 	ROM_LOAD( "10436.2", 0x8000, 0x8000, 0x96c76613 )
1494 ROM_END
1495 
ROM_START(alexkida)1496 ROM_START( alexkida )
1497 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
1498 	ROM_LOAD_EVEN( "10447.43", 0x000000, 0x10000, 0x29e87f71 )
1499 	ROM_LOAD_ODD ( "10445.26", 0x000000, 0x10000, 0x25ce5b6f )
1500 	ROM_LOAD_EVEN( "10448.42", 0x020000, 0x10000, 0x05baedb5 )
1501 	ROM_LOAD_ODD ( "10446.25", 0x020000, 0x10000, 0xcd61d23c )
1502 
1503 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
1504 	ROM_LOAD( "10431.95", 0x00000, 0x08000, 0xa7962c39 )
1505 	ROM_LOAD( "10432.94", 0x08000, 0x08000, 0xdb8cd24e )
1506 	ROM_LOAD( "10433.93", 0x10000, 0x08000, 0xe163c8c2 )
1507 
1508 	ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites */
1509 	ROM_LOAD( "10437.10", 0x000000, 0x008000, 0x522f7618 )
1510 	ROM_LOAD( "10441.11", 0x008000, 0x008000, 0x74e3a35c )
1511 	ROM_LOAD( "10438.17", 0x010000, 0x008000, 0x738a6362 )
1512 	ROM_LOAD( "10442.18", 0x018000, 0x008000, 0x86cb9c14 )
1513 	ROM_LOAD( "10439.23", 0x020000, 0x008000, 0xb391aca7 )
1514 	ROM_LOAD( "10443.24", 0x028000, 0x008000, 0x95d32635 )
1515 	ROM_LOAD( "10440.29", 0x030000, 0x008000, 0x23939508 )
1516 	ROM_LOAD( "10444.30", 0x038000, 0x008000, 0x82115823 )
1517 //	ROM_LOAD( "10437.10", 0x040000, 0x008000, 0x522f7618 ) twice?
1518 //	ROM_LOAD( "10441.11", 0x048000, 0x008000, 0x74e3a35c ) twice?
1519 
1520 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
1521 	ROM_LOAD( "10434.12", 0x0000, 0x8000, 0x77141cce )
1522 
1523 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
1524 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
1525 
1526 	ROM_REGION( 0x10000, REGION_SOUND1 ) /* 7751 sound data */
1527 	ROM_LOAD( "10435.1", 0x0000, 0x8000, 0xad89f6e3 )
1528 	ROM_LOAD( "10436.2", 0x8000, 0x8000, 0x96c76613 )
1529 ROM_END
1530 
1531 /***************************************************************************/
1532 
1533 static READ_HANDLER( alexkidd_skip_r )
1534 {
1535 	if (cpu_get_pc()==0x242c) {cpu_spinuntil_int(); return 0xffff;}
1536 
1537 	return READ_WORD(&sys16_workingram[0x3108]);
1538 }
1539 
1540 static struct MemoryReadAddress alexkidd_readmem[] =
1541 {
1542 	{ 0x000000, 0x03ffff, MRA_ROM },
1543 	{ 0x400000, 0x40ffff, MRA_TILERAM },
1544 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
1545 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
1546 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
1547 	{ 0xc40002, 0xc40005, MRA_NOP },		//??
1548 	{ 0xc41002, 0xc41003, io_player1_r },
1549 	{ 0xc41006, 0xc41007, io_player2_r },
1550 	{ 0xc41000, 0xc41001, io_service_r },
1551 	{ 0xc42000, 0xc42001, io_dip1_r },
1552 	{ 0xc42002, 0xc42003, io_dip2_r },
1553 	{ 0xc60000, 0xc60001, MRA_NOP },
1554 	{ 0xfff108, 0xfff109, alexkidd_skip_r },
1555 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
1556 	{-1}
1557 };
1558 
1559 static struct MemoryWriteAddress alexkidd_writemem[] =
1560 {
1561 	{ 0x000000, 0x03ffff, MWA_ROM },
1562 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
1563 	{ 0x400000, 0x40ffff, MWA_TILERAM },
1564 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
1565 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
1566 	{ 0xc40000, 0xc40001, sound_command_nmi_w },
1567 	{ 0xc40002, 0xc40005, MWA_NOP },		//??
1568 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
1569 	{-1}
1570 };
1571 /***************************************************************************/
1572 
alexkidd_update_proc(void)1573 static void alexkidd_update_proc( void ){
1574 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
1575 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
1576 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
1577 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
1578 
1579 	set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
1580 	set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
1581 }
1582 
alexkidd_init_machine(void)1583 static void alexkidd_init_machine( void ){
1584 	static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
1585 	sys16_obj_bank = bank;
1586 	sys16_textmode=1;
1587 	sys16_spritesystem = 2;
1588 	sys16_sprxoffset = -0xbc;
1589 	sys16_fgxoffset = sys16_bgxoffset = 7;
1590 	sys16_bg_priority_mode=1;
1591 
1592 	sys16_update_proc = alexkidd_update_proc;
1593 }
1594 
init_alexkidd(void)1595 static void init_alexkidd( void )
1596 {
1597 	sys16_onetime_init_machine();
1598 	sys16_sprite_decode( 5,0x010000 );
1599 }
1600 /***************************************************************************/
1601 
1602 INPUT_PORTS_START( alexkidd )
1603 	SYS16_JOY1_SWAPPEDBUTTONS
1604 	SYS16_JOY2_SWAPPEDBUTTONS
1605 	SYS16_SERVICE
1606 	SYS16_COINAGE
1607 
1608 PORT_START	/* DSW1 */
1609 	PORT_DIPNAME( 0x01, 0x00, "Continues" )
1610 	PORT_DIPSETTING(    0x01, "Only before level 5" )
1611 	PORT_DIPSETTING(    0x00, "Unlimited" )
1612 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
1613 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1614 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1615 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
1616 	PORT_DIPSETTING(    0x0c, "3" )
1617 	PORT_DIPSETTING(    0x08, "4" )
1618 	PORT_DIPSETTING(    0x04, "5" )
1619 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240", IP_KEY_NONE, IP_JOY_NONE )
1620 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )
1621 	PORT_DIPSETTING(    0x20, "10000" )
1622 	PORT_DIPSETTING(    0x30, "20000" )
1623 	PORT_DIPSETTING(    0x10, "40000" )
1624 	PORT_DIPSETTING(    0x00, "None" )
1625 	PORT_DIPNAME( 0xc0, 0xc0, "Time Adjust" )
1626 	PORT_DIPSETTING(    0x80, "70" )
1627 	PORT_DIPSETTING(    0xc0, "60" )
1628 	PORT_DIPSETTING(    0x40, "50" )
1629 	PORT_DIPSETTING(    0x00, "40" )
1630 
1631 INPUT_PORTS_END
1632 
1633 /***************************************************************************/
1634 
1635 MACHINE_DRIVER_7751( machine_driver_alexkidd, \
1636 	alexkidd_readmem,alexkidd_writemem,alexkidd_init_machine,gfx8 )
1637 
1638 /***************************************************************************/
1639 // sys16B
1640 ROM_START( aliensyn )
1641 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
1642 	ROM_LOAD_EVEN( "11083.a4", 0x00000, 0x8000, 0xcb2ad9b3 )
1643 	ROM_LOAD_ODD ( "11080.a1", 0x00000, 0x8000, 0xfe7378d9 )
1644 	ROM_LOAD_EVEN( "11084.a5", 0x10000, 0x8000, 0x2e1ec7b1 )
1645 	ROM_LOAD_ODD ( "11081.a2", 0x10000, 0x8000, 0x1308ee63 )
1646 	ROM_LOAD_EVEN( "11085.a6", 0x20000, 0x8000, 0xcff78f39 )
1647 	ROM_LOAD_ODD ( "11082.a3", 0x20000, 0x8000, 0x9cdc2a14 )
1648 
1649 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
1650 	ROM_LOAD( "10702.b9",  0x00000, 0x10000, 0x393bc813 )
1651 	ROM_LOAD( "10703.b10", 0x10000, 0x10000, 0x6b6dd9f5 )
1652 	ROM_LOAD( "10704.b11", 0x20000, 0x10000, 0x911e7ebc )
1653 
1654 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
1655 	ROM_LOAD( "10709.b1", 0x00000, 0x10000, 0xaddf0a90 )
1656 	ROM_LOAD( "10713.b5", 0x10000, 0x10000, 0xececde3a )
1657 	ROM_LOAD( "10710.b2", 0x20000, 0x10000, 0x992369eb )
1658 	ROM_LOAD( "10714.b6", 0x30000, 0x10000, 0x91bf42fb )
1659 	ROM_LOAD( "10711.b3", 0x40000, 0x10000, 0x29166ef6 )
1660 	ROM_LOAD( "10715.b7", 0x50000, 0x10000, 0xa7c57384 )
1661 	ROM_LOAD( "10712.b4", 0x60000, 0x10000, 0x876ad019 )
1662 	ROM_LOAD( "10716.b8", 0x70000, 0x10000, 0x40ba1d48 )
1663 
1664 	ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
1665 	ROM_LOAD( "10723.a7", 0x0000, 0x8000, 0x99953526 )
1666 	ROM_LOAD( "10724.a8", 0x10000, 0x8000, 0xf971a817 )
1667 	ROM_LOAD( "10725.a9", 0x18000, 0x8000, 0x6a50e08f )
1668 	ROM_LOAD( "10726.a10",0x20000, 0x8000, 0xd50b7736 )
1669 ROM_END
1670 
1671 // sys16A - use a different sound chip?
1672 ROM_START( aliensya )
1673 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code. I guessing the order a bit here */
1674 	ROM_LOAD_EVEN( "10808", 0x00000, 0x8000, 0xe669929f )
1675 	ROM_LOAD_ODD ( "10806", 0x00000, 0x8000, 0x9f7f8fdd )
1676 	ROM_LOAD_EVEN( "10809", 0x10000, 0x8000, 0x9a424919 )
1677 	ROM_LOAD_ODD ( "10807", 0x10000, 0x8000, 0x3d2c3530 )
1678 	ROM_LOAD_EVEN( "10701", 0x20000, 0x8000, 0x92171751 )
1679 	ROM_LOAD_ODD ( "10698", 0x20000, 0x8000, 0xc1e4fdc0 )
1680 
1681 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
1682 	ROM_LOAD( "10739", 0x00000, 0x10000, 0xa29ec207 )
1683 	ROM_LOAD( "10740", 0x10000, 0x10000, 0x47f93015 )
1684 	ROM_LOAD( "10741", 0x20000, 0x10000, 0x4970739c )
1685 
1686 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
1687 	ROM_LOAD( "10709.b1", 0x00000, 0x10000, 0xaddf0a90 )
1688 	ROM_LOAD( "10713.b5", 0x10000, 0x10000, 0xececde3a )
1689 	ROM_LOAD( "10710.b2", 0x20000, 0x10000, 0x992369eb )
1690 	ROM_LOAD( "10714.b6", 0x30000, 0x10000, 0x91bf42fb )
1691 	ROM_LOAD( "10711.b3", 0x40000, 0x10000, 0x29166ef6 )
1692 	ROM_LOAD( "10715.b7", 0x50000, 0x10000, 0xa7c57384 )
1693 	ROM_LOAD( "10712.b4", 0x60000, 0x10000, 0x876ad019 )
1694 	ROM_LOAD( "10716.b8", 0x70000, 0x10000, 0x40ba1d48 )
1695 
1696 	ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
1697 	ROM_LOAD( "10705", 0x00000, 0x8000, 0x777b749e )
1698 	ROM_LOAD( "10706", 0x10000, 0x8000, 0xaa114acc )
1699 	ROM_LOAD( "10707", 0x18000, 0x8000, 0x800c1d82 )
1700 	ROM_LOAD( "10708", 0x20000, 0x8000, 0x5921ef52 )
1701 ROM_END
1702 
1703 ROM_START( aliensyj )
1704 	ROM_REGION( 0x030000, REGION_CPU1 ) /* Custom 68000 code . I guessing the order a bit here */
1705 // custom cpu 317-0033
1706 	ROM_LOAD_EVEN( "epr10699.43", 0x00000, 0x8000, 0x3fd38d17 )
1707 	ROM_LOAD_ODD ( "epr10696.26", 0x00000, 0x8000, 0xd734f19f )
1708 	ROM_LOAD_EVEN( "epr10700.42", 0x10000, 0x8000, 0x3b04b252 )
1709 	ROM_LOAD_ODD ( "epr10697.25", 0x10000, 0x8000, 0xf2bc123d )
1710 	ROM_LOAD_EVEN( "10701", 0x20000, 0x8000, 0x92171751 )
1711 	ROM_LOAD_ODD ( "10698", 0x20000, 0x8000, 0xc1e4fdc0 )
1712 
1713 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
1714 	ROM_LOAD( "10739", 0x00000, 0x10000, 0xa29ec207 )
1715 	ROM_LOAD( "10740", 0x10000, 0x10000, 0x47f93015 )
1716 	ROM_LOAD( "10741", 0x20000, 0x10000, 0x4970739c )
1717 
1718 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
1719 	ROM_LOAD( "10709.b1", 0x00000, 0x10000, 0xaddf0a90 )
1720 	ROM_LOAD( "10713.b5", 0x10000, 0x10000, 0xececde3a )
1721 	ROM_LOAD( "10710.b2", 0x20000, 0x10000, 0x992369eb )
1722 	ROM_LOAD( "10714.b6", 0x30000, 0x10000, 0x91bf42fb )
1723 	ROM_LOAD( "10711.b3", 0x40000, 0x10000, 0x29166ef6 )
1724 	ROM_LOAD( "10715.b7", 0x50000, 0x10000, 0xa7c57384 )
1725 	ROM_LOAD( "10712.b4", 0x60000, 0x10000, 0x876ad019 )
1726 	ROM_LOAD( "10716.b8", 0x70000, 0x10000, 0x40ba1d48 )
1727 
1728 	ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
1729 	ROM_LOAD( "10705", 0x00000, 0x8000, 0x777b749e )
1730 	ROM_LOAD( "10706", 0x10000, 0x8000, 0xaa114acc )
1731 	ROM_LOAD( "10707", 0x18000, 0x8000, 0x800c1d82 )
1732 	ROM_LOAD( "10708", 0x20000, 0x8000, 0x5921ef52 )
1733 ROM_END
1734 
1735 
1736 ROM_START( aliensyb )
1737 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
1738 	ROM_LOAD_EVEN( "as_typeb.a4", 0x00000, 0x8000, 0x17bf5304 )
1739 	ROM_LOAD_ODD ( "as_typeb.a1", 0x00000, 0x8000, 0x4cd134df )
1740 	ROM_LOAD_EVEN( "as_typeb.a5", 0x10000, 0x8000, 0xc8b791b0 )
1741 	ROM_LOAD_ODD ( "as_typeb.a2", 0x10000, 0x8000, 0xbdcf4a30 )
1742 	ROM_LOAD_EVEN( "as_typeb.a6", 0x20000, 0x8000, 0x1d0790aa )
1743 	ROM_LOAD_ODD ( "as_typeb.a3", 0x20000, 0x8000, 0x1e7586b7 )
1744 
1745 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
1746 	ROM_LOAD( "10702.b9",  0x00000, 0x10000, 0x393bc813 )
1747 	ROM_LOAD( "10703.b10", 0x10000, 0x10000, 0x6b6dd9f5 )
1748 	ROM_LOAD( "10704.b11", 0x20000, 0x10000, 0x911e7ebc )
1749 
1750 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
1751 	ROM_LOAD( "10709.b1", 0x00000, 0x10000, 0xaddf0a90 )
1752 	ROM_LOAD( "10713.b5", 0x10000, 0x10000, 0xececde3a )
1753 	ROM_LOAD( "10710.b2", 0x20000, 0x10000, 0x992369eb )
1754 	ROM_LOAD( "10714.b6", 0x30000, 0x10000, 0x91bf42fb )
1755 	ROM_LOAD( "10711.b3", 0x40000, 0x10000, 0x29166ef6 )
1756 	ROM_LOAD( "10715.b7", 0x50000, 0x10000, 0xa7c57384 )
1757 	ROM_LOAD( "10712.b4", 0x60000, 0x10000, 0x876ad019 )
1758 	ROM_LOAD( "10716.b8", 0x70000, 0x10000, 0x40ba1d48 )
1759 
1760 	ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
1761 	ROM_LOAD( "10723.a7", 0x0000, 0x8000, 0x99953526 )
1762 	ROM_LOAD( "10724.a8", 0x10000, 0x8000, 0xf971a817 )
1763 	ROM_LOAD( "10725.a9", 0x18000, 0x8000, 0x6a50e08f )
1764 	ROM_LOAD( "10726.a10",0x20000, 0x8000, 0xd50b7736 )
1765 ROM_END
1766 
1767 
1768 
1769 
1770 /***************************************************************************/
1771 
1772 static struct MemoryReadAddress aliensyn_readmem[] =
1773 {
1774 	{ 0x000000, 0x02ffff, MRA_ROM },
1775 	{ 0x400000, 0x40ffff, MRA_TILERAM },
1776 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
1777 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
1778 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
1779 	{ 0xc41002, 0xc41003, io_player1_r },
1780 	{ 0xc41006, 0xc41007, io_player2_r },
1781 	{ 0xc41000, 0xc41001, io_service_r },
1782 	{ 0xc42002, 0xc42003, io_dip1_r },
1783 	{ 0xc42000, 0xc42001, io_dip2_r },
1784 	{ 0xc40000, 0xc40fff, MRA_EXTRAM },
1785 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
1786 	{-1}
1787 };
1788 
1789 static struct MemoryWriteAddress aliensyn_writemem[] =
1790 {
1791 	{ 0x000000, 0x02ffff, MWA_ROM },
1792 	{ 0x400000, 0x40ffff, MWA_TILERAM },
1793 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
1794 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
1795 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
1796 	{ 0xc00006, 0xc00007, sound_command_w },
1797 	{ 0xc40000, 0xc40fff, MWA_EXTRAM },
1798 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
1799 	{-1}
1800 };
1801 
1802 /***************************************************************************/
1803 
aliensyn_update_proc(void)1804 static void aliensyn_update_proc( void ){
1805 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
1806 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
1807 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
1808 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
1809 
1810 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
1811 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
1812 
1813 	set_refresh( READ_WORD( &sys16_extraram[0] ) ); // 0xc40001
1814 }
1815 
aliensyn_init_machine(void)1816 static void aliensyn_init_machine( void ){
1817 	static int bank[16] = { 0,0,0,0,0,0,0,6,0,0,0,4,0,2,0,0 };
1818 	sys16_obj_bank = bank;
1819 	sys16_bg_priority_mode=1;
1820 	sys16_fg_priority_mode=1;
1821 
1822 	sys16_update_proc = aliensyn_update_proc;
1823 }
1824 
aliensyn_sprite_decode(void)1825 static void aliensyn_sprite_decode( void ){
1826 	sys16_sprite_decode( 4,0x20000 );
1827 }
1828 
init_aliensyn(void)1829 static void init_aliensyn( void )
1830 {
1831 	sys16_onetime_init_machine();
1832 	sys16_bg1_trans=1;
1833 	aliensyn_sprite_decode();
1834 }
1835 
1836 /***************************************************************************/
1837 
1838 INPUT_PORTS_START( aliensyn )
1839 	SYS16_JOY1
1840 	SYS16_JOY2
1841 	SYS16_SERVICE
1842 	SYS16_COINAGE
1843 
1844 PORT_START	/* DSW1 */
1845 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
1846 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1847 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1848 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
1849 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1850 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1851 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
1852 	PORT_DIPSETTING(    0x08, "2" )
1853 	PORT_DIPSETTING(    0x0c, "3" )
1854 	PORT_DIPSETTING(    0x04, "4" )
1855 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "127", IP_KEY_NONE, IP_JOY_NONE )
1856 	PORT_DIPNAME( 0x30, 0x30, "Timer" )
1857 	PORT_DIPSETTING(    0x00, "120" )
1858 	PORT_DIPSETTING(    0x10, "130" )
1859 	PORT_DIPSETTING(    0x20, "140" )
1860 	PORT_DIPSETTING(    0x30, "150" )
1861 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
1862 	PORT_DIPSETTING(    0x80, "Easy" )
1863 	PORT_DIPSETTING(    0xc0, "Normal" )
1864 	PORT_DIPSETTING(    0x40, "Hard" )
1865 	PORT_DIPSETTING(    0x00, "Hardest" )
1866 INPUT_PORTS_END
1867 
1868 /***************************************************************************/
1869 
1870 static struct UPD7759_interface aliensyn_upd7759_interface =
1871 {
1872 	1,			/* 1 chip */
1873 	480000,
1874 	{ 60 }, 	/* volumes */
1875 	{ REGION_CPU2 },			/* memory region 3 contains the sample data */
1876     UPD7759_SLAVE_MODE,
1877 	{ sound_cause_nmi },
1878 };
1879 
1880 /****************************************************************************/
1881 
MACHINE_DRIVER_7759(machine_driver_aliensyn,aliensyn_readmem,aliensyn_writemem,aliensyn_init_machine,gfx1,aliensyn_upd7759_interface)1882 MACHINE_DRIVER_7759( machine_driver_aliensyn, \
1883 	aliensyn_readmem,aliensyn_writemem,aliensyn_init_machine, gfx1, aliensyn_upd7759_interface )
1884 
1885 /***************************************************************************/
1886 // sys16B
1887 ROM_START( altbeast )
1888 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
1889 	ROM_LOAD_EVEN( "11705", 0x000000, 0x20000, 0x57dc5c7a )
1890 	ROM_LOAD_ODD ( "11704", 0x000000, 0x20000, 0x33bbcf07 )
1891 
1892 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
1893 	ROM_LOAD( "11674", 0x00000, 0x20000, 0xa57a66d5 )
1894 	ROM_LOAD( "11675", 0x20000, 0x20000, 0x2ef2f144 )
1895 	ROM_LOAD( "11676", 0x40000, 0x20000, 0x0c04acac )
1896 
1897 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
1898 	ROM_LOAD( "epr11677.b1", 0x00000, 0x10000, 0xa01425cd )
1899 	ROM_CONTINUE(            0x20000, 0x10000 )
1900 	ROM_LOAD( "epr11681.b5", 0x10000, 0x10000, 0xd9e03363 )
1901 	ROM_CONTINUE(            0x30000, 0x10000 )
1902 	ROM_LOAD( "epr11678.b2", 0x40000, 0x10000, 0x17a9fc53 )
1903 	ROM_CONTINUE(            0x60000, 0x10000 )
1904 	ROM_LOAD( "epr11682.b6", 0x50000, 0x10000, 0xe3f77c5e )
1905 	ROM_CONTINUE(            0x70000, 0x10000 )
1906 	ROM_LOAD( "epr11679.b3", 0x80000, 0x10000, 0x14dcc245 )
1907 	ROM_CONTINUE(            0xa0000, 0x10000 )
1908 	ROM_LOAD( "epr11683.b7", 0x90000, 0x10000, 0xf9a60f06 )
1909 	ROM_CONTINUE(            0xb0000, 0x10000 )
1910 	ROM_LOAD( "epr11680.b4", 0xc0000, 0x10000, 0xf43dcdec )
1911 	ROM_CONTINUE(            0xe0000, 0x10000 )
1912 	ROM_LOAD( "epr11684.b8", 0xd0000, 0x10000, 0xb20c0edb )
1913 	ROM_CONTINUE(            0xf0000, 0x10000 )
1914 
1915 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
1916 	ROM_LOAD( "11671",		 0x00000, 0x08000, 0x2b71343b )
1917 	ROM_LOAD( "opr11672",    0x10000, 0x20000, 0xbbd7f460 )
1918 	ROM_LOAD( "opr11673",    0x30000, 0x20000, 0x400c4a36 )
1919 ROM_END
1920 
1921 ROM_START( jyuohki )
1922 	ROM_REGION( 0x040000, REGION_CPU1 ) /* Custom 68000 code. */
1923 // custom cpu 317-0065
1924 	ROM_LOAD_EVEN( "epr11670.a7", 0x000000, 0x20000, 0xb748eb07 )
1925 	ROM_LOAD_ODD ( "epr11669.a5", 0x000000, 0x20000, 0x005ecd11 )
1926 
1927 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
1928 	ROM_LOAD( "11674", 0x00000, 0x20000, 0xa57a66d5 )
1929 	ROM_LOAD( "11675", 0x20000, 0x20000, 0x2ef2f144 )
1930 	ROM_LOAD( "11676", 0x40000, 0x20000, 0x0c04acac )
1931 
1932 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
1933 	ROM_LOAD( "epr11677.b1", 0x00000, 0x10000, 0xa01425cd )
1934 	ROM_CONTINUE(            0x20000, 0x10000 )
1935 	ROM_LOAD( "epr11681.b5", 0x10000, 0x10000, 0xd9e03363 )
1936 	ROM_CONTINUE(            0x30000, 0x10000 )
1937 	ROM_LOAD( "epr11678.b2", 0x40000, 0x10000, 0x17a9fc53 )
1938 	ROM_CONTINUE(            0x60000, 0x10000 )
1939 	ROM_LOAD( "epr11682.b6", 0x50000, 0x10000, 0xe3f77c5e )
1940 	ROM_CONTINUE(            0x70000, 0x10000 )
1941 	ROM_LOAD( "epr11679.b3", 0x80000, 0x10000, 0x14dcc245 )
1942 	ROM_CONTINUE(            0xa0000, 0x10000 )
1943 	ROM_LOAD( "epr11683.b7", 0x90000, 0x10000, 0xf9a60f06 )
1944 	ROM_CONTINUE(            0xb0000, 0x10000 )
1945 	ROM_LOAD( "epr11680.b4", 0xc0000, 0x10000, 0xf43dcdec )
1946 	ROM_CONTINUE(            0xe0000, 0x10000 )
1947 	ROM_LOAD( "epr11684.b8", 0xd0000, 0x10000, 0xb20c0edb )
1948 	ROM_CONTINUE(            0xf0000, 0x10000 )
1949 
1950 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
1951 	ROM_LOAD( "11671",		 0x00000, 0x08000, 0x2b71343b )
1952 	ROM_LOAD( "opr11672",    0x10000, 0x20000, 0xbbd7f460 )
1953 	ROM_LOAD( "opr11673",    0x30000, 0x20000, 0x400c4a36 )
1954 ROM_END
1955 
1956 // sys16B
1957 ROM_START( altbeas2 )
1958 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
1959 	ROM_LOAD_EVEN( "epr11740", 0x000000, 0x20000, 0xce227542 )
1960 	ROM_LOAD_ODD ( "epr11739", 0x000000, 0x20000, 0xe466eb65 )
1961 
1962 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
1963 	ROM_LOAD( "11674", 0x00000, 0x20000, 0xa57a66d5 )
1964 	ROM_LOAD( "11675", 0x20000, 0x20000, 0x2ef2f144 )
1965 	ROM_LOAD( "11676", 0x40000, 0x20000, 0x0c04acac )
1966 
1967 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
1968 	ROM_LOAD( "epr11677.b1", 0x00000, 0x10000, 0xa01425cd )
1969 	ROM_CONTINUE(            0x20000, 0x10000 )
1970 	ROM_LOAD( "epr11681.b5", 0x10000, 0x10000, 0xd9e03363 )
1971 	ROM_CONTINUE(            0x30000, 0x10000 )
1972 	ROM_LOAD( "epr11678.b2", 0x40000, 0x10000, 0x17a9fc53 )
1973 	ROM_CONTINUE(            0x60000, 0x10000 )
1974 	ROM_LOAD( "epr11682.b6", 0x50000, 0x10000, 0xe3f77c5e )
1975 	ROM_CONTINUE(            0x70000, 0x10000 )
1976 	ROM_LOAD( "epr11679.b3", 0x80000, 0x10000, 0x14dcc245 )
1977 	ROM_CONTINUE(            0xa0000, 0x10000 )
1978 	ROM_LOAD( "epr11683.b7", 0x90000, 0x10000, 0xf9a60f06 )
1979 	ROM_CONTINUE(            0xb0000, 0x10000 )
1980 	ROM_LOAD( "epr11680.b4", 0xc0000, 0x10000, 0xf43dcdec )
1981 	ROM_CONTINUE(            0xe0000, 0x10000 )
1982 	ROM_LOAD( "epr11684.b8", 0xd0000, 0x10000, 0xb20c0edb )
1983 	ROM_CONTINUE(            0xf0000, 0x10000 )
1984 
1985 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
1986 	ROM_LOAD( "opr11686",	 0x00000, 0x08000, 0x828a45b3 )	// ???
1987 	ROM_LOAD( "opr11672",    0x10000, 0x20000, 0xbbd7f460 )
1988 	ROM_LOAD( "opr11673",    0x30000, 0x20000, 0x400c4a36 )
1989 ROM_END
1990 
1991 
1992 
1993 /***************************************************************************/
1994 
1995 static READ_HANDLER( altbeast_skip_r )
1996 {
1997 	if (cpu_get_pc()==0x3994) {cpu_spinuntil_int(); return 1<<8;}
1998 
1999 	return READ_WORD(&sys16_workingram[0x301c]);
2000 }
2001 
2002 // ??? What is this, input test shows 4 bits to each player, but what does it do?
READ_HANDLER(altbeast_io_r)2003 static READ_HANDLER( altbeast_io_r )
2004 {
2005 	return 0xff;
2006 }
2007 
2008 static struct MemoryReadAddress altbeast_readmem[] =
2009 {
2010 	{ 0x000000, 0x03ffff, MRA_ROM },
2011 	{ 0x400000, 0x40ffff, MRA_TILERAM },
2012 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
2013 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
2014 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
2015 	{ 0xc41002, 0xc41003, io_player1_r },
2016 	{ 0xc41006, 0xc41007, io_player2_r },
2017 	{ 0xc41004, 0xc41005, altbeast_io_r },
2018 	{ 0xc41000, 0xc41001, io_service_r },
2019 	{ 0xc42002, 0xc42003, io_dip1_r },
2020 	{ 0xc42000, 0xc42001, io_dip2_r },
2021 	{ 0xc40000, 0xc40fff, MRA_EXTRAM },
2022 	{ 0xfff01c, 0xfff01d, altbeast_skip_r },
2023 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
2024 	{-1}
2025 };
2026 
2027 static struct MemoryWriteAddress altbeast_writemem[] =
2028 {
2029 	{ 0x000000, 0x03ffff, MWA_ROM },
2030 	{ 0x400000, 0x40ffff, MWA_TILERAM },
2031 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
2032 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
2033 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
2034 	{ 0xc40000, 0xc40fff, MWA_EXTRAM },
2035 	{ 0xfe0006, 0xfe0007, sound_command_w },
2036 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
2037 	{-1}
2038 };
2039 
2040 /***************************************************************************/
2041 
altbeast_update_proc(void)2042 static void altbeast_update_proc( void ){
2043 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
2044 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
2045 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
2046 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
2047 
2048 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
2049 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
2050 
2051 	set_tile_bank( READ_WORD( &sys16_workingram[0x3094] ) );
2052 	set_refresh( READ_WORD( &sys16_extraram[0] ) );
2053 }
2054 
altbeast_init_machine(void)2055 static void altbeast_init_machine( void ){
2056 	static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
2057 	sys16_obj_bank = bank;
2058 	sys16_update_proc = altbeast_update_proc;
2059 }
2060 
altbeas2_init_machine(void)2061 static void altbeas2_init_machine( void ){
2062 	static int bank[16] = {0x00,0x00,0x02,0x00,0x04,0x00,0x06,0x00,0x08,0x00,0x0A,0x00,0x0C,0x00,0x00,0x00};
2063 	sys16_obj_bank = bank;
2064 	sys16_update_proc = altbeast_update_proc;
2065 }
2066 
init_altbeast(void)2067 static void init_altbeast( void )
2068 {
2069 	sys16_onetime_init_machine();
2070 	sys16_sprite_decode( 7,0x20000 );
2071 }
2072 
2073 /***************************************************************************/
2074 
INPUT_PORTS_START(altbeast)2075 INPUT_PORTS_START( altbeast )
2076 	SYS16_JOY1
2077 	SYS16_JOY2
2078 	SYS16_SERVICE
2079 	SYS16_COINAGE
2080 
2081 PORT_START	/* DSW1 */
2082 	PORT_DIPNAME( 0x01, 0x01, "Credits needed" )
2083 	PORT_DIPSETTING(    0x01, "1 to start, 1 to continue")
2084 	PORT_DIPSETTING(    0x00, "2 to start, 1 to continue")
2085 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
2086 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
2087 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2088 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
2089 	PORT_DIPSETTING(    0x08, "2" )
2090 	PORT_DIPSETTING(    0x0c, "3" )
2091 	PORT_DIPSETTING(    0x04, "4" )
2092 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240", IP_KEY_NONE, IP_JOY_NONE )
2093 	PORT_DIPNAME( 0x30, 0x30, "Energy Meter" )
2094 	PORT_DIPSETTING(    0x20, "2" )
2095 	PORT_DIPSETTING(    0x30, "3" )
2096 	PORT_DIPSETTING(    0x10, "4" )
2097 	PORT_DIPSETTING(    0x00, "5" )
2098 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
2099 	PORT_DIPSETTING(    0x80, "Easy" )
2100 	PORT_DIPSETTING(    0xc0, "Normal" )
2101 	PORT_DIPSETTING(    0x40, "Hard" )
2102 	PORT_DIPSETTING(    0x00, "Hardest" )
2103 INPUT_PORTS_END
2104 
2105 /***************************************************************************/
2106 
2107 MACHINE_DRIVER_7759( machine_driver_altbeast, \
2108 	altbeast_readmem,altbeast_writemem,altbeast_init_machine, gfx2,upd7759_interface )
2109 
2110 MACHINE_DRIVER_7759( machine_driver_altbeas2, \
2111 	altbeast_readmem,altbeast_writemem,altbeas2_init_machine, gfx2,upd7759_interface )
2112 
2113 /***************************************************************************/
2114 // sys18
2115 ROM_START( astorm )
2116 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
2117 	ROM_LOAD_EVEN( "epr13085.bin", 0x000000, 0x40000, 0x15f74e2d )
2118 	ROM_LOAD_ODD ( "epr13084.bin", 0x000000, 0x40000, 0x9687b38f )
2119 
2120 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2121 	ROM_LOAD( "epr13073.bin", 0x00000, 0x40000, 0xdf5d0a61 )
2122 	ROM_LOAD( "epr13074.bin", 0x40000, 0x40000, 0x787afab8 )
2123 	ROM_LOAD( "epr13075.bin", 0x80000, 0x40000, 0x4e01b477 )
2124 
2125 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
2126 	ROM_LOAD( "mpr13082.bin", 0x000000, 0x40000, 0xa782b704 )
2127 	ROM_LOAD( "mpr13089.bin", 0x040000, 0x40000, 0x2a4227f0 )
2128 	ROM_LOAD( "mpr13081.bin", 0x080000, 0x40000, 0xeb510228 )
2129 	ROM_LOAD( "mpr13088.bin", 0x0c0000, 0x40000, 0x3b6b4c55 )
2130 	ROM_LOAD( "mpr13080.bin", 0x100000, 0x40000, 0xe668eefb )
2131 	ROM_LOAD( "mpr13087.bin", 0x140000, 0x40000, 0x2293427d )
2132 	ROM_LOAD( "epr13079.bin", 0x180000, 0x40000, 0xde9221ed )
2133 	ROM_LOAD( "epr13086.bin", 0x1c0000, 0x40000, 0x8c9a71c4 )
2134 
2135 	ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
2136 	ROM_LOAD( "epr13083.bin", 0x10000, 0x20000, 0x5df3af20 )
2137 	ROM_LOAD( "epr13076.bin", 0x30000, 0x40000, 0x94e6c76e )
2138 	ROM_LOAD( "epr13077.bin", 0x70000, 0x40000, 0xe2ec0d8d )
2139 	ROM_LOAD( "epr13078.bin", 0xb0000, 0x40000, 0x15684dc5 )
2140 ROM_END
2141 
2142 ROM_START( astorm2p )
2143 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
2144 	ROM_LOAD_EVEN( "epr13182.bin", 0x000000, 0x40000, 0xe31f2a1c )
2145 	ROM_LOAD_ODD ( "epr13181.bin", 0x000000, 0x40000, 0x78cd3b26 )
2146 
2147 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2148 	ROM_LOAD( "epr13073.bin", 0x00000, 0x40000, 0xdf5d0a61 )
2149 	ROM_LOAD( "epr13074.bin", 0x40000, 0x40000, 0x787afab8 )
2150 	ROM_LOAD( "epr13075.bin", 0x80000, 0x40000, 0x4e01b477 )
2151 
2152 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
2153 	ROM_LOAD( "mpr13082.bin", 0x000000, 0x40000, 0xa782b704 )
2154 	ROM_LOAD( "mpr13089.bin", 0x040000, 0x40000, 0x2a4227f0 )
2155 	ROM_LOAD( "mpr13081.bin", 0x080000, 0x40000, 0xeb510228 )
2156 	ROM_LOAD( "mpr13088.bin", 0x0c0000, 0x40000, 0x3b6b4c55 )
2157 	ROM_LOAD( "mpr13080.bin", 0x100000, 0x40000, 0xe668eefb )
2158 	ROM_LOAD( "mpr13087.bin", 0x140000, 0x40000, 0x2293427d )
2159 	ROM_LOAD( "epr13079.bin", 0x180000, 0x40000, 0xde9221ed )
2160 	ROM_LOAD( "epr13086.bin", 0x1c0000, 0x40000, 0x8c9a71c4 )
2161 
2162 	ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
2163 	ROM_LOAD( "ep13083a.bin", 0x10000, 0x20000, 0xe7528e06 )
2164 	ROM_LOAD( "epr13076.bin", 0x30000, 0x40000, 0x94e6c76e )
2165 	ROM_LOAD( "epr13077.bin", 0x70000, 0x40000, 0xe2ec0d8d )
2166 	ROM_LOAD( "epr13078.bin", 0xb0000, 0x40000, 0x15684dc5 )
2167 ROM_END
2168 
2169 ROM_START( astormbl )
2170 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
2171 	ROM_LOAD_EVEN( "astorm.a6", 0x000000, 0x40000, 0x7682ed3e )
2172 	ROM_LOAD_ODD ( "astorm.a5", 0x000000, 0x40000, 0xefe9711e )
2173 
2174 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2175 	ROM_LOAD( "epr13073.bin", 0x00000, 0x40000, 0xdf5d0a61 )
2176 	ROM_LOAD( "epr13074.bin", 0x40000, 0x40000, 0x787afab8 )
2177 	ROM_LOAD( "epr13075.bin", 0x80000, 0x40000, 0x4e01b477 )
2178 
2179 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
2180 	ROM_LOAD( "mpr13082.bin", 0x000000, 0x40000, 0xa782b704 )
2181 	ROM_LOAD( "astorm.a11",   0x040000, 0x40000, 0x7829c4f3 )
2182 	ROM_LOAD( "mpr13081.bin", 0x080000, 0x40000, 0xeb510228 )
2183 	ROM_LOAD( "mpr13088.bin", 0x0c0000, 0x40000, 0x3b6b4c55 )
2184 	ROM_LOAD( "mpr13080.bin", 0x100000, 0x40000, 0xe668eefb )
2185 	ROM_LOAD( "mpr13087.bin", 0x140000, 0x40000, 0x2293427d )
2186 	ROM_LOAD( "epr13079.bin", 0x180000, 0x40000, 0xde9221ed )
2187 	ROM_LOAD( "epr13086.bin", 0x1c0000, 0x40000, 0x8c9a71c4 )
2188 
2189 	ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
2190 	ROM_LOAD( "epr13083.bin", 0x10000, 0x20000, 0x5df3af20 )
2191 	ROM_LOAD( "epr13076.bin", 0x30000, 0x40000, 0x94e6c76e )
2192 	ROM_LOAD( "epr13077.bin", 0x70000, 0x40000, 0xe2ec0d8d )
2193 	ROM_LOAD( "epr13078.bin", 0xb0000, 0x40000, 0x15684dc5 )
2194 ROM_END
2195 
2196 /***************************************************************************/
2197 
2198 static READ_HANDLER( astorm_skip_r )
2199 {
2200 	if (cpu_get_pc()==0x3d4c) {cpu_spinuntil_int(); return 0xffff;}
2201 
2202 	return READ_WORD(&sys16_workingram[0x2c2c]);
2203 }
2204 
2205 static struct MemoryReadAddress astorm_readmem[] =
2206 {
2207 	{ 0x000000, 0x07ffff, MRA_ROM },
2208 	{ 0x100000, 0x10ffff, MRA_TILERAM },
2209 	{ 0x110000, 0x110fff, MRA_TEXTRAM },
2210 	{ 0x140000, 0x140fff, MRA_PALETTERAM },
2211 	{ 0x200000, 0x200fff, MRA_SPRITERAM },
2212 	{ 0xa00000, 0xa00001, io_dip1_r },
2213 	{ 0xa00002, 0xa00003, io_dip2_r },
2214 	{ 0xa01002, 0xa01003, io_player1_r },
2215 	{ 0xa01004, 0xa01005, io_player2_r },
2216 	{ 0xa01006, 0xa01007, io_player3_r },
2217 	{ 0xa01000, 0xa01001, io_service_r },
2218 	{ 0xa00000, 0xa0ffff, MRA_EXTRAM2 },
2219 	{ 0xc00000, 0xc0ffff, MRA_EXTRAM },
2220 	{ 0xc40000, 0xc4ffff, MRA_EXTRAM3 },
2221 	{ 0xffec2c, 0xffec2d, astorm_skip_r },
2222 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
2223 	{-1}
2224 };
2225 
2226 static struct MemoryWriteAddress astorm_writemem[] =
2227 {
2228 	{ 0x000000, 0x07ffff, MWA_ROM },
2229 	{ 0x100000, 0x10ffff, MWA_TILERAM },
2230 	{ 0x110000, 0x110fff, MWA_TEXTRAM },
2231 	{ 0x140000, 0x140fff, MWA_PALETTERAM },
2232 	{ 0x200000, 0x200fff, MWA_SPRITERAM },
2233 	{ 0xa00006, 0xa00007, sound_command_nmi_w },
2234 	{ 0xa00000, 0xa0ffff, MWA_EXTRAM2 },
2235 	{ 0xc00000, 0xc0ffff, MWA_EXTRAM },
2236 	{ 0xc40000, 0xc4ffff, MWA_EXTRAM3 },
2237 	{ 0xfe0020, 0xfe003f, MWA_NOP },
2238 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
2239 	{-1}
2240 };
2241 /***************************************************************************/
2242 
astorm_update_proc(void)2243 static void astorm_update_proc( void ){
2244 	int data;
2245 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
2246 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
2247 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
2248 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
2249 
2250 	data = READ_WORD( &sys16_textram[0x0e80] );
2251 	sys16_fg_page[1] = data>>12;
2252 	sys16_fg_page[3] = (data>>8)&0xf;
2253 	sys16_fg_page[0] = (data>>4)&0xf;
2254 	sys16_fg_page[2] = data&0xf;
2255 
2256 	data = READ_WORD( &sys16_textram[0x0e82] );
2257 	sys16_bg_page[1] = data>>12;
2258 	sys16_bg_page[3] = (data>>8)&0xf;
2259 	sys16_bg_page[0] = (data>>4)&0xf;
2260 	sys16_bg_page[2] = data&0xf;
2261 
2262 
2263 	sys16_fg2_scrollx = READ_WORD( &sys16_textram[0x0e9c] );
2264 	sys16_bg2_scrollx = READ_WORD( &sys16_textram[0x0e9e] );
2265 	sys16_fg2_scrolly = READ_WORD( &sys16_textram[0x0e94] );
2266 	sys16_bg2_scrolly = READ_WORD( &sys16_textram[0x0e96] );
2267 
2268 	data = READ_WORD( &sys16_textram[0x0e84] );
2269 	sys16_fg2_page[1] = data>>12;
2270 	sys16_fg2_page[3] = (data>>8)&0xf;
2271 	sys16_fg2_page[0] = (data>>4)&0xf;
2272 	sys16_fg2_page[2] = data&0xf;
2273 
2274 	data = READ_WORD( &sys16_textram[0x0e86] );
2275 	sys16_bg2_page[1] = data>>12;
2276 	sys16_bg2_page[3] = (data>>8)&0xf;
2277 	sys16_bg2_page[0] = (data>>4)&0xf;
2278 	sys16_bg2_page[2] = data&0xf;
2279 
2280 	if(sys16_fg2_scrollx | sys16_fg2_scrolly | READ_WORD( &sys16_textram[0x0e84] ))
2281 		sys18_fg2_active=1;
2282 	else
2283 		sys18_fg2_active=0;
2284 	if(sys16_bg2_scrollx | sys16_bg2_scrolly | READ_WORD( &sys16_textram[0x0e86] ))
2285 		sys18_bg2_active=1;
2286 	else
2287 		sys18_bg2_active=0;
2288 
2289 	set_tile_bank18( READ_WORD( &sys16_extraram2[0xe] ) ); // 0xa0000f
2290 	set_refresh_18( READ_WORD( &sys16_extraram3[0x6600] ) ); // 0xc46601
2291 }
2292 
astorm_init_machine(void)2293 static void astorm_init_machine( void ){
2294 	static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
2295 	sys16_obj_bank = bank;
2296 	sys16_fgxoffset = sys16_bgxoffset = -9;
2297 
2298 	patch_code( 0x2D6E, 0x32 );
2299 	patch_code( 0x2D6F, 0x3c );
2300 	patch_code( 0x2D70, 0x80 );
2301 	patch_code( 0x2D71, 0x00 );
2302 	patch_code( 0x2D72, 0x33 );
2303 	patch_code( 0x2D73, 0xc1 );
2304 	patch_code( 0x2ea2, 0x30 );
2305 	patch_code( 0x2ea3, 0x38 );
2306 	patch_code( 0x2ea4, 0xec );
2307 	patch_code( 0x2ea5, 0xf6 );
2308 	patch_code( 0x2ea6, 0x30 );
2309 	patch_code( 0x2ea7, 0x80 );
2310 	patch_code( 0x2e5c, 0x30 );
2311 	patch_code( 0x2e5d, 0x38 );
2312 	patch_code( 0x2e5e, 0xec );
2313 	patch_code( 0x2e5f, 0xe2 );
2314 	patch_code( 0x2e60, 0xc0 );
2315 	patch_code( 0x2e61, 0x7c );
2316 
2317 	patch_code( 0x4cd8, 0x02 );
2318 	patch_code( 0x4cec, 0x03 );
2319 	patch_code( 0x2dc6c, 0xe9 );
2320 	patch_code( 0x2dc64, 0x10 );
2321 	patch_code( 0x2dc65, 0x10 );
2322 	patch_code( 0x3a100, 0x10 );
2323 	patch_code( 0x3a101, 0x13 );
2324 	patch_code( 0x3a102, 0x90 );
2325 	patch_code( 0x3a103, 0x2b );
2326 	patch_code( 0x3a104, 0x00 );
2327 	patch_code( 0x3a105, 0x01 );
2328 	patch_code( 0x3a106, 0x0c );
2329 	patch_code( 0x3a107, 0x00 );
2330 	patch_code( 0x3a108, 0x00 );
2331 	patch_code( 0x3a109, 0x01 );
2332 	patch_code( 0x3a10a, 0x66 );
2333 	patch_code( 0x3a10b, 0x06 );
2334 	patch_code( 0x3a10c, 0x42 );
2335 	patch_code( 0x3a10d, 0x40 );
2336 	patch_code( 0x3a10e, 0x54 );
2337 	patch_code( 0x3a10f, 0x8b );
2338 	patch_code( 0x3a110, 0x60 );
2339 	patch_code( 0x3a111, 0x02 );
2340 	patch_code( 0x3a112, 0x30 );
2341 	patch_code( 0x3a113, 0x1b );
2342 	patch_code( 0x3a114, 0x34 );
2343 	patch_code( 0x3a115, 0xc0 );
2344 	patch_code( 0x3a116, 0x34 );
2345 	patch_code( 0x3a117, 0xdb );
2346 	patch_code( 0x3a118, 0x24 );
2347 	patch_code( 0x3a119, 0xdb );
2348 	patch_code( 0x3a11a, 0x24 );
2349 	patch_code( 0x3a11b, 0xdb );
2350 	patch_code( 0x3a11c, 0x4e );
2351 	patch_code( 0x3a11d, 0x75 );
2352 	patch_code( 0xaf8e, 0x66 );
2353 
2354 	/* fix missing credit text */
2355 	patch_code( 0x3f9a, 0xec );
2356 	patch_code( 0x3f9b, 0x36 );
2357 
2358 	sys16_update_proc = astorm_update_proc;
2359 }
2360 
init_astorm(void)2361 static void init_astorm( void )
2362 {
2363 	unsigned char *RAM= memory_region(REGION_CPU2);
2364 	sys16_onetime_init_machine();
2365 	sys18_splittab_fg_x=&sys16_textram[0x0f80];
2366 	sys18_splittab_bg_x=&sys16_textram[0x0fc0];
2367 
2368 	memcpy(RAM,&RAM[0x10000],0xa000);
2369 #ifdef TRANSPARENT_SHADOWS
2370 	sys16_MaxShadowColors=0;		// doesn't seem to use transparent shadows
2371 #endif
2372 
2373 	sys16_sprite_decode( 4,0x080000 );
2374 }
2375 
2376 /***************************************************************************/
2377 
2378 INPUT_PORTS_START( astorm )
2379 	PORT_START /* player 1 */
2380 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
2381 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
2382 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
2383 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2384 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
2385 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
2386 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
2387 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
2388 
2389 	PORT_START /* player 2 */
2390 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
2391 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
2392 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
2393 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2394 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
2395 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
2396 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
2397 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
2398 
2399 	PORT_START
2400 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
2401 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
2402 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
2403 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 )
2404 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
2405 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
2406 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 )
2407 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
2408 	SYS16_COINAGE
2409 
2410 	PORT_START	/* DSW1 */
2411 	PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
2412 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
2413 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2414 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
2415 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
2416 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2417 	PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Difficulty ) )
2418 	PORT_DIPSETTING(    0x04, "Easiest" )
2419 	PORT_DIPSETTING(    0x08, "Easier" )
2420 	PORT_DIPSETTING(    0x0c, "Easy" )
2421 	PORT_DIPSETTING(    0x1c, "Normal" )
2422 	PORT_DIPSETTING(    0x10, "Hard" )
2423 	PORT_DIPSETTING(    0x14, "Harder" )
2424 	PORT_DIPSETTING(    0x18, "Hardest" )
2425 	PORT_DIPSETTING(    0x00, "Special" )
2426 	PORT_DIPNAME( 0x20, 0x20, "Coin Chutes" )
2427 	PORT_DIPSETTING(    0x20, "3" )
2428 	PORT_DIPSETTING(    0x00, "1" )
2429 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
2430 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
2431 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2432 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
2433 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2434 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2435 
2436 	PORT_START /* player 3 */
2437 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
2438 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
2439 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
2440 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2441 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3 )
2442 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER3 )
2443 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
2444 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER3 )
2445 INPUT_PORTS_END
2446 
2447 /***************************************************************************/
2448 
2449 MACHINE_DRIVER_18( machine_driver_astorm, \
2450 	astorm_readmem,astorm_writemem,astorm_init_machine, gfx4 )
2451 
2452 /***************************************************************************/
2453 // sys16B
2454 ROM_START( atomicp )
2455 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
2456 	ROM_LOAD_EVEN( "ap-t2.bin", 0x000000, 0x10000, 0x97421047 )
2457 	ROM_LOAD_ODD ( "ap-t1.bin", 0x000000, 0x10000, 0x5c65fe56 )
2458 
2459 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2460 	ROM_LOAD( "ap-t4.bin",  0x00000, 0x8000, 0x332e58f4 )
2461 	ROM_LOAD( "ap-t3.bin",  0x08000, 0x8000, 0xdddc122c )
2462 	ROM_LOAD( "ap-t5.bin",  0x10000, 0x8000, 0xef5ecd6b )
2463 
2464 	ROM_REGION( 0x1, REGION_GFX2 ) /* sprites */
2465 
2466 ROM_END
2467 
2468 /***************************************************************************/
2469 
2470 /*static READ_HANDLER( atomicp_skip_r )
2471 {
2472 	if (cpu_get_pc()==0x7fc) {cpu_spinuntil_int(); return 0xffff;}
2473 
2474 	return READ_WORD(&sys16_workingram[0x0902]);
2475 }*/
2476 
2477 
2478 static struct MemoryReadAddress atomicp_readmem[] =
2479 {
2480 	{ 0x000000, 0x01ffff, MRA_ROM },
2481 	{ 0x400000, 0x40ffff, MRA_TILERAM },
2482 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
2483 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
2484 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
2485 	{ 0xc41000, 0xc41001, io_player1_r },
2486 	{ 0xc41002, 0xc41003, io_player2_r },
2487 	{ 0xc41004, 0xc41005, io_dip1_r },
2488 	{ 0xc41006, 0xc41007, io_dip2_r },
2489 //	{ 0xffc902, 0xffc903, atomicp_skip_r },
2490 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
2491 	{-1}
2492 };
2493 
WRITE_HANDLER(atomicp_sound_w)2494 static WRITE_HANDLER( atomicp_sound_w )
2495 {
2496 	if(offset==0)
2497 		YM2413_register_port_0_w(0,(data>>8)&0xff);
2498 	else
2499 		YM2413_data_port_0_w(0,(data>>8)&0xff);
2500 }
2501 
2502 static struct MemoryWriteAddress atomicp_writemem[] =
2503 {
2504 	{ 0x000000, 0x01ffff, MWA_ROM },
2505 	{ 0x080000, 0x080003, atomicp_sound_w },
2506 	{ 0x3f0000, 0x3f0003, MWA_NOP },
2507 	{ 0x400000, 0x40ffff, MWA_TILERAM },
2508 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
2509 	{ 0x440000, 0x44ffff, MWA_SPRITERAM },
2510 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
2511 	{ 0xc40000, 0xc40001, MWA_EXTRAM2 },
2512 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
2513 	{-1}
2514 };
2515 
2516 //	{ 0x0a, 0x0a, YM2413_register_port_0_w },
2517 //	{ 0x0b, 0x0b, YM2413_data_port_0_w },
2518 
2519 /***************************************************************************/
2520 
atomicp_update_proc(void)2521 static void atomicp_update_proc( void ){
2522 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
2523 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
2524 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
2525 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
2526 
2527 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
2528 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
2529 }
2530 
atomicp_init_machine(void)2531 static void atomicp_init_machine( void ){
2532 	static int bank[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
2533 	sys16_obj_bank = bank;
2534 	sys16_update_proc = atomicp_update_proc;
2535 }
2536 
init_atomicp(void)2537 static void init_atomicp( void )
2538 {
2539 	sys16_onetime_init_machine();
2540 }
2541 
2542 /***************************************************************************/
2543 
INPUT_PORTS_START(atomicp)2544 INPUT_PORTS_START( atomicp )
2545 
2546 PORT_START
2547 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
2548 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
2549 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
2550 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
2551 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
2552 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
2553 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
2554 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
2555 
2556 PORT_START
2557 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
2558 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
2559 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
2560 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
2561 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
2562 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
2563 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
2564 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
2565 
2566 PORT_START	// dummy
2567 
2568 PORT_START	// dip1
2569 	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) )
2570 	PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
2571 	PORT_DIPSETTING(    0x04, DEF_STR( 3C_1C ) )
2572 	PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
2573 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
2574 	PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
2575 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
2576 	PORT_DIPSETTING(    0x01, DEF_STR( 1C_4C ) )
2577 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_5C ) )
2578 
2579 	PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_A ) )
2580 	PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
2581 	PORT_DIPSETTING(    0x20, DEF_STR( 3C_1C ) )
2582 	PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
2583 	PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) )
2584 	PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
2585 	PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) )
2586 	PORT_DIPSETTING(    0x08, DEF_STR( 1C_4C ) )
2587 	PORT_DIPSETTING(    0x30, DEF_STR( 1C_5C ) )
2588 
2589 	PORT_DIPNAME( 0xC0, 0xC0, DEF_STR( Lives ) )
2590 	PORT_DIPSETTING(    0xC0, "1" )
2591 	PORT_DIPSETTING(    0x80, "2" )
2592 	PORT_DIPSETTING(    0x40, "3" )
2593 	PORT_DIPSETTING(    0x00, "5" )
2594 
2595 PORT_START  //dip2
2596 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
2597 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
2598 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2599 	PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
2600 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
2601 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2602 	PORT_DIPNAME( 0x04, 0x04, "Instructions" )
2603 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2604 	PORT_DIPSETTING(    0x04, DEF_STR( On ) )
2605 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
2606 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
2607 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2608 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
2609 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
2610 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2611 	PORT_DIPNAME( 0x20, 0x20, "Continuation" )
2612 	PORT_DIPSETTING(    0x20, "Continue" )
2613 	PORT_DIPSETTING(    0x00, "No Continue" )
2614 	PORT_DIPNAME( 0x40, 0x00, "Level Select" )
2615 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
2616 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2617 	PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
2618 INPUT_PORTS_END
2619 
2620 /***************************************************************************/
2621 static int ap_interrupt( void ){
2622 	int intleft=cpu_getiloops();
2623 	if(intleft!=0) return 2;
2624 	else return 4;
2625 }
2626 
2627 static struct YM2413interface ym2413_interface=
2628 {
2629     1,
2630     8000000,	/* ??? */
2631     { 30 },
2632 };
2633 
2634 static struct MachineDriver machine_driver_atomicp =
2635 {
2636 	{
2637 		{
2638 			CPU_M68000,
2639 			10000000,
2640 			atomicp_readmem,atomicp_writemem,0,0,
2641 			ap_interrupt,2
2642 		}
2643 	},
2644 	60, DEFAULT_60HZ_VBLANK_DURATION,
2645 	1,
2646 	atomicp_init_machine,
2647 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
2648 	gfx8,
2649 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
2650 	0,
2651 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
2652 	0,
2653 	sys16_vh_start,
2654 	sys16_vh_stop,
2655 	sys16_vh_screenrefresh,
2656 	0,0,0,0,
2657 	{
2658 		{
2659 			SOUND_YM2413,
2660 			&ym2413_interface
2661 		}
2662 	}
2663 };
2664 
2665 /***************************************************************************
2666 
2667    Aurail
2668 
2669 ***************************************************************************/
2670 // sys16B
2671 ROM_START( aurail )
2672 	ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
2673 	ROM_LOAD_EVEN( "13577", 0x000000, 0x20000, 0x6701b686 )
2674 	ROM_LOAD_ODD ( "13576", 0x000000, 0x20000, 0x1e428d94 )
2675 	/* empty 0x40000 - 0x80000 */
2676 	ROM_LOAD_EVEN( "13447", 0x080000, 0x20000, 0x70a52167 )
2677 	ROM_LOAD_ODD ( "13445", 0x080000, 0x20000, 0x28dfc3dd )
2678 
2679 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2680 	ROM_LOAD( "aurail.a14", 0x00000, 0x20000, 0x0fc4a7a8 ) /* plane 1 */
2681 	ROM_LOAD( "aurail.b14", 0x20000, 0x20000, 0xe08135e0 )
2682 	ROM_LOAD( "aurail.a15", 0x40000, 0x20000, 0x1c49852f ) /* plane 2 */
2683 	ROM_LOAD( "aurail.b15", 0x60000, 0x20000, 0xe14c6684 )
2684 	ROM_LOAD( "aurail.a16", 0x80000, 0x20000, 0x047bde5e ) /* plane 3 */
2685 	ROM_LOAD( "aurail.b16", 0xa0000, 0x20000, 0x6309fec4 )
2686 
2687 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
2688 	ROM_LOAD( "aurail.b1",  0x000000, 0x020000, 0x5fa0a9f8 )
2689 	ROM_LOAD( "aurail.b5",  0x020000, 0x020000, 0x0d1b54da )
2690 	ROM_LOAD( "aurail.b2",  0x040000, 0x020000, 0x5f6b33b1 )
2691 	ROM_LOAD( "aurail.b6",  0x060000, 0x020000, 0xbad340c3 )
2692 	ROM_LOAD( "aurail.b3",  0x080000, 0x020000, 0x4e80520b )
2693 	ROM_LOAD( "aurail.b7",  0x0a0000, 0x020000, 0x7e9165ac )
2694 	ROM_LOAD( "aurail.b4",  0x0c0000, 0x020000, 0x5733c428 )
2695 	ROM_LOAD( "aurail.b8",  0x0e0000, 0x020000, 0x66b8f9b3 )
2696 	ROM_LOAD( "aurail.a1",  0x100000, 0x020000, 0x4f370b2b )
2697 	ROM_LOAD( "aurail.b10", 0x120000, 0x020000, 0xf76014bf )
2698 	ROM_LOAD( "aurail.a2",  0x140000, 0x020000, 0x37cf9cb4 )
2699 	ROM_LOAD( "aurail.b11", 0x160000, 0x020000, 0x1061e7da )
2700 	ROM_LOAD( "aurail.a3",  0x180000, 0x020000, 0x049698ef )
2701 	ROM_LOAD( "aurail.b12", 0x1a0000, 0x020000, 0x7dbcfbf1 )
2702 	ROM_LOAD( "aurail.a4",  0x1c0000, 0x020000, 0x77a8989e )
2703 	ROM_LOAD( "aurail.b13", 0x1e0000, 0x020000, 0x551df422 )
2704 
2705 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
2706 	ROM_LOAD( "13448",      0x0000, 0x8000, 0xb5183fb9 )
2707 	ROM_LOAD( "aurail.a12", 0x10000,0x20000, 0xd3d9aaf9 )
2708 	ROM_LOAD( "aurail.a12", 0x30000,0x20000, 0xd3d9aaf9 )
2709 ROM_END
2710 
ROM_START(auraila)2711 ROM_START( auraila )
2712 	ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
2713 // custom cpu 317-0168
2714 	ROM_LOAD_EVEN( "epr13469.a7", 0x000000, 0x20000, 0xc628b69d )
2715 	ROM_LOAD_ODD ( "epr13468.a5", 0x000000, 0x20000, 0xce092218 )
2716 	/* 0x40000 - 0x80000 is empty, I will place decrypted opcodes here */
2717 	ROM_LOAD_EVEN( "13447", 0x080000, 0x20000, 0x70a52167 )
2718 	ROM_LOAD_ODD ( "13445", 0x080000, 0x20000, 0x28dfc3dd )
2719 
2720 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2721 	ROM_LOAD( "aurail.a14", 0x00000, 0x20000, 0x0fc4a7a8 ) /* plane 1 */
2722 	ROM_LOAD( "aurail.b14", 0x20000, 0x20000, 0xe08135e0 )
2723 	ROM_LOAD( "aurail.a15", 0x40000, 0x20000, 0x1c49852f ) /* plane 2 */
2724 	ROM_LOAD( "aurail.b15", 0x60000, 0x20000, 0xe14c6684 )
2725 	ROM_LOAD( "aurail.a16", 0x80000, 0x20000, 0x047bde5e ) /* plane 3 */
2726 	ROM_LOAD( "aurail.b16", 0xa0000, 0x20000, 0x6309fec4 )
2727 
2728 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
2729 	ROM_LOAD( "aurail.b1",  0x000000, 0x020000, 0x5fa0a9f8 )
2730 	ROM_LOAD( "aurail.b5",  0x020000, 0x020000, 0x0d1b54da )
2731 	ROM_LOAD( "aurail.b2",  0x040000, 0x020000, 0x5f6b33b1 )
2732 	ROM_LOAD( "aurail.b6",  0x060000, 0x020000, 0xbad340c3 )
2733 	ROM_LOAD( "aurail.b3",  0x080000, 0x020000, 0x4e80520b )
2734 	ROM_LOAD( "aurail.b7",  0x0a0000, 0x020000, 0x7e9165ac )
2735 	ROM_LOAD( "aurail.b4",  0x0c0000, 0x020000, 0x5733c428 )
2736 	ROM_LOAD( "aurail.b8",  0x0e0000, 0x020000, 0x66b8f9b3 )
2737 	ROM_LOAD( "aurail.a1",  0x100000, 0x020000, 0x4f370b2b )
2738 	ROM_LOAD( "aurail.b10", 0x120000, 0x020000, 0xf76014bf )
2739 	ROM_LOAD( "aurail.a2",  0x140000, 0x020000, 0x37cf9cb4 )
2740 	ROM_LOAD( "aurail.b11", 0x160000, 0x020000, 0x1061e7da )
2741 	ROM_LOAD( "aurail.a3",  0x180000, 0x020000, 0x049698ef )
2742 	ROM_LOAD( "aurail.b12", 0x1a0000, 0x020000, 0x7dbcfbf1 )
2743 	ROM_LOAD( "aurail.a4",  0x1c0000, 0x020000, 0x77a8989e )
2744 	ROM_LOAD( "aurail.b13", 0x1e0000, 0x020000, 0x551df422 )
2745 
2746 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
2747 	ROM_LOAD( "13448",      0x0000, 0x8000, 0xb5183fb9 )
2748 	ROM_LOAD( "aurail.a12", 0x10000,0x20000, 0xd3d9aaf9 )
2749 	ROM_LOAD( "aurail.a12", 0x30000,0x20000, 0xd3d9aaf9 )
2750 ROM_END
2751 
2752 
2753 /***************************************************************************/
2754 
2755 static READ_HANDLER( aurail_skip_r )
2756 {
2757 	if (cpu_get_pc()==0xe4e) {cpu_spinuntil_int(); return 0;}
2758 
2759 	return READ_WORD(&sys16_workingram[0x274e]);
2760 }
2761 
2762 static struct MemoryReadAddress aurail_readmem[] =
2763 {
2764 	{ 0x000000, 0x0bffff, MRA_ROM },
2765 	{ 0x3f0000, 0x3fffff, MRA_EXTRAM },
2766 	{ 0x400000, 0x40ffff, MRA_TILERAM },
2767 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
2768 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
2769 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
2770 	{ 0xc41002, 0xc41003, io_player1_r },
2771 	{ 0xc41006, 0xc41007, io_player2_r },
2772 	{ 0xc41000, 0xc41001, io_service_r },
2773 	{ 0xc42002, 0xc42003, io_dip1_r },
2774 	{ 0xc42000, 0xc42001, io_dip2_r },
2775 	{ 0xc40000, 0xc4ffff, MRA_EXTRAM2 },
2776 	{ 0xfc0000, 0xfc0fff, MRA_EXTRAM3 },
2777 	{ 0xffe74e, 0xffe74f, aurail_skip_r },
2778 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
2779 	{-1}
2780 };
2781 
2782 static struct MemoryWriteAddress aurail_writemem[] =
2783 {
2784 	{ 0x000000, 0x0bffff, MWA_ROM },
2785 	{ 0x3f0000, 0x3fffff, MWA_EXTRAM },
2786 	{ 0x400000, 0x40ffff, MWA_TILERAM },
2787 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
2788 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
2789 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
2790 	{ 0xc40000, 0xc4ffff, MWA_EXTRAM2 },
2791 	{ 0xfc0000, 0xfc0fff, MWA_EXTRAM3 },
2792 	{ 0xfe0006, 0xfe0007, sound_command_w },
2793 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
2794 	{-1}
2795 };
2796 /***************************************************************************/
2797 
aurail_update_proc(void)2798 static void aurail_update_proc (void)
2799 {
2800 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
2801 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
2802 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
2803 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
2804 
2805 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
2806 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
2807 
2808 	set_tile_bank( READ_WORD( &sys16_extraram3[0x0002] ) );
2809 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
2810 }
2811 
aurail_init_machine(void)2812 static void aurail_init_machine( void ){
2813 	static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
2814 
2815 	sys16_obj_bank = bank;
2816 	sys16_spritesystem = 4;
2817 	sys16_spritelist_end=0x8000;
2818 	sys16_bg_priority_mode=1;
2819 
2820 	sys16_update_proc = aurail_update_proc;
2821 }
2822 
init_aurail(void)2823 static void init_aurail (void)
2824 {
2825 	sys16_onetime_init_machine();
2826 	sys16_sprite_decode (8,0x40000);
2827 }
2828 
init_auraila(void)2829 static void init_auraila(void)
2830 {
2831 	unsigned char *rom = memory_region(REGION_CPU1);
2832 	int diff = 0x40000;	/* place decrypted opcodes in a empty hole */
2833 
2834 	init_aurail();
2835 
2836 	memory_set_opcode_base(0,rom+diff);
2837 
2838 	memcpy(rom+diff,rom,0x40000);
2839 
2840 	aurail_decode_data(rom,rom,0x10000);
2841 	aurail_decode_opcode1(rom+diff,rom+diff,0x10000);
2842 	aurail_decode_opcode2(rom+diff+0x10000,rom+diff+0x10000,0x10000);
2843 }
2844 
2845 /***************************************************************************/
2846 
2847 INPUT_PORTS_START( aurail )
2848 	SYS16_JOY1
2849 	SYS16_JOY2
2850 	SYS16_SERVICE
2851 	SYS16_COINAGE
2852 
2853 PORT_START	/* DSW1 */
2854 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
2855 	PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
2856 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
2857 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
2858 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
2859 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2860 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
2861 	PORT_DIPSETTING(    0x00, "2" )
2862 	PORT_DIPSETTING(    0x0c, "3" )
2863 	PORT_DIPSETTING(    0x08, "4" )
2864 	PORT_DIPSETTING(    0x04, "5" )
2865 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
2866 	PORT_DIPSETTING(    0x10, "Normal" )
2867 	PORT_DIPSETTING(    0x00, "Hard" )
2868 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Difficulty ) )
2869 	PORT_DIPSETTING(    0x20, "Normal" )
2870 	PORT_DIPSETTING(    0x00, "Hard" )
2871 	PORT_DIPNAME( 0x40, 0x40, "Controller select" )
2872 	PORT_DIPSETTING(    0x40, "1 Player side" )
2873 	PORT_DIPSETTING(    0x00, "2 Players side" )
2874 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
2875 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2876 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2877 INPUT_PORTS_END
2878 
2879 /***************************************************************************/
2880 
2881 MACHINE_DRIVER_7759( machine_driver_aurail, \
2882 	aurail_readmem,aurail_writemem,aurail_init_machine, gfx4,upd7759_interface )
2883 
2884 /***************************************************************************/
2885 // sys16B
2886 ROM_START( bayroute )
2887 	ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
2888 	ROM_LOAD_EVEN( "br.4a", 0x000000, 0x10000, 0x91c6424b )
2889 	ROM_LOAD_ODD ( "br.1a", 0x000000, 0x10000, 0x76954bf3 )
2890 	/* empty 0x20000-0x80000*/
2891 	ROM_LOAD_EVEN( "br.5a", 0x080000, 0x10000, 0x9d6fd183 )
2892 	ROM_LOAD_ODD ( "br.2a", 0x080000, 0x10000, 0x5ca1e3d2 )
2893 	ROM_LOAD_EVEN( "br.6a", 0x0a0000, 0x10000, 0xed97ad4c )
2894 	ROM_LOAD_ODD ( "br.3a", 0x0a0000, 0x10000, 0x0d362905 )
2895 
2896 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2897 	ROM_LOAD( "opr12462.a14", 0x00000, 0x10000, 0xa19943b5 )
2898 	ROM_LOAD( "opr12463.a15", 0x10000, 0x10000, 0x62f8200d )
2899 	ROM_LOAD( "opr12464.a16", 0x20000, 0x10000, 0xc8c59703 )
2900 
2901 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
2902 	ROM_LOAD( "br_obj0o.1b", 0x00000, 0x10000, 0x098a5e82 )
2903 	ROM_LOAD( "br_obj0e.5b", 0x10000, 0x10000, 0x85238af9 )
2904 	ROM_LOAD( "br_obj1o.2b", 0x20000, 0x10000, 0xcc641da1 )
2905 	ROM_LOAD( "br_obj1e.6b", 0x30000, 0x10000, 0xd3123315 )
2906 	ROM_LOAD( "br_obj2o.3b", 0x40000, 0x10000, 0x84efac1f )
2907 	ROM_LOAD( "br_obj2e.7b", 0x50000, 0x10000, 0xb73b12cb )
2908 	ROM_LOAD( "br_obj3o.4b", 0x60000, 0x10000, 0xa2e238ac )
2909 	ROM_LOAD( "br.8b",		 0x70000, 0x10000, 0xd8de78ff )
2910 
2911 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
2912 	ROM_LOAD( "epr12459.a10", 0x00000, 0x08000, 0x3e1d29d0 )
2913 	ROM_LOAD( "mpr12460.a11", 0x10000, 0x20000, 0x0bae570d )
2914 	ROM_LOAD( "mpr12461.a12", 0x30000, 0x20000, 0xb03b8b46 )
2915 ROM_END
2916 
2917 ROM_START( bayrouta )
2918 	ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
2919 // custom cpu 317-0116
2920 	ROM_LOAD_EVEN( "epr12517.a7", 0x000000, 0x20000, 0x436728a9 )
2921 	ROM_LOAD_ODD ( "epr12516.a5", 0x000000, 0x20000, 0x4ff0353f )
2922 	/* empty 0x40000-0x80000*/
2923 	ROM_LOAD_EVEN( "epr12458.a8", 0x080000, 0x20000, 0xe7c7476a )
2924 	ROM_LOAD_ODD ( "epr12456.a6", 0x080000, 0x20000, 0x25dc2eaf )
2925 
2926 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2927 	ROM_LOAD( "opr12462.a14", 0x00000, 0x10000, 0xa19943b5 )
2928 	ROM_LOAD( "opr12463.a15", 0x10000, 0x10000, 0x62f8200d )
2929 	ROM_LOAD( "opr12464.a16", 0x20000, 0x10000, 0xc8c59703 )
2930 
2931 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
2932 	ROM_LOAD( "mpr12465.b1", 0x00000, 0x20000, 0x11d61b45 )
2933 	ROM_LOAD( "mpr12467.b5", 0x20000, 0x20000, 0xc3b4e4c0 )
2934 	ROM_LOAD( "mpr12466.b2", 0x40000, 0x20000, 0xa57f236f )
2935 	ROM_LOAD( "mpr12468.b6", 0x60000, 0x20000, 0xd89c77de )
2936 
2937 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
2938 	ROM_LOAD( "epr12459.a10", 0x00000, 0x08000, 0x3e1d29d0 )
2939 	ROM_LOAD( "mpr12460.a11", 0x10000, 0x20000, 0x0bae570d )
2940 	ROM_LOAD( "mpr12461.a12", 0x30000, 0x20000, 0xb03b8b46 )
2941 ROM_END
2942 
2943 ROM_START( bayrtbl1 )
2944 	ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
2945 	ROM_LOAD_EVEN( "b4.bin", 0x000000, 0x10000, 0xeb6646ae )
2946 	ROM_LOAD_ODD ( "b2.bin", 0x000000, 0x10000, 0xecd9cd0e )
2947 	/* empty 0x20000-0x80000*/
2948 	ROM_LOAD_EVEN( "br.5a",  0x080000, 0x10000, 0x9d6fd183 )
2949 	ROM_LOAD_ODD ( "br.2a",  0x080000, 0x10000, 0x5ca1e3d2 )
2950 	ROM_LOAD_EVEN( "b8.bin", 0x0a0000, 0x10000, 0xe7ca0331 )
2951 	ROM_LOAD_ODD ( "b6.bin", 0x0a0000, 0x10000, 0x2bc748a6 )
2952 
2953 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2954 	ROM_LOAD( "bs16.bin", 0x00000, 0x10000, 0xa8a5b310 )
2955 	ROM_LOAD( "bs14.bin", 0x10000, 0x10000, 0x6bc4d0a8 )
2956 	ROM_LOAD( "bs12.bin", 0x20000, 0x10000, 0xc1f967a6 )
2957 
2958 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
2959 	ROM_LOAD( "br_obj0o.1b", 0x00000, 0x10000, 0x098a5e82 )
2960 	ROM_LOAD( "br_obj0e.5b", 0x10000, 0x10000, 0x85238af9 )
2961 	ROM_LOAD( "br_obj1o.2b", 0x20000, 0x10000, 0xcc641da1 )
2962 	ROM_LOAD( "br_obj1e.6b", 0x30000, 0x10000, 0xd3123315 )
2963 	ROM_LOAD( "br_obj2o.3b", 0x40000, 0x10000, 0x84efac1f )
2964 	ROM_LOAD( "br_obj2e.7b", 0x50000, 0x10000, 0xb73b12cb )
2965 	ROM_LOAD( "br_obj3o.4b", 0x60000, 0x10000, 0xa2e238ac )
2966 	ROM_LOAD( "bs7.bin",     0x70000, 0x10000, 0x0c91abcc )
2967 
2968 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
2969 	ROM_LOAD( "epr12459.a10", 0x00000, 0x08000, 0x3e1d29d0 )
2970 	ROM_LOAD( "mpr12460.a11", 0x10000, 0x20000, 0x0bae570d )
2971 	ROM_LOAD( "mpr12461.a12", 0x30000, 0x20000, 0xb03b8b46 )
2972 ROM_END
2973 
2974 ROM_START( bayrtbl2 )
2975 	ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
2976 	ROM_LOAD_EVEN( "br_04", 0x000000, 0x10000, 0x2e33ebfc )
2977 	ROM_LOAD_ODD ( "br_06", 0x000000, 0x10000, 0x3db42313 )
2978 	/* empty 0x20000-0x80000*/
2979 	ROM_LOAD_EVEN( "br_03", 0x080000, 0x20000, 0x285d256b )
2980 	ROM_LOAD_ODD ( "br_05", 0x080000, 0x20000, 0x552e6384 )
2981 
2982 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
2983 	ROM_LOAD( "br_15",    0x00000, 0x10000, 0x050079a9 )
2984 	ROM_LOAD( "br_16",    0x10000, 0x10000, 0xfc371928 )
2985 	ROM_LOAD( "bs12.bin", 0x20000, 0x10000, 0xc1f967a6 )
2986 
2987 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
2988 	ROM_LOAD( "br_11",       0x00000, 0x10000, 0x65232905 )
2989 	ROM_LOAD( "br_obj0e.5b", 0x10000, 0x10000, 0x85238af9 )
2990 	ROM_LOAD( "br_obj1o.2b", 0x20000, 0x10000, 0xcc641da1 )
2991 	ROM_LOAD( "br_obj1e.6b", 0x30000, 0x10000, 0xd3123315 )
2992 	ROM_LOAD( "br_obj2o.3b", 0x40000, 0x10000, 0x84efac1f )
2993 	ROM_LOAD( "br_09",       0x50000, 0x10000, 0x05e9b840 )
2994 	ROM_LOAD( "br_14",       0x60000, 0x10000, 0x4c4a177b )
2995 	ROM_LOAD( "bs7.bin",     0x70000, 0x10000, 0x0c91abcc )
2996 
2997 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
2998 	ROM_LOAD( "br_01", 0x00000, 0x10000, 0xb87156ec )
2999 	ROM_LOAD( "br_02", 0x10000, 0x10000, 0xef63991b )
3000 ROM_END
3001 
3002 /***************************************************************************/
3003 
3004 static struct MemoryReadAddress bayroute_readmem[] =
3005 {
3006 	{ 0x000000, 0x0bffff, MRA_ROM },
3007 	{ 0x500000, 0x503fff, MRA_EXTRAM3 },
3008 	{ 0x600000, 0x600fff, MRA_SPRITERAM },
3009 	{ 0x700000, 0x70ffff, MRA_TILERAM },
3010 	{ 0x710000, 0x710fff, MRA_TEXTRAM },
3011 	{ 0x800000, 0x800fff, MRA_PALETTERAM },
3012 	{ 0x901002, 0x901003, io_player1_r },
3013 	{ 0x901006, 0x901007, io_player2_r },
3014 	{ 0x901000, 0x901001, io_service_r },
3015 	{ 0x902002, 0x902003, io_dip1_r },
3016 	{ 0x902000, 0x902001, io_dip2_r },
3017 	{ 0x900000, 0x900fff, MRA_EXTRAM2 },
3018 
3019 	{-1}
3020 };
3021 
3022 static struct MemoryWriteAddress bayroute_writemem[] =
3023 {
3024 	{ 0x000000, 0x0bffff, MWA_ROM },
3025 	{ 0x500000, 0x503fff, MWA_EXTRAM3 },
3026 	{ 0x600000, 0x600fff, MWA_SPRITERAM },
3027 	{ 0x700000, 0x70ffff, MWA_TILERAM },
3028 	{ 0x710000, 0x710fff, MWA_TEXTRAM },
3029 	{ 0x800000, 0x800fff, MWA_PALETTERAM },
3030 	{ 0x900000, 0x900fff, MWA_EXTRAM2 },
3031 	{ 0xff0006, 0xff0007, sound_command_w },
3032 
3033 	{-1}
3034 };
3035 
3036 /***************************************************************************/
3037 
bayroute_update_proc(void)3038 static void bayroute_update_proc( void ){
3039 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
3040 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
3041 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
3042 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
3043 
3044 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
3045 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
3046 
3047 	set_refresh( READ_WORD( &sys16_extraram2[0x0] ) );
3048 }
3049 
bayroute_init_machine(void)3050 static void bayroute_init_machine( void ){
3051 	static int bank[16] = { 0,0,0,0,0,0,0,6,0,0,0,4,0,2,0,0 };
3052 	sys16_obj_bank = bank;
3053 	sys16_update_proc = bayroute_update_proc;
3054 	sys16_spritesystem = 4;
3055 	sys16_spritelist_end=0xc000;
3056 }
3057 
init_bayroute(void)3058 static void init_bayroute( void )
3059 {
3060 	sys16_onetime_init_machine();
3061 	sys16_sprite_decode( 4,0x20000 );
3062 }
3063 
init_bayrouta(void)3064 static void init_bayrouta( void )
3065 {
3066 	sys16_onetime_init_machine();
3067 	sys16_sprite_decode( 2,0x40000 );
3068 }
3069 
init_bayrtbl1(void)3070 static void init_bayrtbl1( void )
3071 {
3072 	int i;
3073 
3074 	sys16_onetime_init_machine();
3075 
3076 	/* invert the graphics bits on the tiles */
3077 	for (i = 0; i < 0x30000; i++)
3078 		memory_region(REGION_GFX1)[i] ^= 0xff;
3079 
3080 	sys16_sprite_decode( 4,0x20000 );
3081 }
3082 /***************************************************************************/
3083 
3084 INPUT_PORTS_START( bayroute )
3085 	SYS16_JOY1
3086 	SYS16_JOY2
3087 	SYS16_SERVICE
3088 	SYS16_COINAGE
3089 
3090 PORT_START
3091 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
3092 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
3093 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3094 	PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
3095 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
3096 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3097 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
3098 	PORT_DIPSETTING(    0x04, "1" )
3099 	PORT_DIPSETTING(    0x0c, "3" )
3100 	PORT_DIPSETTING(    0x08, "5" )
3101 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Unlimited", IP_KEY_NONE, IP_JOY_NONE )
3102 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )
3103 	PORT_DIPSETTING(    0x30, "10000" )
3104 	PORT_DIPSETTING(    0x20, "15000" )
3105 	PORT_DIPSETTING(    0x10, "20000" )
3106 	PORT_DIPSETTING(    0x00, "None" )
3107 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Unknown ) )
3108 	PORT_DIPSETTING(    0xc0, "A" )
3109 	PORT_DIPSETTING(    0x80, "B" )
3110 	PORT_DIPSETTING(    0x40, "C" )
3111 	PORT_DIPSETTING(    0x00, "D" )
3112 
3113 INPUT_PORTS_END
3114 
3115 /***************************************************************************/
3116 
3117 MACHINE_DRIVER_7759( machine_driver_bayroute, \
3118 	bayroute_readmem,bayroute_writemem,bayroute_init_machine, gfx1,upd7759_interface )
3119 
3120 /***************************************************************************
3121 
3122    Body Slam
3123 
3124 ***************************************************************************/
3125 // pre16
3126 ROM_START( bodyslam )
3127 	ROM_REGION( 0x30000, REGION_CPU1 ) /* 68000 code */
3128 	ROM_LOAD_EVEN( "epr10066.b9", 0x000000, 0x8000, 0x6cd53290 )
3129 	ROM_LOAD_ODD ( "epr10063.b6", 0x000000, 0x8000, 0xdd849a16 )
3130 	ROM_LOAD_EVEN( "epr10067.b10",0x010000, 0x8000, 0xdb22a5ce )
3131 	ROM_LOAD_ODD ( "epr10064.b7", 0x010000, 0x8000, 0x53d6b7e0 )
3132 	ROM_LOAD_EVEN( "epr10068.b11",0x020000, 0x8000, 0x15ccc665 )
3133 	ROM_LOAD_ODD ( "epr10065.b8", 0x020000, 0x8000, 0x0e5fa314 )
3134 
3135 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
3136 	ROM_LOAD( "epr10321.c9",  0x00000, 0x8000, 0xcd3e7cba ) /* plane 1 */
3137 	ROM_LOAD( "epr10322.c10", 0x08000, 0x8000, 0xb53d3217 ) /* plane 2 */
3138 	ROM_LOAD( "epr10323.c11", 0x10000, 0x8000, 0x915a3e61 ) /* plane 3 */
3139 
3140 	ROM_REGION( 0x50000*2, REGION_GFX2 ) /* sprites */
3141 	ROM_LOAD( "epr10012.c5",  0x000000, 0x08000, 0x990824e8 )
3142 	ROM_RELOAD(               0x040000, 0x08000 )
3143 	ROM_LOAD( "epr10016.b2",  0x008000, 0x08000, 0xaf5dc72f )
3144 	ROM_RELOAD(               0x048000, 0x08000 )
3145 	ROM_LOAD( "epr10013.c6",  0x010000, 0x08000, 0x9a0919c5 )
3146 	ROM_LOAD( "epr10017.b3",  0x018000, 0x08000, 0x62aafd95 )
3147 	ROM_LOAD( "epr10027.c7",  0x020000, 0x08000, 0x3f1c57c7 )
3148 	ROM_LOAD( "epr10028.b4",  0x028000, 0x08000, 0x80d4946d )
3149 	ROM_LOAD( "epr10015.c8",  0x030000, 0x08000, 0x582d3b6a )
3150 	ROM_LOAD( "epr10019.b5",  0x038000, 0x08000, 0xe020c38b )
3151 
3152 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
3153 	ROM_LOAD( "epr10026.b1", 0x00000, 0x8000, 0x123b69b8 )
3154 
3155 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
3156 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
3157 
3158 	ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
3159 	ROM_LOAD( "epr10029.c1", 0x00000, 0x8000, 0x7e4aca83 )
3160 	ROM_LOAD( "epr10030.c2", 0x08000, 0x8000, 0xdcc1df0b )
3161 	ROM_LOAD( "epr10031.c3", 0x10000, 0x8000, 0xea3c4472 )
3162 	ROM_LOAD( "epr10032.c4", 0x18000, 0x8000, 0x0aabebce )
3163 
3164 ROM_END
3165 
3166 ROM_START( dumpmtmt )
3167 	ROM_REGION( 0x30000, REGION_CPU1 ) /* 68000 code */
3168 	ROM_LOAD_EVEN( "7704a.bin", 0x000000, 0x8000, 0x96de6c7b )
3169 	ROM_LOAD_ODD ( "7701a.bin", 0x000000, 0x8000, 0x786d1009 )
3170 	ROM_LOAD_EVEN( "7705a.bin", 0x010000, 0x8000, 0xfc584391 )
3171 	ROM_LOAD_ODD ( "7702a.bin", 0x010000, 0x8000, 0x2241a8fd )
3172 	ROM_LOAD_EVEN( "7706a.bin", 0x020000, 0x8000, 0x6bbcc9d0 )
3173 	ROM_LOAD_ODD ( "7703a.bin", 0x020000, 0x8000, 0xfcb0cd40 )
3174 
3175 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
3176 	ROM_LOAD( "7707a.bin",  0x00000, 0x8000, 0x45318738 ) /* plane 1 */
3177 	ROM_LOAD( "7708a.bin",  0x08000, 0x8000, 0x411be9a4 ) /* plane 2 */
3178 	ROM_LOAD( "7709a.bin",  0x10000, 0x8000, 0x74ceb5a8 ) /* plane 3 */
3179 
3180 	ROM_REGION( 0x50000*2, REGION_GFX2 ) /* sprites */
3181 	ROM_LOAD( "7715.bin",  0x000000, 0x08000, 0xbf47e040 )
3182 	ROM_RELOAD(               0x040000, 0x08000 )
3183 	ROM_LOAD( "7719.bin",  0x008000, 0x08000, 0xfa5c5d6c )
3184 	ROM_RELOAD(               0x048000, 0x08000 )
3185 	ROM_LOAD( "epr10013.c6",  0x010000, 0x08000, 0x9a0919c5 )	/* 7716 */
3186 	ROM_LOAD( "epr10017.b3",  0x018000, 0x08000, 0x62aafd95 )	/* 7720 */
3187 	ROM_LOAD( "7717.bin",  0x020000, 0x08000, 0xfa64c86d )
3188 	ROM_LOAD( "7721.bin",  0x028000, 0x08000, 0x62a9143e )
3189 	ROM_LOAD( "epr10015.c8",  0x030000, 0x08000, 0x582d3b6a )	/* 7718 */
3190 	ROM_LOAD( "epr10019.b5",  0x038000, 0x08000, 0xe020c38b )	/* 7722 */
3191 
3192 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
3193 	ROM_LOAD( "7710a.bin", 0x00000, 0x8000, 0xa19b8ba8 )
3194 
3195 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
3196 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
3197 
3198 	ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
3199 	ROM_LOAD( "7711.bin", 0x00000, 0x8000, 0xefa9aabd )
3200 	ROM_LOAD( "7712.bin", 0x08000, 0x8000, 0x7bcd85cf )
3201 	ROM_LOAD( "7713.bin", 0x10000, 0x8000, 0x33f292e7 )
3202 	ROM_LOAD( "7714.bin", 0x18000, 0x8000, 0x8fd48c47 )
3203 
3204 ROM_END
3205 
3206 /***************************************************************************/
3207 
3208 static struct MemoryReadAddress bodyslam_readmem[] =
3209 {
3210 	{ 0x000000, 0x02ffff, MRA_ROM },
3211 	{ 0x400000, 0x40ffff, MRA_TILERAM },
3212 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
3213 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
3214 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
3215 	{ 0xc41002, 0xc41003, io_player1_r },
3216 	{ 0xc41006, 0xc41007, io_player2_r },
3217 	{ 0xc41000, 0xc41001, io_service_r },
3218 	{ 0xc42000, 0xc42001, io_dip1_r },
3219 	{ 0xc42002, 0xc42003, io_dip2_r },
3220 	{ 0xc40000, 0xc400ff, MRA_EXTRAM2 },
3221 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
3222 	{-1}
3223 };
3224 
3225 static struct MemoryWriteAddress bodyslam_writemem[] =
3226 {
3227 	{ 0x000000, 0x02ffff, MWA_ROM },
3228 	{ 0x400000, 0x40ffff, MWA_TILERAM },
3229 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
3230 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
3231 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
3232 	{ 0xc40000, 0xc40001, sound_command_nmi_w },
3233 	{ 0xc40000, 0xc400ff, MWA_EXTRAM2 },
3234 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
3235 	{-1}
3236 };
3237 /***************************************************************************/
3238 
bodyslam_update_proc(void)3239 static void bodyslam_update_proc (void)
3240 {
3241 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
3242 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
3243 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x00ff;
3244 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x01ff;
3245 
3246 	set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
3247 	set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
3248 
3249 	set_refresh_3d( READ_WORD( &sys16_extraram2[2] ) );
3250 }
3251 
3252 
bodyslam_init_machine(void)3253 static void bodyslam_init_machine( void ){
3254 	static int bank[16] = {0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3};
3255 	sys16_obj_bank = bank;
3256 	sys16_textmode=1;
3257 	sys16_spritesystem = 2;
3258 	sys16_sprxoffset = -0xbc;
3259 	sys16_fgxoffset = sys16_bgxoffset = 7;
3260 	sys16_bg_priority_mode = 2;
3261 	sys16_bg_priority_value=0x0e00;
3262 
3263 	sys16_textlayer_lo_min=0;
3264 	sys16_textlayer_lo_max=0x1f;
3265 	sys16_textlayer_hi_min=0x20;
3266 	sys16_textlayer_hi_max=0xff;
3267 
3268 	sys16_update_proc = bodyslam_update_proc;
3269 }
3270 
bodyslam_sprite_decode(void)3271 static void bodyslam_sprite_decode (void)
3272 {
3273 	sys16_sprite_decode (5,0x10000);
3274 }
3275 
3276 
3277 // I have no idea if this is needed, but I cannot find any code for the countdown
3278 // timer in the code and this seems to work ok.
bodyslam_irq_timer(void)3279 static void bodyslam_irq_timer(void)
3280 {
3281 	int flag=READ_WORD(&sys16_workingram[0x200])>>8;
3282 	int tick=READ_WORD(&sys16_workingram[0x200])&0xff;
3283 	int sec=READ_WORD(&sys16_workingram[0x202])>>8;
3284 	int min=READ_WORD(&sys16_workingram[0x202])&0xff;
3285 
3286 	if(tick == 0 && sec == 0 && min == 0)
3287 		flag=1;
3288 	else
3289 	{
3290 		if(tick==0)
3291 		{
3292 			tick=0x40;	// The game initialise this to 0x40
3293 			if(sec==0)
3294 			{
3295 				sec=0x59;
3296 				if(min==0)
3297 				{
3298 					flag=1;
3299 					tick=sec=min=0;
3300 				}
3301 				else
3302 					min--;
3303 			}
3304 			else
3305 			{
3306 				if((sec&0xf)==0)
3307 				{
3308 					sec-=0x10;
3309 					sec|=9;
3310 				}
3311 				else
3312 					sec--;
3313 
3314 			}
3315 		}
3316 		else
3317 			tick--;
3318 	}
3319 	WRITE_WORD(&sys16_workingram[0x200],(flag<<8)+tick);
3320 	WRITE_WORD(&sys16_workingram[0x202],(sec<<8)+min);
3321 }
3322 
init_bodyslam(void)3323 static void init_bodyslam( void ){
3324 	sys16_onetime_init_machine();
3325 	sys16_bg1_trans=1;
3326 	sys16_custom_irq=bodyslam_irq_timer;
3327 	bodyslam_sprite_decode();
3328 }
3329 
3330 /***************************************************************************/
3331 
INPUT_PORTS_START(bodyslam)3332 INPUT_PORTS_START( bodyslam )
3333 	SYS16_JOY1
3334 	SYS16_JOY2
3335 	SYS16_SERVICE
3336 	SYS16_COINAGE
3337 
3338 PORT_START	/* DSW1 */
3339 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
3340 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
3341 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3342 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
3343 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
3344 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3345 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
3346 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
3347 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3348 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
3349 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
3350 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3351 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
3352 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
3353 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3354 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
3355 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
3356 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3357 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
3358 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
3359 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3360 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
3361 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
3362 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3363 
3364 INPUT_PORTS_END
3365 
3366 /***************************************************************************/
3367 
3368 MACHINE_DRIVER_7751( machine_driver_bodyslam, \
3369 	bodyslam_readmem,bodyslam_writemem,bodyslam_init_machine, gfx8 )
3370 
3371 /***************************************************************************/
3372 // sys16B
3373 ROM_START( dduxbl )
3374 	ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
3375 	ROM_LOAD_EVEN( "dduxb03.bin", 0x000000, 0x20000, 0xe7526012 )
3376 	ROM_LOAD_ODD ( "dduxb05.bin", 0x000000, 0x20000, 0x459d1237 )
3377 	/* empty 0x40000 - 0x80000 */
3378 	ROM_LOAD_EVEN( "dduxb02.bin", 0x080000, 0x20000, 0xd8ed3132 )
3379 	ROM_LOAD_ODD ( "dduxb04.bin", 0x080000, 0x20000, 0x30c6cb92 )
3380 
3381 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
3382 	ROM_LOAD( "dduxb14.bin", 0x00000, 0x10000, 0x664bd135 )
3383 	ROM_LOAD( "dduxb15.bin", 0x10000, 0x10000, 0xce0d2b30 )
3384 	ROM_LOAD( "dduxb16.bin", 0x20000, 0x10000, 0x6de95434 )
3385 
3386 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
3387 	ROM_LOAD( "dduxb10.bin", 0x000000, 0x010000, 0x0be3aee5 )
3388 	ROM_LOAD( "dduxb06.bin", 0x010000, 0x010000, 0xb0079e99 )
3389 	ROM_LOAD( "dduxb11.bin", 0x020000, 0x010000, 0xcfb2af18 )
3390 	ROM_LOAD( "dduxb07.bin", 0x030000, 0x010000, 0x0217369c )
3391 	ROM_LOAD( "dduxb12.bin", 0x040000, 0x010000, 0x28ce9b15 )
3392 	ROM_LOAD( "dduxb08.bin", 0x050000, 0x010000, 0x8844f336 )
3393 	ROM_LOAD( "dduxb13.bin", 0x060000, 0x010000, 0xefe57759 )
3394 	ROM_LOAD( "dduxb09.bin", 0x070000, 0x010000, 0x6b64f665 )
3395 
3396 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
3397 	ROM_LOAD( "dduxb01.bin", 0x0000, 0x8000, 0x0dbef0d7 )
3398 ROM_END
3399 
3400 /***************************************************************************/
3401 static READ_HANDLER( dduxbl_skip_r )
3402 {
3403 	if (cpu_get_pc()==0x502) {cpu_spinuntil_int(); return 0xffff;}
3404 
3405 	return READ_WORD(&sys16_workingram[0x36e0]);
3406 }
3407 
3408 static struct MemoryReadAddress dduxbl_readmem[] =
3409 {
3410 	{ 0x000000, 0x0bffff, MRA_ROM },
3411 	{ 0x400000, 0x40ffff, MRA_TILERAM },
3412 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
3413 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
3414 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
3415 	{ 0xc41002, 0xc41003, io_player1_r },
3416 	{ 0xc41004, 0xc41005, io_player2_r },
3417 	{ 0xc41000, 0xc41001, io_service_r },
3418 	{ 0xc42002, 0xc42003, io_dip1_r },
3419 	{ 0xc42000, 0xc42001, io_dip2_r },
3420 	{ 0xfff6e0, 0xfff6e1, dduxbl_skip_r },
3421 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
3422 	{-1}
3423 };
3424 
3425 static struct MemoryWriteAddress dduxbl_writemem[] =
3426 {
3427 	{ 0x000000, 0x0bffff, MWA_ROM },
3428 	{ 0x400000, 0x40ffff, MWA_TILERAM },
3429 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
3430 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
3431 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
3432 	{ 0xc40006, 0xc40007, sound_command_w },
3433 	{ 0xc40000, 0xc4ffff, MWA_EXTRAM2 },
3434 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
3435 	{-1}
3436 };
3437 /***************************************************************************/
3438 
dduxbl_update_proc(void)3439 static void dduxbl_update_proc( void ){
3440 	sys16_fg_scrollx = (READ_WORD( &sys16_extraram2[0x6018] ) ^ 0xffff) & 0x01ff;
3441 	sys16_bg_scrollx = (READ_WORD( &sys16_extraram2[0x6008] ) ^ 0xffff) & 0x01ff;
3442 	sys16_fg_scrolly = READ_WORD( &sys16_extraram2[0x6010] ) & 0x00ff;
3443 	sys16_bg_scrolly = READ_WORD( &sys16_extraram2[0x6000] );
3444 
3445 	{
3446 		unsigned char lu = READ_WORD( &sys16_extraram2[0x6020] ) & 0xff;
3447 		unsigned char ru = READ_WORD( &sys16_extraram2[0x6022] ) & 0xff;
3448 		unsigned char ld = READ_WORD( &sys16_extraram2[0x6024] ) & 0xff;
3449 		unsigned char rd = READ_WORD( &sys16_extraram2[0x6026] ) & 0xff;
3450 
3451 		if (lu==4 && ld==4 && ru==5 && rd==5)
3452 		{ // fix a bug in chicago round (un-tested in MAME)
3453 			int vs=READ_WORD(&sys16_workingram[0x36ec]);
3454 			sys16_bg_scrolly = vs & 0xff;
3455 			sys16_fg_scrolly = vs & 0xff;
3456 			if (vs >= 0x100)
3457 			{
3458 				lu=0x26; ru=0x37;
3459 				ld=0x04; rd=0x15;
3460 			} else {
3461 				ld=0x26; rd=0x37;
3462 				lu=0x04; ru=0x15;
3463 			}
3464 		}
3465 		sys16_fg_page[0] = ld&0xf;
3466 		sys16_fg_page[1] = rd&0xf;
3467 		sys16_fg_page[2] = lu&0xf;
3468 		sys16_fg_page[3] = ru&0xf;
3469 
3470 		sys16_bg_page[0] = ld>>4;
3471 		sys16_bg_page[1] = rd>>4;
3472 		sys16_bg_page[2] = lu>>4;
3473 		sys16_bg_page[3] = ru>>4;
3474 	}
3475 
3476 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
3477 }
3478 
dduxbl_init_machine(void)3479 static void dduxbl_init_machine( void ){
3480 	static int bank[16] = {00,00,00,00,00,00,00,0x06,00,00,00,0x04,00,0x02,00,00};
3481 
3482 	sys16_obj_bank = bank;
3483 
3484 	patch_code( 0x1eb2e, 0x01 );
3485 	patch_code( 0x1eb2f, 0x01 );
3486 	patch_code( 0x1eb3c, 0x00 );
3487 	patch_code( 0x1eb3d, 0x00 );
3488 	patch_code( 0x23132, 0x01 );
3489 	patch_code( 0x23133, 0x01 );
3490 	patch_code( 0x23140, 0x00 );
3491 	patch_code( 0x23141, 0x00 );
3492 	patch_code( 0x24a9a, 0x01 );
3493 	patch_code( 0x24a9b, 0x01 );
3494 	patch_code( 0x24aa8, 0x00 );
3495 	patch_code( 0x24aa9, 0x00 );
3496 
3497 	sys16_update_proc = dduxbl_update_proc;
3498 	sys16_sprxoffset = -0x48;
3499 }
3500 
init_dduxbl(void)3501 static void init_dduxbl(void)
3502 {
3503 	int i;
3504 
3505 	sys16_onetime_init_machine();
3506 
3507 	/* invert the graphics bits on the tiles */
3508 	for (i = 0; i < 0x30000; i++)
3509 		memory_region(REGION_GFX1)[i] ^= 0xff;
3510 
3511 	sys16_sprite_decode( 4,0x020000 );
3512 }
3513 /***************************************************************************/
3514 
INPUT_PORTS_START(dduxbl)3515 INPUT_PORTS_START( dduxbl )
3516 	SYS16_JOY1
3517 	SYS16_JOY2
3518 	SYS16_SERVICE
3519 	SYS16_COINAGE
3520 
3521 PORT_START	/* DSW1 */
3522 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
3523 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
3524 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3525 	PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
3526 	PORT_DIPSETTING(    0x04, "Easy" )
3527 	PORT_DIPSETTING(    0x06, "Normal" )
3528 	PORT_DIPSETTING(    0x02, "Hard" )
3529 	PORT_DIPSETTING(    0x00, "Hardest" )
3530 	PORT_DIPNAME( 0x18, 0x18, DEF_STR( Lives ) )
3531 	PORT_DIPSETTING(    0x10, "2" )
3532 	PORT_DIPSETTING(    0x18, "3" )
3533 	PORT_DIPSETTING(    0x08, "4" )
3534 	PORT_DIPSETTING(    0x00, "5" )
3535 	PORT_DIPNAME( 0x60, 0x60, DEF_STR( Bonus_Life ) )
3536 	PORT_DIPSETTING(    0x40, "150000" )
3537 	PORT_DIPSETTING(    0x60, "200000" )
3538 	PORT_DIPSETTING(    0x20, "300000" )
3539 	PORT_DIPSETTING(    0x00, "400000" )
3540 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
3541 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
3542 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3543 
3544 INPUT_PORTS_END
3545 
3546 /***************************************************************************/
3547 
3548 MACHINE_DRIVER( machine_driver_dduxbl, \
3549 	dduxbl_readmem,dduxbl_writemem,dduxbl_init_machine, gfx1)
3550 
3551 /***************************************************************************/
3552 // sys16B
3553 ROM_START( eswat )
3554 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
3555 	ROM_LOAD_EVEN( "12657", 0x000000, 0x40000, 0xcfb935e9 )
3556 	ROM_LOAD_ODD ( "12656", 0x000000, 0x40000, 0xbe3f9d28 )
3557 
3558 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
3559 	ROM_LOAD( "e12624r", 0x00000, 0x40000, 0xe7b8545e )
3560 	ROM_LOAD( "e12625r", 0x40000, 0x40000, 0xb418582c )
3561 	ROM_LOAD( "e12626r", 0x80000, 0x40000, 0xba65789b )
3562 
3563 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
3564 	ROM_LOAD( "e12618r", 0x000000, 0x040000, 0x2d9ae975 )
3565 	ROM_LOAD( "e12621r", 0x040000, 0x040000, 0x1e6c4cf7 )
3566 	ROM_LOAD( "e12619r", 0x080000, 0x040000, 0x5f7ee6f6 )
3567 	ROM_LOAD( "e12622r", 0x0c0000, 0x040000, 0x33251fde )
3568 	ROM_LOAD( "e12620r", 0x100000, 0x040000, 0x905f9be2 )
3569 	ROM_LOAD( "e12623r", 0x140000, 0x040000, 0xa25ea1fc )
3570 
3571 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
3572 	ROM_LOAD( "e12617", 0x00000, 0x08000, 0x537930cb )
3573 	ROM_LOAD( "e12616r",0x10000, 0x20000, 0xf213fa4a )
3574 ROM_END
3575 
3576 ROM_START( eswatbl )
3577 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
3578 	ROM_LOAD_EVEN( "eswat_c.rom", 0x000000, 0x10000, 0x1028cc81 )
3579 	ROM_LOAD_ODD ( "eswat_f.rom", 0x000000, 0x10000, 0xf7b2d388 )
3580 	ROM_LOAD_EVEN( "eswat_b.rom", 0x020000, 0x10000, 0x87c6b1b5 )
3581 	ROM_LOAD_ODD ( "eswat_e.rom", 0x020000, 0x10000, 0x937ddf9a )
3582 	ROM_LOAD_EVEN( "eswat_a.rom", 0x040000, 0x08000, 0x2af4fc62 )
3583 	ROM_LOAD_ODD ( "eswat_d.rom", 0x040000, 0x08000, 0xb4751e19 )
3584 
3585 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
3586 	ROM_LOAD( "ic19.bin", 0x00000, 0x40000, 0x375a5ec4 )
3587 	ROM_LOAD( "ic20.bin", 0x40000, 0x40000, 0x3b8c757e )
3588 	ROM_LOAD( "ic21.bin", 0x80000, 0x40000, 0x3efca25c )
3589 
3590 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
3591 	ROM_LOAD( "ic9.bin",  0x000000, 0x040000, 0x0d1530bf )
3592 	ROM_LOAD( "ic12.bin", 0x040000, 0x040000, 0x18ff0799 )
3593 	ROM_LOAD( "ic10.bin", 0x080000, 0x040000, 0x32069246 )
3594 	ROM_LOAD( "ic13.bin", 0x0c0000, 0x040000, 0xa3dfe436 )
3595 	ROM_LOAD( "ic11.bin", 0x100000, 0x040000, 0xf6b096e0 )
3596 	ROM_LOAD( "ic14.bin", 0x140000, 0x040000, 0x6773fef6 )
3597 
3598 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
3599 	ROM_LOAD( "ic8.bin", 0x0000, 0x8000, 0x7efecf23 )
3600 	ROM_LOAD( "ic6.bin", 0x10000, 0x40000, 0x254347c2 )
3601 ROM_END
3602 /***************************************************************************/
3603 
3604 static READ_HANDLER( eswatbl_skip_r )
3605 {
3606 	if (cpu_get_pc()==0x65c) {cpu_spinuntil_int(); return 0xffff;}
3607 
3608 	return READ_WORD(&sys16_workingram[0x0454]);
3609 }
3610 
3611 static struct MemoryReadAddress eswat_readmem[] =
3612 {
3613 	{ 0x000000, 0x07ffff, MRA_ROM },
3614 	{ 0x400000, 0x40ffff, MRA_TILERAM },
3615 	{ 0x410000, 0x418fff, MRA_TEXTRAM },
3616 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
3617 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
3618 	{ 0xc41002, 0xc41003, io_player1_r },
3619 	{ 0xc41006, 0xc41007, io_player2_r },
3620 	{ 0xc41000, 0xc41001, io_service_r },
3621 	{ 0xc42002, 0xc42003, io_dip1_r },
3622 	{ 0xc42000, 0xc42001, io_dip2_r },
3623 	{ 0xffc454, 0xffc455, eswatbl_skip_r },
3624 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
3625 	{-1}
3626 };
3627 
3628 static int eswat_tilebank0;
3629 
WRITE_HANDLER(eswat_tilebank0_w)3630 static WRITE_HANDLER( eswat_tilebank0_w )
3631 {
3632 	eswat_tilebank0 = data;
3633 }
3634 
3635 static struct MemoryWriteAddress eswat_writemem[] =
3636 {
3637 	{ 0x000000, 0x07ffff, MWA_ROM },
3638 	{ 0x3e2000, 0x3e2001, eswat_tilebank0_w },
3639 	{ 0x400000, 0x40ffff, MWA_TILERAM },
3640 	{ 0x410000, 0x418fff, MWA_TEXTRAM },
3641 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
3642 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
3643 	{ 0xc42006, 0xc42007, sound_command_w },
3644 	{ 0xc40000, 0xc4ffff, MWA_EXTRAM2 },
3645 	{ 0xc80000, 0xc80001, MWA_NOP },
3646 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
3647 	{-1}
3648 };
3649 /***************************************************************************/
3650 
eswat_update_proc(void)3651 static void eswat_update_proc( void ){
3652 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x8008] ) ^ 0xffff;
3653 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x8018] ) ^ 0xffff;
3654 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x8000] );
3655 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x8010] );
3656 
3657 	set_fg_page( READ_WORD( &sys16_textram[0x8020] ) );
3658 	set_bg_page( READ_WORD( &sys16_textram[0x8028] ) );
3659 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
3660 
3661 	sys16_tile_bank1 = (READ_WORD( &sys16_textram[0x8030] ))&0xf;
3662 	sys16_tile_bank0 = eswat_tilebank0;
3663 }
3664 
eswat_init_machine(void)3665 static void eswat_init_machine( void ){
3666 	static int bank[16] = { 0,2,8,10,16,18,24,26,4,6,12,14,20,22,28,30};
3667 
3668 	sys16_obj_bank = bank;
3669 	sys16_sprxoffset = -0x23c;
3670 
3671 	patch_code( 0x3897, 0x11 );
3672 
3673 	sys16_update_proc = eswat_update_proc;
3674 }
3675 
init_eswat(void)3676 static void init_eswat( void ){
3677 	sys16_onetime_init_machine();
3678 	sys16_rowscroll_scroll=0x8000;
3679 	sys18_splittab_fg_x=&sys16_textram[0x0f80];
3680 
3681 	sys16_sprite_decode( 3,0x080000 );
3682 }
3683 
3684 /***************************************************************************/
3685 
INPUT_PORTS_START(eswat)3686 INPUT_PORTS_START( eswat )
3687 	SYS16_JOY1
3688 	SYS16_JOY2
3689 	SYS16_SERVICE
3690 	SYS16_COINAGE
3691 
3692 PORT_START	/* DSW1 */
3693 	PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
3694 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
3695 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3696 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
3697 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
3698 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3699 	PORT_DIPNAME( 0x04, 0x04, "Display Flip" )
3700 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
3701 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3702 	PORT_DIPNAME( 0x08, 0x08, "Time" )
3703 	PORT_DIPSETTING(    0x08, "Normal" )
3704 	PORT_DIPSETTING(    0x00, "Hard" )
3705 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
3706 	PORT_DIPSETTING(    0x20, "Easy" )
3707 	PORT_DIPSETTING(    0x30, "Normal" )
3708 	PORT_DIPSETTING(    0x10, "Hard" )
3709 	PORT_DIPSETTING(    0x00, "Hardest" )
3710 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
3711 	PORT_DIPSETTING(    0x00, "1" )
3712 	PORT_DIPSETTING(    0x40, "2" )
3713 	PORT_DIPSETTING(    0xc0, "3" )
3714 	PORT_DIPSETTING(    0x80, "4" )
3715 INPUT_PORTS_END
3716 
3717 /***************************************************************************/
3718 
3719 MACHINE_DRIVER_7759( machine_driver_eswat, \
3720 	eswat_readmem,eswat_writemem,eswat_init_machine, gfx4,upd7759_interface )
3721 
3722 /***************************************************************************/
3723 // sys16A
3724 ROM_START( fantzono )
3725 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
3726 	ROM_LOAD_EVEN( "7385.43", 0x000000, 0x8000, 0x5cb64450 )
3727 	ROM_LOAD_ODD ( "7382.26", 0x000000, 0x8000, 0x3fda7416 )
3728 	ROM_LOAD_EVEN( "7386.42", 0x010000, 0x8000, 0x15810ace )
3729 	ROM_LOAD_ODD ( "7383.25", 0x010000, 0x8000, 0xa001e10a )
3730 	ROM_LOAD_EVEN( "7387.41", 0x020000, 0x8000, 0x0acd335d )
3731 	ROM_LOAD_ODD ( "7384.24", 0x020000, 0x8000, 0xfd909341 )
3732 
3733 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
3734 	ROM_LOAD( "7388.95", 0x00000, 0x08000, 0x8eb02f6b )
3735 	ROM_LOAD( "7389.94", 0x08000, 0x08000, 0x2f4f71b8 )
3736 	ROM_LOAD( "7390.93", 0x10000, 0x08000, 0xd90609c6 )
3737 
3738 	ROM_REGION( 0x030000*2, REGION_GFX2 ) /* sprites */
3739 	ROM_LOAD( "7392.10", 0x000000, 0x008000, 0x5bb7c8b6 )
3740 	ROM_LOAD( "7396.11", 0x008000, 0x008000, 0x74ae4b57 )
3741 	ROM_LOAD( "7393.17", 0x010000, 0x008000, 0x14fc7e82 )
3742 	ROM_LOAD( "7397.18", 0x018000, 0x008000, 0xe05a1e25 )
3743 	ROM_LOAD( "7394.23", 0x020000, 0x008000, 0x531ca13f )
3744 	ROM_LOAD( "7398.24", 0x028000, 0x008000, 0x68807b49 )
3745 
3746 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
3747 	ROM_LOAD( "7535.12", 0x0000, 0x8000, 0x0cb2126a )
3748 ROM_END
3749 
3750 ROM_START( fantzone )
3751 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
3752 	ROM_LOAD_EVEN( "epr7385a.43", 0x000000, 0x8000, 0x4091af42 )
3753 	ROM_LOAD_ODD ( "epr7382a.26", 0x000000, 0x8000, 0x77d67bfd )
3754 	ROM_LOAD_EVEN( "epr7386a.42", 0x010000, 0x8000, 0xb0a67cd0 )
3755 	ROM_LOAD_ODD ( "epr7383a.25", 0x010000, 0x8000, 0x5f79b2a9 )
3756 	ROM_LOAD_EVEN( "7387.41", 0x020000, 0x8000, 0x0acd335d )
3757 	ROM_LOAD_ODD ( "7384.24", 0x020000, 0x8000, 0xfd909341 )
3758 
3759 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
3760 	ROM_LOAD( "7388.95", 0x00000, 0x08000, 0x8eb02f6b )
3761 	ROM_LOAD( "7389.94", 0x08000, 0x08000, 0x2f4f71b8 )
3762 	ROM_LOAD( "7390.93", 0x10000, 0x08000, 0xd90609c6 )
3763 
3764 	ROM_REGION( 0x030000*2, REGION_GFX2 ) /* sprites */
3765 	ROM_LOAD( "7392.10", 0x000000, 0x008000, 0x5bb7c8b6 )
3766 	ROM_LOAD( "7396.11", 0x008000, 0x008000, 0x74ae4b57 )
3767 	ROM_LOAD( "7393.17", 0x010000, 0x008000, 0x14fc7e82 )
3768 	ROM_LOAD( "7397.18", 0x018000, 0x008000, 0xe05a1e25 )
3769 	ROM_LOAD( "7394.23", 0x020000, 0x008000, 0x531ca13f )
3770 	ROM_LOAD( "7398.24", 0x028000, 0x008000, 0x68807b49 )
3771 
3772 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
3773 	ROM_LOAD( "epr7535a.12", 0x0000, 0x8000, 0xbc1374fa )
3774 ROM_END
3775 
3776 
3777 /***************************************************************************/
3778 
3779 static READ_HANDLER( fantzone_skip_r )
3780 {
3781 	if (cpu_get_pc()==0x91b2) {cpu_spinuntil_int(); return 0xffff;}
3782 
3783 	return READ_WORD(&sys16_workingram[0x022a]);
3784 }
3785 
3786 static struct MemoryReadAddress fantzono_readmem[] =
3787 {
3788 	{ 0x000000, 0x02ffff, MRA_ROM },
3789 	{ 0x400000, 0x40ffff, MRA_TILERAM },
3790 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
3791 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
3792 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
3793 	{ 0xc41002, 0xc41003, io_player1_r },
3794 	{ 0xc41006, 0xc41007, io_player2_r },
3795 	{ 0xc41000, 0xc41001, io_service_r },
3796 	{ 0xc42000, 0xc42001, io_dip1_r },
3797 	{ 0xc42002, 0xc42003, io_dip2_r },
3798 	{ 0xc40000, 0xc40003, MRA_EXTRAM2 },
3799 	{ 0xffc22a, 0xffc22b, fantzone_skip_r },
3800 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
3801 	{-1}
3802 };
3803 
3804 static struct MemoryWriteAddress fantzono_writemem[] =
3805 {
3806 	{ 0x000000, 0x02ffff, MWA_ROM },
3807 	{ 0x400000, 0x40ffff, MWA_TILERAM },
3808 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
3809 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
3810 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
3811 	{ 0xc40000, 0xc40001, sound_command_nmi_w },
3812 	{ 0xc40000, 0xc40003, MWA_EXTRAM2 },
3813 	{ 0xc60000, 0xc60003, MWA_NOP },
3814 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
3815 	{-1}
3816 };
3817 
3818 static struct MemoryReadAddress fantzone_readmem[] =
3819 {
3820 	{ 0x000000, 0x02ffff, MRA_ROM },
3821 	{ 0x400000, 0x40ffff, MRA_TILERAM },
3822 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
3823 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
3824 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
3825 	{ 0xc41002, 0xc41003, io_player1_r },
3826 	{ 0xc41006, 0xc41007, io_player2_r },
3827 	{ 0xc41000, 0xc41001, io_service_r },
3828 	{ 0xc42000, 0xc42001, io_dip1_r },
3829 	{ 0xc42002, 0xc42003, io_dip2_r },
3830 	{ 0xc40000, 0xc40003, MRA_EXTRAM2 },
3831 	{ 0xffc22a, 0xffc22b, fantzone_skip_r },
3832 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
3833 	{-1}
3834 };
3835 
3836 static struct MemoryWriteAddress fantzone_writemem[] =
3837 {
3838 	{ 0x000000, 0x02ffff, MWA_ROM },
3839 	{ 0x400000, 0x40ffff, MWA_TILERAM },
3840 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
3841 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
3842 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
3843 	{ 0xc40000, 0xc40001, sound_command_nmi_w },
3844 	{ 0xc40000, 0xc40003, MWA_EXTRAM2 },
3845 	{ 0xc60000, 0xc60003, MWA_NOP },
3846 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
3847 	{-1}
3848 };
3849 
3850 /***************************************************************************/
3851 
fantzone_update_proc(void)3852 static void fantzone_update_proc( void ){
3853 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
3854 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
3855 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
3856 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
3857 
3858 	set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
3859 	set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
3860 
3861 	set_refresh_3d( READ_WORD( &sys16_extraram2[2] ) );	// c40003
3862 }
3863 
fantzono_init_machine(void)3864 static void fantzono_init_machine( void ){
3865 	static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
3866 
3867 	sys16_obj_bank = bank;
3868 	sys16_textmode=1;
3869 	sys16_spritesystem = 3;
3870 	sys16_sprxoffset = -0xbe;
3871 //	sys16_fgxoffset = sys16_bgxoffset = 8;
3872 	sys16_fg_priority_mode=3;				// fixes end of game priority
3873 	sys16_fg_priority_value=0xd000;
3874 
3875 	patch_code( 0x20e7, 0x16 );
3876 	patch_code( 0x30ef, 0x16 );
3877 
3878 	// solving Fantasy Zone scrolling bug
3879 	patch_code(0x308f,0x00);
3880 
3881 	// invincible
3882 /*	patch_code(0x224e,0x4e);
3883 	patch_code(0x224f,0x71);
3884 	patch_code(0x2250,0x4e);
3885 	patch_code(0x2251,0x71);
3886 
3887 	patch_code(0x2666,0x4e);
3888 	patch_code(0x2667,0x71);
3889 	patch_code(0x2668,0x4e);
3890 	patch_code(0x2669,0x71);
3891 
3892 	patch_code(0x25c0,0x4e);
3893 	patch_code(0x25c1,0x71);
3894 	patch_code(0x25c2,0x4e);
3895 	patch_code(0x25c3,0x71);
3896 */
3897 
3898 	sys16_update_proc = fantzone_update_proc;
3899 }
3900 
fantzone_init_machine(void)3901 static void fantzone_init_machine( void ){
3902 	static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
3903 
3904 	sys16_obj_bank = bank;
3905 	sys16_textmode=1;
3906 	sys16_spritesystem = 3;
3907 	sys16_sprxoffset = -0xbe;
3908 	sys16_fg_priority_mode=3;				// fixes end of game priority
3909 	sys16_fg_priority_value=0xd000;
3910 
3911 	patch_code( 0x2135, 0x16 );
3912 	patch_code( 0x3649, 0x16 );
3913 
3914 	// solving Fantasy Zone scrolling bug
3915 	patch_code(0x35e9,0x00);
3916 
3917 	sys16_update_proc = fantzone_update_proc;
3918 }
3919 
init_fantzone(void)3920 static void init_fantzone( void )
3921 {
3922 	sys16_onetime_init_machine();
3923 	sys16_sprite_decode( 3,0x010000 );
3924 }
3925 /***************************************************************************/
3926 
INPUT_PORTS_START(fantzone)3927 INPUT_PORTS_START( fantzone )
3928 	SYS16_JOY1
3929 	SYS16_JOY2
3930 	SYS16_SERVICE
3931 	SYS16_COINAGE
3932 
3933 PORT_START	/* DSW1 */
3934 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
3935 	PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
3936 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
3937 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
3938 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
3939 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3940 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
3941 	PORT_DIPSETTING(    0x08, "2" )
3942 	PORT_DIPSETTING(    0x0c, "3" )
3943 	PORT_DIPSETTING(    0x04, "4" )
3944 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240", IP_KEY_NONE, IP_JOY_NONE )
3945 	PORT_DIPNAME( 0x30, 0x30, "Extra Ship Cost" )
3946 	PORT_DIPSETTING(    0x30, "5000" )
3947 	PORT_DIPSETTING(    0x20, "10000" )
3948 	PORT_DIPSETTING(    0x10, "15000" )
3949 	PORT_DIPSETTING(    0x00, "20000" )
3950 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
3951 	PORT_DIPSETTING(    0x80, "Easy" )
3952 	PORT_DIPSETTING(    0xc0, "Normal" )
3953 	PORT_DIPSETTING(    0x40, "Hard" )
3954 	PORT_DIPSETTING(    0x00, "Hardest" )
3955 
3956 INPUT_PORTS_END
3957 
3958 /***************************************************************************/
3959 
3960 MACHINE_DRIVER( machine_driver_fantzono, \
3961 	fantzono_readmem,fantzono_writemem,fantzono_init_machine, gfx8 )
3962 MACHINE_DRIVER( machine_driver_fantzone, \
3963 	fantzone_readmem,fantzone_writemem,fantzone_init_machine, gfx8 )
3964 
3965 /***************************************************************************/
3966 // sys16B
3967 ROM_START( fpoint )
3968 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
3969 	ROM_LOAD_EVEN( "12591b.bin", 0x000000, 0x10000, 0x248b3e1b )
3970 	ROM_LOAD_ODD ( "12590b.bin", 0x000000, 0x10000, 0x75256e3d )
3971 
3972 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
3973 	ROM_LOAD( "12595.bin", 0x00000, 0x10000, 0x5b18d60b )
3974 	ROM_LOAD( "12594.bin", 0x10000, 0x10000, 0x8bfc4815 )
3975 	ROM_LOAD( "12593.bin", 0x20000, 0x10000, 0xcc0582d8 )
3976 
3977 	ROM_REGION( 0x020000*2, REGION_GFX2 ) /* sprites */
3978 	ROM_LOAD( "12596.bin", 0x000000, 0x010000, 0x4a4041f3 )
3979 	ROM_LOAD( "12597.bin", 0x010000, 0x010000, 0x6961e676 )
3980 
3981 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
3982 	ROM_LOAD( "12592.bin", 0x0000, 0x8000, 0x9a8c11bb )
3983 ROM_END
3984 
3985 ROM_START( fpointbl )
3986 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
3987 	ROM_LOAD_EVEN( "flpoint.003", 0x000000, 0x10000, 0x4d6df514 )
3988 	ROM_LOAD_ODD ( "flpoint.002", 0x000000, 0x10000, 0x4dff2ee8 )
3989 
3990 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
3991 	ROM_LOAD( "flpoint.006", 0x00000, 0x10000, 0xc539727d )
3992 	ROM_LOAD( "flpoint.005", 0x10000, 0x10000, 0x82c0b8b0 )
3993 	ROM_LOAD( "flpoint.004", 0x20000, 0x10000, 0x522426ae )
3994 
3995 	ROM_REGION( 0x020000*2, REGION_GFX2 ) /* sprites */
3996 	ROM_LOAD( "12596.bin", 0x000000, 0x010000, 0x4a4041f3 )
3997 	ROM_LOAD( "12597.bin", 0x010000, 0x010000, 0x6961e676 )
3998 
3999 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
4000 	ROM_LOAD( "12592.bin",   0x0000, 0x8000, 0x9a8c11bb )	// wrong sound rom? (this ones from the original)
4001 //	ROM_LOAD( "flpoint.001", 0x0000, 0x8000, 0xc5b8e0fe )	// bootleg rom doesn't work!
4002 ROM_END
4003 /***************************************************************************/
4004 
4005 static READ_HANDLER( fp_io_service_dummy_r ){
4006 	int data = input_port_2_r( 0 ) & 0xff;
4007 	return (data << 8) + data;
4008 }
4009 
4010 static struct MemoryReadAddress fpoint_readmem[] =
4011 {
4012 	{ 0x000000, 0x01ffff, MRA_ROM },
4013 	{ 0x02002e, 0x020049, fp_io_service_dummy_r },
4014 	{ 0x601002, 0x601003, io_player1_r },
4015 	{ 0x601004, 0x601005, io_player2_r },
4016 	{ 0x601000, 0x601001, io_service_r },
4017 	{ 0x600000, 0x600001, io_dip2_r },
4018 	{ 0x600002, 0x600003, io_dip1_r },
4019 	{ 0x400000, 0x40ffff, MRA_TILERAM },
4020 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
4021 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
4022 	{ 0x44302a, 0x44304d, fp_io_service_dummy_r },
4023 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
4024 	{ 0xfe003e, 0xfe003f, fp_io_service_dummy_r },
4025 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
4026 	{-1}
4027 };
4028 
4029 static struct MemoryWriteAddress fpoint_writemem[] =
4030 {
4031 	{ 0x000000, 0x01ffff, MWA_ROM },
4032 	{ 0x600006, 0x600007, sound_command_w },
4033 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
4034 	{ 0x400000, 0x40ffff, MWA_TILERAM },
4035 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
4036 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
4037 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
4038 	{-1}
4039 };
4040 /***************************************************************************/
4041 
fpoint_update_proc(void)4042 static void fpoint_update_proc( void ){
4043 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
4044 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
4045 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
4046 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
4047 
4048 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
4049 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
4050 }
4051 
fpoint_init_machine(void)4052 static void fpoint_init_machine( void ){
4053 	static int bank[16] = {00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00};
4054 
4055 	sys16_obj_bank = bank;
4056 
4057 	patch_code( 0x454, 0x33 );
4058 	patch_code( 0x455, 0xf8 );
4059 	patch_code( 0x456, 0xe0 );
4060 	patch_code( 0x457, 0xe2 );
4061 	patch_code( 0x8ce8, 0x16 );
4062 	patch_code( 0x8ce9, 0x66 );
4063 	patch_code( 0x17687, 0x00 );
4064 	patch_code( 0x7bed, 0x04 );
4065 
4066 	patch_code( 0x7ea8, 0x61 );
4067 	patch_code( 0x7ea9, 0x00 );
4068 	patch_code( 0x7eaa, 0x84 );
4069 	patch_code( 0x7eab, 0x16 );
4070 	patch_code( 0x2c0, 0xe7 );
4071 	patch_code( 0x2c1, 0x48 );
4072 	patch_code( 0x2c2, 0xe7 );
4073 	patch_code( 0x2c3, 0x49 );
4074 	patch_code( 0x2c4, 0x04 );
4075 	patch_code( 0x2c5, 0x40 );
4076 	patch_code( 0x2c6, 0x00 );
4077 	patch_code( 0x2c7, 0x10 );
4078 	patch_code( 0x2c8, 0x4e );
4079 	patch_code( 0x2c9, 0x75 );
4080 
4081 	sys16_update_proc = fpoint_update_proc;
4082 }
4083 
init_fpoint(void)4084 static void init_fpoint(void)
4085 {
4086 	sys16_onetime_init_machine();
4087 	sys16_sprite_decode( 1,0x020000 );
4088 }
4089 
init_fpointbl(void)4090 static void init_fpointbl(void)
4091 {
4092 	int i;
4093 
4094 	sys16_onetime_init_machine();
4095 
4096 	/* invert the graphics bits on the tiles */
4097 	for (i = 0; i < 0x30000; i++)
4098 		memory_region(REGION_GFX1)[i] ^= 0xff;
4099 
4100 	sys16_sprite_decode( 1,0x020000 );
4101 }
4102 /***************************************************************************/
4103 
INPUT_PORTS_START(fpoint)4104 INPUT_PORTS_START( fpoint )
4105 PORT_START
4106 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
4107 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 )
4108 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
4109 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
4110 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
4111 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
4112 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
4113 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
4114 
4115 PORT_START
4116 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
4117 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
4118 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
4119 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
4120 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
4121 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
4122 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
4123 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
4124 
4125 	SYS16_SERVICE
4126 	SYS16_COINAGE
4127 
4128 PORT_START	/* DSW1 */
4129 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
4130 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
4131 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4132 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
4133 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
4134 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4135 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
4136 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
4137 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4138 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
4139 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
4140 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4141 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
4142 	PORT_DIPSETTING(    0x20, "Easy" )
4143 	PORT_DIPSETTING(    0x30, "Normal" )
4144 	PORT_DIPSETTING(    0x10, "Hard" )
4145 	PORT_DIPSETTING(    0x00, "Hardest" )
4146 	PORT_DIPNAME( 0x40, 0x40, "Clear round allowed" ) /* Use button 3 */
4147 	PORT_DIPSETTING(    0x00, "1" )
4148 	PORT_DIPSETTING(    0x40, "2" )
4149 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
4150 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
4151 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4152 
4153 INPUT_PORTS_END
4154 
4155 /***************************************************************************/
4156 
4157 MACHINE_DRIVER( machine_driver_fpoint, \
4158 	fpoint_readmem,fpoint_writemem,fpoint_init_machine, gfx1)
4159 
4160 /***************************************************************************/
4161 // sys16B
4162 ROM_START( goldnaxe )
4163 	ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
4164 	ROM_LOAD_EVEN( "epr12523.a7", 0x00000, 0x20000, 0x8e6128d7 )
4165 	ROM_LOAD_ODD ( "epr12522.a5", 0x00000, 0x20000, 0xb6c35160 )
4166 	/* emtpy 0x40000 - 0x80000 */
4167 	ROM_LOAD_EVEN( "epr12521.a8", 0x80000, 0x20000, 0x5001d713 )
4168 	ROM_LOAD_ODD ( "epr12519.a6", 0x80000, 0x20000, 0x4438ca8e )
4169 
4170 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
4171 	ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
4172 	ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
4173 	ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
4174 
4175 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
4176 	ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
4177 	ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
4178 	ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
4179 	ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
4180 	ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
4181 	ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
4182 
4183 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
4184 	ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
4185 	ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
4186 ROM_END
4187 
4188 ROM_START( goldnaxj )
4189 	ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
4190 // Custom cpu 317-0121
4191 	ROM_LOAD_EVEN( "epr12540.a7", 0x00000, 0x20000, 0x0c7ccc6d )
4192 	ROM_LOAD_ODD ( "epr12539.a5", 0x00000, 0x20000, 0x1f24f7d0 )
4193 	/* emtpy 0x40000 - 0x80000 */
4194 	ROM_LOAD_EVEN( "epr12521.a8", 0x80000, 0x20000, 0x5001d713 )
4195 	ROM_LOAD_ODD ( "epr12519.a6", 0x80000, 0x20000, 0x4438ca8e )
4196 
4197 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
4198 	ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
4199 	ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
4200 	ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
4201 
4202 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
4203 	ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
4204 	ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
4205 	ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
4206 	ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
4207 	ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
4208 	ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
4209 
4210 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
4211 	ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
4212 	ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
4213 ROM_END
4214 
4215 
4216 ROM_START( goldnabl )
4217 	ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
4218 // protected code
4219 	ROM_LOAD_EVEN( "ga6.a22", 0x00000, 0x10000, 0xf95b459f )
4220 	ROM_LOAD_ODD ( "ga4.a20", 0x00000, 0x10000, 0x83eabdf5 )
4221 	ROM_LOAD_EVEN( "ga11.a27",0x20000, 0x10000, 0xf4ef9349 )
4222 	ROM_LOAD_ODD ( "ga8.a24", 0x20000, 0x10000, 0x37a65839 )
4223 	/* emtpy 0x40000 - 0x80000 */
4224 	ROM_LOAD_EVEN( "epr12521.a8", 0x80000, 0x20000, 0x5001d713 )
4225 	ROM_LOAD_ODD ( "epr12519.a6", 0x80000, 0x20000, 0x4438ca8e )
4226 
4227 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
4228 	ROM_LOAD( "ga33.b16", 0x00000, 0x10000, 0x84587263 )
4229 	ROM_LOAD( "ga32.b15", 0x10000, 0x10000, 0x63d72388 )
4230 	ROM_LOAD( "ga31.b14", 0x20000, 0x10000, 0xf8b6ae4f )
4231 	ROM_LOAD( "ga30.b13", 0x30000, 0x10000, 0xe29baf4f )
4232 	ROM_LOAD( "ga29.b12", 0x40000, 0x10000, 0x22f0667e )
4233 	ROM_LOAD( "ga28.b11", 0x50000, 0x10000, 0xafb1a7e4 )
4234 
4235 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
4236 	ROM_LOAD( "ga34.b17", 0x000000, 0x10000, 0x28ba70c8 )
4237 	ROM_LOAD( "ga35.b18", 0x010000, 0x10000, 0x2ed96a26 )
4238 	ROM_LOAD( "ga23.a14", 0x020000, 0x10000, 0x84dccc5b )
4239 	ROM_LOAD( "ga18.a9",  0x030000, 0x10000, 0xde346006 )
4240 	ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
4241 	ROM_LOAD( "ga36.b19", 0x080000, 0x10000, 0x101d2fff )
4242 	ROM_LOAD( "ga37.b20", 0x090000, 0x10000, 0x677e64a6 )
4243 	ROM_LOAD( "ga19.a10", 0x0a0000, 0x10000, 0x11794d05 )
4244 	ROM_LOAD( "ga20.a11", 0x0b0000, 0x10000, 0xad1c1c90 )
4245 	ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
4246 	ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
4247 	ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
4248 
4249 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
4250 	ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
4251 	ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
4252 ROM_END
4253 
4254 
4255 /***************************************************************************/
4256 
4257 static READ_HANDLER( goldnaxe_skip_r )
4258 {
4259 	if (cpu_get_pc()==0x3cb0) {cpu_spinuntil_int(); return 0xffff;}
4260 
4261 	return READ_WORD(&sys16_workingram[0x2c1c]);
4262 }
4263 
READ_HANDLER(ga_io_players_r)4264 static READ_HANDLER( ga_io_players_r ) {return (io_player1_r(offset) << 8) | io_player2_r(offset);}
READ_HANDLER(ga_io_service_r)4265 static READ_HANDLER( ga_io_service_r )
4266 {
4267 	return (io_service_r(offset) << 8) | (READ_WORD(&sys16_workingram[0x2c96]) & 0x00ff);
4268 }
4269 
4270 static struct MemoryReadAddress goldnaxe_readmem[] =
4271 {
4272 	{ 0x000000, 0x0bffff, MRA_ROM },
4273 
4274 	{ 0x100000, 0x10ffff, MRA_TILERAM },
4275 	{ 0x110000, 0x110fff, MRA_TEXTRAM },
4276 	{ 0x140000, 0x140fff, MRA_PALETTERAM },
4277 	{ 0x1f0000, 0x1f0003, MRA_EXTRAM },
4278 	{ 0x200000, 0x200fff, MRA_SPRITERAM },
4279 	{ 0xc41002, 0xc41003, io_player1_r },
4280 	{ 0xc41006, 0xc41007, io_player2_r },
4281 	{ 0xc41000, 0xc41001, io_service_r },
4282 	{ 0xc42002, 0xc42003, io_dip1_r },
4283 	{ 0xc42000, 0xc42001, io_dip2_r },
4284 	{ 0xc40000, 0xc40fff, MRA_EXTRAM2 },
4285 	{ 0xffecd0, 0xffecd1, ga_io_players_r },
4286 	{ 0xffec96, 0xffec97, ga_io_service_r },
4287 	{ 0xffec1c, 0xffec1d, goldnaxe_skip_r },
4288 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
4289 	{-1}
4290 };
4291 
WRITE_HANDLER(ga_sound_command_w)4292 static WRITE_HANDLER( ga_sound_command_w )
4293 {
4294 	if( (data&0xff000000)==0 )
4295 		sound_command_w(offset,data>>8);
4296 	COMBINE_WORD_MEM(&sys16_workingram[0x2cfc],data);
4297 }
4298 
4299 static struct MemoryWriteAddress goldnaxe_writemem[] =
4300 {
4301 	{ 0x000000, 0x0bffff, MWA_ROM },
4302 	{ 0x100000, 0x10ffff, MWA_TILERAM },
4303 	{ 0x110000, 0x110fff, MWA_TEXTRAM },
4304 	{ 0x140000, 0x140fff, MWA_PALETTERAM },
4305 	{ 0x1f0000, 0x1f0003, MWA_EXTRAM },
4306 	{ 0x200000, 0x200fff, MWA_SPRITERAM },
4307 	{ 0xc40000, 0xc40fff, MWA_EXTRAM2 },
4308 	{ 0xc43000, 0xc43001, MWA_NOP },
4309 	{ 0xffecfc, 0xffecfd, ga_sound_command_w },
4310 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
4311 	{-1}
4312 };
4313 /***************************************************************************/
4314 
goldnaxe_update_proc(void)4315 static void goldnaxe_update_proc( void ){
4316 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
4317 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
4318 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
4319 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
4320 
4321 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
4322 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
4323 	set_tile_bank( READ_WORD( &sys16_workingram[0x2c94] ) );
4324 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
4325 }
4326 
goldnaxe_init_machine(void)4327 static void goldnaxe_init_machine( void ){
4328 	static int bank[16] = { 0,2,8,10,16,18,0,0,4,6,12,14,20,22,0,0 };
4329 
4330 	sys16_obj_bank = bank;
4331 
4332 	patch_code( 0x3CB2, 0x60 );
4333 	patch_code( 0x3CB3, 0x1e );
4334 
4335 	sys16_sprxoffset = -0xb8;
4336 	sys16_update_proc = goldnaxe_update_proc;
4337 }
4338 
init_goldnaxe(void)4339 static void init_goldnaxe( void )
4340 {
4341 	sys16_onetime_init_machine();
4342 	sys16_sprite_decode( 3,0x80000 );
4343 }
4344 
init_goldnabl(void)4345 static void init_goldnabl( void )
4346 {
4347 	int i;
4348 
4349 	sys16_onetime_init_machine();
4350 
4351 	/* invert the graphics bits on the tiles */
4352 	for (i = 0; i < 0x60000; i++)
4353 		memory_region(REGION_GFX1)[i] ^= 0xff;
4354 	sys16_sprite_decode( 3,0x80000 );
4355 }
4356 
4357 /***************************************************************************/
4358 
INPUT_PORTS_START(goldnaxe)4359 INPUT_PORTS_START( goldnaxe )
4360 	SYS16_JOY1
4361 	SYS16_JOY2
4362 	SYS16_SERVICE
4363 	SYS16_COINAGE
4364 
4365 PORT_START	/* DSW1 */
4366 	PORT_DIPNAME( 0x01, 0x01, "Credits needed" )
4367 	PORT_DIPSETTING(    0x01, "1 to start, 1 to continue")
4368 	PORT_DIPSETTING(    0x00, "2 to start, 1 to continue")
4369 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
4370 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
4371 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4372 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
4373 	PORT_DIPSETTING(    0x08, "1" )
4374 	PORT_DIPSETTING(    0x0c, "2" )
4375 	PORT_DIPSETTING(    0x04, "3" )
4376 	PORT_DIPSETTING(    0x00, "5" )
4377 	PORT_DIPNAME( 0x30, 0x30, "Energy Meter" )
4378 	PORT_DIPSETTING(    0x20, "2" )
4379 	PORT_DIPSETTING(    0x30, "3" )
4380 	PORT_DIPSETTING(    0x10, "4" )
4381 	PORT_DIPSETTING(    0x00, "5" )
4382 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
4383 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
4384 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4385 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
4386 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
4387 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4388 INPUT_PORTS_END
4389 
4390 /***************************************************************************/
4391 
4392 MACHINE_DRIVER_7759( machine_driver_goldnaxe, \
4393 	goldnaxe_readmem,goldnaxe_writemem,goldnaxe_init_machine, gfx2,upd7759_interface )
4394 
4395 /***************************************************************************/
4396 // sys16B
4397 ROM_START( goldnaxa )
4398 	ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
4399 	ROM_LOAD_EVEN( "epr12545.a2", 0x00000, 0x40000, 0xa97c4e4d )
4400 	ROM_LOAD_ODD ( "epr12544.a1", 0x00000, 0x40000, 0x5e38f668 )
4401 
4402 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
4403 	ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
4404 	ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
4405 	ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
4406 
4407 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
4408 	ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
4409 	ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
4410 	ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
4411 	ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
4412 	ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
4413 	ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
4414 
4415 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
4416 	ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
4417 	ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
4418 ROM_END
4419 
4420 ROM_START( goldnaxb )
4421 	ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
4422 // Custom 68000 ver 317-0110
4423 	ROM_LOAD_EVEN( "epr12389.a2", 0x00000, 0x40000, 0x35d5fa77 )
4424 	ROM_LOAD_ODD ( "epr12388.a1", 0x00000, 0x40000, 0x72952a93 )
4425 
4426 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
4427 	ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
4428 	ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
4429 	ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
4430 
4431 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
4432 	ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
4433 	ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
4434 	ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
4435 	ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
4436 	ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
4437 	ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
4438 
4439 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
4440 	ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
4441 	ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
4442 ROM_END
4443 
4444 ROM_START( goldnaxc )
4445 	ROM_REGION( 0x0c0000, REGION_CPU1 ) /* 68000 code */
4446 // Custom 68000 ver 317-0122
4447 	ROM_LOAD_EVEN( "epr12543.a2", 0x00000, 0x40000, 0xb0df9ca4 )
4448 	ROM_LOAD_ODD ( "epr12542.a1", 0x00000, 0x40000, 0xb7994d3c )
4449 
4450 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
4451 	ROM_LOAD( "epr12385", 0x00000, 0x20000, 0xb8a4e7e0 )
4452 	ROM_LOAD( "epr12386", 0x20000, 0x20000, 0x25d7d779 )
4453 	ROM_LOAD( "epr12387", 0x40000, 0x20000, 0xc7fcadf3 )
4454 
4455 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
4456 	ROM_LOAD( "mpr12378.b1", 0x000000, 0x40000, 0x119e5a82 )
4457 	ROM_LOAD( "mpr12379.b4", 0x040000, 0x40000, 0x1a0e8c57 )
4458 	ROM_LOAD( "mpr12380.b2", 0x080000, 0x40000, 0xbb2c0853 )
4459 	ROM_LOAD( "mpr12381.b5", 0x0c0000, 0x40000, 0x81ba6ecc )
4460 	ROM_LOAD( "mpr12382.b3", 0x100000, 0x40000, 0x81601c6f )
4461 	ROM_LOAD( "mpr12383.b6", 0x140000, 0x40000, 0x5dbacf7a )
4462 
4463 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
4464 	ROM_LOAD( "epr12390",     0x00000, 0x08000, 0x399fc5f5 )
4465 	ROM_LOAD( "mpr12384.a11", 0x10000, 0x20000, 0x6218d8e7 )
4466 ROM_END
4467 
4468 
4469 /***************************************************************************/
4470 
4471 static READ_HANDLER( goldnaxa_skip_r )
4472 {
4473 	if (cpu_get_pc()==0x3ca0) {cpu_spinuntil_int(); return 0xffff;}
4474 
4475 	return READ_WORD(&sys16_workingram[0x2c1c]);
4476 }
4477 
4478 // This version has somekind of hardware comparitor for collision detection,
4479 // and a hardware multiplier.
4480 static int ga_hardware_collision_data[5];
WRITE_HANDLER(ga_hardware_collision_w)4481 static WRITE_HANDLER( ga_hardware_collision_w )
4482 {
4483 	static int bit=1;
4484 	ga_hardware_collision_data[offset/2]=data;
4485 	if(offset==4)
4486 	{
4487 		if(ga_hardware_collision_data[2] <= ga_hardware_collision_data[0] &&
4488 			ga_hardware_collision_data[2] >= ga_hardware_collision_data[1])
4489 		{
4490 			ga_hardware_collision_data[4] |=bit;
4491 		}
4492 		bit=bit<<1;
4493 	}
4494 	if(offset==8) bit=1;
4495 }
4496 
READ_HANDLER(ga_hardware_collision_r)4497 static READ_HANDLER( ga_hardware_collision_r )
4498 {
4499 	return ga_hardware_collision_data[4];
4500 }
4501 
4502 static int ga_hardware_multiplier_data[4];
WRITE_HANDLER(ga_hardware_multiplier_w)4503 static WRITE_HANDLER( ga_hardware_multiplier_w )
4504 {
4505 	ga_hardware_multiplier_data[offset/2]=data;
4506 }
4507 
READ_HANDLER(ga_hardware_multiplier_r)4508 static READ_HANDLER( ga_hardware_multiplier_r )
4509 {
4510 	if(offset==6)
4511 		return ga_hardware_multiplier_data[0] * ga_hardware_multiplier_data[1];
4512 	else
4513 		return ga_hardware_multiplier_data[offset/2];
4514 }
4515 
4516 static struct MemoryReadAddress goldnaxa_readmem[] =
4517 {
4518 	{ 0x000000, 0x07ffff, MRA_ROM },
4519 
4520 	{ 0x100000, 0x10ffff, MRA_TILERAM },
4521 	{ 0x110000, 0x110fff, MRA_TEXTRAM },
4522 	{ 0x140000, 0x140fff, MRA_PALETTERAM },
4523 	{ 0x1e0008, 0x1e0009, ga_hardware_collision_r },
4524 	{ 0x1f0000, 0x1f0007, ga_hardware_multiplier_r },
4525 	{ 0x1f1008, 0x1f1009, ga_hardware_collision_r },
4526 	{ 0x1f2000, 0x1f2003, MRA_EXTRAM },
4527 	{ 0x200000, 0x200fff, MRA_SPRITERAM },
4528 	{ 0xc41002, 0xc41003, io_player1_r },
4529 	{ 0xc41006, 0xc41007, io_player2_r },
4530 	{ 0xc41000, 0xc41001, io_service_r },
4531 	{ 0xc42002, 0xc42003, io_dip1_r },
4532 	{ 0xc42000, 0xc42001, io_dip2_r },
4533 	{ 0xc40000, 0xc40fff, MRA_EXTRAM2 },
4534 	{ 0xffecd0, 0xffecd1, ga_io_players_r },
4535 	{ 0xffec96, 0xffec97, ga_io_service_r },
4536 	{ 0xffec1c, 0xffec1d, goldnaxa_skip_r },
4537 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
4538 	{-1}
4539 };
4540 
4541 static struct MemoryWriteAddress goldnaxa_writemem[] =
4542 {
4543 	{ 0x000000, 0x07ffff, MWA_ROM },
4544 	{ 0x100000, 0x10ffff, MWA_TILERAM },
4545 	{ 0x110000, 0x110fff, MWA_TEXTRAM },
4546 	{ 0x140000, 0x140fff, MWA_PALETTERAM },
4547 	{ 0x1e0000, 0x1e0009, ga_hardware_collision_w },
4548 	{ 0x1f0000, 0x1f0003, ga_hardware_multiplier_w },
4549 	{ 0x1f1000, 0x1f1009, ga_hardware_collision_w },
4550 	{ 0x1f2000, 0x1f2003, MWA_EXTRAM },
4551 	{ 0x200000, 0x200fff, MWA_SPRITERAM },
4552 	{ 0xc40000, 0xc40fff, MWA_EXTRAM2 },
4553 	{ 0xffecfc, 0xffecfd, ga_sound_command_w },
4554 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
4555 	{-1}
4556 };
4557 /***************************************************************************/
4558 
goldnaxa_update_proc(void)4559 static void goldnaxa_update_proc( void ){
4560 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
4561 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
4562 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
4563 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
4564 
4565 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
4566 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
4567 	set_tile_bank( READ_WORD( &sys16_workingram[0x2c94] ) );
4568 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
4569 }
4570 
goldnaxa_init_machine(void)4571 static void goldnaxa_init_machine( void ){
4572 	static int bank[16] = { 0,2,8,10,16,18,0,0,4,6,12,14,20,22,0,0 };
4573 
4574 	sys16_obj_bank = bank;
4575 
4576 	patch_code( 0x3CA2, 0x60 );
4577 	patch_code( 0x3CA3, 0x1e );
4578 
4579 	sys16_sprxoffset = -0xb8;
4580 	sys16_update_proc = goldnaxa_update_proc;
4581 }
4582 
4583 /***************************************************************************/
4584 
4585 MACHINE_DRIVER_7759( machine_driver_goldnaxa, \
4586 	goldnaxa_readmem,goldnaxa_writemem,goldnaxa_init_machine, gfx2,upd7759_interface )
4587 
4588 /***************************************************************************/
4589 // sys16B
4590 ROM_START( hwchamp )
4591 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
4592 	ROM_LOAD_EVEN( "rom0-e.bin", 0x000000, 0x20000, 0xe5abfed7 )
4593 	ROM_LOAD_ODD ( "rom0-o.bin", 0x000000, 0x20000, 0x25180124 )
4594 
4595 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
4596 	ROM_LOAD( "scr01.bin", 0x00000, 0x20000, 0xfc586a86 )
4597 	ROM_LOAD( "scr11.bin", 0x20000, 0x20000, 0xaeaaa9d8 )
4598 	ROM_LOAD( "scr02.bin", 0x40000, 0x20000, 0x7715a742 )
4599 	ROM_LOAD( "scr12.bin", 0x60000, 0x20000, 0x63a82afa )
4600 	ROM_LOAD( "scr03.bin", 0x80000, 0x20000, 0xf30cd5fd )
4601 	ROM_LOAD( "scr13.bin", 0xA0000, 0x20000, 0x5b8494a8 )
4602 
4603 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
4604 	ROM_LOAD( "obj0-o.bin", 0x000000, 0x020000, 0xfc098a13 )
4605 	ROM_LOAD( "obj0-e.bin", 0x020000, 0x020000, 0x5db934a8 )
4606 	ROM_LOAD( "obj1-o.bin", 0x040000, 0x020000, 0x1f27ee74 )
4607 	ROM_LOAD( "obj1-e.bin", 0x060000, 0x020000, 0x8a6a5cf1 )
4608 	ROM_LOAD( "obj2-o.bin", 0x080000, 0x020000, 0xc0b2ba82 )
4609 	ROM_LOAD( "obj2-e.bin", 0x0a0000, 0x020000, 0xd6c7917b )
4610 	ROM_LOAD( "obj3-o.bin", 0x0c0000, 0x020000, 0x52fa3a49 )
4611 	ROM_LOAD( "obj3-e.bin", 0x0e0000, 0x020000, 0x57e8f9d2 )
4612 
4613 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
4614 	ROM_LOAD( "s-prog.bin", 0x0000, 0x8000, 0x96a12d9d )
4615 
4616 	ROM_LOAD( "speech0.bin", 0x10000, 0x20000, 0x4191c03d )
4617 	ROM_LOAD( "speech1.bin", 0x30000, 0x20000, 0xa4d53f7b )
4618 ROM_END
4619 
4620 /***************************************************************************/
4621 
4622 static int hwc_handles_shifts[3];
4623 
WRITE_HANDLER(hwc_io_handles_w)4624 static WRITE_HANDLER( hwc_io_handles_w )
4625 {
4626 	hwc_handles_shifts[offset/2]=7;
4627 }
4628 
READ_HANDLER(hwc_io_handles_r)4629 static READ_HANDLER( hwc_io_handles_r )
4630 {
4631 	static int dodge_toggle=0;
4632 	int data=0,ret;
4633 	if(offset==0)
4634 	{
4635 		// monitor
4636 		data=input_port_0_r( offset );
4637 		if(input_port_1_r( offset ) & 4)
4638 		{
4639 			if(dodge_toggle)
4640 				data=0x38;
4641 			else
4642 				data=0x60;
4643 		}
4644 		if(input_port_1_r( offset ) & 8)
4645 		{
4646 			if(dodge_toggle)
4647 				data=0xc8;
4648 			else
4649 				data=0xa0;
4650 		}
4651 		if(input_port_1_r( offset ) & 0x10)
4652 		{
4653 			if(dodge_toggle)
4654 				data=0xff;
4655 			else
4656 				data=0xe0;
4657 		}
4658 		if(input_port_1_r( offset ) & 0x20)
4659 		{
4660 			if(dodge_toggle)
4661 				data=0x0;
4662 			else
4663 				data=0x20;
4664 		}
4665 		if(hwc_handles_shifts[offset/2]==0)
4666 			dodge_toggle^=1;
4667 	}
4668 	else if(offset==2)
4669 	{
4670 		// left handle
4671 		if(input_port_1_r( offset ) & 1)
4672 			data=0xff;
4673 	}
4674 	else
4675 	{
4676 		// right handle
4677 		if(input_port_1_r( offset ) & 2)
4678 			data=0xff;
4679 	}
4680 	ret=data>>hwc_handles_shifts[offset/2];
4681 	hwc_handles_shifts[offset/2]--;
4682 	return ret;
4683 }
4684 
4685 static struct MemoryReadAddress hwchamp_readmem[] =
4686 {
4687 	{ 0x000000, 0x03ffff, MRA_ROM },
4688 	{ 0x3f0000, 0x3fffff, MRA_EXTRAM },
4689 	{ 0x400000, 0x40ffff, MRA_TILERAM },
4690 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
4691 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
4692 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
4693 	{ 0xc43020, 0xc43025, hwc_io_handles_r },
4694 	{ 0xc41000, 0xc41001, io_service_r },
4695 	{ 0xc42002, 0xc42003, io_dip1_r },
4696 	{ 0xc42000, 0xc42001, io_dip2_r },
4697 	{ 0xc40000, 0xc43fff, MRA_EXTRAM2 },
4698 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
4699 	{-1}
4700 };
4701 
4702 static struct MemoryWriteAddress hwchamp_writemem[] =
4703 {
4704 	{ 0x000000, 0x03ffff, MWA_ROM },
4705 	{ 0x3f0000, 0x3fffff, MWA_EXTRAM },
4706 	{ 0x400000, 0x40ffff, MWA_TILERAM },
4707 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
4708 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
4709 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
4710 	{ 0xc43020, 0xc43025, hwc_io_handles_w },
4711 	{ 0xc40000, 0xc43fff, MWA_EXTRAM2 },
4712 	{ 0xfe0006, 0xfe0007, sound_command_w },
4713 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
4714 	{-1}
4715 };
4716 /***************************************************************************/
4717 
hwchamp_update_proc(void)4718 static void hwchamp_update_proc( void ){
4719 	int leds;
4720 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
4721 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
4722 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
4723 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
4724 
4725 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
4726 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
4727 
4728 	sys16_tile_bank0 = READ_WORD( &sys16_extraram[0x0000] )&0xf;
4729 	sys16_tile_bank1 = READ_WORD( &sys16_extraram[0x0002] )&0xf;
4730 
4731 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
4732 
4733 	leds=READ_WORD( &sys16_extraram2[0x3034] );
4734 	if(leds & 0x20)
4735 		osd_led_w(0,1);
4736 	else
4737 		osd_led_w(0,0);
4738 	if(leds & 0x80)
4739 		osd_led_w(1,1);
4740 	else
4741 		osd_led_w(1,0);
4742 	if(leds & 0x40)
4743 		osd_led_w(2,1);
4744 	else
4745 		osd_led_w(2,0);
4746 
4747 }
4748 
hwchamp_init_machine(void)4749 static void hwchamp_init_machine( void ){
4750 	static int bank[16] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
4751 
4752 	sys16_obj_bank = bank;
4753 	sys16_spritelist_end=0xc000;
4754 
4755 	sys16_update_proc = hwchamp_update_proc;
4756 }
4757 
init_hwchamp(void)4758 static void init_hwchamp( void )
4759 {
4760 	sys16_onetime_init_machine();
4761 	sys16_sprite_decode( 4,0x040000 );
4762 }
4763 /***************************************************************************/
4764 
INPUT_PORTS_START(hwchamp)4765 INPUT_PORTS_START( hwchamp )
4766 
4767 PORT_START	/* Monitor */
4768 	PORT_ANALOG( 0xff, 0x80, IPT_PADDLE  , 70, 4, 0x0, 0xff )
4769 
4770 PORT_START	/* Handles (Fake) */
4771 	PORT_BITX(0x01, 0, IPT_BUTTON1, IP_NAME_DEFAULT, KEYCODE_F, IP_JOY_NONE ) // right hit
4772 	PORT_BITX(0x02, 0, IPT_BUTTON2, IP_NAME_DEFAULT, KEYCODE_D, IP_JOY_NONE ) // left hit
4773 	PORT_BITX(0x04, 0, IPT_BUTTON3, IP_NAME_DEFAULT, KEYCODE_B, IP_JOY_NONE ) // right dodge
4774 	PORT_BITX(0x08, 0, IPT_BUTTON4, IP_NAME_DEFAULT, KEYCODE_Z, IP_JOY_NONE ) // left dodge
4775 	PORT_BITX(0x10, 0, IPT_BUTTON5, IP_NAME_DEFAULT, KEYCODE_V, IP_JOY_NONE ) // right sway
4776 	PORT_BITX(0x20, 0, IPT_BUTTON6, IP_NAME_DEFAULT, KEYCODE_X, IP_JOY_NONE ) // left swat
4777 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
4778 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
4779 
4780 	SYS16_SERVICE
4781 	SYS16_COINAGE
4782 
4783 PORT_START	/* DSW1 */
4784 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )	// Not Used
4785 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
4786 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4787 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
4788 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
4789 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4790 	PORT_DIPNAME( 0x04, 0x00, "Start Level Select" )
4791 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
4792 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4793 	PORT_DIPNAME( 0x08, 0x08, "Continue Mode" )
4794 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
4795 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
4796 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
4797 	PORT_DIPSETTING(    0x20, "Easy" )
4798 	PORT_DIPSETTING(    0x30, "Normal" )
4799 	PORT_DIPSETTING(    0x10, "Hard" )
4800 	PORT_DIPSETTING(    0x00, "Hardest" )
4801 	PORT_DIPNAME( 0xc0, 0xc0, "Time Adjust"  )
4802 	PORT_DIPSETTING(    0x80, "Easy" )
4803 	PORT_DIPSETTING(    0xc0, "Normal" )
4804 	PORT_DIPSETTING(    0x40, "Hard" )
4805 	PORT_DIPSETTING(    0x00, "Hardest" )
4806 
4807 INPUT_PORTS_END
4808 
4809 /***************************************************************************/
4810 
4811 MACHINE_DRIVER_7759( machine_driver_hwchamp, \
4812 	hwchamp_readmem,hwchamp_writemem,hwchamp_init_machine, gfx4 ,upd7759_interface)
4813 
4814 /***************************************************************************/
4815 // pre16
4816 ROM_START( mjleague )
4817 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
4818 	ROM_LOAD_EVEN( "epr-7404.09b", 0x000000, 0x8000, 0xec1655b5 )
4819 	ROM_LOAD_ODD ( "epr-7401.06b", 0x000000, 0x8000, 0x2befa5e0 )
4820 	ROM_LOAD_EVEN( "epr-7405.10b", 0x010000, 0x8000, 0x7a4f4e38 )
4821 	ROM_LOAD_ODD ( "epr-7402.07b", 0x010000, 0x8000, 0xb7bef762 )
4822 	ROM_LOAD_EVEN( "epra7406.11b", 0x020000, 0x8000, 0xbb743639 )
4823 	ROM_LOAD_ODD ( "epra7403.08b", 0x020000, 0x8000, 0xd86250cf )	// Fails memory test. Bad rom?
4824 
4825 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
4826 	ROM_LOAD( "epr-7051.09a", 0x00000, 0x08000, 0x10ca255a )
4827 	ROM_RELOAD(               0x08000, 0x08000 )
4828 	ROM_LOAD( "epr-7052.10a", 0x10000, 0x08000, 0x2550db0e )
4829 	ROM_RELOAD(               0x18000, 0x08000 )
4830 	ROM_LOAD( "epr-7053.11a", 0x20000, 0x08000, 0x5bfea038 )
4831 	ROM_RELOAD(               0x28000, 0x08000 )
4832 
4833 	ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites */
4834 	ROM_LOAD( "epr-7055.05a", 0x000000, 0x008000, 0x1fb860bd )
4835 	ROM_LOAD( "epr-7059.02b", 0x008000, 0x008000, 0x3d14091d )
4836 	ROM_LOAD( "epr-7056.06a", 0x010000, 0x008000, 0xb35dd968 )
4837 	ROM_LOAD( "epr-7060.03b", 0x018000, 0x008000, 0x61bb3757 )
4838 	ROM_LOAD( "epr-7057.07a", 0x020000, 0x008000, 0x3e5a2b6f )
4839 	ROM_LOAD( "epr-7061.04b", 0x028000, 0x008000, 0xc808dad5 )
4840 	ROM_LOAD( "epr-7058.08a", 0x030000, 0x008000, 0xb543675f )
4841 	ROM_LOAD( "epr-7062.05b", 0x038000, 0x008000, 0x9168eb47 )
4842 //	ROM_LOAD( "epr-7055.05a", 0x040000, 0x008000, 0x1fb860bd ) loaded twice??
4843 //	ROM_LOAD( "epr-7059.02b", 0x048000, 0x008000, 0x3d14091d ) loaded twice??
4844 
4845 	ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
4846 	ROM_LOAD( "eprc7054.01b", 0x00000, 0x8000, 0x4443b744 )
4847 
4848 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
4849 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
4850 
4851 	ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
4852 	ROM_LOAD( "epr-7063.01a", 0x00000, 0x8000, 0x45d8908a )
4853 	ROM_LOAD( "epr-7065.02a", 0x08000, 0x8000, 0x8c8f8cff )
4854 	ROM_LOAD( "epr-7064.03a", 0x10000, 0x8000, 0x159f6636 )
4855 	ROM_LOAD( "epr-7066.04a", 0x18000, 0x8000, 0xf5cfa91f )
4856 ROM_END
4857 
4858 /***************************************************************************/
4859 
4860 static READ_HANDLER( mjl_io_player1_r )
4861 {
4862 	int data=input_port_0_r( offset ) & 0x80;
4863 
4864 	if(READ_WORD( &sys16_extraram2[2] ) & 0x4)
4865 		data|=(input_port_5_r( offset ) & 0x3f) << 1;
4866 	else
4867 		data|=(input_port_6_r( offset ) & 0x3f) << 1;
4868 
4869 	return data;
4870 }
4871 
READ_HANDLER(mjl_io_service_r)4872 static READ_HANDLER( mjl_io_service_r )
4873 {
4874 	int data=input_port_2_r( offset ) & 0x3f;
4875 
4876 	if(READ_WORD( &sys16_extraram2[2] ) & 0x4)
4877 	{
4878 		data|=(input_port_5_r( offset ) & 0x40);
4879 		data|=(input_port_7_r( offset ) & 0x40) << 1;
4880 	}
4881 	else
4882 	{
4883 		data|=(input_port_6_r( offset ) & 0x40);
4884 		data|=(input_port_8_r( offset ) & 0x40) << 1;
4885 	}
4886 
4887 	return data;
4888 }
4889 
READ_HANDLER(mjl_io_player2_r)4890 static READ_HANDLER( mjl_io_player2_r )
4891 {
4892 	int data=input_port_1_r( offset ) & 0x80;
4893 	if(READ_WORD( &sys16_extraram2[2] ) & 0x4)
4894 		data|=(input_port_7_r( offset ) & 0x3f) << 1;
4895 	else
4896 		data|=(input_port_8_r( offset ) & 0x3f) << 1;
4897 	return data;
4898 }
4899 
READ_HANDLER(mjl_io_bat_r)4900 static READ_HANDLER( mjl_io_bat_r )
4901 {
4902 	int data1=input_port_0_r( offset );
4903 	int data2=input_port_1_r( offset );
4904 	int ret=0;
4905 
4906 	// Hitting has 8 values, but for easy of playing, I've only added 3
4907 
4908 	if(data1 &1) ret=0x00;
4909 	else if(data1 &2) ret=0x03;
4910 	else if(data1 &4) ret=0x07;
4911 	else ret=0x0f;
4912 
4913 	if(data2 &1) ret|=0x00;
4914 	else if(data2 &2) ret|=0x30;
4915 	else if(data2 &4) ret|=0x70;
4916 	else ret|=0xf0;
4917 
4918 	return ret;
4919 
4920 }
4921 
4922 static struct MemoryReadAddress mjleague_readmem[] =
4923 {
4924 	{ 0x000000, 0x02ffff, MRA_ROM },
4925 	{ 0x400000, 0x40ffff, MRA_TILERAM },
4926 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
4927 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
4928 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
4929 
4930 	{ 0xc40002, 0xc40007, MRA_EXTRAM2},
4931 	{ 0xc41000, 0xc41001, mjl_io_service_r },
4932 	{ 0xc41002, 0xc41003, mjl_io_player1_r },
4933 	{ 0xc41006, 0xc41007, mjl_io_player2_r },
4934 	{ 0xc41004, 0xc41005, mjl_io_bat_r },
4935 	{ 0xc42000, 0xc42001, io_dip1_r },
4936 	{ 0xc42002, 0xc42003, io_dip2_r },
4937 	{ 0xc60000, 0xc60001, MRA_NOP }, /* What is this? Watchdog? */
4938 
4939 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
4940 	{-1}
4941 };
4942 
4943 static struct MemoryWriteAddress mjleague_writemem[] =
4944 {
4945 	{ 0x000000, 0x02ffff, MWA_ROM },
4946 	{ 0x400000, 0x40ffff, MWA_TILERAM },
4947 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
4948 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
4949 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
4950 	{ 0xc40000, 0xc40001, sound_command_nmi_w },
4951 	{ 0xc40002, 0xc40007, MWA_EXTRAM2},
4952 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
4953 	{-1}
4954 };
4955 /***************************************************************************/
4956 
mjleague_update_proc(void)4957 static void mjleague_update_proc( void ){
4958 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
4959 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
4960 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
4961 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
4962 
4963 	set_fg_page1( READ_WORD( &sys16_textram[0x0e8e] ) );
4964 	set_bg_page1( READ_WORD( &sys16_textram[0x0e8c] ) );
4965 
4966 	set_refresh_3d( READ_WORD( &sys16_extraram2[0] ) );
4967 }
4968 
mjleague_init_machine(void)4969 static void mjleague_init_machine( void ){
4970 	static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
4971 
4972 	sys16_obj_bank = bank;
4973 	sys16_textmode=1;
4974 	sys16_spritesystem = 2;
4975 	sys16_sprxoffset = -0xbd;
4976 	sys16_fgxoffset = sys16_bgxoffset = 7;
4977 
4978 	// remove memory test because it fails.
4979 	patch_code( 0xBD42, 0x66 );
4980 
4981 	sys16_update_proc = mjleague_update_proc;
4982 }
4983 
init_mjleague(void)4984 static void init_mjleague( void )
4985 {
4986 	sys16_onetime_init_machine();
4987 	sys16_sprite_decode( 5,0x010000 );
4988 }
4989 
4990 /***************************************************************************/
4991 
INPUT_PORTS_START(mjleague)4992 INPUT_PORTS_START( mjleague )
4993 
4994 PORT_START /* player 1 button fake */
4995 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
4996 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 )
4997 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 )
4998 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 )
4999 
5000 PORT_START /* player 1 button fake */
5001 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
5002 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_PLAYER2 )
5003 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 | IPF_PLAYER2 )
5004 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 | IPF_PLAYER2 )
5005 
5006 PORT_START  /* Service */
5007 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
5008 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
5009 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
5010 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
5011 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
5012 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
5013 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
5014 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
5015 
5016 	SYS16_COINAGE
5017 
5018 PORT_START	/* DSW1 */
5019 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
5020 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
5021 	PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
5022 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
5023 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
5024 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
5025 	PORT_DIPNAME( 0x0c, 0x00, "Starting Points" )
5026 	PORT_DIPSETTING(    0x0c, "2000" )
5027 	PORT_DIPSETTING(    0x08, "3000" )
5028 	PORT_DIPSETTING(    0x04, "5000" )
5029 	PORT_DIPSETTING(    0x00, "10000" )
5030 	PORT_DIPNAME( 0x10, 0x10, "Team Select" )
5031 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
5032 	PORT_DIPSETTING(    0x10, DEF_STR( On ) )
5033 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )	//??? something to do with cocktail mode?
5034 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
5035 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
5036 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
5037 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
5038 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
5039 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
5040 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
5041 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
5042 
5043 PORT_START	/* IN5 */
5044 	PORT_ANALOG( 0x7f, 0x40, IPT_TRACKBALL_Y, 70, 30, 0, 127 )
5045 
5046 PORT_START	/* IN6 */
5047 	PORT_ANALOG( 0x7f, 0x40, IPT_TRACKBALL_X /*| IPF_REVERSE*/, 50, 30, 0, 127 )
5048 
5049 PORT_START	/* IN7 */
5050 	PORT_ANALOG( 0x7f, 0x40, IPT_TRACKBALL_Y | IPF_PLAYER2, 70, 30, 0, 127 )
5051 
5052 PORT_START	/* IN8 */
5053 	PORT_ANALOG( 0x7f, 0x40, IPT_TRACKBALL_X | IPF_PLAYER2 | IPF_REVERSE, 50, 30, 0, 127 )
5054 
5055 INPUT_PORTS_END
5056 
5057 /***************************************************************************/
5058 
5059 MACHINE_DRIVER_7751( machine_driver_mjleague, \
5060 	mjleague_readmem,mjleague_writemem,mjleague_init_machine, gfx1)
5061 
5062 /***************************************************************************/
5063 // sys18
5064 ROM_START( moonwalk )
5065 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
5066 // custom cpu 317-0159
5067 	ROM_LOAD_EVEN( "epr13235.a6", 0x000000, 0x40000, 0x6983e129 )
5068 	ROM_LOAD_ODD ( "epr13234.a5", 0x000000, 0x40000, 0xc9fd20f2 )
5069 
5070 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
5071 	ROM_LOAD( "mpr13216.b1", 0x00000, 0x40000, 0x862d2c03 )
5072 	ROM_LOAD( "mpr13217.b2", 0x40000, 0x40000, 0x7d1ac3ec )
5073 	ROM_LOAD( "mpr13218.b3", 0x80000, 0x40000, 0x56d3393c )
5074 
5075 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
5076 	ROM_LOAD( "mpr13224.b11", 0x000000, 0x40000, 0xc59f107b )
5077 	ROM_LOAD( "mpr13231.a11", 0x040000, 0x40000, 0xa5e96346 )
5078 	ROM_LOAD( "mpr13223.b10", 0x080000, 0x40000, 0x364f60ff )
5079 	ROM_LOAD( "mpr13230.a10", 0x0c0000, 0x40000, 0x9550091f )
5080 	ROM_LOAD( "mpr13222.b9",  0x100000, 0x40000, 0x523df3ed )
5081 	ROM_LOAD( "mpr13229.a9",  0x140000, 0x40000, 0xf40dc45d )
5082 	ROM_LOAD( "epr13221.b8",  0x180000, 0x40000, 0x9ae7546a )
5083 	ROM_LOAD( "epr13228.a8",  0x1c0000, 0x40000, 0xde3786be )
5084 
5085 	ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
5086 	ROM_LOAD( "epr13225.a4", 0x10000, 0x20000, 0x56c2e82b )
5087 	ROM_LOAD( "mpr13219.b4", 0x30000, 0x40000, 0x19e2061f )
5088 	ROM_LOAD( "mpr13220.b5", 0x70000, 0x40000, 0x58d4d9ce )
5089 	ROM_LOAD( "mpr13249.b6", 0xb0000, 0x40000, 0x623edc5d )
5090 ROM_END
5091 
5092 ROM_START( moonwlka )
5093 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
5094 // custom cpu 317-0158
5095 	ROM_LOAD_EVEN( "epr13233", 0x000000, 0x40000, 0xf3dac671 )
5096 	ROM_LOAD_ODD ( "epr13232", 0x000000, 0x40000, 0x541d8bdf )
5097 
5098 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
5099 	ROM_LOAD( "mpr13216.b1", 0x00000, 0x40000, 0x862d2c03 )
5100 	ROM_LOAD( "mpr13217.b2", 0x40000, 0x40000, 0x7d1ac3ec )
5101 	ROM_LOAD( "mpr13218.b3", 0x80000, 0x40000, 0x56d3393c )
5102 
5103 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
5104 	ROM_LOAD( "mpr13224.b11", 0x000000, 0x40000, 0xc59f107b )
5105 	ROM_LOAD( "mpr13231.a11", 0x040000, 0x40000, 0xa5e96346 )
5106 	ROM_LOAD( "mpr13223.b10", 0x080000, 0x40000, 0x364f60ff )
5107 	ROM_LOAD( "mpr13230.a10", 0x0c0000, 0x40000, 0x9550091f )
5108 	ROM_LOAD( "mpr13222.b9",  0x100000, 0x40000, 0x523df3ed )
5109 	ROM_LOAD( "mpr13229.a9",  0x140000, 0x40000, 0xf40dc45d )
5110 	ROM_LOAD( "epr13221.b8",  0x180000, 0x40000, 0x9ae7546a )
5111 	ROM_LOAD( "epr13228.a8",  0x1c0000, 0x40000, 0xde3786be )
5112 
5113 	ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
5114 	ROM_LOAD( "epr13225.a4", 0x10000, 0x20000, 0x56c2e82b )
5115 	ROM_LOAD( "mpr13219.b4", 0x30000, 0x40000, 0x19e2061f )
5116 	ROM_LOAD( "mpr13220.b5", 0x70000, 0x40000, 0x58d4d9ce )
5117 	ROM_LOAD( "mpr13249.b6", 0xb0000, 0x40000, 0x623edc5d )
5118 ROM_END
5119 
5120 // sys18
5121 ROM_START( moonwlkb )
5122 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
5123 	ROM_LOAD_EVEN( "moonwlkb.01", 0x000000, 0x10000, 0xf49cdb16 )
5124 	ROM_LOAD_ODD ( "moonwlkb.05", 0x000000, 0x10000, 0xc483f29f )
5125 	ROM_LOAD_EVEN( "moonwlkb.02", 0x020000, 0x10000, 0x0bde1896 )
5126 	ROM_LOAD_ODD ( "moonwlkb.06", 0x020000, 0x10000, 0x5b9fc688 )
5127 	ROM_LOAD_EVEN( "moonwlkb.03", 0x040000, 0x10000, 0x0c5fe15c )
5128 	ROM_LOAD_ODD ( "moonwlkb.07", 0x040000, 0x10000, 0x9e600704 )
5129 	ROM_LOAD_EVEN( "moonwlkb.04", 0x060000, 0x10000, 0x64692f79 )
5130 	ROM_LOAD_ODD ( "moonwlkb.08", 0x060000, 0x10000, 0x546ca530 )
5131 
5132 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
5133 	ROM_LOAD( "mpr13216.b1", 0x00000, 0x40000, 0x862d2c03 )
5134 	ROM_LOAD( "mpr13217.b2", 0x40000, 0x40000, 0x7d1ac3ec )
5135 	ROM_LOAD( "mpr13218.b3", 0x80000, 0x40000, 0x56d3393c )
5136 
5137 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
5138 	ROM_LOAD( "mpr13224.b11", 0x000000, 0x40000, 0xc59f107b )
5139 	ROM_LOAD( "mpr13231.a11", 0x040000, 0x40000, 0xa5e96346 )
5140 	ROM_LOAD( "mpr13223.b10", 0x080000, 0x40000, 0x364f60ff )
5141 	ROM_LOAD( "mpr13230.a10", 0x0c0000, 0x40000, 0x9550091f )
5142 	ROM_LOAD( "mpr13222.b9",  0x100000, 0x40000, 0x523df3ed )
5143 	ROM_LOAD( "mpr13229.a9",  0x140000, 0x40000, 0xf40dc45d )
5144 	ROM_LOAD( "epr13221.b8",  0x180000, 0x40000, 0x9ae7546a )
5145 	ROM_LOAD( "epr13228.a8",  0x1c0000, 0x40000, 0xde3786be )
5146 
5147 	ROM_REGION( 0x100000, REGION_CPU2 ) /* sound CPU */
5148 	ROM_LOAD( "epr13225.a4", 0x10000, 0x20000, 0x56c2e82b )
5149 	ROM_LOAD( "mpr13219.b4", 0x30000, 0x40000, 0x19e2061f )
5150 	ROM_LOAD( "mpr13220.b5", 0x70000, 0x40000, 0x58d4d9ce )
5151 	ROM_LOAD( "mpr13249.b6", 0xb0000, 0x40000, 0x623edc5d )
5152 ROM_END
5153 
5154 /***************************************************************************/
5155 
5156 static READ_HANDLER( moonwlkb_skip_r )
5157 {
5158 	if (cpu_get_pc()==0x308a) {cpu_spinuntil_int(); return 0xffff;}
5159 
5160 	return READ_WORD(&sys16_workingram[0x202c]);
5161 }
5162 
5163 static struct MemoryReadAddress moonwalk_readmem[] =
5164 {
5165 	{ 0x000000, 0x07ffff, MRA_ROM },
5166 
5167 	{ 0x400000, 0x40ffff, MRA_TILERAM },
5168 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
5169 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
5170 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
5171 	{ 0xc00000, 0xc0ffff, MRA_EXTRAM },
5172 	{ 0xc40000, 0xc40001, io_dip1_r },
5173 	{ 0xc40002, 0xc40003, io_dip2_r },
5174 	{ 0xc41002, 0xc41003, io_player1_r },
5175 	{ 0xc41004, 0xc41005, io_player2_r },
5176 	{ 0xc41006, 0xc41007, io_player3_r },
5177 	{ 0xc41000, 0xc41001, io_service_r },
5178 	{ 0xc40000, 0xc4ffff, MRA_EXTRAM3 },
5179 	{ 0xe40000, 0xe4ffff, MRA_EXTRAM2 },
5180 	{ 0xfe0000, 0xfeffff, MRA_EXTRAM4 },
5181 	{ 0xffe02c, 0xffe02d, moonwlkb_skip_r },
5182 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
5183 	{-1}
5184 };
5185 
5186 static struct MemoryWriteAddress moonwalk_writemem[] =
5187 {
5188 	{ 0x000000, 0x07ffff, MWA_ROM },
5189 	{ 0x400000, 0x40ffff, MWA_TILERAM },
5190 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
5191 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
5192 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
5193 	{ 0xc00000, 0xc0ffff, MWA_EXTRAM },
5194 	{ 0xc40006, 0xc40007, sound_command_nmi_w },
5195 	{ 0xc40000, 0xc4ffff, MWA_EXTRAM3 },
5196 	{ 0xe40000, 0xe4ffff, MWA_EXTRAM2 },
5197 	{ 0xfe0000, 0xfeffff, MWA_EXTRAM4 },
5198 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
5199 	{-1}
5200 };
5201 /***************************************************************************/
5202 
moonwalk_update_proc(void)5203 static void moonwalk_update_proc( void ){
5204 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
5205 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
5206 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
5207 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
5208 
5209 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
5210 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
5211 
5212 	sys16_fg2_scrollx = READ_WORD( &sys16_textram[0x0e9c] );
5213 	sys16_bg2_scrollx = READ_WORD( &sys16_textram[0x0e9e] );
5214 	sys16_fg2_scrolly = READ_WORD( &sys16_textram[0x0e94] );
5215 	sys16_bg2_scrolly = READ_WORD( &sys16_textram[0x0e96] );
5216 
5217 	set_fg2_page( READ_WORD( &sys16_textram[0x0e84] ) );
5218 	set_bg2_page( READ_WORD( &sys16_textram[0x0e86] ) );
5219 
5220 	if(sys16_fg2_scrollx | sys16_fg2_scrolly | READ_WORD( &sys16_textram[0x0e84] ))
5221 		sys18_fg2_active=1;
5222 	else
5223 		sys18_fg2_active=0;
5224 	if(sys16_bg2_scrollx | sys16_bg2_scrolly | READ_WORD( &sys16_textram[0x0e86] ))
5225 		sys18_bg2_active=1;
5226 	else
5227 		sys18_bg2_active=0;
5228 
5229 	set_tile_bank18( READ_WORD( &sys16_extraram3[0x6800] ) );
5230 	set_refresh_18( READ_WORD( &sys16_extraram3[0x6600] ) ); // 0xc46601
5231 }
5232 
moonwalk_init_machine(void)5233 static void moonwalk_init_machine( void ){
5234 	static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
5235 	sys16_obj_bank = bank;
5236 	sys16_bg_priority_value=0x1000;
5237 	sys16_sprxoffset = -0x238;
5238 	sys16_spritelist_end=0x8000;
5239 
5240 	patch_code( 0x70116, 0x4e);
5241 	patch_code( 0x70117, 0x71);
5242 
5243 	patch_code( 0x314a, 0x46);
5244 	patch_code( 0x314b, 0x42);
5245 
5246 	patch_code( 0x311b, 0x3f);
5247 
5248 	patch_code( 0x70103, 0x00);
5249 	patch_code( 0x70109, 0x00);
5250 	patch_code( 0x07727, 0x00);
5251 	patch_code( 0x07729, 0x00);
5252 	patch_code( 0x0780d, 0x00);
5253 	patch_code( 0x0780f, 0x00);
5254 	patch_code( 0x07861, 0x00);
5255 	patch_code( 0x07863, 0x00);
5256 	patch_code( 0x07d47, 0x00);
5257 	patch_code( 0x07863, 0x00);
5258 	patch_code( 0x08533, 0x00);
5259 	patch_code( 0x08535, 0x00);
5260 	patch_code( 0x085bd, 0x00);
5261 	patch_code( 0x085bf, 0x00);
5262 	patch_code( 0x09a4b, 0x00);
5263 	patch_code( 0x09a4d, 0x00);
5264 	patch_code( 0x09b2f, 0x00);
5265 	patch_code( 0x09b31, 0x00);
5266 	patch_code( 0x0a05b, 0x00);
5267 	patch_code( 0x0a05d, 0x00);
5268 	patch_code( 0x0a23f, 0x00);
5269 	patch_code( 0x0a241, 0x00);
5270 	patch_code( 0x10159, 0x00);
5271 	patch_code( 0x1015b, 0x00);
5272 	patch_code( 0x109fb, 0x00);
5273 	patch_code( 0x109fd, 0x00);
5274 
5275 	// * SEGA mark
5276 	patch_code( 0x70212, 0x4e);
5277 	patch_code( 0x70213, 0x71);
5278 
5279 	sys16_update_proc = moonwalk_update_proc;
5280 }
5281 
init_moonwalk(void)5282 static void init_moonwalk( void ){
5283 	unsigned char *RAM= memory_region(REGION_CPU2);
5284 	sys16_onetime_init_machine();
5285 	sys18_splittab_fg_x=&sys16_textram[0x0f80];
5286 	sys18_splittab_bg_x=&sys16_textram[0x0fc0];
5287 
5288 	memcpy(RAM,&RAM[0x10000],0xa000);
5289 
5290 	sys16_sprite_decode( 4,0x080000 );
5291 }
5292 
5293 /***************************************************************************/
5294 
5295 INPUT_PORTS_START( moonwalk )
5296 
5297 PORT_START /* player 1 */
5298 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
5299 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
5300 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
5301 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
5302 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
5303 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
5304 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
5305 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
5306 
5307 PORT_START /* player 2 */
5308 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
5309 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
5310 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
5311 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
5312 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
5313 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
5314 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
5315 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
5316 
5317 PORT_START /* service */
5318 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
5319 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
5320 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
5321 	PORT_BITX(0x08, 0x08, IPT_TILT, "Test", KEYCODE_T, IP_JOY_NONE )
5322 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
5323 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
5324 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
5325 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
5326 
5327 	SYS16_COINAGE
5328 
5329 PORT_START	/* DSW1 */
5330 	PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
5331 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
5332 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
5333 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
5334 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
5335 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
5336 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )
5337 	PORT_DIPSETTING(    0x04, "2" )
5338 	PORT_DIPSETTING(    0x00, "3" )
5339 	PORT_DIPNAME( 0x08, 0x08, "Player Vitality" )
5340 	PORT_DIPSETTING(    0x08, "Low" )
5341 	PORT_DIPSETTING(    0x00, "High" )
5342 	PORT_DIPNAME( 0x10, 0x00, "Play Mode" )
5343 	PORT_DIPSETTING(    0x10, "2 Players" )
5344 	PORT_DIPSETTING(    0x00, "3 Players" )
5345 	PORT_DIPNAME( 0x20, 0x20, "Coin Mode" )
5346 	PORT_DIPSETTING(    0x20, "Common" )
5347 	PORT_DIPSETTING(    0x00, "Individual" )
5348 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
5349 	PORT_DIPSETTING(    0x80, "Easy" )
5350 	PORT_DIPSETTING(    0xc0, "Normal" )
5351 	PORT_DIPSETTING(    0x40, "Hard" )
5352 	PORT_DIPSETTING(    0x00, "Hardest" )
5353 
5354 PORT_START /* player 3 */
5355 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
5356 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
5357 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
5358 //	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
5359 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 )
5360 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3 )
5361 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER3 )
5362 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
5363 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER3 )
5364 INPUT_PORTS_END
5365 
5366 /***************************************************************************/
5367 
5368 MACHINE_DRIVER_18( machine_driver_moonwalk, \
5369 	moonwalk_readmem,moonwalk_writemem,moonwalk_init_machine, gfx4 )
5370 
5371 /***************************************************************************/
5372 // sys16B
5373 ROM_START( passsht )
5374 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
5375 	ROM_LOAD_EVEN( "epr11871.a4", 0x000000, 0x10000, 0x0f9ccea5 )
5376 	ROM_LOAD_ODD ( "epr11870.a1", 0x000000, 0x10000, 0xdf43ebcf )
5377 
5378 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
5379 	ROM_LOAD( "opr11854.b9",  0x00000, 0x10000, 0xd31c0b6c )
5380 	ROM_LOAD( "opr11855.b10", 0x10000, 0x10000, 0xb78762b4 )
5381 	ROM_LOAD( "opr11856.b11", 0x20000, 0x10000, 0xea49f666 )
5382 
5383 	ROM_REGION( 0x60000*2, REGION_GFX2 ) /* sprites */
5384 	ROM_LOAD( "opr11862.b1",  0x00000, 0x10000, 0xb6e94727 )
5385 	ROM_LOAD( "opr11865.b5",  0x10000, 0x10000, 0x17e8d5d5 )
5386 	ROM_LOAD( "opr11863.b2",  0x20000, 0x10000, 0x3e670098 )
5387 	ROM_LOAD( "opr11866.b6",  0x30000, 0x10000, 0x50eb71cc )
5388 	ROM_LOAD( "opr11864.b3",  0x40000, 0x10000, 0x05733ca8 )
5389 	ROM_LOAD( "opr11867.b7",  0x50000, 0x10000, 0x81e49697 )
5390 
5391 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
5392 	ROM_LOAD( "epr11857.a7",  0x00000, 0x08000, 0x789edc06 )
5393 	ROM_LOAD( "epr11858.a8",  0x10000, 0x08000, 0x08ab0018 )
5394 	ROM_LOAD( "epr11859.a9",  0x18000, 0x08000, 0x8673e01b )
5395 	ROM_LOAD( "epr11860.a10", 0x20000, 0x08000, 0x10263746 )
5396 	ROM_LOAD( "epr11861.a11", 0x28000, 0x08000, 0x38b54a71 )
5397 ROM_END
5398 
5399 ROM_START( passht4b )
5400 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
5401 	ROM_LOAD_EVEN( "pas4p.3", 0x000000, 0x10000, 0x2d8bc946 )
5402 	ROM_LOAD_ODD ( "pas4p.4", 0x000000, 0x10000, 0xe759e831 )
5403 
5404 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
5405 	ROM_LOAD( "pas4p.11",  0x00000, 0x10000, 0xda20fbc9 )
5406 	ROM_LOAD( "pas4p.12", 0x10000, 0x10000, 0xbebb9211 )
5407 	ROM_LOAD( "pas4p.13", 0x20000, 0x10000, 0xe37506c3 )
5408 
5409 	ROM_REGION( 0x60000*2, REGION_GFX2 ) /* sprites */
5410 	ROM_LOAD( "opr11862.b1",  0x00000, 0x10000, 0xb6e94727 )
5411 	ROM_LOAD( "opr11865.b5",  0x10000, 0x10000, 0x17e8d5d5 )
5412 	ROM_LOAD( "opr11863.b2",  0x20000, 0x10000, 0x3e670098 )
5413 	ROM_LOAD( "opr11866.b6",  0x30000, 0x10000, 0x50eb71cc )
5414 	ROM_LOAD( "opr11864.b3",  0x40000, 0x10000, 0x05733ca8 )
5415 	ROM_LOAD( "opr11867.b7",  0x50000, 0x10000, 0x81e49697 )
5416 
5417 	ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
5418 	ROM_LOAD( "pas4p.1",  0x00000, 0x08000, 0xe60fb017 )
5419 	ROM_LOAD( "pas4p.2",  0x10000, 0x10000, 0x092e016e )
5420 ROM_END
5421 
5422 ROM_START( passshtb )
5423 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
5424 	ROM_LOAD_EVEN( "pass3_2p.bin", 0x000000, 0x10000, 0x26bb9299 )
5425 	ROM_LOAD_ODD ( "pass4_2p.bin", 0x000000, 0x10000, 0x06ac6d5d )
5426 
5427 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
5428 	ROM_LOAD( "opr11854.b9",  0x00000, 0x10000, 0xd31c0b6c )
5429 	ROM_LOAD( "opr11855.b10", 0x10000, 0x10000, 0xb78762b4 )
5430 	ROM_LOAD( "opr11856.b11", 0x20000, 0x10000, 0xea49f666 )
5431 
5432 	ROM_REGION( 0x60000*2, REGION_GFX2 ) /* sprites */
5433 	ROM_LOAD( "opr11862.b1",  0x00000, 0x10000, 0xb6e94727 )
5434 	ROM_LOAD( "opr11865.b5",  0x10000, 0x10000, 0x17e8d5d5 )
5435 	ROM_LOAD( "opr11863.b2",  0x20000, 0x10000, 0x3e670098 )
5436 	ROM_LOAD( "opr11866.b6",  0x30000, 0x10000, 0x50eb71cc )
5437 	ROM_LOAD( "opr11864.b3",  0x40000, 0x10000, 0x05733ca8 )
5438 	ROM_LOAD( "opr11867.b7",  0x50000, 0x10000, 0x81e49697 )
5439 
5440 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
5441 	ROM_LOAD( "epr11857.a7",  0x00000, 0x08000, 0x789edc06 )
5442 	ROM_LOAD( "epr11858.a8",  0x10000, 0x08000, 0x08ab0018 )
5443 	ROM_LOAD( "epr11859.a9",  0x18000, 0x08000, 0x8673e01b )
5444 	ROM_LOAD( "epr11860.a10", 0x20000, 0x08000, 0x10263746 )
5445 	ROM_LOAD( "epr11861.a11", 0x28000, 0x08000, 0x38b54a71 )
5446 ROM_END
5447 /***************************************************************************/
5448 
5449 static struct MemoryReadAddress passsht_readmem[] =
5450 {
5451 	{ 0x000000, 0x01ffff, MRA_ROM },
5452 	{ 0x400000, 0x40ffff, MRA_TILERAM },
5453 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
5454 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
5455 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
5456 	{ 0xc41002, 0xc41003, io_player1_r },
5457 	{ 0xc41004, 0xc41005, io_player2_r },
5458 	{ 0xc41000, 0xc41001, io_service_r },
5459 	{ 0xc42002, 0xc42003, io_dip1_r },
5460 	{ 0xc42000, 0xc42001, io_dip2_r },
5461 	{ 0xc40000, 0xc40fff, MRA_EXTRAM },
5462 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
5463 	{-1}
5464 };
5465 
5466 static struct MemoryWriteAddress passsht_writemem[] =
5467 {
5468 	{ 0x000000, 0x01ffff, MWA_ROM },
5469 	{ 0x400000, 0x40ffff, MWA_TILERAM },
5470 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
5471 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
5472 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
5473 	{ 0xc42006, 0xc42007, sound_command_w },
5474 	{ 0xc40000, 0xc40fff, MWA_EXTRAM },
5475 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
5476 	{-1}
5477 };
5478 
5479 static int passht4b_io1_val;
5480 static int passht4b_io2_val;
5481 static int passht4b_io3_val;
5482 
READ_HANDLER(passht4b_service_r)5483 static READ_HANDLER( passht4b_service_r )
5484 {
5485 	int val=io_service_r(offset);
5486 
5487 	if(!(io_player1_r(offset) & 0x40)) val&=0xef;
5488 	if(!(io_player2_r(offset) & 0x40)) val&=0xdf;
5489 	if(!(io_player3_r(offset) & 0x40)) val&=0xbf;
5490 	if(!(io_player4_r(offset) & 0x40)) val&=0x7f;
5491 
5492 	passht4b_io3_val=(io_player1_r(offset)<<4) | (io_player3_r(offset)&0xf);
5493 	passht4b_io2_val=(io_player2_r(offset)<<4) | (io_player4_r(offset)&0xf);
5494 
5495 	passht4b_io1_val=0xff;
5496 
5497 	// player 1 buttons
5498 	if(!(io_player1_r(offset) & 0x10)) passht4b_io1_val &=0xfe;
5499 	if(!(io_player1_r(offset) & 0x20)) passht4b_io1_val &=0xfd;
5500 	if(!(io_player1_r(offset) & 0x80)) passht4b_io1_val &=0xfc;
5501 
5502 	// player 2 buttons
5503 	if(!(io_player2_r(offset) & 0x10)) passht4b_io1_val &=0xfb;
5504 	if(!(io_player2_r(offset) & 0x20)) passht4b_io1_val &=0xf7;
5505 	if(!(io_player2_r(offset) & 0x80)) passht4b_io1_val &=0xf3;
5506 
5507 	// player 3 buttons
5508 	if(!(io_player3_r(offset) & 0x10)) passht4b_io1_val &=0xef;
5509 	if(!(io_player3_r(offset) & 0x20)) passht4b_io1_val &=0xdf;
5510 	if(!(io_player3_r(offset) & 0x80)) passht4b_io1_val &=0xcf;
5511 
5512 	// player 4 buttons
5513 	if(!(io_player4_r(offset) & 0x10)) passht4b_io1_val &=0xbf;
5514 	if(!(io_player4_r(offset) & 0x20)) passht4b_io1_val &=0x7f;
5515 	if(!(io_player4_r(offset) & 0x80)) passht4b_io1_val &=0x3f;
5516 
5517 	return val;
5518 }
5519 
READ_HANDLER(passht4b_io1_r)5520 static READ_HANDLER( passht4b_io1_r ) {	return passht4b_io1_val;}
READ_HANDLER(passht4b_io2_r)5521 static READ_HANDLER( passht4b_io2_r ) {	return passht4b_io2_val;}
READ_HANDLER(passht4b_io3_r)5522 static READ_HANDLER( passht4b_io3_r ) {	return passht4b_io3_val;}
5523 
5524 static struct MemoryReadAddress passht4b_readmem[] =
5525 {
5526 	{ 0x000000, 0x01ffff, MRA_ROM },
5527 	{ 0x400000, 0x40ffff, MRA_TILERAM },
5528 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
5529 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
5530 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
5531 	{ 0xc41000, 0xc41001, passht4b_service_r },
5532 
5533 	{ 0xc41002, 0xc41003, passht4b_io1_r },
5534 	{ 0xc41004, 0xc41005, passht4b_io2_r },
5535 	{ 0xc41006, 0xc41007, passht4b_io3_r },
5536 
5537 	{ 0xc42002, 0xc42003, io_dip1_r },
5538 	{ 0xc42000, 0xc42001, io_dip2_r },
5539 	{ 0xc43000, 0xc43001, io_player1_r },		// test mode only
5540 	{ 0xc43002, 0xc43003, io_player2_r },
5541 	{ 0xc43004, 0xc43005, io_player3_r },
5542 	{ 0xc43006, 0xc43007, io_player4_r },
5543 	{ 0xc4600a, 0xc4600b, MRA_EXTRAM },
5544 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
5545 	{-1}
5546 };
5547 
5548 static struct MemoryWriteAddress passht4b_writemem[] =
5549 {
5550 	{ 0x000000, 0x01ffff, MWA_ROM },
5551 	{ 0x400000, 0x40ffff, MWA_TILERAM },
5552 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
5553 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
5554 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
5555 	{ 0xc42006, 0xc42007, sound_command_w },
5556 	{ 0xc4600a, 0xc4600b, MWA_EXTRAM },
5557 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
5558 	{-1}
5559 };
5560 
5561 /***************************************************************************/
5562 
passsht_update_proc(void)5563 static void passsht_update_proc( void ){
5564 	sys16_fg_scrollx = READ_WORD( &sys16_workingram[0x34be] );
5565 	sys16_bg_scrollx = READ_WORD( &sys16_workingram[0x34c2] );
5566 	sys16_fg_scrolly = READ_WORD( &sys16_workingram[0x34bc] );
5567 	sys16_bg_scrolly = READ_WORD( &sys16_workingram[0x34c0] );
5568 
5569 	set_fg_page( READ_WORD( &sys16_textram[0x0ff6] ) );
5570 	set_bg_page( READ_WORD( &sys16_textram[0x0ff4] ) );
5571 	set_refresh( READ_WORD( &sys16_extraram[0] ) );
5572 }
5573 
passht4b_update_proc(void)5574 static void passht4b_update_proc( void ){
5575 	sys16_fg_scrollx = READ_WORD( &sys16_workingram[0x34ce] );
5576 	sys16_bg_scrollx = READ_WORD( &sys16_workingram[0x34d2] );
5577 	sys16_fg_scrolly = READ_WORD( &sys16_workingram[0x34cc] );
5578 	sys16_bg_scrolly = READ_WORD( &sys16_workingram[0x34d0] );
5579 
5580 	set_fg_page( READ_WORD( &sys16_textram[0x0ff6] ) );
5581 	set_bg_page( READ_WORD( &sys16_textram[0x0ff4] ) );
5582 	set_refresh( READ_WORD( &sys16_extraram[0] ) );
5583 
5584 }
5585 
passsht_init_machine(void)5586 static void passsht_init_machine( void ){
5587 	static int bank[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,3 };
5588 	sys16_obj_bank = bank;
5589 
5590 	sys16_sprxoffset = -0x48;
5591 	sys16_spritesystem = 0;
5592 
5593 	// fix name entry
5594 	patch_code( 0x13a8,0xc0);
5595 
5596 	sys16_update_proc = passsht_update_proc;
5597 }
5598 
passht4b_init_machine(void)5599 static void passht4b_init_machine( void ){
5600 	static int bank[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,3 };
5601 	sys16_obj_bank = bank;
5602 
5603 	sys16_sprxoffset = -0xb8;
5604 	sys16_spritesystem = 8;
5605 
5606 	// fix name entry
5607 	patch_code( 0x138a,0xc0);
5608 
5609 	sys16_update_proc = passht4b_update_proc;
5610 }
5611 
init_passsht(void)5612 static void init_passsht( void )
5613 {
5614 	sys16_onetime_init_machine();
5615 	sys16_sprite_decode( 3,0x20000 );
5616 }
5617 
init_passht4b(void)5618 static void init_passht4b( void ){
5619 	int i;
5620 
5621 	sys16_onetime_init_machine();
5622 
5623 	/* invert the graphics bits on the tiles */
5624 	for (i = 0; i < 0x30000; i++)
5625 		memory_region(REGION_GFX1)[i] ^= 0xff;
5626 
5627 	sys16_sprite_decode( 3,0x20000 );
5628 }
5629 
5630 /***************************************************************************/
5631 
INPUT_PORTS_START(passsht)5632 INPUT_PORTS_START( passsht )
5633 PORT_START /* joy 1 */
5634 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 )
5635 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
5636 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
5637 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )
5638 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
5639 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
5640 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
5641 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
5642 
5643 PORT_START /* joy 2 */
5644 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
5645 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
5646 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
5647 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_COCKTAIL )
5648 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
5649 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
5650 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
5651 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
5652 
5653 	SYS16_SERVICE
5654 	SYS16_COINAGE
5655 
5656 PORT_START	/* DSW1 */
5657 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
5658 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
5659 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
5660 	PORT_DIPNAME( 0x0e, 0x0e, "Initial Point" )
5661 	PORT_DIPSETTING(    0x06, "2000" )
5662 	PORT_DIPSETTING(    0x0a, "3000" )
5663 	PORT_DIPSETTING(    0x0c, "4000" )
5664 	PORT_DIPSETTING(    0x0e, "5000" )
5665 	PORT_DIPSETTING(    0x08, "6000" )
5666 	PORT_DIPSETTING(    0x04, "7000" )
5667 	PORT_DIPSETTING(    0x02, "8000" )
5668 	PORT_DIPSETTING(    0x00, "9000" )
5669 	PORT_DIPNAME( 0x30, 0x30, "Point Table" )
5670 	PORT_DIPSETTING(    0x20, "Easy" )
5671 	PORT_DIPSETTING(    0x30, "Normal" )
5672 	PORT_DIPSETTING(    0x10, "Hard" )
5673 	PORT_DIPSETTING(    0x00, "Hardest" )
5674 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
5675 	PORT_DIPSETTING(    0x80, "Easy" )
5676 	PORT_DIPSETTING(    0xc0, "Normal" )
5677 	PORT_DIPSETTING(    0x40, "Hard" )
5678 	PORT_DIPSETTING(    0x00, "Hardest" )
5679 INPUT_PORTS_END
5680 
5681 INPUT_PORTS_START( passht4b )
5682 PORT_START /* joy 1 */
5683 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
5684 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
5685 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
5686 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
5687 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
5688 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
5689 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
5690 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
5691 
5692 PORT_START /* joy 2 */
5693 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
5694 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
5695 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
5696 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
5697 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
5698 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
5699 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
5700 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_COCKTAIL )
5701 
5702 PORT_START /* service */
5703 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
5704 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
5705 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
5706 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
5707 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
5708 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
5709 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 )
5710 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
5711 
5712 	SYS16_COINAGE
5713 
5714 PORT_START	/* DSW1 */
5715 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
5716 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
5717 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
5718 	PORT_DIPNAME( 0x0e, 0x0e, "Initial Point" )
5719 	PORT_DIPSETTING(    0x06, "2000" )
5720 	PORT_DIPSETTING(    0x0a, "3000" )
5721 	PORT_DIPSETTING(    0x0c, "4000" )
5722 	PORT_DIPSETTING(    0x0e, "5000" )
5723 	PORT_DIPSETTING(    0x08, "6000" )
5724 	PORT_DIPSETTING(    0x04, "7000" )
5725 	PORT_DIPSETTING(    0x02, "8000" )
5726 	PORT_DIPSETTING(    0x00, "9000" )
5727 	PORT_DIPNAME( 0x30, 0x30, "Point Table" )
5728 	PORT_DIPSETTING(    0x20, "Easy" )
5729 	PORT_DIPSETTING(    0x30, "Normal" )
5730 	PORT_DIPSETTING(    0x10, "Hard" )
5731 	PORT_DIPSETTING(    0x00, "Hardest" )
5732 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
5733 	PORT_DIPSETTING(    0x80, "Easy" )
5734 	PORT_DIPSETTING(    0xc0, "Normal" )
5735 	PORT_DIPSETTING(    0x40, "Hard" )
5736 	PORT_DIPSETTING(    0x00, "Hardest" )
5737 
5738 PORT_START /* joy 3 */
5739 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3 )
5740 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER3 )
5741 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
5742 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER3 )
5743 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
5744 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
5745 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
5746 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER3 )
5747 
5748 PORT_START /* joy 4 */
5749 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER4 )
5750 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER4 )
5751 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER4 )
5752 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER4 )
5753 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER4 )
5754 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
5755 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
5756 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER4 )
5757 
5758 INPUT_PORTS_END
5759 
5760 /***************************************************************************/
5761 
5762 MACHINE_DRIVER_7759( machine_driver_passsht, \
5763 	passsht_readmem,passsht_writemem,passsht_init_machine, gfx1 ,upd7759_interface)
5764 
5765 MACHINE_DRIVER_7759( machine_driver_passht4b, \
5766 	passht4b_readmem,passht4b_writemem,passht4b_init_machine, gfx1 ,upd7759_interface)
5767 
5768 /***************************************************************************/
5769 // pre16
5770 ROM_START( quartet )
5771 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
5772 	ROM_LOAD_EVEN( "epr7458a.9b",  0x000000, 0x8000, 0x42e7b23e )
5773 	ROM_LOAD_ODD ( "epr7455a.6b",  0x000000, 0x8000, 0x01631ab2 )
5774 	ROM_LOAD_EVEN( "epr7459a.10b", 0x010000, 0x8000, 0x6b540637 )
5775 	ROM_LOAD_ODD ( "epr7456a.7b",  0x010000, 0x8000, 0x31ca583e )
5776 	ROM_LOAD_EVEN( "epr7460.11b",  0x020000, 0x8000, 0xa444ea13 )
5777 	ROM_LOAD_ODD ( "epr7457.8b",   0x020000, 0x8000, 0x3b282c23 )
5778 
5779 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
5780 	ROM_LOAD( "epr7461.9c",  0x00000, 0x08000, 0xf6af07f2 )
5781 	ROM_LOAD( "epr7462.10c", 0x08000, 0x08000, 0x7914af28 )
5782 	ROM_LOAD( "epr7463.11c", 0x10000, 0x08000, 0x827c5603 )
5783 
5784 	ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites  - the same as quartet 2 */
5785 	ROM_LOAD( "epr7465.5c",  0x000000, 0x008000, 0x8a1ab7d7 )
5786 	ROM_RELOAD(              0x040000, 0x008000 ) //twice? - fixes a sprite glitch
5787 	ROM_LOAD( "epr-7469.2b", 0x008000, 0x008000, 0xcb65ae4f )
5788 	ROM_RELOAD(              0x048000, 0x008000 ) //twice?
5789 	ROM_LOAD( "epr7466.6c",  0x010000, 0x008000, 0xb2d3f4f3 )
5790 	ROM_LOAD( "epr-7470.3b", 0x018000, 0x008000, 0x16fc67b1 )
5791 	ROM_LOAD( "epr7467.7c",  0x020000, 0x008000, 0x0af68de2 )
5792 	ROM_LOAD( "epr-7471.4b", 0x028000, 0x008000, 0x13fad5ac )
5793 	ROM_LOAD( "epr7468.8c",  0x030000, 0x008000, 0xddfd40c0 )
5794 	ROM_LOAD( "epr-7472.5b", 0x038000, 0x008000, 0x8e2762ec )
5795 
5796 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
5797 	ROM_LOAD( "epr-7464.1b", 0x0000, 0x8000, 0x9f291306 )
5798 
5799 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
5800 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
5801 
5802 	ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
5803 	ROM_LOAD( "epr7473.1c", 0x00000, 0x8000, 0x06ec75fa )
5804 	ROM_LOAD( "epr7475.2c", 0x08000, 0x8000, 0x7abd1206 )
5805 	ROM_LOAD( "epr7474.3c", 0x10000, 0x8000, 0xdbf853b8 )
5806 	ROM_LOAD( "epr7476.4c", 0x18000, 0x8000, 0x5eba655a )
5807 ROM_END
5808 
5809 ROM_START( quartetj )
5810 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
5811 	ROM_LOAD_EVEN( "epr-7458.43",  0x000000, 0x8000, 0x0096499f )
5812 	ROM_LOAD_ODD ( "epr-7455.26",  0x000000, 0x8000, 0xda934390 )
5813 	ROM_LOAD_EVEN( "epr-7459.42",  0x010000, 0x8000, 0xd130cf61 )
5814 	ROM_LOAD_ODD ( "epr-7456.25",  0x010000, 0x8000, 0x7847149f )
5815 	ROM_LOAD_EVEN( "epr7460.11b",  0x020000, 0x8000, 0xa444ea13 )
5816 	ROM_LOAD_ODD ( "epr7457.8b",   0x020000, 0x8000, 0x3b282c23 )
5817 
5818 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
5819 	ROM_LOAD( "epr7461.9c",  0x00000, 0x08000, 0xf6af07f2 )
5820 	ROM_LOAD( "epr7462.10c", 0x08000, 0x08000, 0x7914af28 )
5821 	ROM_LOAD( "epr7463.11c", 0x10000, 0x08000, 0x827c5603 )
5822 
5823 	ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites  - the same as quartet 2 */
5824 	ROM_LOAD( "epr7465.5c",  0x000000, 0x008000, 0x8a1ab7d7 )
5825 	ROM_RELOAD(              0x040000, 0x008000 ) //twice? - fixes a sprite glitch
5826 	ROM_LOAD( "epr-7469.2b", 0x008000, 0x008000, 0xcb65ae4f )
5827 	ROM_RELOAD(              0x048000, 0x008000 ) //twice?
5828 	ROM_LOAD( "epr7466.6c",  0x010000, 0x008000, 0xb2d3f4f3 )
5829 	ROM_LOAD( "epr-7470.3b", 0x018000, 0x008000, 0x16fc67b1 )
5830 	ROM_LOAD( "epr7467.7c",  0x020000, 0x008000, 0x0af68de2 )
5831 	ROM_LOAD( "epr-7471.4b", 0x028000, 0x008000, 0x13fad5ac )
5832 	ROM_LOAD( "epr7468.8c",  0x030000, 0x008000, 0xddfd40c0 )
5833 	ROM_LOAD( "epr-7472.5b", 0x038000, 0x008000, 0x8e2762ec )
5834 
5835 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
5836 	ROM_LOAD( "epr-7464.1b", 0x0000, 0x8000, 0x9f291306 )
5837 
5838 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
5839 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
5840 
5841 	ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
5842 	ROM_LOAD( "epr7473.1c", 0x00000, 0x8000, 0x06ec75fa )
5843 	ROM_LOAD( "epr7475.2c", 0x08000, 0x8000, 0x7abd1206 )
5844 	ROM_LOAD( "epr7474.3c", 0x10000, 0x8000, 0xdbf853b8 )
5845 	ROM_LOAD( "epr7476.4c", 0x18000, 0x8000, 0x5eba655a )
5846 ROM_END
5847 
5848 
5849 /***************************************************************************/
5850 
5851 static READ_HANDLER( quartet_skip_r )
5852 {
5853 	if (cpu_get_pc()==0x89b2) {cpu_spinuntil_int(); return 0xffff;}
5854 
5855 	return READ_WORD(&sys16_workingram[0x0800]);
5856 }
5857 
READ_HANDLER(io_quartet_p1_r)5858 static READ_HANDLER( io_quartet_p1_r ) {return input_port_0_r( offset );}
READ_HANDLER(io_quartet_p2_r)5859 static READ_HANDLER( io_quartet_p2_r ) {return input_port_1_r( offset );}
READ_HANDLER(io_quartet_p3_r)5860 static READ_HANDLER( io_quartet_p3_r ) {return input_port_2_r( offset );}
READ_HANDLER(io_quartet_p4_r)5861 static READ_HANDLER( io_quartet_p4_r ) {return input_port_3_r( offset );}
READ_HANDLER(io_quartet_dip1_r)5862 static READ_HANDLER( io_quartet_dip1_r ) {return input_port_4_r( offset );}
READ_HANDLER(io_quartet_dip2_r)5863 static READ_HANDLER( io_quartet_dip2_r ) {return input_port_5_r( offset );}
5864 
5865 static struct MemoryReadAddress quartet_readmem[] =
5866 {
5867 	{ 0x000000, 0x02ffff, MRA_ROM },
5868 	{ 0x400000, 0x40ffff, MRA_TILERAM },
5869 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
5870 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
5871 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
5872 	{ 0xc41000, 0xc41001, io_quartet_p1_r },
5873 	{ 0xc41002, 0xc41003, io_quartet_p2_r },
5874 	{ 0xc41004, 0xc41005, io_quartet_p3_r },
5875 	{ 0xc41006, 0xc41007, io_quartet_p4_r },
5876 	{ 0xc42000, 0xc42001, io_quartet_dip1_r },
5877 	{ 0xc42002, 0xc42003, io_quartet_dip2_r },
5878 	{ 0xc40000, 0xc4ffff, MRA_EXTRAM },
5879 	{ 0xffc800, 0xffc801, quartet_skip_r },
5880 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
5881 	{-1}
5882 };
5883 
5884 static struct MemoryWriteAddress quartet_writemem[] =
5885 {
5886 	{ 0x000000, 0x02ffff, MWA_ROM },
5887 	{ 0x400000, 0x40ffff, MWA_TILERAM },
5888 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
5889 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
5890 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
5891 	{ 0xc40000, 0xc40001, sound_command_nmi_w },
5892 	{ 0xc40000, 0xc4ffff, MWA_EXTRAM },
5893 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
5894 	{-1}
5895 };
5896 /***************************************************************************/
5897 
quartet_update_proc(void)5898 static void quartet_update_proc( void ){
5899 	sys16_fg_scrollx = READ_WORD( &sys16_workingram[0x0d14] ) & 0x01ff;
5900 	sys16_bg_scrollx = READ_WORD( &sys16_workingram[0x0d18] ) & 0x01ff;
5901 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
5902 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
5903 
5904 	if((READ_WORD(&sys16_extraram[4]) & 0xff) == 1)
5905 		sys16_quartet_title_kludge=1;
5906 	else
5907 		sys16_quartet_title_kludge=0;
5908 
5909 	set_fg_page1( READ_WORD( &sys16_workingram[0x0d1c] ) );
5910 	set_bg_page1( READ_WORD( &sys16_workingram[0x0d1e] ) );
5911 
5912 	set_refresh_3d( READ_WORD( &sys16_extraram[2] ) );
5913 }
5914 
quartet_init_machine(void)5915 static void quartet_init_machine( void ){
5916 	static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
5917 	sys16_obj_bank = bank;
5918 	sys16_textmode=1;
5919 	sys16_spritesystem = 2;
5920 	sys16_sprxoffset = -0xbc;
5921 	sys16_fgxoffset = sys16_bgxoffset = 7;
5922 
5923 	sys16_update_proc = quartet_update_proc;
5924 }
5925 
init_quartet(void)5926 static void init_quartet( void )
5927 {
5928 	sys16_onetime_init_machine();
5929 	sys16_sprite_decode( 5,0x010000 );
5930 }
5931 /***************************************************************************/
5932 
INPUT_PORTS_START(quartet)5933 INPUT_PORTS_START( quartet )
5934 	// Player 1
5935 	PORT_START
5936 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY  )
5937 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  | IPF_8WAY  )
5938 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
5939 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
5940 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
5941 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
5942 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
5943 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
5944 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* player 1 coin 2 really */
5945 	// Player 2
5946 	PORT_START
5947 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY  | IPF_PLAYER2 )
5948 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  | IPF_8WAY  | IPF_PLAYER2 )
5949 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2)
5950 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2)
5951 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2)
5952 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
5953 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2)
5954 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
5955 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* player 2 coin 2 really */
5956 	// Player 3
5957 	PORT_START
5958 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3  )
5959 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  | IPF_8WAY  | IPF_PLAYER3 )
5960 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
5961 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER3 )
5962 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
5963 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START3 )
5964 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
5965 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
5966 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* player 3 coin 2 really */
5967 	// Player 4
5968 	PORT_START
5969 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY  | IPF_PLAYER4 )
5970 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP  | IPF_8WAY  | IPF_PLAYER4 )
5971 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER4)
5972 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER4)
5973 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4)
5974 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START4 )
5975 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4)
5976 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN4 )
5977 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* player 4 coin 2 really */
5978 
5979 	SYS16_COINAGE
5980 
5981 	PORT_START	/* DSW1 */
5982 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
5983 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
5984 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
5985 	PORT_DIPNAME( 0x06, 0x00, "Credit Power" )
5986 	PORT_DIPSETTING(    0x04, "500" )
5987 	PORT_DIPSETTING(    0x06, "1000" )
5988 	PORT_DIPSETTING(    0x02, "2000" )
5989 	PORT_DIPSETTING(    0x00, "9000" )
5990 	PORT_DIPNAME( 0x18, 0x00, DEF_STR( Difficulty ) )
5991 	PORT_DIPSETTING(    0x10, "Easy" )
5992 	PORT_DIPSETTING(    0x18, "Normal" )
5993 	PORT_DIPSETTING(    0x08, "Hard" )
5994 	PORT_DIPSETTING(    0x00, "Hardest" )
5995 	PORT_DIPNAME( 0x20, 0x20, "Coin During Game" )
5996 	PORT_DIPSETTING(    0x20, "Power" )
5997 	PORT_DIPSETTING(    0x00, "Credit" )
5998 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
5999 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
6000 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6001 	PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
6002 INPUT_PORTS_END
6003 
6004 /***************************************************************************/
6005 
6006 MACHINE_DRIVER_7751( machine_driver_quartet, \
6007 	quartet_readmem,quartet_writemem,quartet_init_machine, gfx8 )
6008 
6009 /***************************************************************************/
6010 // pre16
6011 ROM_START( quartet2 )
6012 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
6013 	ROM_LOAD_EVEN( "quartet2.b9",  0x000000, 0x8000, 0x67177cd8 )
6014 	ROM_LOAD_ODD ( "quartet2.b6",  0x000000, 0x8000, 0x50f50b08 )
6015 	ROM_LOAD_EVEN( "quartet2.b10", 0x010000, 0x8000, 0x4273c3b7 )
6016 	ROM_LOAD_ODD ( "quartet2.b7",  0x010000, 0x8000, 0x0aa337bb )
6017 	ROM_LOAD_EVEN( "quartet2.b11", 0x020000, 0x8000, 0x3a6a375d )
6018 	ROM_LOAD_ODD ( "quartet2.b8",  0x020000, 0x8000, 0xd87b2ca2 )
6019 
6020 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
6021 	ROM_LOAD( "quartet2.c9",  0x00000, 0x08000, 0x547a6058 )
6022 	ROM_LOAD( "quartet2.c10", 0x08000, 0x08000, 0x77ec901d )
6023 	ROM_LOAD( "quartet2.c11", 0x10000, 0x08000, 0x7e348cce )
6024 
6025 	ROM_REGION( 0x050000*2, REGION_GFX2 ) /* sprites */
6026 	ROM_LOAD( "epr7465.5c",  0x000000, 0x008000, 0x8a1ab7d7 )
6027 	ROM_RELOAD(              0x040000, 0x008000 ) //twice? - fixes a sprite glitch
6028 	ROM_LOAD( "epr-7469.2b", 0x008000, 0x008000, 0xcb65ae4f )
6029 	ROM_RELOAD(              0x048000, 0x008000 ) //twice?
6030 	ROM_LOAD( "epr7466.6c",  0x010000, 0x008000, 0xb2d3f4f3 )
6031 	ROM_LOAD( "epr-7470.3b", 0x018000, 0x008000, 0x16fc67b1 )
6032 	ROM_LOAD( "epr7467.7c",  0x020000, 0x008000, 0x0af68de2 )
6033 	ROM_LOAD( "epr-7471.4b", 0x028000, 0x008000, 0x13fad5ac )
6034 	ROM_LOAD( "epr7468.8c",  0x030000, 0x008000, 0xddfd40c0 )
6035 	ROM_LOAD( "epr-7472.5b", 0x038000, 0x008000, 0x8e2762ec )
6036 
6037 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
6038 	ROM_LOAD( "epr-7464.1b", 0x0000, 0x8000, 0x9f291306 )
6039 
6040 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
6041 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
6042 
6043 	ROM_REGION( 0x20000, REGION_SOUND1 ) /* 7751 sound data */
6044 	ROM_LOAD( "epr7473.1c", 0x00000, 0x8000, 0x06ec75fa )
6045 	ROM_LOAD( "epr7475.2c", 0x08000, 0x8000, 0x7abd1206 )
6046 	ROM_LOAD( "epr7474.3c", 0x10000, 0x8000, 0xdbf853b8 )
6047 	ROM_LOAD( "epr7476.4c", 0x18000, 0x8000, 0x5eba655a )
6048 ROM_END
6049 
6050 /***************************************************************************/
6051 
6052 static READ_HANDLER( quartet2_skip_r )
6053 {
6054 	if (cpu_get_pc()==0x8f6c) {cpu_spinuntil_int(); return 0xffff;}
6055 
6056 	return READ_WORD(&sys16_workingram[0x0800]);
6057 }
6058 
6059 static struct MemoryReadAddress quartet2_readmem[] =
6060 {
6061 	{ 0x000000, 0x02ffff, MRA_ROM },
6062 	{ 0x400000, 0x40ffff, MRA_TILERAM },
6063 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
6064 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
6065 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
6066 	{ 0xc41002, 0xc41003, io_player1_r },
6067 	{ 0xc41006, 0xc41007, io_player2_r },
6068 	{ 0xc41000, 0xc41001, io_service_r },
6069 	{ 0xc42000, 0xc42001, io_dip1_r },
6070 	{ 0xc42002, 0xc42003, io_dip2_r },
6071 	{ 0xc40000, 0xc4ffff, MRA_EXTRAM },
6072 	{ 0xffc800, 0xffc801, quartet2_skip_r },
6073 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
6074 	{-1}
6075 };
6076 
6077 static struct MemoryWriteAddress quartet2_writemem[] =
6078 {
6079 	{ 0x000000, 0x02ffff, MWA_ROM },
6080 	{ 0x400000, 0x40ffff, MWA_TILERAM },
6081 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
6082 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
6083 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
6084 	{ 0xc40000, 0xc40001, sound_command_nmi_w },
6085 	{ 0xc40000, 0xc4ffff, MWA_EXTRAM },
6086 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
6087 	{-1}
6088 };
6089 /***************************************************************************/
6090 
quartet2_update_proc(void)6091 static void quartet2_update_proc( void ){
6092 	sys16_fg_scrollx = READ_WORD( &sys16_workingram[0x0d14] ) & 0x01ff;
6093 	sys16_bg_scrollx = READ_WORD( &sys16_workingram[0x0d18] ) & 0x01ff;
6094 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
6095 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
6096 
6097 	if((READ_WORD(&sys16_extraram[4]) & 0xff) == 1)
6098 		sys16_quartet_title_kludge=1;
6099 	else
6100 		sys16_quartet_title_kludge=0;
6101 
6102 	set_fg_page1( READ_WORD( &sys16_workingram[0x0d1c] ) );
6103 	set_bg_page1( READ_WORD( &sys16_workingram[0x0d1e] ) );
6104 
6105 	set_refresh_3d( READ_WORD( &sys16_extraram[2] ) );
6106 }
6107 
quartet2_init_machine(void)6108 static void quartet2_init_machine( void ){
6109 	static int bank[16] = { 00,01,02,03,00,01,02,03,00,01,02,03,00,01,02,03};
6110 	sys16_obj_bank = bank;
6111 	sys16_textmode=1;
6112 	sys16_spritesystem = 2;
6113 	sys16_sprxoffset = -0xbc;
6114 	sys16_fgxoffset = sys16_bgxoffset = 7;
6115 
6116 	sys16_update_proc = quartet2_update_proc;
6117 }
6118 
init_quartet2(void)6119 static void init_quartet2( void )
6120 {
6121 	sys16_onetime_init_machine();
6122 	sys16_sprite_decode( 5,0x010000 );
6123 }
6124 /***************************************************************************/
6125 
INPUT_PORTS_START(quartet2)6126 INPUT_PORTS_START( quartet2 )
6127 	SYS16_JOY1_SWAPPEDBUTTONS
6128 	SYS16_JOY2_SWAPPEDBUTTONS
6129 	SYS16_SERVICE
6130 	SYS16_COINAGE
6131 
6132 PORT_START	/* DSW1 */
6133 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
6134 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
6135 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6136 	PORT_DIPNAME( 0x06, 0x00, "Credit Power" )
6137 	PORT_DIPSETTING(    0x04, "500" )
6138 	PORT_DIPSETTING(    0x06, "1000" )
6139 	PORT_DIPSETTING(    0x02, "2000" )
6140 	PORT_DIPSETTING(    0x00, "9000" )
6141 	PORT_DIPNAME( 0x18, 0x00, DEF_STR( Difficulty ) )
6142 	PORT_DIPSETTING(    0x10, "Easy" )
6143 	PORT_DIPSETTING(    0x18, "Normal" )
6144 	PORT_DIPSETTING(    0x08, "Hard" )
6145 	PORT_DIPSETTING(    0x00, "Hardest" )
6146 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
6147 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
6148 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6149 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
6150 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
6151 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6152 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
6153 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
6154 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6155 
6156 INPUT_PORTS_END
6157 
6158 /***************************************************************************/
6159 
6160 MACHINE_DRIVER_7751( machine_driver_quartet2, \
6161 	quartet2_readmem,quartet2_writemem,quartet2_init_machine, gfx8 )
6162 
6163 /***************************************************************************
6164 
6165    Riot City
6166 
6167 ***************************************************************************/
6168 // sys16B
6169 ROM_START( riotcity )
6170 	ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
6171 	ROM_LOAD_EVEN( "epr14612.bin", 0x000000, 0x20000, 0xa1b331ec )
6172 	ROM_LOAD_ODD ( "epr14610.bin", 0x000000, 0x20000, 0xcd4f2c50 )
6173 	/* empty 0x40000 - 0x80000 */
6174 	ROM_LOAD_EVEN( "epr14613.bin", 0x080000, 0x20000, 0x0659df4c )
6175 	ROM_LOAD_ODD ( "epr14611.bin", 0x080000, 0x20000, 0xd9e6f80b )
6176 
6177 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
6178 	ROM_LOAD( "epr14616.bin", 0x00000, 0x20000, 0x46d30368 ) /* plane 1 */
6179 	ROM_LOAD( "epr14625.bin", 0x20000, 0x20000, 0xabfb80fe )
6180 	ROM_LOAD( "epr14617.bin", 0x40000, 0x20000, 0x884e40f9 ) /* plane 2 */
6181 	ROM_LOAD( "epr14626.bin", 0x60000, 0x20000, 0x4ef55846 )
6182 	ROM_LOAD( "epr14618.bin", 0x80000, 0x20000, 0x00eb260e ) /* plane 3 */
6183 	ROM_LOAD( "epr14627.bin", 0xa0000, 0x20000, 0x961e5f82 )
6184 
6185 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
6186 	ROM_LOAD( "epr14619.bin",  0x000000, 0x040000, 0x6f2b5ef7 )
6187 	ROM_LOAD( "epr14622.bin",  0x040000, 0x040000, 0x7ca7e40d )
6188 	ROM_LOAD( "epr14620.bin",  0x080000, 0x040000, 0x66183333 )
6189 	ROM_LOAD( "epr14623.bin",  0x0c0000, 0x040000, 0x98630049 )
6190 	ROM_LOAD( "epr14621.bin",  0x100000, 0x040000, 0xc0f2820e )
6191 	ROM_LOAD( "epr14624.bin",  0x140000, 0x040000, 0xd1a68448 )
6192 
6193 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
6194 	ROM_LOAD( "epr14614.bin", 0x00000, 0x10000, 0xc65cc69a )
6195 	ROM_LOAD( "epr14615.bin", 0x10000, 0x20000, 0x46653db1 )
6196 ROM_END
6197 
6198 /***************************************************************************/
6199 
6200 static READ_HANDLER( riotcity_skip_r )
6201 {
6202 	if (cpu_get_pc()==0x3ce) {cpu_spinuntil_int(); return 0;}
6203 
6204 	return READ_WORD(&sys16_workingram[0x2cde]);
6205 }
6206 
6207 static struct MemoryReadAddress riotcity_readmem[] =
6208 {
6209 	{ 0x000000, 0x0bffff, MRA_ROM },
6210 	{ 0x3f0000, 0x3fffff, MRA_EXTRAM },
6211 	{ 0xf20000, 0xf20fff, MRA_EXTRAM3 },
6212 	{ 0xf40000, 0xf40fff, MRA_SPRITERAM },
6213 	{ 0xf60000, 0xf60fff, MRA_PALETTERAM },
6214 	{ 0xf81002, 0xf81003, io_player1_r },
6215 	{ 0xf81006, 0xf81007, io_player2_r },
6216 	{ 0xf81000, 0xf81001, io_service_r },
6217 	{ 0xf82002, 0xf82003, io_dip1_r },
6218 	{ 0xf82000, 0xf82001, io_dip2_r },
6219 	{ 0xf80000, 0xf8ffff, MRA_EXTRAM2 },
6220 	{ 0xfa0000, 0xfaffff, MRA_TILERAM },
6221 	{ 0xfb0000, 0xfb0fff, MRA_TEXTRAM },
6222 	{ 0xffecde, 0xffecdf, riotcity_skip_r },
6223 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
6224 	{-1}
6225 };
6226 
6227 static struct MemoryWriteAddress riotcity_writemem[] =
6228 {
6229 	{ 0x000000, 0x0bffff, MWA_ROM },
6230 	{ 0x3f0000, 0x3fffff, MWA_EXTRAM },
6231 	{ 0xf00006, 0xf00007, sound_command_w },
6232 	{ 0xf20000, 0xf20fff, MWA_EXTRAM3 },
6233 	{ 0xf40000, 0xf40fff, MWA_SPRITERAM },
6234 	{ 0xf60000, 0xf60fff, MWA_PALETTERAM },
6235 	{ 0xf80000, 0xf8ffff, MWA_EXTRAM2 },
6236 	{ 0xfa0000, 0xfaffff, MWA_TILERAM },
6237 	{ 0xfb0000, 0xfb0fff, MWA_TEXTRAM },
6238 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
6239 	{-1}
6240 };
6241 /***************************************************************************/
6242 
riotcity_update_proc(void)6243 static void riotcity_update_proc (void)
6244 {
6245 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
6246 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
6247 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
6248 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
6249 
6250 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
6251 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
6252 
6253 	sys16_tile_bank1 = READ_WORD( &sys16_extraram3[0x0002] ) & 0xf;
6254 	sys16_tile_bank0 = READ_WORD( &sys16_extraram3[0x0000] ) & 0xf;
6255 
6256 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
6257 }
6258 
riotcity_init_machine(void)6259 static void riotcity_init_machine( void ){
6260 	static int bank[16] = {0x00,0x02,0x08,0x0A,0x10,0x12,0x00,0x00,0x04,0x06,0x0C,0x0E,0x14,0x16,0x00,0x00};
6261 
6262 	sys16_obj_bank = bank;
6263 	sys16_spritesystem = 4;
6264 	sys16_spritelist_end=0x8000;
6265 	sys16_bg_priority_mode=1;
6266 
6267 	sys16_update_proc = riotcity_update_proc;
6268 }
6269 
init_riotcity(void)6270 static void init_riotcity(void)
6271 {
6272 	sys16_onetime_init_machine();
6273 	sys16_sprite_decode (3,0x80000);
6274 }
6275 
6276 /***************************************************************************/
6277 
INPUT_PORTS_START(riotcity)6278 INPUT_PORTS_START( riotcity )
6279 	SYS16_JOY1
6280 	SYS16_JOY2
6281 	SYS16_SERVICE
6282 	SYS16_COINAGE
6283 
6284 PORT_START	/* DSW1 */
6285 	PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
6286 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
6287 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6288 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
6289 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
6290 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6291 	PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Lives ) )
6292 	PORT_DIPSETTING(    0x00, "1" )
6293 	PORT_DIPSETTING(    0x0c, "2" )
6294 	PORT_DIPSETTING(    0x08, "3" )
6295 	PORT_DIPSETTING(    0x04, "4" )
6296 	PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
6297 	PORT_DIPSETTING(    0x20, "Easy" )
6298 	PORT_DIPSETTING(    0x30, "Normal" )
6299 	PORT_DIPSETTING(    0x10, "Hard" )
6300 	PORT_DIPSETTING(    0x00, "Hardest" )
6301 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) )
6302 	PORT_DIPSETTING(    0x40, "Normal" )
6303 	PORT_DIPSETTING(    0x00, "Hard" )
6304 	PORT_DIPNAME( 0x80, 0x80, "Attack Button to Start" )
6305 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
6306 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6307 INPUT_PORTS_END
6308 
6309 /***************************************************************************/
6310 
6311 MACHINE_DRIVER_7759( machine_driver_riotcity, \
6312 	riotcity_readmem,riotcity_writemem,riotcity_init_machine, gfx4,upd7759_interface )
6313 
6314 /***************************************************************************/
6315 // sys16B
6316 ROM_START( sdi )
6317 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
6318 	ROM_LOAD_EVEN( "a4.rom", 0x000000, 0x8000, 0xf2c41dd6 )
6319 	ROM_LOAD_ODD ( "a1.rom", 0x000000, 0x8000, 0xa9f816ef )
6320 	ROM_LOAD_EVEN( "a5.rom", 0x010000, 0x8000, 0x7952e27e )
6321 	ROM_LOAD_ODD ( "a2.rom", 0x010000, 0x8000, 0x369af326 )
6322 	ROM_LOAD_EVEN( "a6.rom", 0x020000, 0x8000, 0x8ee2c287 )
6323 	ROM_LOAD_ODD ( "a3.rom", 0x020000, 0x8000, 0x193e4231 )
6324 
6325 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
6326 	ROM_LOAD( "b9.rom",  0x00000, 0x10000, 0x182b6301 )
6327 	ROM_LOAD( "b10.rom", 0x10000, 0x10000, 0x8f7129a2 )
6328 	ROM_LOAD( "b11.rom", 0x20000, 0x10000, 0x4409411f )
6329 
6330 	ROM_REGION( 0x060000*2, REGION_GFX2 ) /* sprites */
6331 	ROM_LOAD( "b1.rom", 0x000000, 0x010000, 0x30e2c50a )
6332 	ROM_LOAD( "b5.rom", 0x010000, 0x010000, 0x794e3e8b )
6333 	ROM_LOAD( "b2.rom", 0x020000, 0x010000, 0x6a8b3fd0 )
6334 	ROM_LOAD( "b6.rom", 0x030000, 0x010000, 0x602da5d5 )
6335 	ROM_LOAD( "b3.rom", 0x040000, 0x010000, 0xb9de3aeb )
6336 	ROM_LOAD( "b7.rom", 0x050000, 0x010000, 0x0a73a057 )
6337 
6338 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
6339 	ROM_LOAD( "a7.rom", 0x0000, 0x8000, 0x793f9f7f )
6340 ROM_END
6341 
6342 // sys16A
6343 ROM_START( sdioj )
6344 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
6345 // Custom cpu 317-0027
6346 	ROM_LOAD_EVEN( "epr10970.43", 0x000000, 0x8000, 0xb8fa4a2c )
6347 	ROM_LOAD_ODD ( "epr10968.26", 0x000000, 0x8000, 0xa3f97793 )
6348 	ROM_LOAD_EVEN( "epr10971.42", 0x010000, 0x8000, 0xc44a0328 )
6349 	ROM_LOAD_ODD ( "epr10969.25", 0x010000, 0x8000, 0x455d15bd )
6350 	ROM_LOAD_EVEN( "epr10755.41", 0x020000, 0x8000, 0x405e3969 )
6351 	ROM_LOAD_ODD ( "epr10752.24", 0x020000, 0x8000, 0x77453740 )
6352 
6353 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
6354 	ROM_LOAD( "epr10756.95", 0x00000, 0x10000, 0x44d8a506 )
6355 	ROM_LOAD( "epr10757.94", 0x10000, 0x10000, 0x497e1740 )
6356 	ROM_LOAD( "epr10758.93", 0x20000, 0x10000, 0x61d61486 )
6357 
6358 	ROM_REGION( 0x060000*2, REGION_GFX2 ) /* sprites */
6359 	ROM_LOAD( "b1.rom", 0x000000, 0x010000, 0x30e2c50a )
6360 	ROM_LOAD( "b5.rom", 0x010000, 0x010000, 0x794e3e8b )
6361 	ROM_LOAD( "b2.rom", 0x020000, 0x010000, 0x6a8b3fd0 )
6362 	ROM_LOAD( "b6.rom", 0x030000, 0x010000, 0x602da5d5 )
6363 	ROM_LOAD( "b3.rom", 0x040000, 0x010000, 0xb9de3aeb )
6364 	ROM_LOAD( "b7.rom", 0x050000, 0x010000, 0x0a73a057 )
6365 
6366 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
6367 	ROM_LOAD( "epr10759.12", 0x0000, 0x8000, 0xd7f9649f )
6368 ROM_END
6369 
6370 
6371 /***************************************************************************/
6372 
6373 static READ_HANDLER( io_p1mousex_r ){ return 0xff-input_port_5_r( offset ); }
READ_HANDLER(io_p1mousey_r)6374 static READ_HANDLER( io_p1mousey_r ){ return input_port_6_r( offset ); }
6375 
READ_HANDLER(io_p2mousex_r)6376 static READ_HANDLER( io_p2mousex_r ){ return input_port_7_r( offset ); }
READ_HANDLER(io_p2mousey_r)6377 static READ_HANDLER( io_p2mousey_r ){ return input_port_8_r( offset ); }
6378 
READ_HANDLER(sdi_skip_r)6379 static READ_HANDLER( sdi_skip_r )
6380 {
6381 	if (cpu_get_pc()==0x5326) {cpu_spinuntil_int(); return 0xffff;}
6382 
6383 	return READ_WORD(&sys16_workingram[0x0400]);
6384 }
6385 
6386 static struct MemoryReadAddress sdi_readmem[] =
6387 {
6388 	{ 0x000000, 0x02ffff, MRA_ROM },
6389 	{ 0x400000, 0x40ffff, MRA_TILERAM },
6390 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
6391 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
6392 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
6393 	{ 0xc40000, 0xc40001, MRA_EXTRAM },
6394 	{ 0xc41004, 0xc41005, io_player1_r },
6395 	{ 0xc41002, 0xc41003, io_player2_r },
6396 	{ 0xc41000, 0xc41001, io_service_r },
6397 	{ 0xc42000, 0xc42001, io_dip2_r },
6398 	{ 0xc42002, 0xc42003, io_dip1_r },
6399 	{ 0xc42004, 0xc42005, io_dip2_r },
6400 	{ 0xc43000, 0xc43001, io_p1mousex_r },
6401 	{ 0xc43004, 0xc43005, io_p1mousey_r },
6402 	{ 0xc43008, 0xc43009, io_p2mousex_r },
6403 	{ 0xc4300c, 0xc4300d, io_p2mousey_r },
6404 //	{ 0xc42000, 0xc42001, MRA_NOP }, /* What is this? */
6405 	{ 0xc60000, 0xc60001, MRA_NOP }, /* What is this? */
6406 	{ 0xffc400, 0xffc401, sdi_skip_r },
6407 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
6408 	{-1}
6409 };
6410 
6411 static struct MemoryWriteAddress sdi_writemem[] =
6412 {
6413 	{ 0x000000, 0x02ffff, MWA_ROM },
6414 	{ 0x123406, 0x123407, sound_command_w },
6415 	{ 0x400000, 0x40ffff, MWA_TILERAM },
6416 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
6417 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
6418 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
6419 	{ 0xc40000, 0xc40001, MWA_EXTRAM },
6420 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
6421 	{-1}
6422 };
6423 /***************************************************************************/
6424 
sdi_update_proc(void)6425 static void sdi_update_proc( void ){
6426 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
6427 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
6428 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
6429 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
6430 
6431 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
6432 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
6433 
6434 	set_refresh( READ_WORD( &sys16_extraram[0] ) );
6435 }
6436 
sdi_init_machine(void)6437 static void sdi_init_machine( void ){
6438 	static int bank[16] = {00,00,00,00,00,00,00,0x06,00,00,00,0x04,00,0x02,00,00};
6439 
6440 	sys16_obj_bank = bank;
6441 
6442 	// ??
6443 	patch_code( 0x102f2, 0x00 );
6444 	patch_code( 0x102f3, 0x02 );
6445 
6446 	sys16_update_proc = sdi_update_proc;
6447 }
6448 
sdi_sprite_decode(void)6449 static void sdi_sprite_decode( void ){
6450 	sys16_sprite_decode( 3,0x020000 );
6451 }
6452 
init_sdi(void)6453 static void init_sdi( void ){
6454 	sys16_onetime_init_machine();
6455 	sys18_splittab_bg_x=&sys16_textram[0x0fc0];
6456 	sys16_rowscroll_scroll=0xff00;
6457 
6458 	sdi_sprite_decode();
6459 }
6460 
6461 /***************************************************************************/
6462 
INPUT_PORTS_START(sdi)6463 INPUT_PORTS_START( sdi )
6464 PORT_START	/* DSW1 */
6465 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN  | IPF_8WAY )
6466 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP    | IPF_8WAY )
6467 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT | IPF_8WAY )
6468 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT  | IPF_8WAY )
6469 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN  | IPF_8WAY | IPF_PLAYER2)
6470 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP    | IPF_8WAY | IPF_PLAYER2)
6471 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT | IPF_8WAY | IPF_PLAYER2)
6472 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT  | IPF_8WAY | IPF_PLAYER2)
6473 
6474 	SYS16_JOY2
6475 
6476 PORT_START /* Service */
6477 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
6478 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
6479 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
6480 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
6481 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
6482 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
6483 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
6484 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2)
6485 
6486 	SYS16_COINAGE
6487 
6488 PORT_START	/* DSW1 */
6489 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
6490 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
6491 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6492 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
6493 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
6494 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6495 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
6496 	PORT_DIPSETTING(    0x08, "2" )
6497 	PORT_DIPSETTING(    0x0c, "3" )
6498 	PORT_DIPSETTING(    0x04, "4" )
6499 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240?", IP_KEY_NONE, IP_JOY_NONE )
6500 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
6501 	PORT_DIPSETTING(    0x20, "Easy" )
6502 	PORT_DIPSETTING(    0x30, "Normal" )
6503 	PORT_DIPSETTING(    0x10, "Hard" )
6504 	PORT_DIPSETTING(    0x00, "Hardest" )
6505 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) )
6506 	PORT_DIPSETTING(    0x80, "Every 50000" )
6507 	PORT_DIPSETTING(    0xc0, "50000" )
6508 	PORT_DIPSETTING(    0x40, "100000" )
6509 	PORT_DIPSETTING(    0x00, "None" )
6510 
6511 	PORT_START				/* fake analog X */
6512 	PORT_ANALOG( 0xff, 0x80, IPT_TRACKBALL_X, 75, 1, 0, 255 )
6513 
6514 	PORT_START				/* fake analog Y */
6515 	PORT_ANALOG( 0xff, 0x80, IPT_TRACKBALL_Y, 75, 1, 0, 255 )
6516 
6517 	PORT_START				/* fake analog X */
6518 	PORT_ANALOG( 0xff, 0x80, IPT_TRACKBALL_X | IPF_PLAYER2 , 75, 1, 0, 255 )
6519 
6520 	PORT_START				/* fake analog Y */
6521 	PORT_ANALOG( 0xff, 0x80, IPT_TRACKBALL_Y | IPF_PLAYER2, 75, 1, 0, 255 )
6522 
6523 INPUT_PORTS_END
6524 
6525 /***************************************************************************/
6526 
6527 MACHINE_DRIVER( machine_driver_sdi, \
6528 	sdi_readmem,sdi_writemem,sdi_init_machine, gfx1)
6529 
6530 /***************************************************************************/
6531 // sys18
6532 ROM_START( shdancer )
6533 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
6534 	ROM_LOAD_EVEN( "shdancer.a6", 0x000000, 0x40000, 0x3d5b3fa9 )
6535 	ROM_LOAD_ODD ( "shdancer.a5", 0x000000, 0x40000, 0x2596004e )
6536 
6537 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
6538 	ROM_LOAD( "sd12712.bin", 0x00000, 0x40000, 0x9bdabe3d )
6539 	ROM_LOAD( "sd12713.bin", 0x40000, 0x40000, 0x852d2b1c )
6540 	ROM_LOAD( "sd12714.bin", 0x80000, 0x40000, 0x448226ce )
6541 
6542 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
6543 	ROM_LOAD( "sd12719.bin",  0x000000, 0x40000, 0xd6888534 )
6544 	ROM_LOAD( "sd12726.bin",  0x040000, 0x40000, 0xff344945 )
6545 	ROM_LOAD( "sd12718.bin",  0x080000, 0x40000, 0xba2efc0c )
6546 	ROM_LOAD( "sd12725.bin",  0x0c0000, 0x40000, 0x268a0c17 )
6547 	ROM_LOAD( "sd12717.bin",  0x100000, 0x40000, 0xc81cc4f8 )
6548 	ROM_LOAD( "sd12724.bin",  0x140000, 0x40000, 0x0f4903dc )
6549 	ROM_LOAD( "sd12716.bin",  0x180000, 0x40000, 0xa870e629 )
6550 	ROM_LOAD( "sd12723.bin",  0x1c0000, 0x40000, 0xc606cf90 )
6551 
6552 	ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
6553 	ROM_LOAD( "sd12720.bin", 0x10000, 0x20000, 0x7a0d8de1 )
6554 	ROM_LOAD( "sd12715.bin", 0x30000, 0x40000, 0x07051a52 )
6555 ROM_END
6556 
6557 /***************************************************************************/
6558 
6559 static READ_HANDLER( shdancer_skip_r )
6560 {
6561 	if (cpu_get_pc()==0x2f76) {cpu_spinuntil_int(); return 0xffff;}
6562 
6563 	return READ_WORD(&sys16_workingram[0x0000]);
6564 }
6565 
6566 
6567 static struct MemoryReadAddress shdancer_readmem[] =
6568 {
6569 	{ 0x000000, 0x07ffff, MRA_ROM },
6570 
6571 	{ 0x400000, 0x40ffff, MRA_TILERAM },
6572 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
6573 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
6574 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
6575 	{ 0xc00000, 0xc00007, MRA_EXTRAM },
6576 	{ 0xe4000a, 0xe4000b, io_dip1_r },
6577 	{ 0xe4000c, 0xe4000d, io_dip2_r },
6578 	{ 0xe40000, 0xe40001, io_player1_r },
6579 	{ 0xe40002, 0xe40003, io_player2_r },
6580 	{ 0xe40008, 0xe40009, io_service_r },
6581 	{ 0xe40000, 0xe4001f, MRA_EXTRAM2 },
6582 	{ 0xe43034, 0xe43035, MRA_NOP },
6583 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
6584 	{-1}
6585 };
6586 
6587 static struct MemoryWriteAddress shdancer_writemem[] =
6588 {
6589 	{ 0x000000, 0x07ffff, MWA_ROM },
6590 	{ 0x400000, 0x40ffff, MWA_TILERAM },
6591 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
6592 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
6593 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
6594 	{ 0xc00000, 0xc00007, MWA_EXTRAM },
6595 	{ 0xe40000, 0xe4001f, MWA_EXTRAM2 },
6596 	{ 0xe43034, 0xe43035, MWA_NOP },
6597 	{ 0xfe0006, 0xfe0007, sound_command_nmi_w },
6598 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
6599 	{-1}
6600 };
6601 /***************************************************************************/
6602 
shdancer_update_proc(void)6603 static void shdancer_update_proc( void ){
6604 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
6605 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
6606 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
6607 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
6608 
6609 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
6610 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
6611 
6612 	sys16_fg2_scrollx = READ_WORD( &sys16_textram[0x0e9c] );
6613 	sys16_bg2_scrollx = READ_WORD( &sys16_textram[0x0e9e] );
6614 	sys16_fg2_scrolly = READ_WORD( &sys16_textram[0x0e94] );
6615 	sys16_bg2_scrolly = READ_WORD( &sys16_textram[0x0e96] );
6616 
6617 	set_fg2_page( READ_WORD( &sys16_textram[0x0e84] ) );
6618 	set_bg2_page( READ_WORD( &sys16_textram[0x0e86] ) );
6619 
6620 	sys18_bg2_active=0;
6621 	sys18_fg2_active=0;
6622 
6623 	if(sys16_fg2_scrollx | sys16_fg2_scrolly | READ_WORD( &sys16_textram[0x0e84] ))
6624 		sys18_fg2_active=1;
6625 	if(sys16_bg2_scrollx | sys16_bg2_scrolly | READ_WORD( &sys16_textram[0x0e86] ))
6626 		sys18_bg2_active=1;
6627 
6628 	set_tile_bank18( READ_WORD( &sys16_extraram[0] ) );
6629 	set_refresh_18( READ_WORD( &sys16_extraram2[0x1c] ) );
6630 }
6631 
shdancer_init_machine(void)6632 static void shdancer_init_machine( void ){
6633 	static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
6634 	sys16_obj_bank = bank;
6635 	sys16_spritelist_end=0x8000;
6636 
6637 	sys16_update_proc = shdancer_update_proc;
6638 }
6639 
init_shdancer(void)6640 static void init_shdancer( void ){
6641 	unsigned char *RAM= memory_region(REGION_CPU2);
6642 	sys16_onetime_init_machine();
6643 	sys18_splittab_fg_x=&sys16_textram[0x0f80];
6644 	sys18_splittab_bg_x=&sys16_textram[0x0fc0];
6645 	install_mem_read_handler(0, 0xffc000, 0xffc001, shdancer_skip_r );
6646 #ifdef TRANSPARENT_SHADOWS
6647 	sys16_MaxShadowColors=0;		// doesn't seem to use transparent shadows
6648 #endif
6649 
6650 	memcpy(RAM,&RAM[0x10000],0xa000);
6651 
6652 	sys16_sprite_decode( 4,0x080000 );
6653 }
6654 
6655 /***************************************************************************/
6656 
6657 INPUT_PORTS_START( shdancer )
6658 PORT_START /* player 1 */
6659 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
6660 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
6661 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
6662 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
6663 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
6664 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
6665 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
6666 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
6667 
6668 PORT_START /* player 2 */
6669 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
6670 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
6671 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
6672 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
6673 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
6674 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
6675 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
6676 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
6677 	SYS16_SERVICE
6678 	SYS16_COINAGE
6679 
6680 PORT_START	/* DSW1 */
6681 	PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
6682 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
6683 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6684 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
6685 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
6686 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6687 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
6688 	PORT_DIPSETTING(    0x00, "2" )
6689 	PORT_DIPSETTING(    0x0c, "3" )
6690 	PORT_DIPSETTING(    0x08, "4" )
6691 	PORT_DIPSETTING(    0x04, "5" )
6692 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
6693 	PORT_DIPSETTING(    0x20, "Easy" )
6694 	PORT_DIPSETTING(    0x30, "Normal" )
6695 	PORT_DIPSETTING(    0x10, "Hard" )
6696 	PORT_DIPSETTING(    0x00, "Hardest" )
6697 	PORT_DIPNAME( 0xc0, 0xc0, "Time Adjust" )
6698 	PORT_DIPSETTING(    0x00, "2.20" )
6699 	PORT_DIPSETTING(    0x40, "2.40" )
6700 	PORT_DIPSETTING(    0xc0, "3.00" )
6701 	PORT_DIPSETTING(    0x80, "3.30" )
6702 
6703 INPUT_PORTS_END
6704 
6705 /***************************************************************************/
6706 
6707 MACHINE_DRIVER_18( machine_driver_shdancer, \
6708 	shdancer_readmem,shdancer_writemem,shdancer_init_machine, gfx4 )
6709 
6710 /***************************************************************************/
6711 
6712 ROM_START( shdancbl )
6713 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
6714 	ROM_LOAD_EVEN( "ic39", 0x000000, 0x10000, 0xadc1781c )
6715 	ROM_LOAD_ODD ( "ic53", 0x000000, 0x10000, 0x1c1ac463 )
6716 	ROM_LOAD_EVEN( "ic38", 0x020000, 0x10000, 0xcd6e155b )
6717 	ROM_LOAD_ODD ( "ic52", 0x020000, 0x10000, 0xbb3c49a4 )
6718 	ROM_LOAD_EVEN( "ic37", 0x040000, 0x10000, 0x1bd8d5c3 )
6719 	ROM_LOAD_ODD ( "ic51", 0x040000, 0x10000, 0xce2e71b4 )
6720 	ROM_LOAD_EVEN( "ic36", 0x060000, 0x10000, 0xbb861290 )
6721 	ROM_LOAD_ODD ( "ic50", 0x060000, 0x10000, 0x7f7b82b1 )
6722 
6723 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
6724 	ROM_LOAD( "ic4",  0x00000, 0x20000, 0xf0a016fe )
6725 	ROM_LOAD( "ic18", 0x20000, 0x20000, 0xf6bee053 )
6726 	ROM_LOAD( "ic3",  0x40000, 0x20000, 0xe07e6b5d )
6727 	ROM_LOAD( "ic17", 0x60000, 0x20000, 0xf59deba1 )
6728 	ROM_LOAD( "ic2",  0x80000, 0x20000, 0x60095070 )
6729 	ROM_LOAD( "ic16", 0xa0000, 0x20000, 0x0f0d5dd3 )
6730 
6731 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
6732 	ROM_LOAD( "ic73", 0x000000, 0x10000, 0x59e77c96 )
6733 	ROM_LOAD( "ic74", 0x010000, 0x10000, 0x90ea5407 )
6734 	ROM_LOAD( "ic75", 0x020000, 0x10000, 0x27d2fa61 )
6735 	ROM_LOAD( "ic76", 0x030000, 0x10000, 0xf36db688 )
6736 	ROM_LOAD( "ic58", 0x040000, 0x10000, 0x9cd5c8c7 )
6737 	ROM_LOAD( "ic59", 0x050000, 0x10000, 0xff40e872 )
6738 	ROM_LOAD( "ic60", 0x060000, 0x10000, 0x826d7245 )
6739 	ROM_LOAD( "ic61", 0x070000, 0x10000, 0xdcf8068b )
6740 	ROM_LOAD( "ic77", 0x080000, 0x10000, 0xf93470b7 )
6741 	ROM_LOAD( "ic78", 0x090000, 0x10000, 0x4d523ea3 )
6742 	ROM_LOAD( "ic95", 0x0a0000, 0x10000, 0x828b8294 )
6743 	ROM_LOAD( "ic94", 0x0b0000, 0x10000, 0x542b2d1e )
6744 	ROM_LOAD( "ic62", 0x0c0000, 0x10000, 0x50ca8065 )
6745 	ROM_LOAD( "ic63", 0x0d0000, 0x10000, 0xd1866aa9 )
6746 	ROM_LOAD( "ic90", 0x0e0000, 0x10000, 0x3602b758 )
6747 	ROM_LOAD( "ic89", 0x0f0000, 0x10000, 0x1ba4be93 )
6748 	ROM_LOAD( "ic79", 0x100000, 0x10000, 0xf22548ee )
6749 	ROM_LOAD( "ic80", 0x110000, 0x10000, 0x6209f7f9 )
6750 	ROM_LOAD( "ic81", 0x120000, 0x10000, 0x34692f23 )
6751 	ROM_LOAD( "ic82", 0x130000, 0x10000, 0x7ae40237 )
6752 	ROM_LOAD( "ic64", 0x140000, 0x10000, 0x7a8b7bcc )
6753 	ROM_LOAD( "ic65", 0x150000, 0x10000, 0x90ffca14 )
6754 	ROM_LOAD( "ic66", 0x160000, 0x10000, 0x5d655517 )
6755 	ROM_LOAD( "ic67", 0x170000, 0x10000, 0x0e5d0855 )
6756 	ROM_LOAD( "ic83", 0x180000, 0x10000, 0xa9040a32 )
6757 	ROM_LOAD( "ic84", 0x190000, 0x10000, 0xd6810031 )
6758 	ROM_LOAD( "ic92", 0x1a0000, 0x10000, 0xb57d5cb5 )
6759 	ROM_LOAD( "ic91", 0x1b0000, 0x10000, 0x49def6c8 )
6760 	ROM_LOAD( "ic68", 0x1c0000, 0x10000, 0x8d684e53 )
6761 	ROM_LOAD( "ic69", 0x1d0000, 0x10000, 0xc47d32e2 )
6762 	ROM_LOAD( "ic88", 0x1e0000, 0x10000, 0x9de140e1 )
6763 	ROM_LOAD( "ic87", 0x1f0000, 0x10000, 0x8172a991 )
6764 
6765 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
6766 	ROM_LOAD( "ic45", 0x10000, 0x10000, 0x576b3a81 )
6767 	ROM_LOAD( "ic46", 0x20000, 0x10000, 0xc84e8c84 )
6768 ROM_END
6769 
6770 /***************************************************************************/
6771 
6772 /*
6773 static READ_HANDLER( shdancer_skip_r )
6774 {
6775 	if (cpu_get_pc()==0x2f76) {cpu_spinuntil_int(); return 0xffff;}
6776 
6777 	return READ_WORD(&sys16_workingram[0x0000]);
6778 }
6779 */
6780 
6781 static struct MemoryReadAddress shdancbl_readmem[] =
6782 {
6783 	{ 0x000000, 0x07ffff, MRA_ROM },
6784 
6785 	{ 0x400000, 0x40ffff, MRA_TILERAM },
6786 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
6787 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
6788 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
6789 	{ 0xc00000, 0xc00007, MRA_EXTRAM },
6790 	{ 0xc40000, 0xc40001, io_dip1_r },
6791 	{ 0xc40002, 0xc40003, io_dip2_r },
6792 
6793 	{ 0xc41002, 0xc41003, io_player1_r },
6794 	{ 0xc41004, 0xc41005, io_player2_r },
6795 	{ 0xc41000, 0xc41001, io_service_r },
6796 //	{ 0xc40000, 0xc4ffff, MRA_EXTRAM3 },
6797 	{ 0xe40000, 0xe4001f, MRA_EXTRAM2 },
6798 	{ 0xe43034, 0xe43035, MRA_NOP },
6799 //	{ 0xffc000, 0xffc001, shdancer_skip_r },
6800 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
6801 	{-1}
6802 };
6803 
6804 static struct MemoryWriteAddress shdancbl_writemem[] =
6805 {
6806 	{ 0x000000, 0x07ffff, MWA_ROM },
6807 	{ 0x400000, 0x40ffff, MWA_TILERAM },
6808 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
6809 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
6810 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
6811 	{ 0xc00000, 0xc00007, MWA_EXTRAM },
6812 //	{ 0xc40000, 0xc4ffff, MWA_EXTRAM3 },
6813 	{ 0xe40000, 0xe4001f, MWA_EXTRAM2 },
6814 	{ 0xe43034, 0xe43035, MWA_NOP },
6815 	{ 0xfe0006, 0xfe0007, sound_command_nmi_w },
6816 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
6817 	{-1}
6818 };
6819 /***************************************************************************/
6820 
shdancbl_update_proc(void)6821 static void shdancbl_update_proc( void ){
6822 // this is all wrong and needs re-doing.
6823 
6824 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
6825 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
6826 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
6827 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
6828 
6829 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
6830 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
6831 
6832 	sys16_fg2_scrollx = READ_WORD( &sys16_textram[0x0e9c] );
6833 	sys16_bg2_scrollx = READ_WORD( &sys16_textram[0x0e9e] );
6834 	sys16_fg2_scrolly = READ_WORD( &sys16_textram[0x0e94] );
6835 	sys16_bg2_scrolly = READ_WORD( &sys16_textram[0x0e96] );
6836 
6837 	set_fg2_page( READ_WORD( &sys16_textram[0x0e84] ) );
6838 	set_bg2_page( READ_WORD( &sys16_textram[0x0e82] ) );
6839 
6840 	sys18_bg2_active=0;
6841 	sys18_fg2_active=0;
6842 
6843 	if(sys16_fg2_scrollx | sys16_fg2_scrolly | READ_WORD( &sys16_textram[0x0e84] ))
6844 		sys18_fg2_active=1;
6845 	if(sys16_bg2_scrollx | sys16_bg2_scrolly | READ_WORD( &sys16_textram[0x0e86] ))
6846 		sys18_bg2_active=1;
6847 
6848 	set_tile_bank18( READ_WORD( &sys16_extraram[0] ) );
6849 	set_refresh_18( READ_WORD( &sys16_extraram2[0x1c] ) );
6850 }
6851 
6852 
shdancbl_init_machine(void)6853 static void shdancbl_init_machine( void ){
6854 	static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
6855 	sys16_obj_bank = bank;
6856 	sys16_spritelist_end=0x8000;
6857 	sys16_sprxoffset = -0xbc+0x77;
6858 
6859 	sys16_update_proc = shdancbl_update_proc;
6860 }
6861 
init_shdancbl(void)6862 static void init_shdancbl( void ){
6863 	unsigned char *RAM= memory_region(REGION_CPU2);
6864 	int i;
6865 
6866 	sys16_onetime_init_machine();
6867 	sys18_splittab_fg_x=&sys16_textram[0x0f80];
6868 	sys18_splittab_bg_x=&sys16_textram[0x0fc0];
6869 	install_mem_read_handler(0, 0xffc000, 0xffc001, shdancer_skip_r );
6870 #ifdef TRANSPARENT_SHADOWS
6871 	sys16_MaxShadowColors=0;		// doesn't seem to use transparent shadows
6872 #endif
6873 
6874 	memcpy(RAM,&RAM[0x10000],0xa000);
6875 
6876 	/* invert the graphics bits on the tiles */
6877 	for (i = 0; i < 0xc0000; i++)
6878 		memory_region(REGION_GFX1)[i] ^= 0xff;
6879 	sys16_sprite_decode( 4,0x080000 );
6880 }
6881 /***************************************************************************/
6882 
MACHINE_DRIVER_18(machine_driver_shdancbl,shdancbl_readmem,shdancbl_writemem,shdancbl_init_machine,gfx4)6883 MACHINE_DRIVER_18( machine_driver_shdancbl, \
6884 	shdancbl_readmem,shdancbl_writemem,shdancbl_init_machine, gfx4 )
6885 
6886 /***************************************************************************/
6887 // sys18
6888 ROM_START( shdancrj )
6889 	ROM_REGION( 0x080000, REGION_CPU1 ) /* 68000 code */
6890 	ROM_LOAD_EVEN( "sd12722b.bin", 0x000000, 0x40000, 0xc00552a2 )
6891 	ROM_LOAD_ODD ( "sd12721b.bin", 0x000000, 0x40000, 0x653d351a )
6892 
6893 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
6894 	ROM_LOAD( "sd12712.bin",  0x00000, 0x40000, 0x9bdabe3d )
6895 	ROM_LOAD( "sd12713.bin",  0x40000, 0x40000, 0x852d2b1c )
6896 	ROM_LOAD( "sd12714.bin",  0x80000, 0x40000, 0x448226ce )
6897 
6898 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
6899 	ROM_LOAD( "sd12719.bin",  0x000000, 0x40000, 0xd6888534 )
6900 	ROM_LOAD( "sd12726.bin",  0x040000, 0x40000, 0xff344945 )
6901 	ROM_LOAD( "sd12718.bin",  0x080000, 0x40000, 0xba2efc0c )
6902 	ROM_LOAD( "sd12725.bin",  0x0c0000, 0x40000, 0x268a0c17 )
6903 	ROM_LOAD( "sd12717.bin",  0x100000, 0x40000, 0xc81cc4f8 )
6904 	ROM_LOAD( "sd12724.bin",  0x140000, 0x40000, 0x0f4903dc )
6905 	ROM_LOAD( "sd12716.bin",  0x180000, 0x40000, 0xa870e629 )
6906 	ROM_LOAD( "sd12723.bin",  0x1c0000, 0x40000, 0xc606cf90 )
6907 
6908 	ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
6909 	ROM_LOAD( "sd12720.bin", 0x10000, 0x20000, 0x7a0d8de1 )
6910 	ROM_LOAD( "sd12715.bin", 0x30000, 0x40000, 0x07051a52 )
6911 ROM_END
6912 
6913 /***************************************************************************/
6914 static READ_HANDLER( shdancrj_skip_r )
6915 {
6916 	if (cpu_get_pc()==0x2f70) {cpu_spinuntil_int(); return 0xffff;}
6917 
6918 	return READ_WORD(&sys16_workingram[0xc000]);
6919 }
6920 
shdancrj_init_machine(void)6921 static void shdancrj_init_machine( void ){
6922 	static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
6923 	sys16_obj_bank = bank;
6924 	sys16_spritelist_end=0x8000;
6925 
6926 	patch_code(0x6821, 0xdf);
6927 	sys16_update_proc = shdancer_update_proc;
6928 }
6929 
init_shdancrj(void)6930 static void init_shdancrj( void ){
6931 	unsigned char *RAM= memory_region(REGION_CPU2);
6932 	sys16_onetime_init_machine();
6933 	sys18_splittab_fg_x=&sys16_textram[0x0f80];
6934 	sys18_splittab_bg_x=&sys16_textram[0x0fc0];
6935 	install_mem_read_handler(0, 0xffc000, 0xffc001, shdancrj_skip_r );
6936 
6937 	memcpy(RAM,&RAM[0x10000],0xa000);
6938 
6939 	sys16_sprite_decode( 4,0x080000 );
6940 }
6941 
6942 /***************************************************************************/
6943 
MACHINE_DRIVER_18(machine_driver_shdancrj,shdancer_readmem,shdancer_writemem,shdancrj_init_machine,gfx4)6944 MACHINE_DRIVER_18( machine_driver_shdancrj, \
6945 	shdancer_readmem,shdancer_writemem,shdancrj_init_machine, gfx4 )
6946 
6947 /***************************************************************************/
6948 // sys16B
6949 ROM_START( shinobi )
6950 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
6951 	ROM_LOAD_EVEN( "shinobi.a4", 0x000000, 0x10000, 0xb930399d )
6952 	ROM_LOAD_ODD ( "shinobi.a1", 0x000000, 0x10000, 0x343f4c46 )
6953 	ROM_LOAD_EVEN( "epr11283",   0x020000, 0x10000, 0x9d46e707 )
6954 	ROM_LOAD_ODD ( "epr11281",   0x020000, 0x10000, 0x7961d07e )
6955 
6956 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
6957 	ROM_LOAD( "shinobi.b9",  0x00000, 0x10000, 0x5f62e163 )
6958 	ROM_LOAD( "shinobi.b10", 0x10000, 0x10000, 0x75f8fbc9 )
6959 	ROM_LOAD( "shinobi.b11", 0x20000, 0x10000, 0x06508bb9 )
6960 
6961 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
6962 	ROM_LOAD( "epr11290.10", 0x00000, 0x10000, 0x611f413a )
6963 	ROM_LOAD( "epr11294.11", 0x10000, 0x10000, 0x5eb00fc1 )
6964 	ROM_LOAD( "epr11291.17", 0x20000, 0x10000, 0x3c0797c0 )
6965 	ROM_LOAD( "epr11295.18", 0x30000, 0x10000, 0x25307ef8 )
6966 	ROM_LOAD( "epr11292.23", 0x40000, 0x10000, 0xc29ac34e )
6967 	ROM_LOAD( "epr11296.24", 0x50000, 0x10000, 0x04a437f8 )
6968 	ROM_LOAD( "epr11293.29", 0x60000, 0x10000, 0x41f41063 )
6969 	ROM_LOAD( "epr11297.30", 0x70000, 0x10000, 0xb6e1fd72 )
6970 
6971 	ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
6972 	ROM_LOAD( "shinobi.a7", 0x0000, 0x8000, 0x2457a7cf )
6973 	ROM_LOAD( "shinobi.a8", 0x10000, 0x8000, 0xc8df8460 )
6974 	ROM_LOAD( "shinobi.a9", 0x18000, 0x8000, 0xe5a4cf30 )
6975 
6976 ROM_END
6977 
6978 ROM_START( shinobib )
6979 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
6980 // Custom cpu 317-0049
6981 	ROM_LOAD_EVEN( "epr11282", 0x000000, 0x10000, 0x5f2e5524 )
6982 	ROM_LOAD_ODD ( "epr11280", 0x000000, 0x10000, 0xbdfe5c38 )
6983 	ROM_LOAD_EVEN( "epr11283", 0x020000, 0x10000, 0x9d46e707 )
6984 	ROM_LOAD_ODD ( "epr11281", 0x020000, 0x10000, 0x7961d07e )
6985 
6986 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
6987 	ROM_LOAD( "shinobi.b9",  0x00000, 0x10000, 0x5f62e163 )
6988 	ROM_LOAD( "shinobi.b10", 0x10000, 0x10000, 0x75f8fbc9 )
6989 	ROM_LOAD( "shinobi.b11", 0x20000, 0x10000, 0x06508bb9 )
6990 
6991 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
6992 	ROM_LOAD( "epr11290.10", 0x00000, 0x10000, 0x611f413a )
6993 	ROM_LOAD( "epr11294.11", 0x10000, 0x10000, 0x5eb00fc1 )
6994 	ROM_LOAD( "epr11291.17", 0x20000, 0x10000, 0x3c0797c0 )
6995 	ROM_LOAD( "epr11295.18", 0x30000, 0x10000, 0x25307ef8 )
6996 	ROM_LOAD( "epr11292.23", 0x40000, 0x10000, 0xc29ac34e )
6997 	ROM_LOAD( "epr11296.24", 0x50000, 0x10000, 0x04a437f8 )
6998 	ROM_LOAD( "epr11293.29", 0x60000, 0x10000, 0x41f41063 )
6999 	ROM_LOAD( "epr11297.30", 0x70000, 0x10000, 0xb6e1fd72 )
7000 
7001 	ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
7002 	ROM_LOAD( "shinobi.a7", 0x0000, 0x8000, 0x2457a7cf )
7003 	ROM_LOAD( "shinobi.a8", 0x10000, 0x8000, 0xc8df8460 )
7004 	ROM_LOAD( "shinobi.a9", 0x18000, 0x8000, 0xe5a4cf30 )
7005 
7006 ROM_END
7007 
7008 /***************************************************************************/
7009 
7010 static READ_HANDLER( shinobi_skip_r )
7011 {
7012 	if (cpu_get_pc()==0x32e0) {cpu_spinuntil_int(); return 1<<8;}
7013 
7014 	return READ_WORD(&sys16_workingram[0x301c]);
7015 }
7016 
7017 static struct MemoryReadAddress shinobi_readmem[] =
7018 {
7019 	{ 0x000000, 0x03ffff, MRA_ROM },
7020 	{ 0x400000, 0x40ffff, MRA_TILERAM },
7021 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
7022 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
7023 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
7024 	{ 0xc41002, 0xc41003, io_player1_r },
7025 	{ 0xc41006, 0xc41007, io_player2_r },
7026 	{ 0xc41000, 0xc41001, io_service_r },
7027 	{ 0xc42002, 0xc42003, io_dip1_r },
7028 	{ 0xc42000, 0xc42001, io_dip2_r },
7029 	{ 0xc40000, 0xc40001, MRA_EXTRAM2 },
7030 	{ 0xc43000, 0xc43001, MRA_NOP },
7031 	{ 0xfff01c, 0xfff01d, shinobi_skip_r },
7032 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
7033 	{-1}
7034 };
7035 
7036 static struct MemoryWriteAddress shinobi_writemem[] =
7037 {
7038 	{ 0x000000, 0x03ffff, MWA_ROM },
7039 	{ 0x400000, 0x40ffff, MWA_TILERAM },
7040 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
7041 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
7042 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
7043 	{ 0xc40000, 0xc40001, MWA_EXTRAM2 },
7044 	{ 0xc43000, 0xc43001, MWA_NOP },
7045 	{ 0xfe0006, 0xfe0007, sound_command_w },
7046 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
7047 	{-1}
7048 };
7049 
7050 /***************************************************************************/
7051 
shinobi_update_proc(void)7052 static void shinobi_update_proc( void ){
7053 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
7054 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
7055 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
7056 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
7057 
7058 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
7059 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
7060 
7061 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
7062 }
7063 
shinobi_init_machine(void)7064 static void shinobi_init_machine( void ){
7065 	static int bank[16] = { 0,0,0,0,0,0,0,6,0,0,0,4,0,2,0,0 };
7066 	sys16_obj_bank = bank;
7067 	sys16_dactype = 1;
7068 	sys16_update_proc = shinobi_update_proc;
7069 }
7070 
init_shinobi(void)7071 static void init_shinobi( void )
7072 {
7073 	sys16_onetime_init_machine();
7074 	sys16_sprite_decode( 4,0x20000 );
7075 }
7076 
7077 /***************************************************************************/
7078 
7079 INPUT_PORTS_START( shinobi )
7080 	SYS16_JOY1
7081 	SYS16_JOY2
7082 	SYS16_SERVICE
7083 	SYS16_COINAGE
7084 
7085 PORT_START
7086 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
7087 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
7088 	PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
7089 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
7090 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
7091 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7092 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
7093 	PORT_DIPSETTING(    0x08, "2" )
7094 	PORT_DIPSETTING(    0x0c, "3" )
7095 	PORT_DIPSETTING(    0x04, "5" )
7096 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "240", IP_KEY_NONE, IP_JOY_NONE )
7097 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
7098 	PORT_DIPSETTING(    0x20, "Easy" )
7099 	PORT_DIPSETTING(    0x30, "Normal" )
7100 	PORT_DIPSETTING(    0x10, "Hard" )
7101 	PORT_DIPSETTING(    0x00, "Hardest" )
7102 	PORT_DIPNAME( 0x40, 0x40, "Enemy's Bullet Speed" )
7103 	PORT_DIPSETTING(    0x40, "Slow" )
7104 	PORT_DIPSETTING(    0x00, "Fast" )
7105 	PORT_DIPNAME( 0x80, 0x80, "Language" )
7106 	PORT_DIPSETTING(    0x80, "Japanese" )
7107 	PORT_DIPSETTING(    0x00, "English" )
7108 
7109 INPUT_PORTS_END
7110 
7111 /***************************************************************************/
7112 
7113 MACHINE_DRIVER_7759( machine_driver_shinobi, \
7114 	shinobi_readmem,shinobi_writemem,shinobi_init_machine, gfx1,upd7759_interface )
7115 
7116 /***************************************************************************/
7117 // sys16A
7118 ROM_START( shinobia )
7119 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
7120 // custom cpu 317-0050
7121 	ROM_LOAD_EVEN( "epr11262.42", 0x000000, 0x10000, 0xd4b8df12 )
7122 	ROM_LOAD_ODD ( "epr11260.27", 0x000000, 0x10000, 0x2835c95d )
7123 	ROM_LOAD_EVEN( "epr11263.43", 0x020000, 0x10000, 0xa2a620bd )
7124 	ROM_LOAD_ODD ( "epr11261.25", 0x020000, 0x10000, 0xa3ceda52 )
7125 
7126 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7127 	ROM_LOAD( "epr11264.95", 0x00000, 0x10000, 0x46627e7d )
7128 	ROM_LOAD( "epr11265.94", 0x10000, 0x10000, 0x87d0f321 )
7129 	ROM_LOAD( "epr11266.93", 0x20000, 0x10000, 0xefb4af87 )
7130 
7131 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
7132 	ROM_LOAD( "epr11290.10", 0x00000, 0x10000, 0x611f413a )
7133 	ROM_LOAD( "epr11294.11", 0x10000, 0x10000, 0x5eb00fc1 )
7134 	ROM_LOAD( "epr11291.17", 0x20000, 0x10000, 0x3c0797c0 )
7135 	ROM_LOAD( "epr11295.18", 0x30000, 0x10000, 0x25307ef8 )
7136 	ROM_LOAD( "epr11292.23", 0x40000, 0x10000, 0xc29ac34e )
7137 	ROM_LOAD( "epr11296.24", 0x50000, 0x10000, 0x04a437f8 )
7138 	ROM_LOAD( "epr11293.29", 0x60000, 0x10000, 0x41f41063 )
7139 	ROM_LOAD( "epr11297.30", 0x70000, 0x10000, 0xb6e1fd72 )
7140 
7141 	ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
7142 	ROM_LOAD( "epr11267.12", 0x0000, 0x8000, 0xdd50b745 )
7143 
7144 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
7145 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
7146 
7147 	ROM_REGION( 0x08000, REGION_SOUND1 ) /* 7751 sound data */
7148 	ROM_LOAD( "epr11268.1", 0x0000, 0x8000, 0x6d7966da )
7149 ROM_END
7150 
7151 
7152 ROM_START( shinobl )
7153 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
7154 // Star Bootleg
7155 	ROM_LOAD_EVEN( "b3",          0x000000, 0x10000, 0x38e59646 )
7156 	ROM_LOAD_ODD ( "b1",          0x000000, 0x10000, 0x8529d192 )
7157 	ROM_LOAD_EVEN( "epr11263.43", 0x020000, 0x10000, 0xa2a620bd )
7158 	ROM_LOAD_ODD ( "epr11261.25", 0x020000, 0x10000, 0xa3ceda52 )
7159 
7160 // Beta Bootleg
7161 //	ROM_LOAD_EVEN( "4",           0x000000, 0x10000, 0xc178a39c )
7162 //	ROM_LOAD_ODD ( "2",           0x000000, 0x10000, 0x5ad8ebf2 )
7163 //	ROM_LOAD_EVEN( "epr11263.43", 0x020000, 0x10000, 0xa2a620bd )
7164 //	ROM_LOAD_ODD ( "epr11261.25", 0x020000, 0x10000, 0xa3ceda52 )
7165 
7166 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7167 	ROM_LOAD( "epr11264.95", 0x00000, 0x10000, 0x46627e7d )
7168 	ROM_LOAD( "epr11265.94", 0x10000, 0x10000, 0x87d0f321 )
7169 	ROM_LOAD( "epr11266.93", 0x20000, 0x10000, 0xefb4af87 )
7170 
7171 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
7172 	ROM_LOAD( "epr11290.10", 0x00000, 0x10000, 0x611f413a )
7173 	ROM_LOAD( "epr11294.11", 0x10000, 0x10000, 0x5eb00fc1 )
7174 	ROM_LOAD( "epr11291.17", 0x20000, 0x10000, 0x3c0797c0 )
7175 	ROM_LOAD( "epr11295.18", 0x30000, 0x10000, 0x25307ef8 )
7176 	ROM_LOAD( "epr11292.23", 0x40000, 0x10000, 0xc29ac34e )
7177 	ROM_LOAD( "epr11296.24", 0x50000, 0x10000, 0x04a437f8 )
7178 	ROM_LOAD( "epr11293.29", 0x60000, 0x10000, 0x41f41063 )
7179 //	ROM_LOAD( "epr11297.30", 0x70000, 0x10000, 0xb6e1fd72 )
7180 	ROM_LOAD( "b17",         0x70000, 0x10000, 0x0315cf42 )	// Beta bootleg uses the rom above.
7181 
7182 	ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
7183 	ROM_LOAD( "epr11267.12", 0x0000, 0x8000, 0xdd50b745 )
7184 
7185 	ROM_REGION( 0x1000, REGION_CPU3 )      /* 4k for 7751 onboard ROM */
7186 	ROM_LOAD( "7751.bin",     0x0000, 0x0400, 0x6a9534fc ) /* 7751 - U34 */
7187 
7188 	ROM_REGION( 0x08000, REGION_SOUND1 ) /* 7751 sound data */
7189 	ROM_LOAD( "epr11268.1", 0x0000, 0x8000, 0x6d7966da )
7190 ROM_END
7191 
7192 /***************************************************************************/
7193 
7194 static struct MemoryReadAddress shinobl_readmem[] =
7195 {
7196 	{ 0x000000, 0x03ffff, MRA_ROM },
7197 	{ 0x400000, 0x40ffff, MRA_TILERAM },
7198 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
7199 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
7200 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
7201 	{ 0xc41002, 0xc41003, io_player1_r },
7202 	{ 0xc41006, 0xc41007, io_player2_r },
7203 	{ 0xc41000, 0xc41001, io_service_r },
7204 	{ 0xc42000, 0xc42001, io_dip1_r },
7205 	{ 0xc42002, 0xc42003, io_dip2_r },
7206 	{ 0xc40000, 0xc40fff, MRA_EXTRAM2 },
7207 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
7208 	{-1}
7209 };
7210 
7211 static struct MemoryWriteAddress shinobl_writemem[] =
7212 {
7213 	{ 0x000000, 0x03ffff, MWA_ROM },
7214 	{ 0x400000, 0x40ffff, MWA_TILERAM },
7215 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
7216 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
7217 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
7218 	{ 0xc40000, 0xc40001, sound_command_nmi_w },
7219 	{ 0xc40000, 0xc40fff, MWA_EXTRAM2 },
7220 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
7221 	{-1}
7222 };
7223 
7224 /***************************************************************************/
7225 
shinobl_update_proc(void)7226 static void shinobl_update_proc( void ){
7227 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
7228 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
7229 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
7230 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
7231 
7232 	set_fg_page( READ_WORD( &sys16_textram[0x0e9e] ) );
7233 	set_bg_page( READ_WORD( &sys16_textram[0x0e9c] ) );
7234 
7235 	set_refresh_3d( READ_WORD( &sys16_extraram2[2] ) );
7236 
7237 }
7238 
shinobl_init_machine(void)7239 static void shinobl_init_machine( void ){
7240 	static int bank[16] = {0,2,4,6,1,3,5,7,0,0,0,0,0,0,0,0};
7241 	sys16_obj_bank = bank;
7242 	sys16_textmode=1;
7243 	sys16_spritesystem = 2;
7244 	sys16_sprxoffset = -0xbc;
7245 	sys16_fgxoffset = sys16_bgxoffset = 7;
7246 	sys16_tilebank_switch=0x2000;
7247 
7248 	sys16_dactype = 1;
7249 	sys16_update_proc = shinobl_update_proc;
7250 }
7251 
7252 
7253 
7254 /***************************************************************************/
7255 
7256 MACHINE_DRIVER_7751( machine_driver_shinobl, \
7257 	shinobl_readmem,shinobl_writemem,shinobl_init_machine, gfx1)
7258 
7259 /***************************************************************************/
7260 
7261 // sys16A custom
7262 ROM_START( tetris )
7263 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
7264 	ROM_LOAD_EVEN( "epr12201.rom", 0x000000, 0x8000, 0x338e9b51 )
7265 	ROM_LOAD_ODD ( "epr12200.rom", 0x000000, 0x8000, 0xfb058779 )
7266 
7267 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7268 	ROM_LOAD( "epr12202.rom", 0x00000, 0x10000, 0x2f7da741 )
7269 	ROM_LOAD( "epr12203.rom", 0x10000, 0x10000, 0xa6e58ec5 )
7270 	ROM_LOAD( "epr12204.rom", 0x20000, 0x10000, 0x0ae98e23 )
7271 
7272 	ROM_REGION( 0x010000*2, REGION_GFX2 ) /* sprites */
7273 	ROM_LOAD( "epr12169.rom", 0x0000, 0x8000, 0xdacc6165 )
7274 	ROM_LOAD( "epr12170.rom", 0x8000, 0x8000, 0x87354e42 )
7275 
7276 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
7277 	ROM_LOAD( "epr12205.rom", 0x0000, 0x8000, 0x6695dc99 )
7278 ROM_END
7279 
7280 // sys16B
7281 ROM_START( tetrisbl )
7282 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
7283 	ROM_LOAD_EVEN( "rom2.bin", 0x000000, 0x10000, 0x4d165c38 )
7284 	ROM_LOAD_ODD ( "rom1.bin", 0x000000, 0x10000, 0x1e912131 )
7285 
7286 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7287 	ROM_LOAD( "scr01.rom", 0x00000, 0x10000, 0x62640221 )
7288 	ROM_LOAD( "scr02.rom", 0x10000, 0x10000, 0x9abd183b )
7289 	ROM_LOAD( "scr03.rom", 0x20000, 0x10000, 0x2495fd4e )
7290 
7291 	ROM_REGION( 0x020000*2, REGION_GFX2 ) /* sprites */
7292 	ROM_LOAD( "obj0-o.rom", 0x00000, 0x10000, 0x2fb38880 )
7293 	ROM_LOAD( "obj0-e.rom", 0x10000, 0x10000, 0xd6a02cba )
7294 
7295 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
7296 	ROM_LOAD( "s-prog.rom", 0x0000, 0x8000, 0xbd9ba01b )
7297 ROM_END
7298 
7299 // sys16B
7300 ROM_START( tetrisa )
7301 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
7302 // Custom Cpu 317-0092
7303 	ROM_LOAD_EVEN( "tetris.a7", 0x000000, 0x10000, 0x9ce15ac9 )
7304 	ROM_LOAD_ODD ( "tetris.a5", 0x000000, 0x10000, 0x98d590ca )
7305 
7306 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7307 	ROM_LOAD( "scr01.rom", 0x00000, 0x10000, 0x62640221 )
7308 	ROM_LOAD( "scr02.rom", 0x10000, 0x10000, 0x9abd183b )
7309 	ROM_LOAD( "scr03.rom", 0x20000, 0x10000, 0x2495fd4e )
7310 
7311 	ROM_REGION( 0x020000*2, REGION_GFX2 ) /* sprites */
7312 	ROM_LOAD( "obj0-o.rom", 0x00000, 0x10000, 0x2fb38880 )
7313 	ROM_LOAD( "obj0-e.rom", 0x10000, 0x10000, 0xd6a02cba )
7314 
7315 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
7316 	ROM_LOAD( "s-prog.rom", 0x0000, 0x8000, 0xbd9ba01b )
7317 ROM_END
7318 
7319 /***************************************************************************/
7320 
7321 static struct MemoryReadAddress tetris_readmem[] =
7322 {
7323 	{ 0x000000, 0x01ffff, MRA_ROM },
7324 	{ 0x400000, 0x40ffff, MRA_TILERAM },
7325 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
7326 	{ 0x418000, 0x41803f, MRA_EXTRAM2 },
7327 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
7328 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
7329 	{ 0xc40000, 0xc40001, MRA_EXTRAM },
7330 	{ 0xc41002, 0xc41003, io_player1_r },
7331 	{ 0xc41006, 0xc41007, io_player2_r },
7332 	{ 0xc41000, 0xc41001, io_service_r },
7333 	{ 0xc42002, 0xc42003, io_dip1_r },
7334 	{ 0xc42000, 0xc42001, io_dip2_r },
7335 	{ 0xc80000, 0xc80001, MRA_NOP },
7336 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
7337 	{-1}
7338 };
7339 
7340 static struct MemoryWriteAddress tetris_writemem[] =
7341 {
7342 	{ 0x000000, 0x01ffff, MWA_ROM },
7343 	{ 0x400000, 0x40ffff, MWA_TILERAM },
7344 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
7345 	{ 0x418000, 0x41803f, MWA_EXTRAM2 },
7346 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
7347 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
7348 	{ 0xc40000, 0xc40001, MWA_EXTRAM },
7349 	{ 0xc42006, 0xc42007, sound_command_w },
7350 	{ 0xc43034, 0xc43035, MWA_NOP },
7351 	{ 0xc80000, 0xc80001, MWA_NOP },
7352 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
7353 	{-1}
7354 };
7355 /***************************************************************************/
7356 
tetris_update_proc(void)7357 static void tetris_update_proc( void ){
7358 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
7359 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
7360 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
7361 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
7362 
7363 	set_fg_page( READ_WORD( &sys16_extraram2[0x38] ) );
7364 	set_bg_page( READ_WORD( &sys16_extraram2[0x28] ) );
7365 
7366 	set_refresh( READ_WORD( &sys16_extraram[0x0] ) );
7367 }
7368 
tetris_init_machine(void)7369 static void tetris_init_machine( void ){
7370 	static int bank[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
7371 
7372 	sys16_obj_bank = bank;
7373 
7374 	patch_code( 0xba6, 0x4e );
7375 	patch_code( 0xba7, 0x71 );
7376 
7377 	sys16_sprxoffset = -0x40;
7378 	sys16_update_proc = tetris_update_proc;
7379 }
7380 
init_tetris(void)7381 static void init_tetris( void )
7382 {
7383 	sys16_onetime_init_machine();
7384 	sys16_sprite_decode( 1,0x10000 );
7385 }
7386 
init_tetrisbl(void)7387 static void init_tetrisbl( void )
7388 {
7389 	sys16_onetime_init_machine();
7390 	sys16_sprite_decode( 1,0x20000 );
7391 }
7392 /***************************************************************************/
7393 
INPUT_PORTS_START(tetris)7394 INPUT_PORTS_START( tetris )
7395 	SYS16_JOY1
7396 	SYS16_JOY2
7397 	SYS16_SERVICE
7398 	SYS16_COINAGE /* unconfirmed */
7399 
7400 PORT_START	/* DSW1 */
7401 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
7402 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
7403 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7404 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
7405 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
7406 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7407 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) )	// from the code it looks like some kind of difficulty
7408 	PORT_DIPSETTING(    0x0c, "A" )					// level, but all 4 levels points to the same place
7409 	PORT_DIPSETTING(    0x08, "B" )					// so it doesn't actually change anything!!
7410 	PORT_DIPSETTING(    0x04, "C" )
7411 	PORT_DIPSETTING(    0x00, "D" )
7412 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
7413 	PORT_DIPSETTING(    0x20, "Easy" )
7414 	PORT_DIPSETTING(    0x30, "Normal" )
7415 	PORT_DIPSETTING(    0x10, "Hard" )
7416 	PORT_DIPSETTING(    0x00, "Hardest" )
7417 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
7418 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
7419 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7420 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
7421 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
7422 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7423 INPUT_PORTS_END
7424 
7425 /***************************************************************************/
7426 
7427 MACHINE_DRIVER( machine_driver_tetris, \
7428 	tetris_readmem,tetris_writemem,tetris_init_machine, gfx1 )
7429 
7430 /***************************************************************************/
7431 // sys16B
7432 ROM_START( timscanr )
7433 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
7434 	ROM_LOAD_EVEN( "ts10853.bin", 0x00000, 0x8000, 0x24d7c5fb )
7435 	ROM_LOAD_ODD ( "ts10850.bin", 0x00000, 0x8000, 0xf1575732 )
7436 	ROM_LOAD_EVEN( "ts10854.bin", 0x10000, 0x8000, 0x82d0b237 )
7437 	ROM_LOAD_ODD ( "ts10851.bin", 0x10000, 0x8000, 0xf5ce271b )
7438 	ROM_LOAD_EVEN( "ts10855.bin", 0x20000, 0x8000, 0x63e95a53 )
7439 	ROM_LOAD_ODD ( "ts10852.bin", 0x20000, 0x8000, 0x7cd1382b )
7440 
7441 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7442 	ROM_LOAD( "timscanr.b9",  0x00000, 0x8000, 0x07dccc37 )
7443 	ROM_LOAD( "timscanr.b10", 0x08000, 0x8000, 0x84fb9a3a )
7444 	ROM_LOAD( "timscanr.b11", 0x10000, 0x8000, 0xc8694bc0 )
7445 
7446 	ROM_REGION( 0x40000*2, REGION_GFX2 ) /* sprites */
7447 	ROM_LOAD( "ts10548.bin", 0x00000, 0x8000, 0xaa150735 )
7448 	ROM_LOAD( "ts10552.bin", 0x08000, 0x8000, 0x6fcbb9f7 )
7449 	ROM_LOAD( "ts10549.bin", 0x10000, 0x8000, 0x2f59f067 )
7450 	ROM_LOAD( "ts10553.bin", 0x18000, 0x8000, 0x8a220a9f )
7451 	ROM_LOAD( "ts10550.bin", 0x20000, 0x8000, 0xf05069ff )
7452 	ROM_LOAD( "ts10554.bin", 0x28000, 0x8000, 0xdc64f809 )
7453 	ROM_LOAD( "ts10551.bin", 0x30000, 0x8000, 0x435d811f )
7454 	ROM_LOAD( "ts10555.bin", 0x38000, 0x8000, 0x2143c471 )
7455 
7456 	ROM_REGION( 0x18000, REGION_CPU2 ) /* sound CPU */
7457 	ROM_LOAD( "ts10562.bin", 0x0000, 0x8000, 0x3f5028bf )
7458 	ROM_LOAD( "ts10563.bin", 0x10000, 0x8000, 0x9db7eddf )
7459 ROM_END
7460 
7461 /***************************************************************************/
7462 
7463 static READ_HANDLER( timscanr_skip_r )
7464 {
7465 	if (cpu_get_pc()==0x1044c) {cpu_spinuntil_int(); return 0;}
7466 
7467 	return READ_WORD(&sys16_workingram[0x000c]);
7468 }
7469 
7470 
7471 static struct MemoryReadAddress timscanr_readmem[] =
7472 {
7473 	{ 0x000000, 0x02ffff, MRA_ROM },
7474 	{ 0x400000, 0x40ffff, MRA_TILERAM },
7475 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
7476 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
7477 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
7478 	{ 0xc41002, 0xc41003, io_player1_r },
7479 	{ 0xc41006, 0xc41007, io_player2_r },
7480 	{ 0xc41000, 0xc41001, io_service_r },
7481 	{ 0xc42002, 0xc42003, io_dip1_r },
7482 	{ 0xc42000, 0xc42001, io_dip2_r },
7483 	{ 0xc41004, 0xc41005, io_dip3_r },
7484 	{ 0xffc00c, 0xffc00d, timscanr_skip_r },
7485 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
7486 	{-1}
7487 };
7488 
7489 static struct MemoryWriteAddress timscanr_writemem[] =
7490 {
7491 	{ 0x000000, 0x02ffff, MWA_ROM },
7492 	{ 0x400000, 0x40ffff, MWA_TILERAM },
7493 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
7494 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
7495 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
7496 	{ 0xc40000, 0xc40001, MWA_EXTRAM },
7497 	{ 0xfe0006, 0xfe0007, sound_command_w },
7498 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
7499 	{-1}
7500 };
7501 /***************************************************************************/
7502 
timscanr_update_proc(void)7503 static void timscanr_update_proc( void ){
7504 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
7505 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
7506 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
7507 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
7508 
7509 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
7510 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
7511 
7512 	set_refresh( READ_WORD( &sys16_extraram[0x0] ) );
7513 }
7514 
timscanr_init_machine(void)7515 static void timscanr_init_machine( void ){
7516 	static int bank[16] = {00,00,00,00,00,00,00,0x03,00,00,00,0x02,00,0x01,00,00};
7517 	sys16_obj_bank = bank;
7518 	sys16_textmode=1;
7519 	sys16_update_proc = timscanr_update_proc;
7520 }
7521 
init_timscanr(void)7522 static void init_timscanr( void )
7523 {
7524 	sys16_onetime_init_machine();
7525 	sys16_sprite_decode( 4,0x10000 );
7526 }
7527 /***************************************************************************/
7528 
7529 INPUT_PORTS_START( timscanr )
7530 	SYS16_JOY1
7531 	SYS16_JOY2
7532 	SYS16_SERVICE
7533 	SYS16_COINAGE
7534 
7535 PORT_START	/* DSW2 */
7536 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )		//??
7537 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
7538 	PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
7539 	PORT_DIPNAME( 0x1e, 0x14, "Bonus" )
7540 	PORT_DIPSETTING(    0x16, "Replay 1000000/2000000" )
7541 	PORT_DIPSETTING(    0x14, "Replay 1200000/2500000" )
7542 	PORT_DIPSETTING(    0x12, "Replay 1500000/3000000" )
7543 	PORT_DIPSETTING(    0x10, "Replay 2000000/4000000" )
7544 	PORT_DIPSETTING(    0x1c, "Replay 1000000" )
7545 	PORT_DIPSETTING(    0x1e, "Replay 1200000" )
7546 	PORT_DIPSETTING(    0x1a, "Replay 1500000" )
7547 	PORT_DIPSETTING(    0x18, "Replay 1800000" )
7548 	PORT_DIPSETTING(    0x0e, "ExtraBall 100000" )
7549 	PORT_DIPSETTING(    0x0c, "ExtraBall 200000" )
7550 	PORT_DIPSETTING(    0x0a, "ExtraBall 300000" )
7551 	PORT_DIPSETTING(    0x08, "ExtraBall 400000" )
7552 	PORT_DIPSETTING(    0x06, "ExtraBall 500000" )
7553 	PORT_DIPSETTING(    0x04, "ExtraBall 600000" )
7554 	PORT_DIPSETTING(    0x02, "ExtraBall 700000" )
7555 	PORT_DIPSETTING(    0x00, "None" )
7556 
7557 	PORT_DIPNAME( 0x20, 0x20, "Match" )
7558 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
7559 	PORT_DIPSETTING(    0x20, DEF_STR( On ) )
7560 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
7561 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
7562 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7563 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Lives ) )
7564 	PORT_DIPSETTING(    0x80, "3" )
7565 	PORT_DIPSETTING(    0x00, "5" )
7566 
7567 PORT_START	/* DSW3 */
7568 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )		//??
7569 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
7570 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7571 	PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
7572 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
7573 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7574 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) )
7575 	PORT_DIPSETTING(    0x04, "1" )
7576 	PORT_DIPSETTING(    0x0c, "2" )
7577 	PORT_DIPSETTING(    0x08, "3" )
7578 	PORT_DIPSETTING(    0x00, "None" )
7579 	PORT_DIPNAME( 0x10, 0x10, "Allow Continue" )
7580 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
7581 	PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
7582 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
7583 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
7584 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7585 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
7586 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
7587 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7588 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
7589 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
7590 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7591 
7592 INPUT_PORTS_END
7593 
7594 /***************************************************************************/
7595 
7596 MACHINE_DRIVER_7759( machine_driver_timscanr, \
7597 	timscanr_readmem,timscanr_writemem,timscanr_init_machine, gfx8,upd7759_interface )
7598 
7599 /***************************************************************************/
7600 
7601 // sys16B
7602 ROM_START( toryumon )
7603 	ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
7604 	ROM_LOAD_EVEN( "17689",  0x00000, 0x20000, 0x4f0dee19 )
7605 	ROM_LOAD_ODD ( "17688",  0x00000, 0x20000, 0x717d81c7 )
7606 
7607 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7608 	ROM_LOAD( "17700", 0x00000, 0x40000, 0x8f288b37 )
7609 	ROM_LOAD( "17701", 0x40000, 0x40000, 0x6dfb025b )
7610 	ROM_LOAD( "17702", 0x80000, 0x40000, 0xae0b7eab )
7611 
7612 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
7613 	ROM_LOAD( "17692", 0x00000, 0x20000, 0x543c4327 )
7614 	ROM_LOAD( "17695", 0x20000, 0x20000, 0xee60f244 )
7615 	ROM_LOAD( "17693", 0x40000, 0x20000, 0x4a350b3e )
7616 	ROM_LOAD( "17696", 0x60000, 0x20000, 0x6edb54f1 )
7617 	ROM_LOAD( "17694", 0x80000, 0x20000, 0xb296d71d )
7618 	ROM_LOAD( "17697", 0xa0000, 0x20000, 0x6ccb7b28 )
7619 	ROM_LOAD( "17698", 0xc0000, 0x20000, 0xcd4dfb82 )
7620 	ROM_LOAD( "17699", 0xe0000, 0x20000, 0x2694ecce )
7621 
7622 
7623 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
7624 	ROM_LOAD( "17691", 0x00000,  0x08000, 0x14205388 )
7625 	ROM_LOAD( "17690", 0x10000,  0x40000, 0x4f9ba4e4 )
7626 ROM_END
7627 
7628 /***************************************************************************/
7629 
7630 static struct MemoryReadAddress toryumon_readmem[] =
7631 {
7632 	{ 0x000000, 0x03ffff, MRA_ROM },
7633 	{ 0x3e2000, 0x3e2003, MRA_EXTRAM },
7634 	{ 0x400000, 0x40ffff, MRA_TILERAM },
7635 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
7636 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
7637 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
7638 
7639 	{ 0xe40000, 0xe40001, MRA_EXTRAM2 },
7640 
7641 	{ 0xe41002, 0xe41003, io_player1_r },
7642 	{ 0xe41004, 0xe41005, MRA_NOP },
7643 	{ 0xe41006, 0xe41007, io_player2_r },
7644 	{ 0xe41000, 0xe41001, io_service_r },
7645 	{ 0xe42002, 0xe42003, io_dip1_r },
7646 	{ 0xe42000, 0xe42001, io_dip2_r },
7647 
7648 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
7649 	{-1}
7650 };
7651 
7652 static struct MemoryWriteAddress toryumon_writemem[] =
7653 {
7654 	{ 0x000000, 0x03ffff, MWA_ROM },
7655 	{ 0x3e2000, 0x3e2003, MWA_EXTRAM },
7656 	{ 0x400000, 0x40ffff, MWA_TILERAM },
7657 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
7658 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
7659 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
7660 	{ 0xe40000, 0xe40001, MWA_EXTRAM2 },
7661 	{ 0xfe0006, 0xfe0007, sound_command_w },
7662 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
7663 	{-1}
7664 };
7665 /***************************************************************************/
7666 
toryumon_update_proc(void)7667 static void toryumon_update_proc( void ){
7668 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
7669 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
7670 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
7671 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
7672 
7673 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
7674 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
7675 
7676 	sys16_tile_bank0 = READ_WORD( &sys16_extraram[0x0000] )&0xf;
7677 	sys16_tile_bank1 = READ_WORD( &sys16_extraram[0x0002] )&0xf;
7678 
7679 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
7680 }
7681 
toryumon_init_machine(void)7682 static void toryumon_init_machine( void ){
7683 	static int bank[16] = {00,0x02,0x04,0x06,0x08,0x0a,0x0c,0x0e,00,00,00,00,00,00,00,00};
7684 	sys16_obj_bank = bank;
7685 
7686 	sys16_update_proc = toryumon_update_proc;
7687 }
7688 
init_toryumon(void)7689 static void init_toryumon(void)
7690 {
7691 	sys16_onetime_init_machine();
7692 	sys16_sprite_decode( 4,0x40000 );
7693 }
7694 /***************************************************************************/
7695 
INPUT_PORTS_START(toryumon)7696 INPUT_PORTS_START( toryumon )
7697 	SYS16_JOY1
7698 	SYS16_JOY2
7699 	SYS16_SERVICE
7700 	SYS16_COINAGE
7701 
7702 PORT_START	/* DSW1 */
7703 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
7704 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
7705 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7706 	PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) )
7707 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
7708 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7709 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
7710 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
7711 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7712 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
7713 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
7714 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7715 	PORT_DIPNAME( 0x10, 0x10, "VS-Mode Battle" )
7716 	PORT_DIPSETTING(    0x10, "1" )
7717 	PORT_DIPSETTING(    0x00, "3" )
7718 	PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Difficulty ) )
7719 	PORT_DIPSETTING(    0xc0, "Easy" )
7720 	PORT_DIPSETTING(    0xe0, "Normal" )
7721 	PORT_DIPSETTING(    0xa0, "Hard" )
7722 	PORT_DIPSETTING(    0x80, "Hard+1" )
7723 	PORT_DIPSETTING(    0x60, "Hard+2" )
7724 	PORT_DIPSETTING(    0x40, "Hard+3" )
7725 	PORT_DIPSETTING(    0x20, "Hard+4" )
7726 	PORT_DIPSETTING(    0x00, "Hard+5" )
7727 INPUT_PORTS_END
7728 
7729 /***************************************************************************/
7730 
7731 MACHINE_DRIVER_7759( machine_driver_toryumon, \
7732 	toryumon_readmem,toryumon_writemem,toryumon_init_machine, gfx4,upd7759_interface )
7733 
7734 /***************************************************************************/
7735 
7736 // sys16B
7737 ROM_START( tturf )
7738 	ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
7739 	ROM_LOAD_EVEN( "12327.7a",  0x00000, 0x20000, 0x0376c593 )
7740 	ROM_LOAD_ODD ( "12326.5a",  0x00000, 0x20000, 0xf998862b )
7741 
7742 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7743 	ROM_LOAD( "12268.14a", 0x00000, 0x10000, 0xe0dac07f )
7744 	ROM_LOAD( "12269.15a", 0x10000, 0x10000, 0x457a8790 )
7745 	ROM_LOAD( "12270.16a", 0x20000, 0x10000, 0x69fc025b )
7746 
7747 	ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
7748 	ROM_LOAD( "12279.1b", 0x00000, 0x10000, 0x7a169fb1 )
7749 	ROM_LOAD( "12283.5b", 0x10000, 0x10000, 0xae0fa085 )
7750 	ROM_LOAD( "12278.2b", 0x20000, 0x10000, 0x961d06b7 )
7751 	ROM_LOAD( "12282.6b", 0x30000, 0x10000, 0xe8671ee1 )
7752 	ROM_LOAD( "12277.3b", 0x40000, 0x10000, 0xf16b6ba2 )
7753 	ROM_LOAD( "12281.7b", 0x50000, 0x10000, 0x1ef1077f )
7754 	ROM_LOAD( "12276.4b", 0x60000, 0x10000, 0x838bd71f )
7755 	ROM_LOAD( "12280.8b", 0x70000, 0x10000, 0x639a57cb )
7756 
7757 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
7758 	ROM_LOAD( "12328.10a", 0x0000, 0x8000, 0x00000000 )
7759 	ROM_LOAD( "12329.11a", 0x10000, 0x10000, 0xed9a686d )		// speech
7760 	ROM_LOAD( "12330.12a", 0x20000, 0x10000, 0xfb762bca )
7761 
7762 ROM_END
7763 
7764 // sys16B
7765 ROM_START( tturfu )
7766 	ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
7767 	ROM_LOAD_EVEN( "epr12266.bin",  0x00000, 0x10000, 0xf549def8 )
7768 	ROM_LOAD_ODD ( "epr12264.bin",  0x00000, 0x10000, 0xf7cdb289 )
7769 	ROM_LOAD_EVEN( "epr12267.bin",  0x20000, 0x10000, 0x3c3ce191 )
7770 	ROM_LOAD_ODD ( "epr12265.bin",  0x20000, 0x10000, 0x8cdadd9a )
7771 
7772 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7773 	ROM_LOAD( "12268.14a", 0x00000, 0x10000, 0xe0dac07f )
7774 	ROM_LOAD( "12269.15a", 0x10000, 0x10000, 0x457a8790 )
7775 	ROM_LOAD( "12270.16a", 0x20000, 0x10000, 0x69fc025b )
7776 
7777 	ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
7778 	ROM_LOAD( "12279.1b", 0x00000, 0x10000, 0x7a169fb1 )
7779 	ROM_LOAD( "12283.5b", 0x10000, 0x10000, 0xae0fa085 )
7780 	ROM_LOAD( "12278.2b", 0x20000, 0x10000, 0x961d06b7 )
7781 	ROM_LOAD( "12282.6b", 0x30000, 0x10000, 0xe8671ee1 )
7782 	ROM_LOAD( "12277.3b", 0x40000, 0x10000, 0xf16b6ba2 )
7783 	ROM_LOAD( "12281.7b", 0x50000, 0x10000, 0x1ef1077f )
7784 	ROM_LOAD( "12276.4b", 0x60000, 0x10000, 0x838bd71f )
7785 	ROM_LOAD( "12280.8b", 0x70000, 0x10000, 0x639a57cb )
7786 
7787 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
7788 	ROM_LOAD( "epr12271.bin", 0x0000,  0x8000, 0x99671e52 )
7789 	ROM_LOAD( "epr12272.bin", 0x10000, 0x8000, 0x7cf7e69f )
7790 	ROM_LOAD( "epr12273.bin", 0x18000, 0x8000, 0x28f0bb8b )
7791 	ROM_LOAD( "epr12274.bin", 0x20000, 0x8000, 0x8207f0c4 )
7792 	ROM_LOAD( "epr12275.bin", 0x28000, 0x8000, 0x182f3c3d )
7793 
7794 ROM_END
7795 
7796 /***************************************************************************/
7797 static READ_HANDLER( tt_io_player1_r ){ return input_port_0_r( offset ) << 8; }
READ_HANDLER(tt_io_player2_r)7798 static READ_HANDLER( tt_io_player2_r ){ return input_port_1_r( offset ) << 8; }
READ_HANDLER(tt_io_service_r)7799 static READ_HANDLER( tt_io_service_r ){ return input_port_2_r( offset ) << 8; }
7800 
7801 static struct MemoryReadAddress tturf_readmem[] =
7802 {
7803 	{ 0x000000, 0x03ffff, MRA_ROM },
7804 	{ 0x2001e6, 0x2001e7, tt_io_service_r },
7805 	{ 0x2001e8, 0x2001e9, tt_io_player1_r },
7806 	{ 0x2001ea, 0x2001eb, tt_io_player2_r },
7807 	{ 0x200000, 0x203fff, MRA_EXTRAM },
7808 	{ 0x300000, 0x300fff, MRA_SPRITERAM },
7809 	{ 0x400000, 0x40ffff, MRA_TILERAM },
7810 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
7811 	{ 0x500000, 0x500fff, MRA_PALETTERAM },
7812 
7813 	{ 0x602002, 0x602003, io_dip1_r },
7814 	{ 0x602000, 0x602001, io_dip2_r },
7815 	{-1}
7816 };
7817 
7818 static struct MemoryWriteAddress tturf_writemem[] =
7819 {
7820 	{ 0x000000, 0x03ffff, MWA_ROM },
7821 	{ 0x200000, 0x203fff, MWA_EXTRAM },
7822 	{ 0x300000, 0x300fff, MWA_SPRITERAM },
7823 	{ 0x400000, 0x40ffff, MWA_TILERAM },
7824 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
7825 	{ 0x500000, 0x500fff, MWA_PALETTERAM },
7826 	{ 0x600000, 0x600005, MWA_EXTRAM2 },
7827 //	{ 0x600006, 0x600007, sound_command_w },
7828 	{-1}
7829 };
7830 /***************************************************************************/
tturf_update_proc(void)7831 static void tturf_update_proc( void ){
7832 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
7833 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
7834 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
7835 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
7836 
7837 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
7838 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
7839 
7840 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
7841 }
7842 
tturf_init_machine(void)7843 static void tturf_init_machine( void ){
7844 	static int bank[16] = {00,00,0x02,00,0x04,00,0x06,00,00,00,00,00,00,00,00,00};
7845 	sys16_obj_bank = bank;
7846 	sys16_spritelist_end=0xc000;
7847 
7848 	sys16_update_proc = tturf_update_proc;
7849 }
7850 
tturfu_init_machine(void)7851 static void tturfu_init_machine( void ){
7852 	static int bank[16] = {00,00,00,00,00,00,00,00,00,00,00,02,00,04,06,00};
7853 	sys16_obj_bank = bank;
7854 	sys16_spritelist_end=0xc000;
7855 
7856 	sys16_update_proc = tturf_update_proc;
7857 }
7858 
init_tturf(void)7859 static void init_tturf(void)
7860 {
7861 	sys16_onetime_init_machine();
7862 	sys16_sprite_decode( 4,0x20000 );
7863 }
7864 /***************************************************************************/
7865 
7866 INPUT_PORTS_START( tturf )
7867 	SYS16_JOY1
7868 	SYS16_JOY2
7869 	SYS16_SERVICE
7870 	SYS16_COINAGE
7871 
7872 PORT_START	/* DSW1 */
7873 	PORT_DIPNAME( 0x03, 0x00, "Continues" )
7874 	PORT_DIPSETTING(    0x00, "None" )
7875 	PORT_DIPSETTING(    0x01, "3" )
7876 	PORT_DIPSETTING(    0x02, "Unlimited" )
7877 	PORT_DIPSETTING(    0x03, "Unlimited" )
7878 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
7879 	PORT_DIPSETTING(    0x08, "Easy" )
7880 	PORT_DIPSETTING(    0x0c, "Normal" )
7881 	PORT_DIPSETTING(    0x04, "Hard" )
7882 	PORT_DIPSETTING(    0x00, "Hardest" )
7883 	PORT_DIPNAME( 0x30, 0x20, "Starting Energy" )
7884 	PORT_DIPSETTING(    0x00, "3" )
7885 	PORT_DIPSETTING(    0x10, "4" )
7886 	PORT_DIPSETTING(    0x20, "6" )
7887 	PORT_DIPSETTING(    0x30, "8" )
7888 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
7889 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
7890 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
7891 	PORT_DIPNAME( 0x80, 0x00, "Bonus Energy" )
7892 	PORT_DIPSETTING(    0x80, "1" )
7893 	PORT_DIPSETTING(    0x00, "2" )
7894 INPUT_PORTS_END
7895 
7896 /***************************************************************************/
7897 
7898 MACHINE_DRIVER_7759( machine_driver_tturf, \
7899 	tturf_readmem,tturf_writemem,tturf_init_machine, gfx1,upd7759_interface )
7900 
7901 MACHINE_DRIVER_7759( machine_driver_tturfu, \
7902 	tturf_readmem,tturf_writemem,tturfu_init_machine, gfx1,upd7759_interface )
7903 
7904 /***************************************************************************/
7905 // sys16B
7906 ROM_START( tturfbl )
7907 	ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
7908 	ROM_LOAD_EVEN( "tt042197.rom", 0x00000, 0x10000, 0xdeee5af1 )
7909 	ROM_LOAD_ODD ( "tt06c794.rom", 0x00000, 0x10000, 0x90e6a95a )
7910 	ROM_LOAD_EVEN( "tt030be3.rom", 0x20000, 0x10000, 0x100264a2 )
7911 	ROM_LOAD_ODD ( "tt05ef8a.rom", 0x20000, 0x10000, 0xf787a948 )
7912 
7913 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
7914 	ROM_LOAD( "tt1574b3.rom", 0x00000, 0x10000, 0xe9e630da )
7915 	ROM_LOAD( "tt16cf44.rom", 0x10000, 0x10000, 0x4c467735 )
7916 	ROM_LOAD( "tt17d59e.rom", 0x20000, 0x10000, 0x60c0f2fe )
7917 
7918 	ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
7919 	ROM_LOAD( "12279.1b", 0x00000, 0x10000, 0x7a169fb1 )
7920 	ROM_LOAD( "12283.5b", 0x10000, 0x10000, 0xae0fa085 )
7921 	ROM_LOAD( "12278.2b", 0x20000, 0x10000, 0x961d06b7 )
7922 	ROM_LOAD( "12282.6b", 0x30000, 0x10000, 0xe8671ee1 )
7923 	ROM_LOAD( "12277.3b", 0x40000, 0x10000, 0xf16b6ba2 )
7924 	ROM_LOAD( "12281.7b", 0x50000, 0x10000, 0x1ef1077f )
7925 	ROM_LOAD( "12276.4b", 0x60000, 0x10000, 0x838bd71f )
7926 	ROM_LOAD( "12280.8b", 0x70000, 0x10000, 0x639a57cb )
7927 
7928 	ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
7929 	ROM_LOAD( "tt014d68.rom", 0x00000, 0x08000, 0xd4aab1d9 )
7930 	ROM_CONTINUE(             0x10000, 0x08000 )
7931 	ROM_LOAD( "tt0246ff.rom", 0x18000, 0x10000, 0xbb4bba8f )
7932 ROM_END
7933 
7934 /***************************************************************************/
7935 
7936 static struct MemoryReadAddress tturfbl_readmem[] =
7937 {
7938 	{ 0x000000, 0x03ffff, MRA_ROM },
7939 	{ 0x2001e6, 0x2001e7, tt_io_service_r },
7940 	{ 0x2001e8, 0x2001e9, tt_io_player1_r },
7941 	{ 0x2001ea, 0x2001eb, tt_io_player2_r },
7942 	{ 0x200000, 0x203fff, MRA_EXTRAM },
7943 	{ 0x300000, 0x300fff, MRA_SPRITERAM },
7944 	{ 0x400000, 0x40ffff, MRA_TILERAM },
7945 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
7946 	{ 0x500000, 0x500fff, MRA_PALETTERAM },
7947 	{ 0x600002, 0x600003, io_dip1_r },
7948 	{ 0x600000, 0x600001, io_dip2_r },
7949 	{ 0x601002, 0x601003, io_player1_r },
7950 	{ 0x601004, 0x601005, io_player2_r },
7951 	{ 0x601000, 0x601001, io_service_r },
7952 	{ 0x602002, 0x602003, io_dip1_r },
7953 	{ 0x602000, 0x602001, io_dip2_r },
7954 	{ 0xc46000, 0xc4601f, MRA_EXTRAM3 },
7955 	{-1}
7956 };
7957 
7958 static struct MemoryWriteAddress tturfbl_writemem[] =
7959 {
7960 	{ 0x000000, 0x03ffff, MWA_ROM },
7961 	{ 0x200000, 0x203fff, MWA_EXTRAM },
7962 	{ 0x300000, 0x300fff, MWA_SPRITERAM },
7963 	{ 0x400000, 0x40ffff, MWA_TILERAM },
7964 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
7965 	{ 0x500000, 0x500fff, MWA_PALETTERAM },
7966 	{ 0x600000, 0x600005, MWA_EXTRAM2 },
7967 	{ 0x600006, 0x600007, sound_command_w },
7968 	{ 0xc44000, 0xc44001, MWA_NOP },
7969 	{ 0xc46000, 0xc4601f, MWA_EXTRAM3 },
7970 	{-1}
7971 };
7972 
7973 /***************************************************************************/
7974 
tturfbl_update_proc(void)7975 static void tturfbl_update_proc( void ){
7976 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] ) & 0x01ff;
7977 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] ) & 0x01ff;
7978 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
7979 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
7980 
7981 
7982 	{
7983 		int data1,data2;
7984 
7985 		data1 = READ_WORD( &sys16_textram[0x0e80] );
7986 		data2 = READ_WORD( &sys16_textram[0x0e82] );
7987 
7988 		sys16_fg_page[3] = data1>>12;
7989 		sys16_bg_page[3] = (data1>>8)&0xf;
7990 		sys16_fg_page[1] = (data1>>4)&0xf;
7991 		sys16_bg_page[1] = data1&0xf;
7992 
7993 		sys16_fg_page[2] = data2>>12;
7994 		sys16_bg_page[2] = (data2>>8)&0xf;
7995 		sys16_fg_page[0] = (data2>>4)&0xf;
7996 		sys16_bg_page[0] = data2&0xf;
7997 	}
7998 
7999 
8000 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
8001 }
8002 
tturfbl_init_machine(void)8003 static void tturfbl_init_machine( void ){
8004 	static int bank[16] = {00,00,00,00,00,00,00,0x06,00,00,00,0x04,00,0x02,00,00};
8005 	sys16_obj_bank = bank;
8006 	sys16_sprxoffset = -0x48;
8007 	sys16_spritelist_end=0xc000;
8008 
8009 	sys16_update_proc = tturfbl_update_proc;
8010 }
8011 
init_tturfbl(void)8012 static void init_tturfbl(void)
8013 {
8014 	int i;
8015 
8016 	sys16_onetime_init_machine();
8017 
8018 	/* invert the graphics bits on the tiles */
8019 	for (i = 0; i < 0x30000; i++)
8020 		memory_region(REGION_GFX1)[i] ^= 0xff;
8021 
8022 	sys16_sprite_decode( 4,0x20000 );
8023 }
8024 /***************************************************************************/
8025 // sound ??
8026 MACHINE_DRIVER_7759( machine_driver_tturfbl, \
8027 	tturfbl_readmem,tturfbl_writemem,tturfbl_init_machine, gfx1,upd7759_interface )
8028 
8029 /***************************************************************************/
8030 // sys16B
8031 ROM_START( wb3 )
8032 	ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
8033 	ROM_LOAD_EVEN( "epr12259.a7", 0x000000, 0x20000, 0x54927c7e )
8034 	ROM_LOAD_ODD ( "epr12258.a5", 0x000000, 0x20000, 0x01f5898c )
8035 
8036 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
8037 	ROM_LOAD( "epr12124.a14", 0x00000, 0x10000, 0xdacefb6f )
8038 	ROM_LOAD( "epr12125.a15", 0x10000, 0x10000, 0x9fc36df7 )
8039 	ROM_LOAD( "epr12126.a16", 0x20000, 0x10000, 0xa693fd94 )
8040 
8041 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
8042 	ROM_LOAD( "epr12093.b4", 0x000000, 0x010000, 0x4891e7bb )
8043 	ROM_LOAD( "epr12097.b8", 0x010000, 0x010000, 0xe645902c )
8044 	ROM_LOAD( "epr12091.b2", 0x020000, 0x010000, 0x8409a243 )
8045 	ROM_LOAD( "epr12095.b6", 0x030000, 0x010000, 0xe774ec2c )
8046 	ROM_LOAD( "epr12090.b1", 0x040000, 0x010000, 0xaeeecfca )
8047 	ROM_LOAD( "epr12094.b5", 0x050000, 0x010000, 0x615e4927 )
8048 	ROM_LOAD( "epr12092.b3", 0x060000, 0x010000, 0x5c2f0d90 )
8049 	ROM_LOAD( "epr12096.b7", 0x070000, 0x010000, 0x0cd59d6e )
8050 
8051 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
8052 	ROM_LOAD( "epr12127.a10", 0x0000, 0x8000, 0x0bb901bb )
8053 ROM_END
8054 
8055 ROM_START( wb3a )
8056 	ROM_REGION( 0x40000, REGION_CPU1 ) /* 68000 code */
8057 // Custom CPU 317-0089
8058 	ROM_LOAD_EVEN( "epr12137.a7", 0x000000, 0x20000, 0x6f81238e )
8059 	ROM_LOAD_ODD ( "epr12136.a5", 0x000000, 0x20000, 0x4cf05003 )
8060 
8061 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
8062 	ROM_LOAD( "epr12124.a14", 0x00000, 0x10000, 0xdacefb6f )
8063 	ROM_LOAD( "epr12125.a15", 0x10000, 0x10000, 0x9fc36df7 )
8064 	ROM_LOAD( "epr12126.a16", 0x20000, 0x10000, 0xa693fd94 )
8065 
8066 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
8067 	ROM_LOAD( "epr12093.b4", 0x000000, 0x010000, 0x4891e7bb )
8068 	ROM_LOAD( "epr12097.b8", 0x010000, 0x010000, 0xe645902c )
8069 	ROM_LOAD( "epr12091.b2", 0x020000, 0x010000, 0x8409a243 )
8070 	ROM_LOAD( "epr12095.b6", 0x030000, 0x010000, 0xe774ec2c )
8071 	ROM_LOAD( "epr12090.b1", 0x040000, 0x010000, 0xaeeecfca )
8072 	ROM_LOAD( "epr12094.b5", 0x050000, 0x010000, 0x615e4927 )
8073 	ROM_LOAD( "epr12092.b3", 0x060000, 0x010000, 0x5c2f0d90 )
8074 	ROM_LOAD( "epr12096.b7", 0x070000, 0x010000, 0x0cd59d6e )
8075 
8076 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
8077 	ROM_LOAD( "epr12127.a10", 0x0000, 0x8000, 0x0bb901bb )
8078 ROM_END
8079 
8080 /***************************************************************************/
8081 
8082 static struct MemoryReadAddress wb3_readmem[] =
8083 {
8084 	{ 0x000000, 0x03ffff, MRA_ROM },
8085 	{ 0x400000, 0x40ffff, MRA_TILERAM },
8086 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
8087 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
8088 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
8089 	{ 0xc41002, 0xc41003, io_player1_r },
8090 	{ 0xc41006, 0xc41007, io_player2_r },
8091 	{ 0xc41000, 0xc41001, io_service_r },
8092 	{ 0xc42002, 0xc42003, io_dip1_r },
8093 	{ 0xc42000, 0xc42001, io_dip2_r },
8094 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
8095 	{-1}
8096 };
8097 
WRITE_HANDLER(wb3_sound_command_w)8098 static WRITE_HANDLER( wb3_sound_command_w )
8099 {
8100 	if( (data&0xff000000)==0 )
8101 		sound_command_w(offset,data>>8);
8102 }
8103 
8104 static struct MemoryWriteAddress wb3_writemem[] =
8105 {
8106 	{ 0x000000, 0x03ffff, MWA_ROM },
8107 	{ 0x3f0000, 0x3f0003, MWA_NOP },
8108 	{ 0x400000, 0x40ffff, MWA_TILERAM },
8109 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
8110 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
8111 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
8112 	{ 0xc40000, 0xc40001, MWA_EXTRAM2 },
8113 	{ 0xffc008, 0xffc009, wb3_sound_command_w },
8114 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
8115 	{-1}
8116 };
8117 /***************************************************************************/
8118 
wb3_update_proc(void)8119 static void wb3_update_proc( void ){
8120 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
8121 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
8122 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
8123 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
8124 
8125 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
8126 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
8127 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
8128 }
8129 
8130 
wb3_init_machine(void)8131 static void wb3_init_machine( void ){
8132 	static int bank[16] = {4,0,2,0,6,0,0,0x06,0,0,0,0x04,0,0x02,0,0};
8133 
8134 	sys16_obj_bank = bank;
8135 
8136 	sys16_update_proc = wb3_update_proc;
8137 }
8138 
init_wb3(void)8139 static void init_wb3(void)
8140 {
8141 	sys16_onetime_init_machine();
8142 	sys16_sprite_decode( 4,0x20000 );
8143 }
8144 
8145 /***************************************************************************/
8146 
8147 INPUT_PORTS_START( wb3 )
8148 	SYS16_JOY1
8149 	SYS16_JOY2
8150 	SYS16_SERVICE
8151 	SYS16_COINAGE
8152 
8153 PORT_START	/* DSW1 */
8154 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
8155 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
8156 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
8157 	PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
8158 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
8159 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
8160 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
8161 	PORT_DIPSETTING(    0x00, "2" )
8162 	PORT_DIPSETTING(    0x0c, "3" )
8163 	PORT_DIPSETTING(    0x08, "4" )
8164 	PORT_DIPSETTING(    0x04, "5" )
8165 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )		//??
8166 	PORT_DIPSETTING(    0x10, "5000/10000/18000/30000" )
8167 	PORT_DIPSETTING(    0x00, "5000/15000/30000" )
8168 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
8169 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
8170 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
8171 	PORT_DIPNAME( 0x40, 0x40, "Allow Round Select" )
8172 	PORT_DIPSETTING(    0x40, DEF_STR( No ) )
8173 	PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )			// no collision though
8174 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
8175 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
8176 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
8177 
8178 INPUT_PORTS_END
8179 
8180 /***************************************************************************/
8181 
8182 MACHINE_DRIVER( machine_driver_wb3, \
8183 	wb3_readmem,wb3_writemem,wb3_init_machine, gfx1 )
8184 
8185 /***************************************************************************/
8186 // sys16B
8187 ROM_START( wb3bl )
8188 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
8189 	ROM_LOAD_EVEN( "wb3_03", 0x000000, 0x10000, 0x0019ab3b )
8190 	ROM_LOAD_ODD ( "wb3_05", 0x000000, 0x10000, 0x196e17ee )
8191 	ROM_LOAD_EVEN( "wb3_02", 0x020000, 0x10000, 0xc87350cb )
8192 	ROM_LOAD_ODD ( "wb3_04", 0x020000, 0x10000, 0x565d5035 )
8193 
8194 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
8195 	ROM_LOAD( "wb3_14", 0x00000, 0x10000, 0xd3f20bca )
8196 	ROM_LOAD( "wb3_15", 0x10000, 0x10000, 0x96ff9d52 )
8197 	ROM_LOAD( "wb3_16", 0x20000, 0x10000, 0xafaf0d31 )
8198 
8199 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
8200 	ROM_LOAD( "epr12093.b4", 0x000000, 0x010000, 0x4891e7bb )
8201 	ROM_LOAD( "epr12097.b8", 0x010000, 0x010000, 0xe645902c )
8202 	ROM_LOAD( "epr12091.b2", 0x020000, 0x010000, 0x8409a243 )
8203 	ROM_LOAD( "epr12095.b6", 0x030000, 0x010000, 0xe774ec2c )
8204 	ROM_LOAD( "epr12090.b1", 0x040000, 0x010000, 0xaeeecfca )
8205 	ROM_LOAD( "epr12094.b5", 0x050000, 0x010000, 0x615e4927 )
8206 	ROM_LOAD( "epr12092.b3", 0x060000, 0x010000, 0x5c2f0d90 )
8207 	ROM_LOAD( "epr12096.b7", 0x070000, 0x010000, 0x0cd59d6e )
8208 
8209 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
8210 	ROM_LOAD( "epr12127.a10", 0x0000, 0x8000, 0x0bb901bb )
8211 ROM_END
8212 
8213 /***************************************************************************/
8214 
8215 static struct MemoryReadAddress wb3bl_readmem[] =
8216 {
8217 	{ 0x000000, 0x03ffff, MRA_ROM },
8218 	{ 0x400000, 0x40ffff, MRA_TILERAM },
8219 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
8220 	{ 0x440000, 0x440fff, MRA_SPRITERAM },
8221 	{ 0x840000, 0x840fff, MRA_PALETTERAM },
8222 	{ 0xc41002, 0xc41003, io_player1_r },
8223 	{ 0xc41004, 0xc41005, io_player2_r },
8224 	{ 0xc41000, 0xc41001, io_service_r },
8225 	{ 0xc42002, 0xc42003, io_dip1_r },
8226 	{ 0xc42000, 0xc42001, io_dip2_r },
8227 	{ 0xc46000, 0xc4601f, MRA_EXTRAM3 },
8228 	{ 0xff0000, 0xffffff, MRA_WORKINGRAM },
8229 	{-1}
8230 };
8231 
8232 static struct MemoryWriteAddress wb3bl_writemem[] =
8233 {
8234 	{ 0x000000, 0x03ffff, MWA_ROM },
8235 	{ 0x3f0000, 0x3f0003, MWA_NOP },
8236 	{ 0x400000, 0x40ffff, MWA_TILERAM },
8237 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
8238 	{ 0x440000, 0x440fff, MWA_SPRITERAM },
8239 	{ 0x840000, 0x840fff, MWA_PALETTERAM },
8240 	{ 0xc42006, 0xc42007, sound_command_w },
8241 	{ 0xc40000, 0xc40001, MWA_EXTRAM2 },
8242 	{ 0xc44000, 0xc44001, MWA_NOP },
8243 	{ 0xc46000, 0xc4601f, MWA_EXTRAM3 },
8244 	{ 0xff0000, 0xffffff, MWA_WORKINGRAM },
8245 	{-1}
8246 };
8247 
8248 /***************************************************************************/
8249 
wb3bl_update_proc(void)8250 static void wb3bl_update_proc( void ){
8251 	sys16_fg_scrollx = READ_WORD( &sys16_workingram[0xc030] );
8252 	sys16_bg_scrollx = READ_WORD( &sys16_workingram[0xc038] );
8253 	sys16_fg_scrolly = READ_WORD( &sys16_workingram[0xc032] );
8254 	sys16_bg_scrolly = READ_WORD( &sys16_workingram[0xc03c] );
8255 
8256 	set_fg_page( READ_WORD( &sys16_textram[0x0ff6] ) );
8257 	set_bg_page( READ_WORD( &sys16_textram[0x0ff4] ) );
8258 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
8259 }
8260 
wb3bl_init_machine(void)8261 static void wb3bl_init_machine( void ){
8262 	static int bank[16] = {4,0,2,0,6,0,0,0x06,0,0,0,0x04,0,0x02,0,0};
8263 
8264 	sys16_obj_bank = bank;
8265 
8266 	patch_code( 0x17058, 0x4e );
8267 	patch_code( 0x17059, 0xb9 );
8268 	patch_code( 0x1705a, 0x00 );
8269 	patch_code( 0x1705b, 0x00 );
8270 	patch_code( 0x1705c, 0x09 );
8271 	patch_code( 0x1705d, 0xdc );
8272 	patch_code( 0x1705e, 0x4e );
8273 	patch_code( 0x1705f, 0xf9 );
8274 	patch_code( 0x17060, 0x00 );
8275 	patch_code( 0x17061, 0x01 );
8276 	patch_code( 0x17062, 0x70 );
8277 	patch_code( 0x17063, 0xe0 );
8278 	patch_code( 0x1a3a, 0x31 );
8279 	patch_code( 0x1a3b, 0x7c );
8280 	patch_code( 0x1a3c, 0x80 );
8281 	patch_code( 0x1a3d, 0x00 );
8282 	patch_code( 0x23df8, 0x14 );
8283 	patch_code( 0x23df9, 0x41 );
8284 	patch_code( 0x23dfa, 0x10 );
8285 	patch_code( 0x23dfd, 0x14 );
8286 	patch_code( 0x23dff, 0x1c );
8287 
8288 	sys16_update_proc = wb3bl_update_proc;
8289 }
8290 
init_wb3bl(void)8291 static void init_wb3bl(void)
8292 {
8293 	int i;
8294 
8295 	sys16_onetime_init_machine();
8296 
8297 	/* invert the graphics bits on the tiles */
8298 	for (i = 0; i < 0x30000; i++)
8299 		memory_region(REGION_GFX1)[i] ^= 0xff;
8300 
8301 	sys16_sprite_decode( 4,0x20000 );
8302 }
8303 
8304 /***************************************************************************/
8305 
MACHINE_DRIVER(machine_driver_wb3bl,wb3bl_readmem,wb3bl_writemem,wb3bl_init_machine,gfx1)8306 MACHINE_DRIVER( machine_driver_wb3bl, \
8307 	wb3bl_readmem,wb3bl_writemem,wb3bl_init_machine, gfx1 )
8308 
8309 /***************************************************************************/
8310 // sys16B
8311 ROM_START( wrestwar )
8312 	ROM_REGION( 0xc0000, REGION_CPU1 ) /* 68000 code */
8313 	ROM_LOAD_EVEN( "ww.a7", 0x00000, 0x20000, 0xeeaba126 )
8314 	ROM_LOAD_ODD ( "ww.a5", 0x00000, 0x20000, 0x6714600a )
8315 	/* empty 0x40000 - 0x80000 */
8316 	ROM_LOAD_EVEN( "ww.a8", 0x80000, 0x20000, 0xb77ba665 )
8317 	ROM_LOAD_ODD ( "ww.a6", 0x80000, 0x20000, 0xddf075cb )
8318 
8319 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
8320 	ROM_LOAD( "ww.a14", 0x00000, 0x20000, 0x6a821ab9 )
8321 	ROM_LOAD( "ww.a15", 0x20000, 0x20000, 0x2b1a0751 )
8322 	ROM_LOAD( "ww.a16", 0x40000, 0x20000, 0xf6e190fe )
8323 
8324 	ROM_REGION( 0x180000*2, REGION_GFX2 ) /* sprites */
8325 	ROM_LOAD( "ww.b1",  0x000000, 0x20000, 0xffa7d368 )
8326 	ROM_LOAD( "ww.b5",  0x020000, 0x20000, 0x8d7794c1 )
8327 	ROM_LOAD( "ww.b2",  0x040000, 0x20000, 0x0ed343f2 )
8328 	ROM_LOAD( "ww.b6",  0x060000, 0x20000, 0x99458d58 )
8329 	ROM_LOAD( "ww.b3",  0x080000, 0x20000, 0x3087104d )
8330 	ROM_LOAD( "ww.b7",  0x0a0000, 0x20000, 0xabcf9bed )
8331 	ROM_LOAD( "ww.b4",  0x0c0000, 0x20000, 0x41b6068b )
8332 	ROM_LOAD( "ww.b8",  0x0e0000, 0x20000, 0x97eac164 )
8333 	ROM_LOAD( "ww.a1",  0x100000, 0x20000, 0x260311c5 )
8334 	ROM_LOAD( "ww.b10", 0x120000, 0x20000, 0x35a4b1b1 )
8335 	ROM_LOAD( "ww.a2",  0x140000, 0x10000, 0x12e38a5c )
8336 	ROM_LOAD( "ww.b11", 0x160000, 0x10000, 0xfa06fd24 )
8337 
8338 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
8339 	ROM_LOAD( "ww.a10", 0x0000, 0x08000, 0xc3609607 )
8340 	ROM_LOAD( "ww.a11", 0x10000, 0x20000, 0xfb9a7f29 )
8341 	ROM_LOAD( "ww.a12", 0x30000, 0x20000, 0xd6617b19 )
8342 ROM_END
8343 
8344 /***************************************************************************/
8345 
8346 static READ_HANDLER( ww_io_service_r )
8347 {
8348 	return io_service_r(offset) | (READ_WORD(&sys16_workingram[0x2082]) & 0xff00);
8349 }
8350 
8351 static struct MemoryReadAddress wrestwar_readmem[] =
8352 {
8353 
8354 	{ 0x000000, 0x0bffff, MRA_ROM },
8355 	{ 0x100000, 0x10ffff, MRA_TILERAM },
8356 	{ 0x110000, 0x110fff, MRA_TEXTRAM },
8357 	{ 0x200000, 0x200fff, MRA_SPRITERAM },
8358 	{ 0x300000, 0x300fff, MRA_PALETTERAM },
8359 	{ 0x400000, 0x400003, MRA_EXTRAM },
8360 	{ 0xc40000, 0xc40001, MRA_EXTRAM2 },
8361 	{ 0xc41002, 0xc41003, io_player1_r },
8362 	{ 0xc41006, 0xc41007, io_player2_r },
8363 	{ 0xc42002, 0xc42003, io_dip1_r },
8364 	{ 0xc42000, 0xc42001, io_dip2_r },
8365 	{ 0xffe082, 0xffe083, ww_io_service_r },
8366 	{ 0xffc000, 0xffffff, MRA_WORKINGRAM },
8367 	{-1}
8368 };
8369 
8370 static struct MemoryWriteAddress wrestwar_writemem[] =
8371 {
8372 	{ 0x000000, 0x0bffff, MWA_ROM },
8373 	{ 0x100000, 0x10ffff, MWA_TILERAM },
8374 	{ 0x110000, 0x110fff, MWA_TEXTRAM },
8375 	{ 0x200000, 0x200fff, MWA_SPRITERAM },
8376 	{ 0x300000, 0x300fff, MWA_PALETTERAM },
8377 	{ 0x400000, 0x400003, MWA_EXTRAM },
8378 	{ 0xc40000, 0xc40001, MWA_EXTRAM2 },
8379 	{ 0xc43034, 0xc43035, MWA_NOP },
8380 	{ 0xffe08e, 0xffe08f, sound_command_w },
8381 	{ 0xffc000, 0xffffff, MWA_WORKINGRAM },
8382 	{-1}
8383 };
8384 /***************************************************************************/
8385 
wrestwar_update_proc(void)8386 static void wrestwar_update_proc( void ){
8387 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
8388 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
8389 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
8390 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
8391 
8392 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
8393 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
8394 	set_tile_bank( READ_WORD( &sys16_extraram[2] ) );
8395 	set_refresh( READ_WORD( &sys16_extraram2[0] ) );
8396 }
8397 
wrestwar_init_machine(void)8398 static void wrestwar_init_machine( void ){
8399 	static int bank[16] = {0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,0x18,0x1A,0x1C,0x1E};
8400 
8401 	sys16_obj_bank = bank;
8402 	sys16_bg_priority_mode=2;
8403 	sys16_bg_priority_value=0x0a00;
8404 
8405 	sys16_update_proc = wrestwar_update_proc;
8406 }
8407 
init_wrestwar(void)8408 static void init_wrestwar( void ){
8409 	sys16_onetime_init_machine();
8410 	sys16_bg1_trans=1;
8411 #ifdef TRANSPARENT_SHADOWS
8412 	sys16_MaxShadowColors=16;
8413 #endif
8414 	sys18_splittab_bg_y=&sys16_textram[0x0f40];
8415 	sys18_splittab_fg_y=&sys16_textram[0x0f00];
8416 	sys16_rowscroll_scroll=0x8000;
8417 
8418 	sys16_sprite_decode( 6,0x40000 );
8419 }
8420 /***************************************************************************/
8421 
INPUT_PORTS_START(wrestwar)8422 INPUT_PORTS_START( wrestwar )
8423 	SYS16_JOY1
8424 	SYS16_JOY2
8425 	SYS16_SERVICE
8426 	SYS16_COINAGE
8427 
8428 PORT_START	/* DSW1 */
8429 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
8430 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
8431 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
8432 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
8433 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
8434 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
8435 	PORT_DIPNAME( 0x0c, 0x0c, "Round Time" )
8436 	PORT_DIPSETTING(    0x00, "100" )
8437 	PORT_DIPSETTING(    0x0c, "110" )
8438 	PORT_DIPSETTING(    0x08, "120" )
8439 	PORT_DIPSETTING(    0x04, "130" )
8440 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
8441 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
8442 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
8443 	PORT_DIPNAME( 0x20, 0x20, "Continuation" )
8444 	PORT_DIPSETTING(    0x20, "Continue" )
8445 	PORT_DIPSETTING(    0x00, "No Continue" )
8446 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
8447 	PORT_DIPSETTING(    0x80, "Easy" )
8448 	PORT_DIPSETTING(    0xc0, "Normal" )
8449 	PORT_DIPSETTING(    0x40, "Hard" )
8450 	PORT_DIPSETTING(    0x00, "Hardest" )
8451 
8452 INPUT_PORTS_END
8453 
8454 /***************************************************************************/
8455 
8456 MACHINE_DRIVER_7759( machine_driver_wrestwar, \
8457 	wrestwar_readmem,wrestwar_writemem,wrestwar_init_machine, gfx2,upd7759_interface )
8458 
8459 
8460 /***************************************************************************/
8461 /***************************************************************************/
8462 
8463 /* hang-on's accel/brake are really both analog controls, but I've added them
8464 as digital as well to see what works better */
8465 #define HANGON_DIGITAL_CONTROLS
8466 
8467 // hangon hardware
8468 ROM_START( hangon )
8469 	ROM_REGION( 0x020000, REGION_CPU1 ) /* 68000 code */
8470 	ROM_LOAD_EVEN( "6918.rom", 0x000000, 0x8000, 0x20b1c2b0 )
8471 	ROM_LOAD_ODD ( "6916.rom", 0x000000, 0x8000, 0x7d9db1bf )
8472 	ROM_LOAD_EVEN( "6917.rom", 0x010000, 0x8000, 0xfea12367 )
8473 	ROM_LOAD_ODD ( "6915.rom", 0x010000, 0x8000, 0xac883240 )
8474 
8475 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
8476 	ROM_LOAD( "6841.rom", 0x00000, 0x08000, 0x54d295dc )
8477 	ROM_LOAD( "6842.rom", 0x08000, 0x08000, 0xf677b568 )
8478 	ROM_LOAD( "6843.rom", 0x10000, 0x08000, 0xa257f0da )
8479 
8480 	ROM_REGION( 0x080000*2, REGION_GFX2 ) /* sprites */
8481 	ROM_LOAD( "6819.rom", 0x000000, 0x008000, 0x469dad07 )
8482 	ROM_RELOAD(           0x070000, 0x008000 )	/* again? */
8483 	ROM_LOAD( "6820.rom", 0x008000, 0x008000, 0x87cbc6de )
8484 	ROM_RELOAD(           0x078000, 0x008000 )	/* again? */
8485 	ROM_LOAD( "6821.rom", 0x010000, 0x008000, 0x15792969 )
8486 	ROM_LOAD( "6822.rom", 0x018000, 0x008000, 0xe9718de5 )
8487 	ROM_LOAD( "6823.rom", 0x020000, 0x008000, 0x49422691 )
8488 	ROM_LOAD( "6824.rom", 0x028000, 0x008000, 0x701deaa4 )
8489 	ROM_LOAD( "6825.rom", 0x030000, 0x008000, 0x6e23c8b4 )
8490 	ROM_LOAD( "6826.rom", 0x038000, 0x008000, 0x77d0de2c )
8491 	ROM_LOAD( "6827.rom", 0x040000, 0x008000, 0x7fa1bfb6 )
8492 	ROM_LOAD( "6828.rom", 0x048000, 0x008000, 0x8e880c93 )
8493 	ROM_LOAD( "6829.rom", 0x050000, 0x008000, 0x7ca0952d )
8494 	ROM_LOAD( "6830.rom", 0x058000, 0x008000, 0xb1a63aef )
8495 	ROM_LOAD( "6845.rom", 0x060000, 0x008000, 0xba08c9b8 )
8496 	ROM_LOAD( "6846.rom", 0x068000, 0x008000, 0xf21e57a3 )
8497 
8498 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
8499 	ROM_LOAD( "6833.rom", 0x00000, 0x4000, 0x3b942f5f )
8500 
8501 	ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
8502 	ROM_LOAD( "6831.rom", 0x00000, 0x8000, 0xcfef5481 )
8503 	ROM_LOAD( "6832.rom", 0x08000, 0x8000, 0x4165aea5 )
8504 
8505 	ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
8506 	ROM_LOAD_EVEN("6920.rom", 0x0000, 0x8000, 0x1c95013e )
8507 	ROM_LOAD_ODD( "6919.rom", 0x0000, 0x8000, 0x6ca30d69 )
8508 
8509 	ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
8510 	ROM_LOAD( "6840.rom", 0x0000, 0x8000, 0x581230e3 )
8511 ROM_END
8512 
8513 /***************************************************************************/
8514 
8515 
8516 static READ_HANDLER( ho_io_x_r ){ return input_port_0_r( offset ); }
8517 #ifdef HANGON_DIGITAL_CONTROLS
READ_HANDLER(ho_io_y_r)8518 static READ_HANDLER( ho_io_y_r ){
8519 	int data = input_port_1_r( offset );
8520 
8521 	switch(data & 3)
8522 	{
8523 		case 3:	return 0xffff;	// both
8524 		case 2:	return 0x00ff;  // brake
8525 		case 1:	return 0xff00;  // accel
8526 		case 0:	return 0x0000;  // neither
8527 	}
8528 	return 0x0000;
8529 }
8530 #else
READ_HANDLER(ho_io_y_r)8531 static READ_HANDLER( ho_io_y_r ){ return (input_port_1_r( offset ) << 8) + input_port_5_r( offset ); }
8532 #endif
8533 
READ_HANDLER(ho_io_highscoreentry_r)8534 static READ_HANDLER( ho_io_highscoreentry_r )
8535 {
8536 	int mode=READ_WORD(&sys16_extraram4[0x3000]);
8537 
8538 	if(mode&4)
8539 	{	// brake
8540 		if(ho_io_y_r(0) & 0x00ff) return 0xffff;
8541 	}
8542 	else if(mode&8)
8543 	{
8544 		// button
8545 		if(ho_io_y_r(0) & 0xff00) return 0xffff;
8546 	}
8547 	return 0;
8548 }
8549 
READ_HANDLER(hangon1_skip_r)8550 static READ_HANDLER( hangon1_skip_r )
8551 {
8552 	if (cpu_get_pc()==0x17e6) {cpu_spinuntil_int(); return 0xffff;}
8553 
8554 //	return READ_WORD(&sys16_extraram[0xc400]);
8555 	return READ_WORD(&sys16_extraram[0x0400]);
8556 }
8557 
8558 
8559 static struct MemoryReadAddress hangon_readmem[] =
8560 {
8561 	{ 0x000000, 0x03ffff, MRA_ROM },
8562 	{ 0x20c400, 0x20c401, hangon1_skip_r },
8563 	{ 0x20c000, 0x20ffff, MRA_EXTRAM },
8564 	{ 0x400000, 0x40ffff, MRA_TILERAM },
8565 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
8566 	{ 0x600000, 0x600fff, MRA_SPRITERAM },
8567 	{ 0xa00000, 0xa00fff, MRA_PALETTERAM },
8568 	{ 0xc68000, 0xc68fff, MRA_EXTRAM2 },
8569 	{ 0xc7e000, 0xc7ffff, MRA_EXTRAM3 },
8570 	{ 0xe01000, 0xe01001, io_service_r },
8571 	{ 0xe0100c, 0xe0100d, io_dip2_r },
8572 	{ 0xe0100a, 0xe0100b, io_dip1_r },
8573 	{ 0xe03020, 0xe03021, ho_io_highscoreentry_r },
8574 	{ 0xe03028, 0xe03029, ho_io_x_r },
8575 	{ 0xe0302a, 0xe0302b, ho_io_y_r },
8576 	{ 0xe00000, 0xe03fff, MRA_EXTRAM4 },
8577 	{-1}
8578 };
8579 
8580 static struct MemoryWriteAddress hangon_writemem[] =
8581 {
8582 	{ 0x000000, 0x03ffff, MWA_ROM },
8583 	{ 0x20c000, 0x20ffff, MWA_EXTRAM },
8584 	{ 0x400000, 0x40ffff, MWA_TILERAM },
8585 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
8586 	{ 0x600000, 0x600fff, MWA_SPRITERAM },
8587 	{ 0xa00000, 0xa00fff, MWA_PALETTERAM },
8588 	{ 0xc68000, 0xc68fff, MWA_EXTRAM2 },
8589 	{ 0xc7e000, 0xc7ffff, MWA_EXTRAM3 },
8590 	{ 0xe00000, 0xe00001, sound_command_nmi_w },
8591 	{ 0xe00000, 0xe03fff, MWA_EXTRAM4 },
8592 	{-1}
8593 };
8594 
READ_HANDLER(hangon2_skip_r)8595 static READ_HANDLER( hangon2_skip_r )
8596 {
8597 	if (cpu_get_pc()==0xf66) {cpu_spinuntil_int(); return 0xffff;}
8598 
8599 //	return READ_WORD(&sys16_extraram2[0x3f000]);
8600 	return READ_WORD(&sys16_extraram3[0x01000]);
8601 }
8602 
8603 static struct MemoryReadAddress hangon_readmem2[] =
8604 {
8605 	{ 0x000000, 0x03ffff, MRA_ROM },
8606 	{ 0xc7f000, 0xc7f001, hangon2_skip_r },
8607 	{ 0xc68000, 0xc68fff, MRA_EXTRAM2 },
8608 	{ 0xc7e000, 0xc7ffff, MRA_EXTRAM3 },
8609 	{-1}
8610 };
8611 
8612 static struct MemoryWriteAddress hangon_writemem2[] =
8613 {
8614 	{ 0x000000, 0x03ffff, MWA_ROM },
8615 	{ 0xc68000, 0xc68fff, MWA_EXTRAM2 },
8616 	{ 0xc7e000, 0xc7ffff, MWA_EXTRAM3 },
8617 	{-1}
8618 };
8619 
8620 
8621 static struct MemoryReadAddress hangon_sound_readmem[] =
8622 {
8623 	{ 0x0000, 0x7fff, MRA_ROM },
8624 	{ 0xc000, 0xc7ff, MRA_RAM },
8625 	{ 0xd000, 0xd000, YM2203_status_port_0_r },
8626 	{ 0xe000, 0xe7ff, SegaPCM_r },
8627 	{ 0xf800, 0xffff, MRA_RAM },
8628 	{ -1 }  /* end of table */
8629 };
8630 
8631 static struct MemoryWriteAddress hangon_sound_writemem[] =
8632 {
8633 	{ 0x0000, 0x7fff, MWA_ROM },
8634 	{ 0xc000, 0xc7ff, MWA_RAM },
8635 	{ 0xd000, 0xd000, YM2203_control_port_0_w },
8636 	{ 0xd001, 0xd001, YM2203_write_port_0_w },
8637 	{ 0xe000, 0xe7ff, SegaPCM_w },
8638 	{ 0xf800, 0xffff, MWA_RAM },
8639 	{ -1 }  /* end of table */
8640 };
8641 
8642 static struct IOReadPort hangon_sound_readport[] =
8643 {
8644 	{ 0x40, 0x40, soundlatch_r },
8645 	{ -1 }	/* end of table */
8646 };
8647 
8648 
8649 static struct IOWritePort hangon_sound_writeport[] =
8650 {
8651 	{ -1 }
8652 };
8653 
8654 /***************************************************************************/
8655 
hangon_update_proc(void)8656 static void hangon_update_proc( void ){
8657 	int leds;
8658 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
8659 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
8660 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
8661 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
8662 
8663 	set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
8664 	set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
8665 	set_refresh_3d( READ_WORD( &sys16_extraram4[0x2] ) );
8666 
8667 	leds=READ_WORD( &sys16_extraram4[0x2] );
8668 	if(leds & 4)
8669 	{
8670 		osd_led_w(0,1);
8671 		osd_led_w(1,1);
8672 		osd_led_w(2,1);
8673 	}
8674 	else
8675 	{
8676 		osd_led_w(0,0);
8677 		osd_led_w(1,0);
8678 		osd_led_w(2,0);
8679 	}
8680 
8681 }
8682 
hangon_init_machine(void)8683 static void hangon_init_machine( void ){
8684 	static int bank[16] = { 00,01,02,03,04,05,06,00,01,02,03,04,05,06,00,06};
8685 	sys16_obj_bank = bank;
8686 	sys16_textmode=1;
8687 	sys16_spritesystem = 5;
8688 	sys16_sprxoffset = -0xc0;
8689 	sys16_fgxoffset = 8;
8690 	sys16_textlayer_lo_min=0;
8691 	sys16_textlayer_lo_max=0;
8692 	sys16_textlayer_hi_min=0;
8693 	sys16_textlayer_hi_max=0xff;
8694 
8695 	patch_code( 0x83bd, 0x29);
8696 	patch_code( 0x8495, 0x2a);
8697 	patch_code( 0x84f9, 0x2b);
8698 
8699 	sys16_update_proc = hangon_update_proc;
8700 
8701 	gr_ver = &sys16_extraram2[0x0];
8702 	gr_hor = gr_ver+0x200;
8703 	gr_pal = gr_ver+0x400;
8704 	gr_flip= gr_ver+0x600;
8705 	gr_palette= 0xf80 / 2;
8706 	gr_palette_default = 0x70 /2;
8707 	gr_colorflip[0][0]=0x08 / 2;
8708 	gr_colorflip[0][1]=0x04 / 2;
8709 	gr_colorflip[0][2]=0x00 / 2;
8710 	gr_colorflip[0][3]=0x06 / 2;
8711 	gr_colorflip[1][0]=0x0a / 2;
8712 	gr_colorflip[1][1]=0x04 / 2;
8713 	gr_colorflip[1][2]=0x02 / 2;
8714 	gr_colorflip[1][3]=0x02 / 2;
8715 }
8716 
8717 
8718 
init_hangon(void)8719 static void init_hangon( void )
8720 {
8721 	sys16_onetime_init_machine();
8722 
8723 	sys16_sprite_decode( 8,0x010000 );
8724 	generate_gr_screen(512,1024,8,0,4,0x8000);
8725 }
8726 /***************************************************************************/
8727 
8728 INPUT_PORTS_START( hangon )
8729 PORT_START	/* Steering */
8730 	PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X | IPF_REVERSE | IPF_CENTER , 100, 3, 0x48, 0xb7 )
8731 
8732 #ifdef HANGON_DIGITAL_CONTROLS
8733 
8734 PORT_START	/* Buttons */
8735 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
8736 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
8737 
8738 #else
8739 
8740 PORT_START	/* Accel / Decel */
8741 	PORT_ANALOG( 0xff, 0x1, IPT_AD_STICK_Y | IPF_CENTER | IPF_REVERSE, 100, 16, 0, 0xa2 )
8742 
8743 #endif
8744 
8745 	SYS16_SERVICE
8746 	SYS16_COINAGE
8747 
8748 PORT_START	/* DSW1 */
8749 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
8750 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
8751 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
8752 	PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
8753 	PORT_DIPSETTING(    0x04, "Easy" )
8754 	PORT_DIPSETTING(    0x06, "Normal" )
8755 	PORT_DIPSETTING(    0x02, "Hard" )
8756 	PORT_DIPSETTING(    0x00, "Hardest" )
8757 	PORT_DIPNAME( 0x18, 0x18, "Time Adj." )
8758 	PORT_DIPSETTING(    0x18, "Normal" )
8759 	PORT_DIPSETTING(    0x10, "Medium" )
8760 	PORT_DIPSETTING(    0x08, "Hard" )
8761 	PORT_DIPSETTING(    0x00, "Hardest" )
8762 	PORT_DIPNAME( 0x20, 0x20, "Play Music" )
8763 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
8764 	PORT_DIPSETTING(    0x20, DEF_STR( On ) )
8765 
8766 #ifndef HANGON_DIGITAL_CONTROLS
8767 
8768 PORT_START	/* Brake */
8769 	PORT_ANALOG( 0xff, 0x1, IPT_AD_STICK_Y | IPF_PLAYER2 | IPF_CENTER | IPF_REVERSE, 100, 16, 0, 0xa2 )
8770 
8771 #endif
8772 INPUT_PORTS_END
8773 
8774 /***************************************************************************/
8775 
8776 static struct MachineDriver machine_driver_hangon =
8777 {
8778 	{
8779 		{
8780 			CPU_M68000,
8781 			10000000,
8782 			hangon_readmem,hangon_writemem,0,0,
8783 			sys16_interrupt,1
8784 		},
8785 		{
8786 			CPU_Z80 | CPU_AUDIO_CPU,
8787 			4096000,
8788 			hangon_sound_readmem,hangon_sound_writemem,hangon_sound_readport,hangon_sound_writeport,
8789 //			ignore_interrupt,1
8790 			interrupt,4
8791 		},
8792 		{
8793 			CPU_M68000,
8794 			10000000,
8795 			hangon_readmem2,hangon_writemem2,0,0,
8796 			sys16_interrupt,1
8797 		},
8798 	},
8799 	60, DEFAULT_60HZ_VBLANK_DURATION,
8800 	1,
8801 	hangon_init_machine,
8802 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
8803 	gfx8,
8804 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
8805 	0,
8806 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
8807 	0,
8808 	sys16_ho_vh_start,
8809 	sys16_vh_stop,
8810 	sys16_ho_vh_screenrefresh,
8811 	SOUND_SUPPORTS_STEREO,0,0,0,
8812 	{
8813 		{
8814 			SOUND_YM2203,
8815 			&ym2203_interface
8816 		},
8817 		{			// wrong sound chip??
8818 			SOUND_SEGAPCM,
8819 			&segapcm_interface_32k,
8820 		}
8821 	}
8822 };
8823 
8824 
8825 /***************************************************************************/
8826 // space harrier / enduro racer hardware
8827 ROM_START( sharrier )
8828 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
8829 	ROM_LOAD_EVEN( "ic97.bin", 0x000000, 0x8000, 0x7c30a036 )
8830 	ROM_LOAD_ODD ( "ic84.bin", 0x000000, 0x8000, 0x16deaeb1 )
8831 	ROM_LOAD_EVEN( "ic98.bin", 0x010000, 0x8000, 0x40b1309f )
8832 	ROM_LOAD_ODD ( "ic85.bin", 0x010000, 0x8000, 0xce78045c )
8833 	ROM_LOAD_EVEN( "ic99.bin", 0x020000, 0x8000, 0xf6391091 )
8834 	ROM_LOAD_ODD ( "ic86.bin", 0x020000, 0x8000, 0x79b367d7 )
8835 	ROM_LOAD_EVEN( "ic100.bin", 0x030000, 0x8000, 0x6171e9d3 )
8836 	ROM_LOAD_ODD ( "ic87.bin", 0x030000, 0x8000, 0x70cb72ef )
8837 
8838 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
8839 	ROM_LOAD( "sic31.bin", 0x00000, 0x08000, 0x347fa325 )
8840 	ROM_LOAD( "sic46.bin", 0x08000, 0x08000, 0x39d98bd1 )
8841 	ROM_LOAD( "sic60.bin", 0x10000, 0x08000, 0x3da3ea6b )
8842 
8843 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
8844 	ROM_LOAD( "ic36.bin", 0x000000, 0x008000, 0x93e2d264 )
8845 	ROM_LOAD( "ic28.bin", 0x008000, 0x008000, 0xedbf5fc3 )
8846 	ROM_LOAD( "ic118.bin",0x010000, 0x008000, 0xe8c537d8 )
8847 	ROM_LOAD( "ic8.bin",  0x018000, 0x008000, 0x22844fa4 )
8848 
8849 	ROM_LOAD( "ic35.bin", 0x020000, 0x008000, 0xcd6e7500 )
8850 	ROM_LOAD( "ic27.bin", 0x028000, 0x008000, 0x41f25a9c )
8851 	ROM_LOAD( "ic17.bin", 0x030000, 0x008000, 0x5bb09a67 )
8852 	ROM_LOAD( "ic7.bin",  0x038000, 0x008000, 0xdcaa2ebf )
8853 
8854 	ROM_LOAD( "ic34.bin", 0x040000, 0x008000, 0xd5e15e66 )
8855 	ROM_LOAD( "ic26.bin", 0x048000, 0x008000, 0xac62ae2e )
8856 	ROM_LOAD( "ic16.bin", 0x050000, 0x008000, 0x9c782295 )
8857 	ROM_LOAD( "ic6.bin",  0x058000, 0x008000, 0x3711105c )
8858 
8859 	ROM_LOAD( "ic33.bin", 0x060000, 0x008000, 0x60d7c1bb )
8860 	ROM_LOAD( "ic25.bin", 0x068000, 0x008000, 0xf6330038 )
8861 	ROM_LOAD( "ic15.bin", 0x070000, 0x008000, 0x60737b98 )
8862 	ROM_LOAD( "ic5.bin",  0x078000, 0x008000, 0x70fb5ebb )
8863 
8864 	ROM_LOAD( "ic32.bin", 0x080000, 0x008000, 0x6d7b5c97 )
8865 	ROM_LOAD( "ic24.bin", 0x088000, 0x008000, 0xcebf797c )
8866 	ROM_LOAD( "ic14.bin", 0x090000, 0x008000, 0x24596a8b )
8867 	ROM_LOAD( "ic4.bin",  0x098000, 0x008000, 0xb537d082 )
8868 
8869 	ROM_LOAD( "ic31.bin", 0x0a0000, 0x008000, 0x5e784271 )
8870 	ROM_LOAD( "ic23.bin", 0x0a8000, 0x008000, 0x510e5e10 )
8871 	ROM_LOAD( "ic13.bin", 0x0b0000, 0x008000, 0x7a2dad15 )
8872 	ROM_LOAD( "ic3.bin",  0x0b8000, 0x008000, 0xf5ba4e08 )
8873 
8874 	ROM_LOAD( "ic30.bin", 0x0c0000, 0x008000, 0xec42c9ef )
8875 	ROM_LOAD( "ic22.bin", 0x0c8000, 0x008000, 0x6d4a7d7a )
8876 	ROM_LOAD( "ic12.bin", 0x0d0000, 0x008000, 0x0f732717 )
8877 	ROM_LOAD( "ic2.bin",  0x0d8000, 0x008000, 0xfc3bf8f3 )
8878 
8879 	ROM_LOAD( "ic29.bin", 0x0e0000, 0x008000, 0xed51fdc4 )
8880 	ROM_LOAD( "ic21.bin", 0x0e8000, 0x008000, 0xdfe75f3d )
8881 	ROM_LOAD( "ic11.bin", 0x0f0000, 0x008000, 0xa2c07741 )
8882 	ROM_LOAD( "ic1.bin",  0x0f8000, 0x008000, 0xb191e22f )
8883 
8884 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
8885 	ROM_LOAD( "ic73.bin", 0x00000, 0x004000, 0xd6397933 )
8886 	ROM_LOAD( "ic72.bin", 0x04000, 0x004000, 0x504e76d9 )
8887 
8888 	ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
8889 	ROM_LOAD( "snd7231.256", 0x00000, 0x008000, 0x871c6b14 )
8890 	ROM_LOAD( "snd7232.256", 0x08000, 0x008000, 0x4b59340c )
8891 
8892 	ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
8893 	ROM_LOAD_EVEN("ic54.bin", 0x0000, 0x8000, 0xd7c535b6 )
8894 	ROM_LOAD_ODD( "ic67.bin", 0x0000, 0x8000, 0xa6153af8 )
8895 
8896 	ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
8897 	ROM_LOAD( "pic2.bin", 0x0000, 0x8000, 0xb4740419 )
8898 ROM_END
8899 
8900 /***************************************************************************/
8901 
READ_HANDLER(sh_io_joy_r)8902 static READ_HANDLER( sh_io_joy_r ){ return (input_port_5_r( offset ) << 8) + input_port_6_r( offset ); }
8903 
8904 static unsigned char *shared_ram;
READ_HANDLER(shared_ram_r)8905 static READ_HANDLER( shared_ram_r ) { return READ_WORD(&shared_ram[offset]); }
WRITE_HANDLER(shared_ram_w)8906 static WRITE_HANDLER( shared_ram_w ) { COMBINE_WORD_MEM(&shared_ram[offset], data); }
8907 
READ_HANDLER(sh_motor_status_r)8908 static READ_HANDLER( sh_motor_status_r ) { return 0x0; }
8909 
8910 static struct MemoryReadAddress harrier_readmem[] =
8911 {
8912 	{ 0x000000, 0x03ffff, MRA_ROM },
8913 	{ 0x040000, 0x043fff, MRA_EXTRAM },
8914 	{ 0x100000, 0x107fff, MRA_TILERAM },
8915 	{ 0x108000, 0x108fff, MRA_TEXTRAM },
8916 	{ 0x110000, 0x110fff, MRA_PALETTERAM },
8917 	{ 0x124000, 0x127fff, shared_ram_r },
8918 	{ 0x130000, 0x130fff, MRA_SPRITERAM },
8919 	{ 0x140010, 0x140011, io_service_r },
8920 	{ 0x140014, 0x140015, io_dip1_r },
8921 	{ 0x140016, 0x140017, io_dip2_r },
8922 	{ 0x140024, 0x140027, sh_motor_status_r },
8923 	{ 0x140000, 0x140027, MRA_EXTRAM3 },		//io
8924 	{ 0xc68000, 0xc68fff, MRA_EXTRAM2 },
8925 
8926 	{-1}
8927 };
8928 
8929 static struct MemoryWriteAddress harrier_writemem[] =
8930 {
8931 	{ 0x000000, 0x03ffff, MWA_ROM },
8932 	{ 0x040000, 0x043fff, MWA_EXTRAM },
8933 	{ 0x100000, 0x107fff, MWA_TILERAM },
8934 	{ 0x108000, 0x108fff, MWA_TEXTRAM },
8935 	{ 0x110000, 0x110fff, MWA_PALETTERAM },
8936 	{ 0x124000, 0x127fff, shared_ram_w, &shared_ram },
8937 	{ 0x130000, 0x130fff, MWA_SPRITERAM },
8938 	{ 0x140000, 0x140001, sound_command_nmi_w },
8939 	{ 0x140000, 0x140027, MWA_EXTRAM3 },		//io
8940 	{ 0xc68000, 0xc68fff, MWA_EXTRAM2 },
8941 
8942 	{-1}
8943 };
8944 
8945 static struct MemoryReadAddress harrier_readmem2[] =
8946 {
8947 	{ 0x000000, 0x03ffff, MRA_ROM },
8948 	{ 0xc68000, 0xc68fff, MRA_EXTRAM2 },
8949 	{ 0xc7c000, 0xc7ffff, shared_ram_r },
8950 	{-1}
8951 };
8952 
8953 static struct MemoryWriteAddress harrier_writemem2[] =
8954 {
8955 	{ 0x000000, 0x03ffff, MWA_ROM },
8956 	{ 0xc68000, 0xc68fff, MWA_EXTRAM2 },
8957 	{ 0xc7c000, 0xc7ffff, shared_ram_w, &shared_ram },
8958 	{-1}
8959 };
8960 
8961 static struct MemoryReadAddress harrier_sound_readmem[] =
8962 {
8963 	{ 0x0000, 0x7fff, MRA_ROM },
8964 	{ 0xd000, 0xd000, YM2203_status_port_0_r },
8965 	{ 0xe000, 0xe0ff, SegaPCM_r },
8966 	{ 0x8000, 0xffff, MRA_RAM },
8967 	{ -1 }  /* end of table */
8968 };
8969 
8970 static struct MemoryWriteAddress harrier_sound_writemem[] =
8971 {
8972 	{ 0x0000, 0x7fff, MWA_ROM },
8973 	{ 0xd000, 0xd000, YM2203_control_port_0_w },
8974 	{ 0xd001, 0xd001, YM2203_write_port_0_w },
8975 	{ 0xe000, 0xe0ff, SegaPCM_w },
8976 	{ 0x8000, 0xffff, MWA_RAM },
8977 	{ -1 }  /* end of table */
8978 };
8979 
8980 static struct IOReadPort harrier_sound_readport[] =
8981 {
8982 	{ 0x40, 0x40, soundlatch_r },
8983 	{ -1 }	/* end of table */
8984 };
8985 
8986 
8987 static struct IOWritePort harrier_sound_writeport[] =
8988 {
8989 	{ -1 }
8990 };
8991 
8992 /***************************************************************************/
8993 
harrier_update_proc(void)8994 static void harrier_update_proc( void ){
8995 	int data;
8996 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
8997 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
8998 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x01ff;
8999 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
9000 
9001 	data = READ_WORD( &sys16_textram[0x0e9e] );
9002 
9003 	sys16_fg_page[0] = data>>12;
9004 	sys16_fg_page[1] = (data>>8)&0xf;
9005 	sys16_fg_page[3] = (data>>4)&0xf;
9006 	sys16_fg_page[2] = data&0xf;
9007 
9008 	data = READ_WORD( &sys16_textram[0x0e9c] );
9009 	sys16_bg_page[0] = data>>12;
9010 	sys16_bg_page[1] = (data>>8)&0xf;
9011 	sys16_bg_page[3] = (data>>4)&0xf;
9012 	sys16_bg_page[2] = data&0xf;
9013 
9014 	WRITE_WORD(&sys16_extraram[0x492],sh_io_joy_r(0));
9015 
9016 	data=READ_WORD( &sys16_extraram3[2] );
9017 	set_refresh_3d( data );
9018 
9019 	if(data & 8)
9020 	{
9021 		osd_led_w(0,1);
9022 		osd_led_w(2,1);
9023 	}
9024 	else
9025 	{
9026 		osd_led_w(0,0);
9027 		osd_led_w(2,0);
9028 	}
9029 	if(data & 4)
9030 		osd_led_w(1,1);
9031 	else
9032 		osd_led_w(1,0);
9033 
9034 }
9035 
harrier_init_machine(void)9036 static void harrier_init_machine( void ){
9037 	static int bank[16] = { 00,01,02,03,04,05,06,07,00,00,00,00,00,00,00,00};
9038 	sys16_obj_bank = bank;
9039 	sys16_textmode=1;
9040 	sys16_spritesystem = 6;
9041 	sys16_sprxoffset = -0xc0;
9042 	sys16_fgxoffset = 8;
9043 	sys16_textlayer_lo_min=0;
9044 	sys16_textlayer_lo_max=0;
9045 	sys16_textlayer_hi_min=0;
9046 	sys16_textlayer_hi_max=0xff;
9047 
9048 
9049 //*disable illegal rom writes
9050 	patch_code( 0x8112, 0x4a);
9051 	patch_code( 0x83d2, 0x4a);
9052 	patch_code( 0x83d6, 0x4a);
9053 	patch_code( 0x82c4, 0x4a);
9054 	patch_code( 0x82c8, 0x4a);
9055 	patch_code( 0x84d0, 0x4a);
9056 	patch_code( 0x84d4, 0x4a);
9057 	patch_code( 0x85de, 0x4a);
9058 	patch_code( 0x85e2, 0x4a);
9059 
9060 	sys16_update_proc = harrier_update_proc;
9061 
9062 	gr_ver = &sys16_extraram2[0x0];
9063 	gr_hor = gr_ver+0x200;
9064 	gr_pal = gr_ver+0x400;
9065 	gr_flip= gr_ver+0x600;
9066 	gr_palette= 0xf80 / 2;
9067 	gr_palette_default = 0x70 /2;
9068 	gr_colorflip[0][0]=0x00 / 2;
9069 	gr_colorflip[0][1]=0x02 / 2;
9070 	gr_colorflip[0][2]=0x04 / 2;
9071 	gr_colorflip[0][3]=0x00 / 2;
9072 	gr_colorflip[1][0]=0x00 / 2;
9073 	gr_colorflip[1][1]=0x00 / 2;
9074 	gr_colorflip[1][2]=0x06 / 2;
9075 	gr_colorflip[1][3]=0x00 / 2;
9076 
9077 #ifdef TRANSPARENT_SHADOWS
9078 	sys16_sh_shadowpal=0;
9079 #endif
9080 }
9081 
init_sharrier(void)9082 static void init_sharrier( void )
9083 {
9084 	sys16_onetime_init_machine();
9085 #ifdef TRANSPARENT_SHADOWS
9086 	sys16_MaxShadowColors=NumOfShadowColors / 2;
9087 #endif
9088 
9089 #ifdef SPACEHARRIER_OFFSETS
9090 	spaceharrier_patternoffsets=malloc(65536);
9091 
9092 	memset(spaceharrier_patternoffsets,0x7f,65535);
9093 	spaceharrier_patternoffsets[0x2124] = 0; // small shadow
9094 	spaceharrier_patternoffsets[0x2429] = 4; // ice berg of round 7
9095 	spaceharrier_patternoffsets[0x211b] = 1; // small flying rock
9096 	spaceharrier_patternoffsets[0x515b] = 0; // small flying ball
9097 	spaceharrier_patternoffsets[0x611f] = 0; // small ceiling ball
9098 	spaceharrier_patternoffsets[0x624a] = 1; // small ceiling ball
9099 	spaceharrier_patternoffsets[0x5785] = 1; // 3 poses of the Harrier on the title screen
9100 	spaceharrier_patternoffsets[0x5771] = 1; // these are the only patterns which do not need
9101 	spaceharrier_patternoffsets[0x579a] = 1; // position compensations
9102 	spaceharrier_patternoffsets[0x06f3] = 0; // missiles
9103 	spaceharrier_patternoffsets[0x0735] = 0;
9104 #endif
9105 
9106 	sys16_sprite_decode2( 8,0x020000 ,1);
9107 	generate_gr_screen(512,512,0,0,4,0x8000);
9108 }
9109 /***************************************************************************/
9110 
9111 INPUT_PORTS_START( sharrier )
9112 	SYS16_JOY1
9113 	SYS16_JOY2
9114 
9115 PORT_START
9116 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
9117 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
9118 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
9119 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
9120 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
9121 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
9122 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
9123 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
9124 
9125 	SYS16_COINAGE
9126 
9127 PORT_START	/* DSW1 */
9128 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
9129 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
9130 	PORT_DIPSETTING(    0x01, "Moving" )
9131 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
9132 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
9133 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
9134 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
9135 	PORT_DIPSETTING(    0x08, "2" )
9136 	PORT_DIPSETTING(    0x0c, "3" )
9137 	PORT_DIPSETTING(    0x04, "4" )
9138 	PORT_DIPSETTING(    0x00, "5" )
9139 	PORT_DIPNAME( 0x10, 0x10, "Add Player Score" )
9140 	PORT_DIPSETTING(    0x10, "5000000" )
9141 	PORT_DIPSETTING(    0x00, "7000000" )
9142 	PORT_DIPNAME( 0x20, 0x20, "Trial Time" )
9143 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
9144 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
9145 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
9146 	PORT_DIPSETTING(    0x80, "Easy" )
9147 	PORT_DIPSETTING(    0xc0, "Normal" )
9148 	PORT_DIPSETTING(    0x40, "Hard" )
9149 	PORT_DIPSETTING(    0x00, "Hardest" )
9150 
9151 
9152 PORT_START	/* X */
9153 	PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X |  IPF_REVERSE, 100, 4, 0x20, 0xdf )
9154 
9155 PORT_START	/* Y */
9156 	PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_Y |  IPF_REVERSE, 100, 4, 0x60, 0x9f )
9157 
9158 INPUT_PORTS_END
9159 
9160 /***************************************************************************/
9161 
9162 static struct MachineDriver machine_driver_sharrier =
9163 {
9164 	{
9165 		{
9166 			CPU_M68000,
9167 			10000000,
9168 			harrier_readmem,harrier_writemem,0,0,
9169 			sys16_interrupt,1
9170 		},
9171 		{
9172 			CPU_Z80 | CPU_AUDIO_CPU,
9173 			4096000,
9174 			harrier_sound_readmem,harrier_sound_writemem,harrier_sound_readport,harrier_sound_writeport,
9175 //			ignore_interrupt,1
9176 			interrupt,4
9177 		},
9178 		{
9179 			CPU_M68000,
9180 			10000000,
9181 			harrier_readmem2,harrier_writemem2,0,0,
9182 			sys16_interrupt,1
9183 		},
9184 	},
9185 	60, DEFAULT_60HZ_VBLANK_DURATION,
9186 	1,
9187 	harrier_init_machine,
9188 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
9189 	gfx8,
9190 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
9191 	0,
9192 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
9193 	0,
9194 	sys16_ho_vh_start,
9195 	sys16_vh_stop,
9196 	sys16_ho_vh_screenrefresh,
9197 	SOUND_SUPPORTS_STEREO,0,0,0,
9198 	{
9199 		{
9200 			SOUND_YM2203,
9201 			&ym2203_interface
9202 		},
9203 		{
9204 			SOUND_SEGAPCM,
9205 			&segapcm_interface_32k,
9206 		}
9207 	}
9208 };
9209 
9210 /***************************************************************************/
9211 
9212 /* hang-on's accel/brake are really both analog controls, but I've added them
9213 as digital as well to see what works better */
9214 
9215 // hangon hardware
9216 ROM_START( shangon )
9217 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code - protected */
9218 	ROM_LOAD_EVEN( "ic133", 0x000000, 0x10000, 0xe52721fe )
9219 	ROM_LOAD_ODD ( "ic118", 0x000000, 0x10000, 0x5fee09f6 )
9220 	ROM_LOAD_EVEN( "ic132", 0x020000, 0x10000, 0x5d55d65f )
9221 	ROM_LOAD_ODD ( "ic117", 0x020000, 0x10000, 0xb967e8c3 )
9222 
9223 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
9224 	ROM_LOAD( "ic54",        0x00000, 0x08000, 0x260286f9 )
9225 	ROM_LOAD( "ic55",        0x08000, 0x08000, 0xc609ee7b )
9226 	ROM_LOAD( "ic56",        0x10000, 0x08000, 0xb236a403 )
9227 
9228 	ROM_REGION( 0x0120000*2, REGION_GFX2 ) /* sprites */
9229 	ROM_LOAD( "ic8",         0x000000, 0x010000, 0xd6ac012b )
9230 	ROM_RELOAD(              0x100000, 0x010000 )	// twice?
9231 	ROM_LOAD( "ic16",        0x010000, 0x010000, 0xd9d83250 )
9232 	ROM_RELOAD(              0x110000, 0x010000 )	// twice?
9233 	ROM_LOAD( "ic7",         0x020000, 0x010000, 0x25ebf2c5 )
9234 	ROM_RELOAD(              0x0e0000, 0x010000 )	// twice?
9235 	ROM_LOAD( "ic15",        0x030000, 0x010000, 0x6365d2e9 )
9236 	ROM_RELOAD(              0x0f0000, 0x010000 )	// twice?
9237 	ROM_LOAD( "ic6",         0x040000, 0x010000, 0x8a57b8d6 )
9238 	ROM_LOAD( "ic14",        0x050000, 0x010000, 0x3aff8910 )
9239 	ROM_LOAD( "ic5",         0x060000, 0x010000, 0xaf473098 )
9240 	ROM_LOAD( "ic13",        0x070000, 0x010000, 0x80bafeef )
9241 	ROM_LOAD( "ic4",         0x080000, 0x010000, 0x03bc4878 )
9242 	ROM_LOAD( "ic12",        0x090000, 0x010000, 0x274b734e )
9243 	ROM_LOAD( "ic3",         0x0a0000, 0x010000, 0x9f0677ed )
9244 	ROM_LOAD( "ic11",        0x0b0000, 0x010000, 0x508a4701 )
9245 	ROM_LOAD( "ic2",         0x0c0000, 0x010000, 0xb176ea72 )
9246 	ROM_LOAD( "ic10",        0x0d0000, 0x010000, 0x42fcd51d )
9247 
9248 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
9249 	ROM_LOAD( "ic88", 0x0000, 0x08000, 0x1254efa6 )
9250 
9251 	ROM_LOAD( "ic66", 0x10000, 0x08000, 0x06f55364 )
9252 	ROM_LOAD( "ic67", 0x18000, 0x08000, 0x731f5cf8 )
9253 	ROM_LOAD( "ic68", 0x20000, 0x08000, 0xa60dabff )
9254 	ROM_LOAD( "ic69", 0x28000, 0x08000, 0x473cc411 )
9255 
9256 	ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU  - protected */
9257 	ROM_LOAD_EVEN( "ic76", 0x0000, 0x10000, 0x02be68db )
9258 	ROM_LOAD_ODD ( "ic58", 0x0000, 0x10000, 0xf13e8bee )
9259 	ROM_LOAD_EVEN( "ic75", 0x20000, 0x10000, 0x1627c224 )
9260 	ROM_LOAD_ODD ( "ic57", 0x20000, 0x10000, 0x8cdbcde8 )
9261 
9262 	ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
9263 	ROM_LOAD( "ic47", 0x0000, 0x8000, 0x7836bcc3 )
9264 ROM_END
9265 
9266 ROM_START( shangonb )
9267 	ROM_REGION( 0x030000, REGION_CPU1 ) /* 68000 code */
9268 	ROM_LOAD_EVEN( "s-hangon.30", 0x000000, 0x10000, 0xd95e82fc )
9269 	ROM_LOAD_ODD ( "s-hangon.32", 0x000000, 0x10000, 0x2ee4b4fb )
9270 	ROM_LOAD_EVEN( "s-hangon.29", 0x020000, 0x8000, 0x12ee8716 )
9271 	ROM_LOAD_ODD ( "s-hangon.31", 0x020000, 0x8000, 0x155e0cfd )
9272 
9273 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
9274 	ROM_LOAD( "ic54",        0x00000, 0x08000, 0x260286f9 )
9275 	ROM_LOAD( "ic55",        0x08000, 0x08000, 0xc609ee7b )
9276 	ROM_LOAD( "ic56",        0x10000, 0x08000, 0xb236a403 )
9277 
9278 	ROM_REGION( 0x0120000*2, REGION_GFX2 ) /* sprites */
9279 	ROM_LOAD( "ic8",         0x000000, 0x010000, 0xd6ac012b )
9280 	ROM_RELOAD(              0x100000, 0x010000 )	// twice?
9281 	ROM_LOAD( "ic16",        0x010000, 0x010000, 0xd9d83250 )
9282 	ROM_RELOAD(              0x110000, 0x010000 )	// twice?
9283 	ROM_LOAD( "s-hangon.20", 0x020000, 0x010000, 0xeef23b3d )
9284 	ROM_RELOAD(              0x0e0000, 0x010000 )	// twice?
9285 	ROM_LOAD( "s-hangon.14", 0x030000, 0x010000, 0x0f26d131 )
9286 	ROM_RELOAD(              0x0f0000, 0x010000 )	// twice?
9287 	ROM_LOAD( "ic6",         0x040000, 0x010000, 0x8a57b8d6 )
9288 	ROM_LOAD( "ic14",        0x050000, 0x010000, 0x3aff8910 )
9289 	ROM_LOAD( "ic5",         0x060000, 0x010000, 0xaf473098 )
9290 	ROM_LOAD( "ic13",        0x070000, 0x010000, 0x80bafeef )
9291 	ROM_LOAD( "ic4",         0x080000, 0x010000, 0x03bc4878 )
9292 	ROM_LOAD( "ic12",        0x090000, 0x010000, 0x274b734e )
9293 	ROM_LOAD( "ic3",         0x0a0000, 0x010000, 0x9f0677ed )
9294 	ROM_LOAD( "ic11",        0x0b0000, 0x010000, 0x508a4701 )
9295 	ROM_LOAD( "ic2",         0x0c0000, 0x010000, 0xb176ea72 )
9296 	ROM_LOAD( "ic10",        0x0d0000, 0x010000, 0x42fcd51d )
9297 
9298 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
9299 	ROM_LOAD( "s-hangon.03", 0x0000, 0x08000, 0x83347dc0 )
9300 
9301 	ROM_REGION( 0x20000, REGION_SOUND1 ) /* Sega PCM sound data */
9302 	ROM_LOAD( "s-hangon.02", 0x00000, 0x10000, 0xda08ca2b )
9303 	ROM_LOAD( "s-hangon.01", 0x10000, 0x10000, 0x8b10e601 )
9304 
9305 	ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU */
9306 	ROM_LOAD_EVEN("s-hangon.09", 0x0000, 0x10000, 0x070c8059 )
9307 	ROM_LOAD_ODD( "s-hangon.05", 0x0000, 0x10000, 0x9916c54b )
9308 	ROM_LOAD_EVEN("s-hangon.08", 0x20000, 0x10000, 0x000ad595 )
9309 	ROM_LOAD_ODD( "s-hangon.04", 0x20000, 0x10000, 0x8f8f4af0 )
9310 
9311 	ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
9312 	ROM_LOAD( "s-hangon.26", 0x0000, 0x8000, 0x1bbe4fc8 )
9313 ROM_END
9314 
9315 
9316 /***************************************************************************/
9317 
9318 static unsigned char *shared_ram2;
READ_HANDLER(shared_ram2_r)9319 static READ_HANDLER( shared_ram2_r ) { return READ_WORD(&shared_ram2[offset]); }
WRITE_HANDLER(shared_ram2_w)9320 static WRITE_HANDLER( shared_ram2_w ) { COMBINE_WORD_MEM(&shared_ram2[offset], data); }
9321 
9322 static struct MemoryReadAddress shangon_readmem[] =
9323 {
9324 	{ 0x000000, 0x03ffff, MRA_ROM },
9325 	{ 0x20c640, 0x20c647, sound_shared_ram_r },
9326 	{ 0x20c000, 0x20ffff, MRA_EXTRAM5 },
9327 
9328 	{ 0x400000, 0x40ffff, MRA_TILERAM },
9329 	{ 0x410000, 0x410fff, MRA_TEXTRAM },
9330 	{ 0x600000, 0x600fff, MRA_SPRITERAM },
9331 	{ 0xa00000, 0xa00fff, MRA_PALETTERAM },
9332 	{ 0xc68000, 0xc68fff, shared_ram_r },
9333 	{ 0xc7c000, 0xc7ffff, shared_ram2_r },
9334 	{ 0xe01000, 0xe01001, io_service_r },
9335 	{ 0xe0100c, 0xe0100d, io_dip2_r },
9336 	{ 0xe0100a, 0xe0100b, io_dip1_r },
9337 	{ 0xe030f8, 0xe030f9, ho_io_x_r },
9338 	{ 0xe030fa, 0xe030fb, ho_io_y_r },
9339 	{ 0xe00000, 0xe03fff, MRA_EXTRAM4 },	// io
9340 	{-1}
9341 };
9342 
9343 static struct MemoryWriteAddress shangon_writemem[] =
9344 {
9345 	{ 0x000000, 0x03ffff, MWA_ROM },
9346 	{ 0x20c640, 0x20c647, sound_shared_ram_w },
9347 	{ 0x20c000, 0x20ffff, MWA_EXTRAM5 },
9348 	{ 0x400000, 0x40ffff, MWA_TILERAM },
9349 	{ 0x410000, 0x410fff, MWA_TEXTRAM },
9350 	{ 0x600000, 0x600fff, MWA_SPRITERAM },
9351 	{ 0xa00000, 0xa00fff, MWA_PALETTERAM },
9352 	{ 0xc68000, 0xc68fff, shared_ram_w, &shared_ram },
9353 	{ 0xc7c000, 0xc7ffff, shared_ram2_w, &shared_ram2 },
9354 	{ 0xe00000, 0xe03fff, MWA_EXTRAM4 },	// io
9355 	{-1}
9356 };
9357 
9358 static struct MemoryReadAddress shangon_readmem2[] =
9359 {
9360 	{ 0x000000, 0x03ffff, MRA_ROM },
9361 	{ 0x454000, 0x45401f, MRA_EXTRAM3 },
9362 	{ 0x7e8000, 0x7e8fff, shared_ram_r },
9363 	{ 0x7fc000, 0x7ffbff, shared_ram2_r },
9364 	{ 0x7ffc00, 0x7fffff, MRA_EXTRAM },
9365 	{-1}
9366 };
9367 
9368 static struct MemoryWriteAddress shangon_writemem2[] =
9369 {
9370 	{ 0x000000, 0x03ffff, MWA_ROM },
9371 	{ 0x454000, 0x45401f, MWA_EXTRAM3 },
9372 	{ 0x7e8000, 0x7e8fff, shared_ram_w },
9373 	{ 0x7fc000, 0x7ffbff, shared_ram2_w },
9374 	{ 0x7ffc00, 0x7fffff, MWA_EXTRAM },
9375 	{-1}
9376 };
9377 
9378 static struct MemoryReadAddress shangon_sound_readmem[] =
9379 {
9380 	{ 0x0000, 0x7fff, MRA_ROM },
9381 	{ 0xf000, 0xf7ff, SegaPCM_r },
9382 	{ 0xf800, 0xf807, sound2_shared_ram_r },
9383 	{ 0xf808, 0xffff, MRA_RAM },
9384 	{ -1 }  /* end of table */
9385 };
9386 
9387 static struct MemoryWriteAddress shangon_sound_writemem[] =
9388 {
9389 	{ 0x0000, 0x7fff, MWA_ROM },
9390 	{ 0xf000, 0xf7ff, SegaPCM_w },
9391 	{ 0xf800, 0xf807, sound2_shared_ram_w,&sound_shared_ram },
9392 	{ 0xf808, 0xffff, MWA_RAM },
9393 	{ -1 }  /* end of table */
9394 };
9395 
9396 /***************************************************************************/
9397 
shangon_update_proc(void)9398 static void shangon_update_proc( void ){
9399 	int leds;
9400 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
9401 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
9402 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x00ff;
9403 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
9404 
9405 	set_fg_page1( READ_WORD( &sys16_textram[0x0e9e] ) );
9406 	set_bg_page1( READ_WORD( &sys16_textram[0x0e9c] ) );
9407 
9408 	set_refresh_3d( READ_WORD( &sys16_extraram4[2] ) );
9409 
9410 	leds=READ_WORD( &sys16_extraram4[0x2] );
9411 
9412 	if(leds & 4)
9413 	{
9414 		osd_led_w(0,1);
9415 		osd_led_w(1,1);
9416 		osd_led_w(2,1);
9417 	}
9418 	else
9419 	{
9420 		osd_led_w(0,0);
9421 		osd_led_w(1,0);
9422 		osd_led_w(2,0);
9423 	}
9424 
9425 }
9426 
shangon_init_machine(void)9427 static void shangon_init_machine( void ){
9428 	static int bank[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
9429 	sys16_obj_bank = bank;
9430 	sys16_textmode=1;
9431 	sys16_spritesystem = 5;
9432 	sys16_sprxoffset = -0xc0;
9433 	sys16_fgxoffset = 8;
9434 	sys16_textlayer_lo_min=0;
9435 	sys16_textlayer_lo_max=0;
9436 	sys16_textlayer_hi_min=0;
9437 	sys16_textlayer_hi_max=0xff;
9438 
9439 	patch_code( 0x65bd, 0xf9);
9440 	patch_code( 0x6677, 0xfa);
9441 	patch_code( 0x66d5, 0xfb);
9442 	patch_code( 0x9621, 0xfb);
9443 
9444 	sys16_update_proc = shangon_update_proc;
9445 
9446 	gr_ver = &shared_ram[0x0];
9447 	gr_hor = gr_ver+0x200;
9448 	gr_pal = gr_ver+0x400;
9449 	gr_flip= gr_ver+0x600;
9450 	gr_palette= 0xf80 / 2;
9451 	gr_palette_default = 0x70 /2;
9452 	gr_colorflip[0][0]=0x08 / 2;
9453 	gr_colorflip[0][1]=0x04 / 2;
9454 	gr_colorflip[0][2]=0x00 / 2;
9455 	gr_colorflip[0][3]=0x06 / 2;
9456 	gr_colorflip[1][0]=0x0a / 2;
9457 	gr_colorflip[1][1]=0x04 / 2;
9458 	gr_colorflip[1][2]=0x02 / 2;
9459 	gr_colorflip[1][3]=0x02 / 2;
9460 }
9461 
9462 
9463 
init_shangon(void)9464 static void init_shangon( void )
9465 {
9466 	sys16_onetime_init_machine();
9467 
9468 	sys16_sprite_decode( 9,0x020000 );
9469 	generate_gr_screen(512,1024,0,0,4,0x8000);
9470 	//??
9471 	patch_z80code( 0x1087, 0x20);
9472 	patch_z80code( 0x1088, 0x01);
9473 }
9474 
init_shangonb(void)9475 static void init_shangonb( void )
9476 {
9477 	sys16_onetime_init_machine();
9478 
9479 	sys16_sprite_decode( 9,0x020000 );
9480 	generate_gr_screen(512,1024,8,0,4,0x8000);
9481 }
9482 /***************************************************************************/
9483 
9484 INPUT_PORTS_START( shangon )
9485 PORT_START	/* Steering */
9486 	PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X | IPF_REVERSE | IPF_CENTER , 100, 3, 0x42, 0xbd )
9487 
9488 #ifdef HANGON_DIGITAL_CONTROLS
9489 
9490 PORT_START	/* Buttons */
9491 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
9492 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
9493 
9494 #else
9495 
9496 PORT_START	/* Accel / Decel */
9497 	PORT_ANALOG( 0xff, 0x1, IPT_AD_STICK_Y | IPF_CENTER | IPF_REVERSE, 100, 16, 1, 0xa2 )
9498 
9499 #endif
9500 
9501 PORT_START
9502 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
9503 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
9504 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
9505 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
9506 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
9507 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
9508 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
9509 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
9510 
9511 	SYS16_COINAGE
9512 
9513 PORT_START	/* DSW1 */
9514 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
9515 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
9516 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
9517 	PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
9518 	PORT_DIPSETTING(    0x04, "Easy" )
9519 	PORT_DIPSETTING(    0x06, "Normal" )
9520 	PORT_DIPSETTING(    0x02, "Hard" )
9521 	PORT_DIPSETTING(    0x00, "Hardest" )
9522 	PORT_DIPNAME( 0x18, 0x18, "Time Adj." )
9523 	PORT_DIPSETTING(    0x10, "Easy" )
9524 	PORT_DIPSETTING(    0x18, "Normal" )
9525 	PORT_DIPSETTING(    0x08, "Hard" )
9526 	PORT_DIPSETTING(    0x00, "Hardest" )
9527 	PORT_DIPNAME( 0x20, 0x20, "Play Music" )
9528 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
9529 	PORT_DIPSETTING(    0x20, DEF_STR( On ) )
9530 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) )
9531 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
9532 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
9533 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
9534 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
9535 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
9536 
9537 
9538 #ifndef HANGON_DIGITAL_CONTROLS
9539 
9540 PORT_START	/* Brake */
9541 	PORT_ANALOG( 0xff, 0x1, IPT_AD_STICK_Y | IPF_PLAYER2 | IPF_CENTER | IPF_REVERSE, 100, 16, 1, 0xa2 )
9542 
9543 #endif
9544 INPUT_PORTS_END
9545 
9546 /***************************************************************************/
9547 static struct MachineDriver machine_driver_shangon =
9548 {
9549 	{
9550 		{
9551 			CPU_M68000,
9552 			10000000,
9553 			shangon_readmem,shangon_writemem,0,0,
9554 			sys16_interrupt,1
9555 		},
9556 		{
9557 			CPU_Z80 | CPU_AUDIO_CPU,
9558 			4096000,
9559 			shangon_sound_readmem,shangon_sound_writemem,sound_readport,sound_writeport,
9560 			ignore_interrupt,1
9561 		},
9562 		{
9563 			CPU_M68000,
9564 			10000000,
9565 			shangon_readmem2,shangon_writemem2,0,0,
9566 			sys16_interrupt,1
9567 		},
9568 	},
9569 	60, DEFAULT_60HZ_VBLANK_DURATION,
9570 	1,
9571 	shangon_init_machine,
9572 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
9573 	gfx8,
9574 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
9575 	0,
9576 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
9577 	0,
9578 	sys16_ho_vh_start,
9579 	sys16_vh_stop,
9580 	sys16_ho_vh_screenrefresh,
9581 	SOUND_SUPPORTS_STEREO,0,0,0,
9582 	{
9583 		{
9584 			SOUND_YM2151,
9585 			&ym2151_interface
9586 		},
9587 		{
9588 			SOUND_SEGAPCM,
9589 			&segapcm_interface_15k_512,
9590 		}
9591 	}
9592 };
9593 
9594 /***************************************************************************/
9595 // Outrun hardware
9596 ROM_START( outrun )
9597 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
9598 	ROM_LOAD_EVEN( "10380a", 0x000000, 0x10000, 0x434fadbc )
9599 	ROM_LOAD_ODD ( "10382a", 0x000000, 0x10000, 0x1ddcc04e )
9600 	ROM_LOAD_EVEN( "10381a", 0x020000, 0x10000, 0xbe8c412b )
9601 	ROM_LOAD_ODD ( "10383a", 0x020000, 0x10000, 0xdcc586e7 )
9602 
9603 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
9604 	ROM_LOAD( "10268", 0x00000, 0x08000, 0x95344b04 )
9605 	ROM_LOAD( "10232", 0x08000, 0x08000, 0x776ba1eb )
9606 	ROM_LOAD( "10267", 0x10000, 0x08000, 0xa85bb823 )
9607 	ROM_LOAD( "10231", 0x18000, 0x08000, 0x8908bcbf )
9608 	ROM_LOAD( "10266", 0x20000, 0x08000, 0x9f6f1a74 )
9609 	ROM_LOAD( "10230", 0x28000, 0x08000, 0x686f5e50 )
9610 
9611 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
9612 	ROM_LOAD( "10371", 0x000000, 0x010000, 0x0a1c98de )
9613 	ROM_CONTINUE(      0x080000, 0x010000 )
9614 	ROM_LOAD( "10373", 0x010000, 0x010000, 0x339f8e64 )
9615 	ROM_CONTINUE(      0x090000, 0x010000 )
9616 	ROM_LOAD( "10375", 0x020000, 0x010000, 0x62a472bd )
9617 	ROM_CONTINUE(      0x0a0000, 0x010000 )
9618 	ROM_LOAD( "10377", 0x030000, 0x010000, 0xc86daecb )
9619 	ROM_CONTINUE(      0x0b0000, 0x010000 )
9620 
9621 	ROM_LOAD( "10372", 0x040000, 0x010000, 0x1640ad1f )
9622 	ROM_CONTINUE(      0x0c0000, 0x010000 )
9623 	ROM_LOAD( "10374", 0x050000, 0x010000, 0x22744340 )
9624 	ROM_CONTINUE(      0x0d0000, 0x010000 )
9625 	ROM_LOAD( "10376", 0x060000, 0x010000, 0x8337ace7 )
9626 	ROM_CONTINUE(      0x0e0000, 0x010000 )
9627 	ROM_LOAD( "10378", 0x070000, 0x010000, 0x544068fd )
9628 	ROM_CONTINUE(      0x0f0000, 0x010000 )
9629 
9630 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
9631 	ROM_LOAD( "10187",       0x00000, 0x008000, 0xa10abaa9 )
9632 
9633 	ROM_REGION( 0x38000, REGION_SOUND1 ) /* Sega PCM sound data */
9634 	ROM_LOAD( "10193",       0x00000, 0x008000, 0xbcd10dde )
9635 	ROM_RELOAD(              0x30000, 0x008000 ) // twice??
9636 	ROM_LOAD( "10192",       0x08000, 0x008000, 0x770f1270 )
9637 	ROM_LOAD( "10191",       0x10000, 0x008000, 0x20a284ab )
9638 	ROM_LOAD( "10190",       0x18000, 0x008000, 0x7cab70e2 )
9639 	ROM_LOAD( "10189",       0x20000, 0x008000, 0x01366b54 )
9640 	ROM_LOAD( "10188",       0x28000, 0x008000, 0xbad30ad9 )
9641 
9642 	ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU */
9643 	ROM_LOAD_EVEN("10327a", 0x00000, 0x10000, 0xe28a5baf )
9644 	ROM_LOAD_ODD( "10329a", 0x00000, 0x10000, 0xda131c81 )
9645 	ROM_LOAD_EVEN("10328a", 0x20000, 0x10000, 0xd5ec5e5d )
9646 	ROM_LOAD_ODD( "10330a", 0x20000, 0x10000, 0xba9ec82a )
9647 
9648 	ROM_REGION( 0x80000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
9649 	ROM_LOAD( "10185", 0x0000, 0x8000, 0x22794426 )
9650 ROM_END
9651 
ROM_START(outruna)9652 ROM_START( outruna )
9653 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
9654 	ROM_LOAD_EVEN( "10380b", 0x000000, 0x10000, 0x1f6cadad )
9655 	ROM_LOAD_ODD ( "10382b", 0x000000, 0x10000, 0xc4c3fa1a )
9656 	ROM_LOAD_EVEN( "10381a", 0x020000, 0x10000, 0xbe8c412b )
9657 	ROM_LOAD_ODD ( "10383b", 0x020000, 0x10000, 0x10a2014a )
9658 
9659 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
9660 	ROM_LOAD( "10268", 0x00000, 0x08000, 0x95344b04 )
9661 	ROM_LOAD( "10232", 0x08000, 0x08000, 0x776ba1eb )
9662 	ROM_LOAD( "10267", 0x10000, 0x08000, 0xa85bb823 )
9663 	ROM_LOAD( "10231", 0x18000, 0x08000, 0x8908bcbf )
9664 	ROM_LOAD( "10266", 0x20000, 0x08000, 0x9f6f1a74 )
9665 	ROM_LOAD( "10230", 0x28000, 0x08000, 0x686f5e50 )
9666 
9667 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
9668 	ROM_LOAD( "10371", 0x000000, 0x010000, 0x0a1c98de )
9669 	ROM_CONTINUE(      0x080000, 0x010000 )
9670 	ROM_LOAD( "10373", 0x010000, 0x010000, 0x339f8e64 )
9671 	ROM_CONTINUE(      0x090000, 0x010000 )
9672 	ROM_LOAD( "10375", 0x020000, 0x010000, 0x62a472bd )
9673 	ROM_CONTINUE(      0x0a0000, 0x010000 )
9674 	ROM_LOAD( "10377", 0x030000, 0x010000, 0xc86daecb )
9675 	ROM_CONTINUE(      0x0b0000, 0x010000 )
9676 
9677 	ROM_LOAD( "10372", 0x040000, 0x010000, 0x1640ad1f )
9678 	ROM_CONTINUE(      0x0c0000, 0x010000 )
9679 	ROM_LOAD( "10374", 0x050000, 0x010000, 0x22744340 )
9680 	ROM_CONTINUE(      0x0d0000, 0x010000 )
9681 	ROM_LOAD( "10376", 0x060000, 0x010000, 0x8337ace7 )
9682 	ROM_CONTINUE(      0x0e0000, 0x010000 )
9683 	ROM_LOAD( "10378", 0x070000, 0x010000, 0x544068fd )
9684 	ROM_CONTINUE(      0x0f0000, 0x010000 )
9685 
9686 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
9687 	ROM_LOAD( "10187",       0x00000, 0x008000, 0xa10abaa9 )
9688 
9689 	ROM_REGION( 0x38000, REGION_SOUND1 ) /* Sega PCM sound data */
9690 	ROM_LOAD( "10193",       0x00000, 0x008000, 0xbcd10dde )
9691 	ROM_RELOAD(              0x30000, 0x008000 ) // twice??
9692 	ROM_LOAD( "10192",       0x08000, 0x008000, 0x770f1270 )
9693 	ROM_LOAD( "10191",       0x10000, 0x008000, 0x20a284ab )
9694 	ROM_LOAD( "10190",       0x18000, 0x008000, 0x7cab70e2 )
9695 	ROM_LOAD( "10189",       0x20000, 0x008000, 0x01366b54 )
9696 	ROM_LOAD( "10188",       0x28000, 0x008000, 0xbad30ad9 )
9697 
9698 	ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU */
9699 	ROM_LOAD_EVEN("10327a", 0x00000, 0x10000, 0xe28a5baf )
9700 	ROM_LOAD_ODD( "10329a", 0x00000, 0x10000, 0xda131c81 )
9701 	ROM_LOAD_EVEN("10328a", 0x20000, 0x10000, 0xd5ec5e5d )
9702 	ROM_LOAD_ODD( "10330a", 0x20000, 0x10000, 0xba9ec82a )
9703 
9704 	ROM_REGION( 0x80000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
9705 	ROM_LOAD( "10185", 0x0000, 0x8000, 0x22794426 )
9706 ROM_END
9707 
9708 
9709 ROM_START( outrunb )
9710 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
9711 	ROM_LOAD_EVEN( "orun_mn.rom", 0x000000, 0x10000, 0xcddceea2 )
9712 	ROM_LOAD_ODD ( "orun_ml.rom", 0x000000, 0x10000, 0x9cfc07d5 )
9713 	ROM_LOAD_EVEN( "orun_mm.rom", 0x020000, 0x10000, 0x3092d857 )
9714 	ROM_LOAD_ODD ( "orun_mk.rom", 0x020000, 0x10000, 0x30a1c496 )
9715 
9716 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
9717 	ROM_LOAD( "10268", 0x00000, 0x08000, 0x95344b04 )
9718 	ROM_LOAD( "10232", 0x08000, 0x08000, 0x776ba1eb )
9719 	ROM_LOAD( "10267", 0x10000, 0x08000, 0xa85bb823 )
9720 	ROM_LOAD( "10231", 0x18000, 0x08000, 0x8908bcbf )
9721 	ROM_LOAD( "10266", 0x20000, 0x08000, 0x9f6f1a74 )
9722 	ROM_LOAD( "10230", 0x28000, 0x08000, 0x686f5e50 )
9723 
9724 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
9725 	ROM_LOAD( "orun_1.rom", 0x000000, 0x010000, 0x77377e00 )
9726 	ROM_LOAD( "orun_3.rom", 0x010000, 0x010000, 0x69ecc975 )
9727 	ROM_LOAD( "orun_5.rom", 0x020000, 0x010000, 0xb6a8d0e2 )
9728 	ROM_LOAD( "orun_7.rom", 0x030000, 0x010000, 0xd632d8a2 )
9729 
9730 	ROM_LOAD( "orun_2.rom", 0x040000, 0x010000, 0x2c0e7277 )
9731 	ROM_LOAD( "orun_4.rom", 0x050000, 0x010000, 0x54761e57 )
9732 	ROM_LOAD( "orun_6.rom", 0x060000, 0x010000, 0xa00d0676 )
9733 	ROM_LOAD( "orun_8.rom", 0x070000, 0x010000, 0xda398368 )
9734 
9735 	ROM_LOAD( "orun_17.rom", 0x080000, 0x010000, 0x4f784236 )
9736 	ROM_LOAD( "orun_19.rom", 0x090000, 0x010000, 0xee4f7154 )
9737 	ROM_LOAD( "orun_21.rom", 0x0a0000, 0x010000, 0xe9880aa3 )
9738 	ROM_LOAD( "orun_23.rom", 0x0b0000, 0x010000, 0xdc286dc2 )
9739 
9740 	ROM_LOAD( "orun_18.rom", 0x0c0000, 0x010000, 0x8d459356 )
9741 	ROM_LOAD( "orun_20.rom", 0x0d0000, 0x010000, 0xc2825654 )
9742 	ROM_LOAD( "orun_22.rom", 0x0e0000, 0x010000, 0xef7d06fe )
9743 	ROM_LOAD( "orun_24.rom", 0x0f0000, 0x010000, 0x1222af9f )
9744 
9745 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
9746 	ROM_LOAD( "orun_ma.rom", 0x00000, 0x008000, 0xa3ff797a )
9747 
9748 	ROM_REGION( 0x38000, REGION_SOUND1 ) /* Sega PCM sound data */
9749 	ROM_LOAD( "10193",       0x00000, 0x008000, 0xbcd10dde )
9750 	ROM_RELOAD(              0x30000, 0x008000 ) // twice??
9751 	ROM_LOAD( "10192",       0x08000, 0x008000, 0x770f1270 )
9752 	ROM_LOAD( "10191",       0x10000, 0x008000, 0x20a284ab )
9753 	ROM_LOAD( "10190",       0x18000, 0x008000, 0x7cab70e2 )
9754 	ROM_LOAD( "10189",       0x20000, 0x008000, 0x01366b54 )
9755 	ROM_LOAD( "10188",       0x28000, 0x008000, 0xbad30ad9 )
9756 
9757 	ROM_REGION( 0x40000, REGION_CPU3 ) /* second 68000 CPU */
9758 	ROM_LOAD_EVEN("orun_mj.rom", 0x00000, 0x10000, 0xd7f5aae0 )
9759 	ROM_LOAD_ODD( "orun_mh.rom", 0x00000, 0x10000, 0x88c2e78f )
9760 	ROM_LOAD_EVEN("10328a",      0x20000, 0x10000, 0xd5ec5e5d )
9761 	ROM_LOAD_ODD( "orun_mg.rom", 0x20000, 0x10000, 0x74c5fbec )
9762 
9763 	ROM_REGION( 0x80000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
9764 	ROM_LOAD( "orun_me.rom", 0x0000, 0x8000, 0x666fe754 )
9765 
9766 //	ROM_LOAD( "orun_mf.rom", 0x0000, 0x8000, 0xed5bda9c )	//??
9767 ROM_END
9768 
9769 /***************************************************************************/
9770 
9771 //static READ_HANDLER( or_io_joy_r ){ return (input_port_5_r( offset ) << 8) + input_port_6_r( offset ); }
9772 
9773 #ifdef HANGON_DIGITAL_CONTROLS
9774 static READ_HANDLER( or_io_brake_r ){
9775 	int data = input_port_1_r( offset );
9776 
9777 	switch(data & 3)
9778 	{
9779 		case 3:	return 0xff00;	// both
9780 		case 1:	return 0xff00;  // brake
9781 		case 2:	return 0x0000;  // accel
9782 		case 0:	return 0x0000;  // neither
9783 	}
9784 	return 0x0000;
9785 }
9786 
READ_HANDLER(or_io_acc_steer_r)9787 static READ_HANDLER( or_io_acc_steer_r ){
9788 	int data = input_port_1_r( offset );
9789 	int ret = input_port_0_r( offset ) << 8;
9790 
9791 	switch(data & 3)
9792 	{
9793 		case 3:	return 0x00 | ret;	// both
9794 		case 1:	return 0x00 | ret;  // brake
9795 		case 2:	return 0xff | ret;  // accel
9796 		case 0:	return 0x00 | ret ;  // neither
9797 	}
9798 	return 0x00 | ret;
9799 }
9800 #else
9801 static READ_HANDLER( or_io_acc_steer_r ){ return (input_port_0_r( offset ) << 8) + input_port_1_r( offset ); }
9802 static READ_HANDLER( or_io_brake_r ){ return input_port_5_r( offset ) << 8; }
9803 #endif
9804 
9805 static int or_gear=0;
9806 
READ_HANDLER(or_io_service_r)9807 static READ_HANDLER( or_io_service_r )
9808 {
9809 	int ret=input_port_2_r( offset );
9810 	int data=input_port_1_r( offset );
9811 	if(data & 4) or_gear=0;
9812 	else if(data & 8) or_gear=1;
9813 
9814 	if(or_gear) ret|=0x10;
9815 	else ret&=0xef;
9816 
9817 	return ret;
9818 }
9819 
READ_HANDLER(or_reset2_r)9820 static READ_HANDLER( or_reset2_r )
9821 {
9822 	cpu_set_reset_line(2,PULSE_LINE);
9823 	return 0;
9824 }
9825 
9826 
9827 static struct MemoryReadAddress outrun_readmem[] =
9828 {
9829 	{ 0x000000, 0x03ffff, MRA_ROM },
9830 	{ 0x060892, 0x060893, or_io_acc_steer_r },
9831 	{ 0x060894, 0x060895, or_io_brake_r },
9832 	{ 0x060900, 0x060907, sound_shared_ram_r },		//???
9833 	{ 0x060000, 0x067fff, MRA_EXTRAM5 },
9834 
9835 	{ 0x100000, 0x10ffff, MRA_TILERAM },
9836 	{ 0x110000, 0x110fff, MRA_TEXTRAM },
9837 
9838 	{ 0x130000, 0x130fff, MRA_SPRITERAM },
9839 	{ 0x120000, 0x121fff, MRA_PALETTERAM },
9840 
9841 	{ 0x140010, 0x140011, or_io_service_r },
9842 	{ 0x140014, 0x140015, io_dip1_r },
9843 	{ 0x140016, 0x140017, io_dip2_r },
9844 
9845 	{ 0x140000, 0x140071, MRA_EXTRAM3 },		//io
9846 	{ 0x200000, 0x23ffff, MRA_BANK8 },
9847 	{ 0x260000, 0x267fff, shared_ram_r },
9848 	{ 0xe00000, 0xe00001, or_reset2_r },
9849 
9850 	{-1}
9851 };
9852 
WRITE_HANDLER(outrun_sound_write_w)9853 static WRITE_HANDLER( outrun_sound_write_w )
9854 {
9855 	sound_shared_ram[0]=data&0xff;
9856 }
9857 
9858 static struct MemoryWriteAddress outrun_writemem[] =
9859 {
9860 	{ 0x000000, 0x03ffff, MWA_ROM },
9861 	{ 0x060900, 0x060907, sound_shared_ram_w },		//???
9862 	{ 0x060000, 0x067fff, MWA_EXTRAM5 },
9863 
9864 	{ 0x100000, 0x10ffff, MWA_TILERAM },
9865 	{ 0x110000, 0x110fff, MWA_TEXTRAM },
9866 
9867 	{ 0x130000, 0x130fff, MWA_SPRITERAM },
9868 	{ 0x120000, 0x121fff, MWA_PALETTERAM },
9869 
9870 	{ 0x140000, 0x140071, MWA_EXTRAM3 },		//io
9871 	{ 0x200000, 0x23ffff, MWA_BANK8 },
9872 	{ 0x260000, 0x267fff, shared_ram_w, &shared_ram },
9873 	{ 0xffff06, 0xffff07, outrun_sound_write_w },
9874 
9875 	{-1}
9876 };
9877 
9878 static struct MemoryReadAddress outrun_readmem2[] =
9879 {
9880 	{ 0x000000, 0x03ffff, MRA_ROM },
9881 	{ 0x060000, 0x067fff, shared_ram_r },
9882 	{ 0x080000, 0x09ffff, MRA_EXTRAM },		// gr
9883 
9884 	{-1}
9885 };
9886 
9887 static struct MemoryWriteAddress outrun_writemem2[] =
9888 {
9889 	{ 0x000000, 0x03ffff, MWA_ROM },
9890 	{ 0x060000, 0x067fff, shared_ram_w },
9891 	{ 0x080000, 0x09ffff, MWA_EXTRAM },		// gr
9892 
9893 	{-1}
9894 };
9895 
9896 // Outrun
9897 
9898 static struct MemoryReadAddress outrun_sound_readmem[] =
9899 {
9900 	{ 0x0000, 0x7fff, MRA_ROM },
9901 	{ 0xf000, 0xf0ff, SegaPCM_r },
9902 	{ 0xf100, 0xf7ff, MRA_NOP },
9903 	{ 0xf800, 0xf807, sound2_shared_ram_r },
9904 	{ 0xf808, 0xffff, MRA_RAM },
9905 	{ -1 }  /* end of table */
9906 };
9907 
9908 static struct MemoryWriteAddress outrun_sound_writemem[] =
9909 {
9910 	{ 0x0000, 0x7fff, MWA_ROM },
9911 	{ 0xf000, 0xf0ff, SegaPCM_w },
9912 	{ 0xf100, 0xf7ff, MWA_NOP },
9913 	{ 0xf800, 0xf807, sound2_shared_ram_w,&sound_shared_ram },
9914 	{ 0xf808, 0xffff, MWA_RAM },
9915 	{ -1 }  /* end of table */
9916 };
9917 
9918 /***************************************************************************/
9919 
outrun_update_proc(void)9920 static void outrun_update_proc( void ){
9921 	int data;
9922 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0e98] );
9923 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0e9a] );
9924 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0e90] );
9925 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0e92] );
9926 	set_fg_page( READ_WORD( &sys16_textram[0x0e80] ) );
9927 	set_bg_page( READ_WORD( &sys16_textram[0x0e82] ) );
9928 
9929 	set_refresh( READ_WORD( &sys16_extraram5[0xb6e] ) );
9930 	data=READ_WORD( &sys16_extraram5[0xb6c] );
9931 
9932 	if(data & 0x2)
9933 	{
9934 		osd_led_w(0,1);
9935 		osd_led_w(2,1);
9936 	}
9937 	else
9938 	{
9939 		osd_led_w(0,0);
9940 		osd_led_w(2,0);
9941 	}
9942 
9943 	if(data & 0x4)
9944 		osd_led_w(1,1);
9945 	else
9946 		osd_led_w(1,0);
9947 }
9948 
outrun_init_machine(void)9949 static void outrun_init_machine( void ){
9950 	static int bank[16] = { 07,00,01,04,05,02,03,06,00,00,00,00,00,00,00,00};
9951 	sys16_obj_bank = bank;
9952 	sys16_spritesystem = 7;
9953 	sys16_textlayer_lo_min=0;
9954 	sys16_textlayer_lo_max=0;
9955 	sys16_textlayer_hi_min=0;
9956 	sys16_textlayer_hi_max=0xff;
9957 	sys16_sprxoffset = -0xc0;
9958 
9959 // cpu 0 reset opcode resets cpu 2?
9960 	patch_code(0x7d44,0x4a);
9961 	patch_code(0x7d45,0x79);
9962 	patch_code(0x7d46,0x00);
9963 	patch_code(0x7d47,0xe0);
9964 	patch_code(0x7d48,0x00);
9965 	patch_code(0x7d49,0x00);
9966 
9967 // *forced sound cmd
9968 	patch_code( 0x55ed, 0x00);
9969 
9970 // rogue tile on music selection screen
9971 //	patch_code( 0x38545, 0x80);
9972 
9973 // *freeze time
9974 //	patch_code( 0xb6b6, 0x4e);
9975 //	patch_code( 0xb6b7, 0x71);
9976 
9977 	cpu_setbank(8, memory_region(REGION_CPU3));
9978 
9979 	sys16_update_proc = outrun_update_proc;
9980 
9981 	gr_ver = &sys16_extraram[0];
9982 	gr_hor = gr_ver+0x400;
9983 	gr_flip= gr_ver+0xc00;
9984 	gr_palette= 0xf00 / 2;
9985 	gr_palette_default = 0x800 /2;
9986 	gr_colorflip[0][0]=0x08 / 2;
9987 	gr_colorflip[0][1]=0x04 / 2;
9988 	gr_colorflip[0][2]=0x00 / 2;
9989 	gr_colorflip[0][3]=0x00 / 2;
9990 	gr_colorflip[1][0]=0x0a / 2;
9991 	gr_colorflip[1][1]=0x06 / 2;
9992 	gr_colorflip[1][2]=0x02 / 2;
9993 	gr_colorflip[1][3]=0x00 / 2;
9994 
9995 	gr_second_road = &sys16_extraram[0x10000];
9996 
9997 }
9998 
outruna_init_machine(void)9999 static void outruna_init_machine( void ){
10000 	static int bank[16] = { 07,00,01,04,05,02,03,06,00,00,00,00,00,00,00,00};
10001 	sys16_obj_bank = bank;
10002 	sys16_spritesystem = 7;
10003 	sys16_textlayer_lo_min=0;
10004 	sys16_textlayer_lo_max=0;
10005 	sys16_textlayer_hi_min=0;
10006 	sys16_textlayer_hi_max=0xff;
10007 
10008 // cpu 0 reset opcode resets cpu 2?
10009 	patch_code(0x7db8,0x4a);
10010 	patch_code(0x7db9,0x79);
10011 	patch_code(0x7dba,0x00);
10012 	patch_code(0x7dbb,0xe0);
10013 	patch_code(0x7dbc,0x00);
10014 	patch_code(0x7dbd,0x00);
10015 
10016 // *forced sound cmd
10017 	patch_code( 0x5661, 0x00);
10018 
10019 // rogue tile on music selection screen
10020 //	patch_code( 0x38455, 0x80);
10021 
10022 // *freeze time
10023 //	patch_code( 0xb6b6, 0x4e);
10024 //	patch_code( 0xb6b7, 0x71);
10025 
10026 	cpu_setbank(8, memory_region(REGION_CPU3));
10027 
10028 	sys16_update_proc = outrun_update_proc;
10029 
10030 	gr_ver = &sys16_extraram[0];
10031 	gr_hor = gr_ver+0x400;
10032 	gr_flip= gr_ver+0xc00;
10033 	gr_palette= 0xf00 / 2;
10034 	gr_palette_default = 0x800 /2;
10035 	gr_colorflip[0][0]=0x08 / 2;
10036 	gr_colorflip[0][1]=0x04 / 2;
10037 	gr_colorflip[0][2]=0x00 / 2;
10038 	gr_colorflip[0][3]=0x00 / 2;
10039 	gr_colorflip[1][0]=0x0a / 2;
10040 	gr_colorflip[1][1]=0x06 / 2;
10041 	gr_colorflip[1][2]=0x02 / 2;
10042 	gr_colorflip[1][3]=0x00 / 2;
10043 
10044 	gr_second_road = &sys16_extraram[0x10000];
10045 
10046 }
10047 
init_outrun(void)10048 static void init_outrun( void )
10049 {
10050 	sys16_onetime_init_machine();
10051 	sys16_sprite_decode2( 4,0x040000, 0 );
10052 	generate_gr_screen(512,2048,0,0,3,0x8000);
10053 }
10054 
init_outrunb(void)10055 static void init_outrunb( void )
10056 {
10057 	unsigned char *RAM = memory_region(REGION_CPU1);
10058 	int i;
10059 	int odd,even,word;
10060 	sys16_onetime_init_machine();
10061 /*
10062   Main Processor
10063 	Comparing the bootleg with the custom bootleg, it seems that:-
10064 
10065   if even bytes &0x28 == 0x20 or 0x08 then they are xored with 0x28
10066   if odd bytes &0xc0 == 0x40 or 0x80 then they are xored with 0xc0
10067 
10068   ie. data lines are switched.
10069 */
10070 
10071 	for(i=0;i<0x40000;i+=2)
10072 	{
10073 		word=READ_WORD(&RAM[i]);
10074 		even=word>>8;
10075 		odd=word&0xff;
10076 		// even byte
10077 		if((even&0x28) == 0x20 || (even&0x28) == 0x08)
10078 			even^=0x28;
10079 		// odd byte
10080 		if((odd&0xc0) == 0x80 || (odd&0xc0) == 0x40)
10081 			odd^=0xc0;
10082 		word=(even<<8)+odd;
10083 		WRITE_WORD(&RAM[i],word);
10084 	}
10085 
10086 /*
10087   Second Processor
10088 
10089   if even bytes &0xc0 == 0x40 or 0x80 then they are xored with 0xc0
10090   if odd bytes &0x0c == 0x04 or 0x08 then they are xored with 0x0c
10091 */
10092 	RAM = memory_region(REGION_CPU3);
10093 	for(i=0;i<0x40000;i+=2)
10094 	{
10095 		word=READ_WORD(&RAM[i]);
10096 		even=word>>8;
10097 		odd=word&0xff;
10098 		// even byte
10099 		if((even&0xc0) == 0x80 || (even&0xc0) == 0x40)
10100 			even^=0xc0;
10101 		// odd byte
10102 		if((odd&0x0c) == 0x08 || (odd&0x0c) == 0x04)
10103 			odd^=0x0c;
10104 		word=(even<<8)+odd;
10105 		WRITE_WORD(&RAM[i],word);
10106 	}
10107 /*
10108   Road GFX
10109 
10110 	rom orun_me.rom
10111 	if bytes &0x60 == 0x40 or 0x20 then they are xored with 0x60
10112 
10113 	rom orun_mf.rom
10114 	if bytes &0xc0 == 0x40 or 0x80 then they are xored with 0xc0
10115 
10116   I don't know why there's 2 road roms, but I'm using orun_me.rom
10117 */
10118 	RAM = memory_region(REGION_GFX3);
10119 	for(i=0;i<0x8000;i++)
10120 	{
10121 		if((RAM[i]&0x60) == 0x20 || (RAM[i]&0x60) == 0x40)
10122 			RAM[i]^=0x60;
10123 	}
10124 
10125 	generate_gr_screen(512,2048,0,0,3,0x8000);
10126 
10127 /*
10128   Z80 Code
10129 	rom orun_ma.rom
10130 	if bytes &0x60 == 0x40 or 0x20 then they are xored with 0x60
10131 
10132 */
10133 	RAM = memory_region(REGION_CPU2);
10134 	for(i=0;i<0x8000;i++)
10135 	{
10136 		if((RAM[i]&0x60) == 0x20 || (RAM[i]&0x60) == 0x40)
10137 			RAM[i]^=0x60;
10138 	}
10139 
10140 	sys16_sprite_decode2( 4,0x040000,0  );
10141 }
10142 
10143 /***************************************************************************/
10144 
INPUT_PORTS_START(outrun)10145 INPUT_PORTS_START( outrun )
10146 PORT_START	/* Steering */
10147 	PORT_ANALOG( 0xff, 0x80, IPT_AD_STICK_X | IPF_CENTER, 100, 3, 0x48, 0xb8 )
10148 //	PORT_ANALOG( 0xff, 0x7f, IPT_PADDLE , 70, 3, 0x48, 0xb8 )
10149 
10150 #ifdef HANGON_DIGITAL_CONTROLS
10151 
10152 PORT_START	/* Buttons */
10153 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 )
10154 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
10155 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 )
10156 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 )
10157 
10158 #else
10159 
10160 PORT_START	/* Accel / Decel */
10161 	PORT_ANALOG( 0xff, 0x30, IPT_AD_STICK_Y | IPF_CENTER | IPF_REVERSE, 100, 16, 0x30, 0x90 )
10162 
10163 #endif
10164 
10165 PORT_START
10166 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
10167 	PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
10168 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
10169 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
10170 //	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
10171 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
10172 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
10173 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
10174 
10175 	SYS16_COINAGE
10176 
10177 PORT_START	/* DSW1 */
10178 	PORT_DIPNAME( 0x03, 0x02, DEF_STR( Cabinet ) )
10179 	PORT_DIPSETTING(    0x02, "Up Cockpit" )
10180 	PORT_DIPSETTING(    0x01, "Mini Up" )
10181 	PORT_DIPSETTING(    0x03, "Moving" )
10182 //	PORT_DIPSETTING(    0x00, "No Use" )
10183 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
10184 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
10185 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
10186 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
10187 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
10188 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
10189 	PORT_DIPNAME( 0x30, 0x30, "Time" )
10190 	PORT_DIPSETTING(    0x20, "Easy" )
10191 	PORT_DIPSETTING(    0x30, "Normal" )
10192 	PORT_DIPSETTING(    0x10, "Hard" )
10193 	PORT_DIPSETTING(    0x00, "Hardest" )
10194 	PORT_DIPNAME( 0xc0, 0xc0, "Enemies" )
10195 	PORT_DIPSETTING(    0x80, "Easy" )
10196 	PORT_DIPSETTING(    0xc0, "Normal" )
10197 	PORT_DIPSETTING(    0x40, "Hard" )
10198 	PORT_DIPSETTING(    0x00, "Hardest" )
10199 
10200 
10201 #ifndef HANGON_DIGITAL_CONTROLS
10202 
10203 PORT_START	/* Brake */
10204 	PORT_ANALOG( 0xff, 0x30, IPT_AD_STICK_Y | IPF_PLAYER2 | IPF_CENTER | IPF_REVERSE, 100, 16, 0x30, 0x90 )
10205 
10206 #endif
10207 
10208 INPUT_PORTS_END
10209 
10210 /***************************************************************************/
10211 static int or_interrupt( void ){
10212 	int intleft=cpu_getiloops();
10213 	if(intleft!=0) return 2;
10214 	else return 4;
10215 }
10216 
10217 
10218 #define MACHINE_DRIVER_OUTRUN( GAMENAME,INITMACHINE) \
10219 static struct MachineDriver GAMENAME = \
10220 { \
10221 	{ \
10222 		{ \
10223 			CPU_M68000, \
10224 			12000000, \
10225 			outrun_readmem,outrun_writemem,0,0, \
10226 			or_interrupt,2 \
10227 		}, \
10228 		{ \
10229 			CPU_Z80 | CPU_AUDIO_CPU, \
10230 			4096000, \
10231 			outrun_sound_readmem,outrun_sound_writemem,sound_readport,sound_writeport, \
10232 			ignore_interrupt,1 \
10233 		}, \
10234 		{ \
10235 			CPU_M68000, \
10236 			12000000, \
10237 			outrun_readmem2,outrun_writemem2,0,0, \
10238 			sys16_interrupt,2 \
10239 		}, \
10240 	}, \
10241 	60, 100 /*DEFAULT_60HZ_VBLANK_DURATION*/, \
10242 	4, /* needed to sync processors */ \
10243 	INITMACHINE, \
10244 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 }, \
10245 	gfx1, \
10246 	4096*ShadowColorsMultiplier,4096*ShadowColorsMultiplier, \
10247 	0, \
10248 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_AFTER_VBLANK, \
10249 	0, \
10250 	sys16_or_vh_start, \
10251 	sys16_vh_stop, \
10252 	sys16_or_vh_screenrefresh, \
10253 	SOUND_SUPPORTS_STEREO,0,0,0, \
10254 	{ \
10255 		{ \
10256 			SOUND_YM2151, \
10257 			&ym2151_interface \
10258 		}, \
10259 		{ \
10260 			SOUND_SEGAPCM, \
10261 			&segapcm_interface_15k, \
10262 		} \
10263 	} \
10264 };
10265 
MACHINE_DRIVER_OUTRUN(machine_driver_outrun,outrun_init_machine)10266 MACHINE_DRIVER_OUTRUN(machine_driver_outrun,outrun_init_machine)
10267 MACHINE_DRIVER_OUTRUN(machine_driver_outruna,outruna_init_machine)
10268 
10269 /*****************************************************************************/
10270 // Enduro Racer
10271 
10272 ROM_START( enduror )
10273 	ROM_REGION( 0x040000, REGION_CPU1 ) /* 68000 code */
10274 	ROM_LOAD_EVEN( "7640a.rom",0x00000, 0x8000, 0x1d1dc5d4 )
10275 	ROM_LOAD_ODD ( "7636a.rom",0x00000, 0x8000, 0x84131639 )
10276 
10277 	ROM_LOAD_EVEN( "7641.rom", 0x10000, 0x8000, 0x2503ae7c )
10278 	ROM_LOAD_ODD ( "7637.rom", 0x10000, 0x8000, 0x82a27a8c )
10279 	ROM_LOAD_EVEN( "7642.rom", 0x20000, 0x8000, 0x1c453bea )	// enduro.a06 / .a09
10280 	ROM_LOAD_ODD ( "7638.rom", 0x20000, 0x8000, 0x70544779 )	// looks like encrypted versions of
10281 
10282 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
10283 	ROM_LOAD( "7644.rom", 0x00000, 0x08000, 0xe7a4ff90 )
10284 	ROM_LOAD( "7645.rom", 0x08000, 0x08000, 0x4caa0095 )
10285 	ROM_LOAD( "7646.rom", 0x10000, 0x08000, 0x7e432683 )
10286 
10287 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
10288 
10289 	ROM_LOAD( "7678.rom", 0x000000, 0x008000, 0x9fb5e656 )
10290 	ROM_LOAD( "7670.rom", 0x008000, 0x008000, 0xdbbe2f6e )
10291 	ROM_LOAD( "7662.rom", 0x010000, 0x008000, 0xcb0c13c5 )
10292 	ROM_LOAD( "7654.rom", 0x018000, 0x008000, 0x2db6520d )
10293 
10294 	ROM_LOAD( "7677.rom", 0x020000, 0x008000, 0x7764765b )
10295 	ROM_LOAD( "7669.rom", 0x028000, 0x008000, 0xf9525faa )
10296 	ROM_LOAD( "7661.rom", 0x030000, 0x008000, 0xfe93a79b )
10297 	ROM_LOAD( "7653.rom", 0x038000, 0x008000, 0x46a52114 )
10298 
10299 	ROM_LOAD( "7676.rom", 0x040000, 0x008000, 0x2e42e0d4 )
10300 	ROM_LOAD( "7668.rom", 0x048000, 0x008000, 0xe115ce33 )
10301 	ROM_LOAD( "7660.rom", 0x050000, 0x008000, 0x86dfbb68 )
10302 	ROM_LOAD( "7652.rom", 0x058000, 0x008000, 0x2880cfdb )
10303 
10304 	ROM_LOAD( "7675.rom", 0x060000, 0x008000, 0x05cd2d61 )
10305 	ROM_LOAD( "7667.rom", 0x068000, 0x008000, 0x923bde9d )
10306 	ROM_LOAD( "7659.rom", 0x070000, 0x008000, 0x629dc8ce )
10307 	ROM_LOAD( "7651.rom", 0x078000, 0x008000, 0xd7902bad )
10308 
10309 	ROM_LOAD( "7674.rom", 0x080000, 0x008000, 0x1a129acf )
10310 	ROM_LOAD( "7666.rom", 0x088000, 0x008000, 0x23697257 )
10311 	ROM_LOAD( "7658.rom", 0x090000, 0x008000, 0x1677f24f )
10312 	ROM_LOAD( "7650.rom", 0x098000, 0x008000, 0x642635ec )
10313 
10314 	ROM_LOAD( "7673.rom", 0x0a0000, 0x008000, 0x82602394 )
10315 	ROM_LOAD( "7665.rom", 0x0a8000, 0x008000, 0x12d77607 )
10316 	ROM_LOAD( "7657.rom", 0x0b0000, 0x008000, 0x8158839c )
10317 	ROM_LOAD( "7649.rom", 0x0b8000, 0x008000, 0x4edba14c )
10318 
10319 	ROM_LOAD( "7672.rom", 0x0c0000, 0x008000, 0xd11452f7 )
10320 	ROM_LOAD( "7664.rom", 0x0c8000, 0x008000, 0x0df2cfad )
10321 	ROM_LOAD( "7656.rom", 0x0d0000, 0x008000, 0x6c741272 )
10322 	ROM_LOAD( "7648.rom", 0x0d8000, 0x008000, 0x983ea830 )
10323 
10324 	ROM_LOAD( "7671.rom", 0x0e0000, 0x008000, 0xb0c7fdc6 )
10325 	ROM_LOAD( "7663.rom", 0x0e8000, 0x008000, 0x2b0b8f08 )
10326 	ROM_LOAD( "7655.rom", 0x0f0000, 0x008000, 0x3433fe7b )
10327 	ROM_LOAD( "7647.rom", 0x0f8000, 0x008000, 0x2e7fbec0 )
10328 
10329 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
10330 	ROM_LOAD( "7682.rom", 0x00000, 0x008000, 0xc4efbf48 )
10331 
10332 	ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
10333 	ROM_LOAD( "7681.rom", 0x00000, 0x008000, 0xbc0c4d12 )
10334 	ROM_LOAD( "7680.rom", 0x08000, 0x008000, 0x627b3c8c )
10335 
10336 	ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
10337 	ROM_LOAD_EVEN("7634.rom", 0x0000, 0x8000, 0x3e07fd32 )
10338 	ROM_LOAD_ODD ("7635.rom", 0x0000, 0x8000, 0x22f762ab )
10339 	// alternate version??
10340 //	ROM_LOAD_EVEN("7634a.rom", 0x0000, 0x8000, 0xaec83731 )
10341 //	ROM_LOAD_ODD ("7635a.rom", 0x0000, 0x8000, 0xb2fce96f )
10342 
10343 	ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
10344 	ROM_LOAD( "7633.rom", 0x0000, 0x8000, 0x6f146210 )
10345 ROM_END
10346 
10347 
10348 
10349 ROM_START( endurobl )
10350 	ROM_REGION( 0x040000+0x010000+0x040000, REGION_CPU1 ) /* 68000 code + space for RAM + space for decrypted opcodes */
10351 	ROM_LOAD_EVEN( "7.13j", 0x030000, 0x08000, 0xf1d6b4b7 )
10352 	ROM_CONTINUE (          0x000000, 0x08000 | ROMFLAG_ALTERNATE )
10353 	ROM_LOAD_ODD ( "4.13h", 0x030000, 0x08000, 0x43bff873 )						// rom de-coded
10354 	ROM_CONTINUE (          0x000001, 0x08000 | ROMFLAG_ALTERNATE )		// data de-coded
10355 
10356 	ROM_LOAD_EVEN( "8.14j", 0x010000, 0x08000, 0x2153154a )
10357 	ROM_LOAD_ODD ( "5.14h", 0x010000, 0x08000, 0x0a97992c )
10358 	ROM_LOAD_EVEN( "9.15j", 0x020000, 0x08000, 0xdb3bff1c )	// one byte difference from
10359 	ROM_LOAD_ODD ( "6.15h", 0x020000, 0x08000, 0x54b1885a )	// enduro.a06 / enduro.a09
10360 
10361 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
10362 	ROM_LOAD( "7644.rom", 0x00000, 0x08000, 0xe7a4ff90 )
10363 	ROM_LOAD( "7645.rom", 0x08000, 0x08000, 0x4caa0095 )
10364 	ROM_LOAD( "7646.rom", 0x10000, 0x08000, 0x7e432683 )
10365 
10366 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
10367 	ROM_LOAD( "7678.rom", 0x000000, 0x008000, 0x9fb5e656 )
10368 	ROM_LOAD( "7670.rom", 0x008000, 0x008000, 0xdbbe2f6e )
10369 	ROM_LOAD( "7662.rom", 0x010000, 0x008000, 0xcb0c13c5 )
10370 	ROM_LOAD( "7654.rom", 0x018000, 0x008000, 0x2db6520d )
10371 
10372 	ROM_LOAD( "7677.rom", 0x020000, 0x008000, 0x7764765b )
10373 	ROM_LOAD( "7669.rom", 0x028000, 0x008000, 0xf9525faa )
10374 	ROM_LOAD( "7661.rom", 0x030000, 0x008000, 0xfe93a79b )
10375 	ROM_LOAD( "7653.rom", 0x038000, 0x008000, 0x46a52114 )
10376 
10377 	ROM_LOAD( "7676.rom", 0x040000, 0x008000, 0x2e42e0d4 )
10378 	ROM_LOAD( "7668.rom", 0x048000, 0x008000, 0xe115ce33 )
10379 	ROM_LOAD( "7660.rom", 0x050000, 0x008000, 0x86dfbb68 )
10380 	ROM_LOAD( "7652.rom", 0x058000, 0x008000, 0x2880cfdb )
10381 
10382 	ROM_LOAD( "7675.rom", 0x060000, 0x008000, 0x05cd2d61 )
10383 	ROM_LOAD( "7667.rom", 0x068000, 0x008000, 0x923bde9d )
10384 	ROM_LOAD( "7659.rom", 0x070000, 0x008000, 0x629dc8ce )
10385 	ROM_LOAD( "7651.rom", 0x078000, 0x008000, 0xd7902bad )
10386 
10387 	ROM_LOAD( "7674.rom", 0x080000, 0x008000, 0x1a129acf )
10388 	ROM_LOAD( "7666.rom", 0x088000, 0x008000, 0x23697257 )
10389 	ROM_LOAD( "7658.rom", 0x090000, 0x008000, 0x1677f24f )
10390 	ROM_LOAD( "7650.rom", 0x098000, 0x008000, 0x642635ec )
10391 
10392 	ROM_LOAD( "7673.rom", 0x0a0000, 0x008000, 0x82602394 )
10393 	ROM_LOAD( "7665.rom", 0x0a8000, 0x008000, 0x12d77607 )
10394 	ROM_LOAD( "7657.rom", 0x0b0000, 0x008000, 0x8158839c )
10395 	ROM_LOAD( "7649.rom", 0x0b8000, 0x008000, 0x4edba14c )
10396 
10397 	ROM_LOAD( "7672.rom", 0x0c0000, 0x008000, 0xd11452f7 )
10398 	ROM_LOAD( "7664.rom", 0x0c8000, 0x008000, 0x0df2cfad )
10399 	ROM_LOAD( "7656.rom", 0x0d0000, 0x008000, 0x6c741272 )
10400 	ROM_LOAD( "7648.rom", 0x0d8000, 0x008000, 0x983ea830 )
10401 
10402 	ROM_LOAD( "7671.rom", 0x0e0000, 0x008000, 0xb0c7fdc6 )
10403 	ROM_LOAD( "7663.rom", 0x0e8000, 0x008000, 0x2b0b8f08 )
10404 	ROM_LOAD( "7655.rom", 0x0f0000, 0x008000, 0x3433fe7b )
10405 	ROM_LOAD( "7647.rom", 0x0f8000, 0x008000, 0x2e7fbec0 )
10406 
10407 
10408 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
10409 	ROM_LOAD( "13.16d", 0x00000, 0x004000, 0x81c82fc9 )
10410 	ROM_LOAD( "12.16e", 0x04000, 0x004000, 0x755bfdad )
10411 
10412 	ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
10413 	ROM_LOAD( "7681.rom", 0x00000, 0x008000, 0xbc0c4d12 )
10414 	ROM_LOAD( "7680.rom", 0x08000, 0x008000, 0x627b3c8c )
10415 
10416 	ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
10417 	ROM_LOAD_EVEN("7634.rom", 0x0000, 0x8000, 0x3e07fd32 )
10418 	ROM_LOAD_ODD ("7635.rom", 0x0000, 0x8000, 0x22f762ab )
10419 
10420 	ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
10421 	ROM_LOAD( "7633.rom", 0x0000, 0x8000, 0x6f146210 )
10422 ROM_END
10423 
10424 ROM_START( endurob2 )
10425 	ROM_REGION( 0x040000+0x010000+0x040000, REGION_CPU1 ) /* 68000 code + space for RAM + space for decrypted opcodes */
10426 	ROM_LOAD_EVEN( "enduro.a07", 0x000000, 0x08000, 0x259069bc )
10427 	ROM_LOAD_ODD ( "enduro.a04", 0x000000, 0x08000, 0xf584fbd9 )
10428 	ROM_LOAD_EVEN( "enduro.a08", 0x010000, 0x08000, 0xd234918c )
10429 	ROM_LOAD_ODD ( "enduro.a05", 0x010000, 0x08000, 0xa525dd57 )
10430 	ROM_LOAD_EVEN( "enduro.a09", 0x020000, 0x08000, 0xf6391091 )
10431 	ROM_LOAD_ODD ( "enduro.a06", 0x020000, 0x08000, 0x79b367d7 )
10432 
10433 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
10434 	ROM_LOAD( "7644.rom", 0x00000, 0x08000, 0xe7a4ff90 )
10435 	ROM_LOAD( "7645.rom", 0x08000, 0x08000, 0x4caa0095 )
10436 	ROM_LOAD( "7646.rom", 0x10000, 0x08000, 0x7e432683 )
10437 
10438 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
10439 
10440 	ROM_LOAD( "7678.rom", 0x000000, 0x008000, 0x9fb5e656 )
10441 	ROM_LOAD( "7670.rom", 0x008000, 0x008000, 0xdbbe2f6e )
10442 	ROM_LOAD( "7662.rom", 0x010000, 0x008000, 0xcb0c13c5 )
10443 	ROM_LOAD( "7654.rom", 0x018000, 0x008000, 0x2db6520d )
10444 
10445 	ROM_LOAD( "7677.rom", 0x020000, 0x008000, 0x7764765b )
10446 	ROM_LOAD( "7669.rom", 0x028000, 0x008000, 0xf9525faa )
10447 	ROM_LOAD( "enduro.a34", 0x030000, 0x008000, 0x296454d8 )
10448 	ROM_LOAD( "7653.rom", 0x038000, 0x008000, 0x46a52114 )
10449 
10450 	ROM_LOAD( "7676.rom", 0x040000, 0x008000, 0x2e42e0d4 )
10451 	ROM_LOAD( "7668.rom", 0x048000, 0x008000, 0xe115ce33 )
10452 	ROM_LOAD( "enduro.a35", 0x050000, 0x008000, 0x1ebe76df )
10453 	ROM_LOAD( "7652.rom", 0x058000, 0x008000, 0x2880cfdb )
10454 
10455 	ROM_LOAD( "enduro.a20", 0x060000, 0x008000, 0x7c280bc8 )
10456 	ROM_LOAD( "enduro.a28", 0x068000, 0x008000, 0x321f034b )
10457 	ROM_LOAD( "enduro.a36", 0x070000, 0x008000, 0x243e34e5 )
10458 	ROM_LOAD( "enduro.a44", 0x078000, 0x008000, 0x84bb12a1 )
10459 
10460 	ROM_LOAD( "7674.rom", 0x080000, 0x008000, 0x1a129acf )
10461 	ROM_LOAD( "7666.rom", 0x088000, 0x008000, 0x23697257 )
10462 	ROM_LOAD( "7658.rom", 0x090000, 0x008000, 0x1677f24f )
10463 	ROM_LOAD( "7650.rom", 0x098000, 0x008000, 0x642635ec )
10464 
10465 	ROM_LOAD( "7673.rom", 0x0a0000, 0x008000, 0x82602394 )
10466 	ROM_LOAD( "7665.rom", 0x0a8000, 0x008000, 0x12d77607 )
10467 	ROM_LOAD( "7657.rom", 0x0b0000, 0x008000, 0x8158839c )
10468 	ROM_LOAD( "7649.rom", 0x0b8000, 0x008000, 0x4edba14c )
10469 
10470 	ROM_LOAD( "7672.rom", 0x0c0000, 0x008000, 0xd11452f7 )
10471 	ROM_LOAD( "7664.rom", 0x0c8000, 0x008000, 0x0df2cfad )
10472 	ROM_LOAD( "enduro.a39", 0x0d0000, 0x008000, 0x1ff3a5e2 )
10473 	ROM_LOAD( "7648.rom", 0x0d8000, 0x008000, 0x983ea830 )
10474 
10475 	ROM_LOAD( "7671.rom", 0x0e0000, 0x008000, 0xb0c7fdc6 )
10476 	ROM_LOAD( "7663.rom", 0x0e8000, 0x008000, 0x2b0b8f08 )
10477 	ROM_LOAD( "7655.rom", 0x0f0000, 0x008000, 0x3433fe7b )
10478 	ROM_LOAD( "7647.rom", 0x0f8000, 0x008000, 0x2e7fbec0 )
10479 
10480 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
10481 	ROM_LOAD( "enduro.a16", 0x00000, 0x008000, 0xd2cb6eb5 )
10482 
10483 	ROM_REGION( 0x10000, REGION_SOUND1 ) /* Sega PCM sound data */
10484 	ROM_LOAD( "7681.rom", 0x00000, 0x008000, 0xbc0c4d12 )
10485 	ROM_LOAD( "7680.rom", 0x08000, 0x008000, 0x627b3c8c )
10486 
10487 	ROM_REGION( 0x10000, REGION_CPU3 ) /* second 68000 CPU */
10488 	ROM_LOAD_EVEN("7634.rom", 0x0000, 0x8000, 0x3e07fd32 )
10489 	ROM_LOAD_ODD ("7635.rom", 0x0000, 0x8000, 0x22f762ab )
10490 
10491 	ROM_REGION( 0x40000, REGION_GFX3 ) /* Road Graphics  (region size should be gr_bitmapwidth*256 )*/
10492 	ROM_LOAD( "7633.rom", 0x0000, 0x8000, 0x6f146210 )
10493 ROM_END
10494 
10495 /***************************************************************************/
10496 
10497 static READ_HANDLER( er_io_analog_r )
10498 {
10499 	switch(READ_WORD(&sys16_extraram3[0x30]))
10500 	{
10501 		case 0:		// accel
10502 			if(input_port_1_r( offset ) & 1)
10503 				return 0xff;
10504 			else
10505 				return 0;
10506 		case 4:		// brake
10507 			if(input_port_1_r( offset ) & 2)
10508 				return 0xff;
10509 			else
10510 				return 0;
10511 		case 8:		// bank up down?
10512 			if(input_port_1_r( offset ) & 4)
10513 				return 0xff;
10514 			else
10515 				return 0;
10516 		case 12:	// handle
10517 			return input_port_0_r( offset );
10518 
10519 	}
10520 	return 0;
10521 }
10522 
READ_HANDLER(er_reset2_r)10523 static READ_HANDLER( er_reset2_r )
10524 {
10525 	cpu_set_reset_line(2,PULSE_LINE);
10526 	return 0;
10527 }
10528 
10529 static struct MemoryReadAddress enduror_readmem[] =
10530 {
10531 	{ 0x000000, 0x03ffff, MRA_ROM },
10532 	{ 0x040000, 0x043fff, MRA_EXTRAM },
10533 	{ 0x100000, 0x107fff, MRA_TILERAM },
10534 	{ 0x108000, 0x108fff, MRA_TEXTRAM },
10535 	{ 0x110000, 0x110fff, MRA_PALETTERAM },
10536 
10537 	{ 0x124000, 0x127fff, shared_ram_r },
10538 
10539 	{ 0x130000, 0x130fff, MRA_SPRITERAM },
10540 
10541 	{ 0x140010, 0x140011, io_service_r },
10542 	{ 0x140014, 0x140015, io_dip1_r },
10543 	{ 0x140016, 0x140017, io_dip2_r },
10544 
10545 	{ 0x140030, 0x140031, er_io_analog_r },
10546 
10547 	{ 0x140000, 0x1400ff, MRA_EXTRAM3 },		//io
10548 	{ 0xe00000, 0xe00001, er_reset2_r },
10549 	{-1}
10550 };
10551 
10552 static struct MemoryWriteAddress enduror_writemem[] =
10553 {
10554 	{ 0x000000, 0x03ffff, MWA_ROM },
10555 	{ 0x040000, 0x043fff, MWA_EXTRAM },
10556 	{ 0x100000, 0x107fff, MWA_TILERAM },
10557 	{ 0x108000, 0x108fff, MWA_TEXTRAM },
10558 	{ 0x110000, 0x110fff, MWA_PALETTERAM },
10559 	{ 0x124000, 0x127fff, shared_ram_w, &shared_ram },
10560 	{ 0x130000, 0x130fff, MWA_SPRITERAM },
10561 	{ 0x140000, 0x140001, sound_command_nmi_w },
10562 	{ 0x140000, 0x1400ff, MWA_EXTRAM3 },		//io
10563 	{-1}
10564 };
10565 
10566 
READ_HANDLER(enduro_p2_skip_r)10567 static READ_HANDLER( enduro_p2_skip_r )
10568 {
10569 	if (cpu_get_pc()==0x4ba) {cpu_spinuntil_int(); return 0xffff;}
10570 
10571 	return READ_WORD(&shared_ram[0x2000]);
10572 }
10573 
10574 static struct MemoryReadAddress enduror_readmem2[] =
10575 {
10576 	{ 0x000000, 0x03ffff, MRA_ROM },
10577 	{ 0xc68000, 0xc68fff, MRA_EXTRAM2 },
10578 	{ 0xc7e000, 0xc7e001, enduro_p2_skip_r },
10579 	{ 0xc7c000, 0xc7ffff, shared_ram_r },
10580 	{-1}
10581 };
10582 
10583 static struct MemoryWriteAddress enduror_writemem2[] =
10584 {
10585 	{ 0x000000, 0x03ffff, MWA_ROM },
10586 	{ 0xc68000, 0xc68fff, MWA_EXTRAM2 },
10587 	{ 0xc7c000, 0xc7ffff, shared_ram_w, &shared_ram },
10588 	{-1}
10589 };
10590 
10591 static struct MemoryReadAddress enduror_sound_readmem[] =
10592 {
10593 	{ 0x0000, 0x7fff, MRA_ROM },
10594 	{ 0xc000, 0xc7ff, MRA_RAM },
10595 	{ 0xd000, 0xd000, YM2203_status_port_0_r },
10596 	{ 0xe000, 0xe7ff, SegaPCM_r },
10597 	{ -1 }  /* end of table */
10598 };
10599 
10600 static struct MemoryWriteAddress enduror_sound_writemem[] =
10601 {
10602 	{ 0x0000, 0x7fff, MWA_ROM },
10603 	{ 0xc000, 0xc7ff, MWA_RAM },
10604 	{ 0xd000, 0xd000, YM2203_control_port_0_w },
10605 	{ 0xd001, 0xd001, YM2203_write_port_0_w },
10606 	{ 0xe000, 0xe7ff, SegaPCM_w },
10607 	{ -1 }  /* end of table */
10608 };
10609 
10610 static struct IOReadPort enduror_sound_readport[] =
10611 {
10612 	{ 0x40, 0x40, soundlatch_r },
10613 	{ -1 }	/* end of table */
10614 };
10615 
10616 
10617 static struct IOWritePort enduror_sound_writeport[] =
10618 {
10619 	{ -1 }
10620 };
10621 
10622 static struct MemoryReadAddress enduror_b2_sound_readmem[] =
10623 {
10624 	{ 0x0000, 0x7fff, MRA_ROM },
10625 //	{ 0xc000, 0xc7ff, MRA_RAM },
10626 	{ 0xf000, 0xf7ff, SegaPCM_r },
10627 	{ 0xf800, 0xffff, MRA_RAM },
10628 	{ -1 }  /* end of table */
10629 };
10630 
10631 static struct MemoryWriteAddress enduror_b2_sound_writemem[] =
10632 {
10633 	{ 0x0000, 0x7fff, MWA_ROM },
10634 //	{ 0xc000, 0xc7ff, MWA_RAM },
10635 	{ 0xf000, 0xf7ff, SegaPCM_w },
10636 	{ 0xf800, 0xffff, MWA_RAM },
10637 	{ -1 }  /* end of table */
10638 };
10639 
10640 static struct IOReadPort enduror_b2_sound_readport[] =
10641 {
10642 	{ 0x00, 0x00, YM2203_status_port_0_r },
10643 	{ 0x80, 0x80, YM2203_status_port_1_r },
10644 	{ 0xc0, 0xc0, YM2203_status_port_2_r },
10645 	{ 0x40, 0x40, soundlatch_r },
10646 	{ -1 }	/* end of table */
10647 };
10648 
10649 static struct IOWritePort enduror_b2_sound_writeport[] =
10650 {
10651 	{ 0x00, 0x00, YM2203_control_port_0_w },
10652 	{ 0x01, 0x01, YM2203_write_port_0_w },
10653 	{ 0x80, 0x80, YM2203_control_port_1_w },
10654 	{ 0x81, 0x81, YM2203_write_port_1_w },
10655 	{ 0xc0, 0xc0, YM2203_control_port_2_w },
10656 	{ 0xc1, 0xc1, YM2203_write_port_2_w },
10657 	{ -1 }
10658 };
10659 
10660 /***************************************************************************/
enduror_update_proc(void)10661 static void enduror_update_proc( void ){
10662 	int data;
10663 	sys16_fg_scrollx = READ_WORD( &sys16_textram[0x0ff8] ) & 0x01ff;
10664 	sys16_bg_scrollx = READ_WORD( &sys16_textram[0x0ffa] ) & 0x01ff;
10665 	sys16_fg_scrolly = READ_WORD( &sys16_textram[0x0f24] ) & 0x01ff;
10666 	sys16_bg_scrolly = READ_WORD( &sys16_textram[0x0f26] ) & 0x01ff;
10667 
10668 	data = READ_WORD( &sys16_textram[0x0e9e] );
10669 
10670 	sys16_fg_page[0] = data>>12;
10671 	sys16_fg_page[1] = (data>>8)&0xf;
10672 	sys16_fg_page[3] = (data>>4)&0xf;
10673 	sys16_fg_page[2] = data&0xf;
10674 
10675 	data = READ_WORD( &sys16_textram[0x0e9c] );
10676 	sys16_bg_page[0] = data>>12;
10677 	sys16_bg_page[1] = (data>>8)&0xf;
10678 	sys16_bg_page[3] = (data>>4)&0xf;
10679 	sys16_bg_page[2] = data&0xf;
10680 
10681 	data = READ_WORD( &sys16_extraram3[2] );
10682 	set_refresh_3d( data );
10683 
10684 	if(data & 4)
10685 	{
10686 		osd_led_w(0,1);
10687 		osd_led_w(1,1);
10688 		osd_led_w(2,1);
10689 	}
10690 	else
10691 	{
10692 		osd_led_w(0,0);
10693 		osd_led_w(1,0);
10694 		osd_led_w(2,0);
10695 	}
10696 }
10697 
10698 
enduror_init_machine(void)10699 static void enduror_init_machine( void ){
10700 	static int bank[16] = { 00,01,02,03,04,05,06,07,00,00,00,00,00,00,00,00};
10701 	sys16_obj_bank = bank;
10702 	sys16_textmode=1;
10703 	sys16_spritesystem = 6;
10704 	sys16_sprxoffset = -0xc0;
10705 	sys16_fgxoffset = 13;
10706 //	sys16_sprxoffset = -0xbb;
10707 //	sys16_fgxoffset = 8;
10708 	sys16_textlayer_lo_min=0;
10709 	sys16_textlayer_lo_max=0;
10710 	sys16_textlayer_hi_min=0;
10711 	sys16_textlayer_hi_max=0xff;
10712 
10713 	sys16_update_proc = enduror_update_proc;
10714 
10715 	gr_ver = &sys16_extraram2[0x0];
10716 	gr_hor = gr_ver+0x200;
10717 	gr_pal = gr_ver+0x400;
10718 	gr_flip= gr_ver+0x600;
10719 	gr_palette= 0xf80 / 2;
10720 	gr_palette_default = 0x70 /2;
10721 	gr_colorflip[0][0]=0x00 / 2;
10722 	gr_colorflip[0][1]=0x02 / 2;
10723 	gr_colorflip[0][2]=0x04 / 2;
10724 	gr_colorflip[0][3]=0x00 / 2;
10725 	gr_colorflip[1][0]=0x00 / 2;
10726 	gr_colorflip[1][1]=0x00 / 2;
10727 	gr_colorflip[1][2]=0x06 / 2;
10728 	gr_colorflip[1][3]=0x00 / 2;
10729 
10730 #ifdef TRANSPARENT_SHADOWS
10731 	sys16_sh_shadowpal=0xff;
10732 #endif
10733 }
10734 
10735 
10736 
enduror_sprite_decode(void)10737 static void enduror_sprite_decode( void ){
10738 	unsigned char *RAM = memory_region(REGION_CPU1);
10739 	sys16_sprite_decode2( 8,0x020000 ,1);
10740 	generate_gr_screen(512,1024,8,0,4,0x8000);
10741 
10742 //	enduror_decode_data (RAM,RAM,0x10000);	// no decrypt info.
10743 	enduror_decode_data (RAM+0x10000,RAM+0x10000,0x10000);
10744 	enduror_decode_data2(RAM+0x20000,RAM+0x20000,0x10000);
10745 }
10746 
endurob_sprite_decode(void)10747 static void endurob_sprite_decode( void ){
10748 	sys16_sprite_decode2( 8,0x020000 ,1);
10749 	generate_gr_screen(512,1024,8,0,4,0x8000);
10750 }
10751 
endurora_opcode_decode(void)10752 static void endurora_opcode_decode( void )
10753 {
10754 	unsigned char *rom = memory_region(REGION_CPU1);
10755 	int diff = 0x50000;	/* place decrypted opcodes in a hole after RAM */
10756 
10757 
10758 	memory_set_opcode_base(0,rom+diff);
10759 
10760 	memcpy(rom+diff+0x10000,rom+0x10000,0x20000);
10761 	memcpy(rom+diff,rom+0x30000,0x10000);
10762 
10763 	// patch code to force a reset on cpu2 when starting a new game.
10764 	// Undoubtly wrong, but something like it is needed for the game to work
10765 	WRITE_WORD(&rom[0x1866 + diff],0x4a79);
10766 	WRITE_WORD(&rom[0x1868 + diff],0x00e0);
10767 	WRITE_WORD(&rom[0x186a + diff],0x0000);
10768 }
10769 
10770 
endurob2_opcode_decode(void)10771 static void endurob2_opcode_decode( void )
10772 {
10773 	unsigned char *rom = memory_region(REGION_CPU1);
10774 	int diff = 0x50000;	/* place decrypted opcodes in a hole after RAM */
10775 
10776 
10777 	memory_set_opcode_base(0,rom+diff);
10778 
10779 	memcpy(rom+diff,rom,0x30000);
10780 
10781 	endurob2_decode_data (rom,rom+diff,0x10000);
10782 	endurob2_decode_data2(rom+0x10000,rom+diff+0x10000,0x10000);
10783 
10784 	// patch code to force a reset on cpu2 when starting a new game.
10785 	// Undoubtly wrong, but something like it is needed for the game to work
10786 	WRITE_WORD(&rom[0x1866 + diff],0x4a79);
10787 	WRITE_WORD(&rom[0x1868 + diff],0x00e0);
10788 	WRITE_WORD(&rom[0x186a + diff],0x0000);
10789 }
10790 
init_enduror(void)10791 static void init_enduror( void )
10792 {
10793 	sys16_onetime_init_machine();
10794 #ifdef TRANSPARENT_SHADOWS
10795 	sys16_MaxShadowColors=NumOfShadowColors / 2;
10796 #endif
10797 //	sys16_MaxShadowColors=0;
10798 
10799 	enduror_sprite_decode();
10800 }
10801 
init_endurobl(void)10802 static void init_endurobl( void )
10803 {
10804 	sys16_onetime_init_machine();
10805 #ifdef TRANSPARENT_SHADOWS
10806 	sys16_MaxShadowColors=NumOfShadowColors / 2;
10807 #endif
10808 //	sys16_MaxShadowColors=0;
10809 
10810 	endurob_sprite_decode();
10811 	endurora_opcode_decode();
10812 }
10813 
init_endurob2(void)10814 static void init_endurob2( void )
10815 {
10816 	sys16_onetime_init_machine();
10817 #ifdef TRANSPARENT_SHADOWS
10818 	sys16_MaxShadowColors=NumOfShadowColors / 2;
10819 #endif
10820 //	sys16_MaxShadowColors=0;
10821 
10822 	endurob_sprite_decode();
10823 	endurob2_opcode_decode();
10824 }
10825 
10826 
10827 /***************************************************************************/
10828 
10829 INPUT_PORTS_START( enduror )
10830 PORT_START	/* handle right left */
10831 	PORT_ANALOG( 0xff, 0x7f, IPT_AD_STICK_X | IPF_REVERSE | IPF_CENTER, 100, 4, 0x0, 0xff )
10832 
10833 PORT_START	/* Fake Buttons */
10834 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )	// accel
10835 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )	// brake
10836 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )	// wheelie
10837 
10838 PORT_START
10839 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
10840 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
10841 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
10842 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
10843 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
10844 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
10845 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
10846 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
10847 
10848 	SYS16_COINAGE
10849 
10850 PORT_START	/* DSW1 */
10851 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
10852 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
10853 	PORT_DIPSETTING(    0x01, "Moving" )
10854 	PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
10855 	PORT_DIPSETTING(    0x04, "Easy" )
10856 	PORT_DIPSETTING(    0x06, "Normal" )
10857 	PORT_DIPSETTING(    0x02, "Hard" )
10858 	PORT_DIPSETTING(    0x00, "Hardest" )
10859 	PORT_DIPNAME( 0x18, 0x18, "Time Adjust" )
10860 	PORT_DIPSETTING(    0x10, "Easy" )
10861 	PORT_DIPSETTING(    0x18, "Normal" )
10862 	PORT_DIPSETTING(    0x08, "Hard" )
10863 	PORT_DIPSETTING(    0x00, "Hardest" )
10864 	PORT_DIPNAME( 0x60, 0x60, "Time Control" )
10865 	PORT_DIPSETTING(    0x40, "Easy" )
10866 	PORT_DIPSETTING(    0x60, "Normal" )
10867 	PORT_DIPSETTING(    0x20, "Hard" )
10868 	PORT_DIPSETTING(    0x00, "Hardest" )
10869 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
10870 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
10871 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
10872 
10873 //PORT_START	/* Y */
10874 //	PORT_ANALOG( 0xff, 0x0, IPT_AD_STICK_Y | IPF_CENTER , 100, 8, 0x0, 0xff )
10875 
10876 INPUT_PORTS_END
10877 
10878 /***************************************************************************/
10879 
10880 static struct MachineDriver machine_driver_enduror =
10881 {
10882 	{
10883 		{
10884 			CPU_M68000,
10885 			10000000,
10886 			enduror_readmem,enduror_writemem,0,0,
10887 			sys16_interrupt,1
10888 		},
10889 		{
10890 			CPU_Z80 | CPU_AUDIO_CPU,
10891 			4096000,
10892 			enduror_sound_readmem,enduror_sound_writemem,enduror_sound_readport,enduror_sound_writeport,
10893 			interrupt,4
10894 		},
10895 		{
10896 			CPU_M68000,
10897 			10000000,
10898 			enduror_readmem2,enduror_writemem2,0,0,
10899 			sys16_interrupt,1
10900 		},
10901 	},
10902 	60, DEFAULT_60HZ_VBLANK_DURATION,
10903 	1,
10904 	enduror_init_machine,
10905 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
10906 	gfx8,
10907 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
10908 	0,
10909 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
10910 	0,
10911 	sys16_ho_vh_start,
10912 	sys16_vh_stop,
10913 	sys16_ho_vh_screenrefresh,
10914 	SOUND_SUPPORTS_STEREO,0,0,0,
10915 	{
10916 		{
10917 			SOUND_YM2203,
10918 			&ym2203_interface
10919 		},
10920 		{
10921 			SOUND_SEGAPCM,
10922 			&segapcm_interface_32k,
10923 		}
10924 	}
10925 };
10926 
10927 static struct MachineDriver machine_driver_endurob2 =
10928 {
10929 	{
10930 		{
10931 			CPU_M68000,
10932 			10000000,
10933 			enduror_readmem,enduror_writemem,0,0,
10934 			sys16_interrupt,1
10935 		},
10936 		{
10937 			CPU_Z80 | CPU_AUDIO_CPU,
10938 			4096000,
10939 			enduror_b2_sound_readmem,enduror_b2_sound_writemem,enduror_b2_sound_readport,enduror_b2_sound_writeport,
10940 			ignore_interrupt,1
10941 		},
10942 		{
10943 			CPU_M68000,
10944 			10000000,
10945 			enduror_readmem2,enduror_writemem2,0,0,
10946 			sys16_interrupt,1
10947 		},
10948 	},
10949 	60, DEFAULT_60HZ_VBLANK_DURATION,
10950 	2,
10951 	enduror_init_machine,
10952 	40*8, 28*8, { 0*8, 40*8-1, 0*8, 28*8-1 },
10953 	gfx8,
10954 	2048*ShadowColorsMultiplier,2048*ShadowColorsMultiplier,
10955 	0,
10956 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
10957 	0,
10958 	sys16_ho_vh_start,
10959 	sys16_vh_stop,
10960 	sys16_ho_vh_screenrefresh,
10961 	SOUND_SUPPORTS_STEREO,0,0,0,
10962 	{
10963 		{
10964 			SOUND_YM2203,
10965 			&ym2203_interface2
10966 		},
10967 		{
10968 			SOUND_SEGAPCM,
10969 			&segapcm_interface_15k,
10970 		}
10971 	}
10972 };
10973 
10974 /*****************************************************************************/
10975 /* Dummy drivers for games that don't have a working clone and are protected */
10976 /*****************************************************************************/
10977 
10978 static struct MemoryReadAddress sys16_dummy_readmem[] =
10979 {
10980 	{ 0x000000, 0x0fffff, MRA_ROM },
10981 	{ 0xff0000, 0xffffff, MRA_WORKINGRAM },
10982 	{-1}
10983 };
10984 
10985 static struct MemoryWriteAddress sys16_dummy_writemem[] =
10986 {
10987 	{ 0x000000, 0x0fffff, MWA_ROM },
10988 	{ 0xff0000, 0xffffff, MWA_WORKINGRAM },
10989 
10990 	{-1}
10991 };
10992 
sys16_dummy_init_machine(void)10993 static void sys16_dummy_init_machine( void ){
10994 	static int bank[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
10995 	sys16_obj_bank = bank;
10996 }
10997 
init_s16dummy(void)10998 static void init_s16dummy( void )
10999 {
11000 	sys16_onetime_init_machine();
11001 //	sys16_sprite_decode( 4,0x040000 );
11002 }
11003 
11004 INPUT_PORTS_START( s16dummy )
11005 INPUT_PORTS_END
11006 
11007 MACHINE_DRIVER( machine_driver_s16dummy, \
11008 	sys16_dummy_readmem,sys16_dummy_writemem,sys16_dummy_init_machine, gfx8)
11009 
11010 /*****************************************************************************/
11011 // Ace Attacker
11012 
11013 // sys18
11014 ROM_START( aceattac )
11015 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11016 	ROM_LOAD_EVEN( "11491.4a", 0x000000, 0x10000, 0x77b820f1 )
11017 	ROM_LOAD_ODD ( "11489.1a", 0x000000, 0x10000, 0xbbe623c5 )
11018 	ROM_LOAD_EVEN( "11492.5a", 0x020000, 0x10000, 0xd8bd3139 )
11019 	ROM_LOAD_ODD ( "11490.2a", 0x020000, 0x10000, 0x38cb3a41 )
11020 
11021 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11022 	ROM_LOAD( "11493.9b",  0x00000, 0x10000, 0x654485d9 )
11023 	ROM_LOAD( "11494.10b", 0x10000, 0x10000, 0xb67971ab )
11024 	ROM_LOAD( "11495.11b", 0x20000, 0x10000, 0xb687ab61 )
11025 
11026 	ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
11027 	ROM_LOAD( "11501.1b", 0x00000, 0x10000, 0x09179ead )
11028 	ROM_LOAD( "11502.2b", 0x10000, 0x10000, 0xa3ee36b8 )
11029 	ROM_LOAD( "11503.3b", 0x20000, 0x10000, 0x344c0692 )
11030 	ROM_LOAD( "11504.4b", 0x30000, 0x10000, 0x7cae7920 )
11031 	ROM_LOAD( "11505.5b", 0x40000, 0x10000, 0xb67f1ecf )
11032 	ROM_LOAD( "11506.6b", 0x50000, 0x10000, 0xb0104def )
11033 	ROM_LOAD( "11507.7b", 0x60000, 0x10000, 0xa2af710a )
11034 	ROM_LOAD( "11508.8b", 0x70000, 0x10000, 0x5cbb833c )
11035 
11036 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
11037 	ROM_LOAD( "11496.7a",	 0x00000, 0x08000, 0x82cb40a9 )
11038 	ROM_LOAD( "11497.8a",    0x10000, 0x08000, 0xb04f62cc )
11039 	ROM_LOAD( "11498.9a",    0x18000, 0x08000, 0x97baf52b )
11040 	ROM_LOAD( "11499.10a",   0x20000, 0x08000, 0xea332866 )
11041 	ROM_LOAD( "11500.11a",   0x28000, 0x08000, 0x2ddf1c31 )
11042 ROM_END
11043 
11044 /*****************************************************************************/
11045 /*****************************************************************************/
11046 // After Burner
11047 
11048 ROM_START( aburner )
11049 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11050 	ROM_LOAD( "epr10949.bin",0x000000,0x20000, 0xd8437d92 )
11051 	ROM_LOAD( "epr10948.bin",0x000000,0x20000, 0x64284761 )
11052 	ROM_LOAD( "epr10947.bin",0x000000,0x20000, 0x08838392 )
11053 	ROM_LOAD( "epr10946.bin",0x000000,0x20000, 0xd7d485f4 )
11054 	ROM_LOAD( "epr10945.bin",0x000000,0x20000, 0xdf4d4c4f )
11055 	ROM_LOAD( "epr10944.bin",0x000000,0x20000, 0x17be8f67 )
11056 	ROM_LOAD( "epr10943.bin",0x000000,0x20000, 0xb98294dc )
11057 	ROM_LOAD( "epr10942.bin",0x000000,0x20000, 0x5ce10b8c )
11058 	ROM_LOAD( "epr10941.bin",0x000000,0x20000, 0x136ea264 )
11059 	ROM_LOAD( "epr10940.bin",0x000000,0x20000, 0x4d132c4e )
11060 	ROM_LOAD( "epr10928.bin",0x000000,0x20000, 0x7c01d40b )
11061 	ROM_LOAD( "epr10927.bin",0x000000,0x20000, 0x66d36757 )
11062 	ROM_LOAD( "epr10926.bin",0x000000,0x10000, 0xed8bd632 )
11063 	ROM_LOAD( "epr10925.bin",0x000000,0x10000, 0x4ef048cc )
11064 	ROM_LOAD( "epr10924.bin",0x000000,0x10000, 0x50c15a6d )
11065 	ROM_LOAD( "epr10923.bin",0x000000,0x10000, 0x6888eb8f )
11066 
11067 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11068 
11069 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
11070 
11071 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
11072 
11073 	ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
11074 
11075 	ROM_REGION( 0x40000, REGION_GFX3 ) /* gr */
11076 ROM_END
11077 
11078 
11079 /*****************************************************************************/
11080 // After Burner II
11081 
11082 ROM_START( aburner2 )
11083 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11084 	ROM_LOAD_EVEN( "11107.58",  0x000000, 0x20000, 0x6d87bab7 )
11085 	ROM_LOAD_ODD ( "11108.104", 0x000000, 0x20000, 0x202a3e1d )
11086 
11087 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11088 	ROM_LOAD( "11115.154", 0x00000, 0x10000, 0xe8e32921 )
11089 	ROM_LOAD( "11114.153", 0x10000, 0x10000, 0x2e97f633 )
11090 	ROM_LOAD( "11113.152", 0x20000, 0x10000, 0x36058c8c )
11091 
11092 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
11093 	ROM_LOAD( "10932.125", 0x000000, 0x20000, 0xcc0821d6 )
11094 	ROM_LOAD( "10933.126", 0x020000, 0x20000, 0xc8efb2c3 )
11095 	ROM_LOAD( "10934.129", 0x040000, 0x20000, 0x4a51b1fa )
11096 	ROM_LOAD( "10935.130", 0x060000, 0x20000, 0xc1e23521 )
11097 
11098 	ROM_LOAD( "10936.133", 0x080000, 0x20000, 0xada70d64 )
11099 	ROM_LOAD( "10937.134", 0x0a0000, 0x20000, 0x00a6144f )
11100 	ROM_LOAD( "10938.102", 0x0c0000, 0x20000, 0xe7675baf )
11101 	ROM_LOAD( "10939.103", 0x0e0000, 0x20000, 0xa0d49480 )
11102 
11103 	ROM_LOAD( "11103.127", 0x100000, 0x20000, 0xbdd60da2 )
11104 	ROM_LOAD( "11104.131", 0x120000, 0x20000, 0x06a35fce )
11105 	ROM_LOAD( "11105.135", 0x140000, 0x20000, 0x027b0689 )
11106 	ROM_LOAD( "11106.104", 0x160000, 0x20000, 0x9e1fec09 )
11107 
11108 	ROM_LOAD( "11116.128", 0x180000, 0x20000, 0x49b4c1ba )
11109 	ROM_LOAD( "11117.132", 0x1a0000, 0x20000, 0x821fbb71 )
11110 	ROM_LOAD( "11118.136", 0x1c0000, 0x20000, 0x8f38540b )
11111 	ROM_LOAD( "11119.105", 0x1e0000, 0x20000, 0xd0343a8e )
11112 
11113 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
11114 	ROM_LOAD( "11112.17",    0x00000, 0x10000, 0xd777fc6d )
11115 	ROM_LOAD( "11102.13",    0x10000, 0x20000, 0x6c07c78d )
11116 	ROM_LOAD( "10931.11",    0x30000, 0x20000, 0x9209068f )
11117 	ROM_LOAD( "10930.12",    0x30000, 0x20000, 0x6493368b )
11118 
11119 	ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
11120 	ROM_LOAD_EVEN( "11109.20", 0x000000, 0x20000, 0x85a0fe07 )
11121 	ROM_LOAD_ODD ( "11110.29", 0x000000, 0x20000, 0xf3d6797c )
11122 
11123 	ROM_REGION( 0x40000, REGION_GFX3 ) /* gr */
11124 	ROM_LOAD_ODD ( "10922.40", 0x000000, 0x10000, 0xb49183d4 )
11125 ROM_END
11126 
11127 
11128 /*****************************************************************************/
11129 // Bloxeed
11130 
11131 // sys18
11132 ROM_START( bloxeed )
11133 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11134 	ROM_LOAD_EVEN( "rom-e.rom", 0x000000, 0x20000, 0xa481581a )
11135 	ROM_LOAD_ODD ( "rom-o.rom", 0x000000, 0x20000, 0xdd1bc3bf )
11136 
11137 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11138 	ROM_LOAD( "scr0.rom", 0x00000, 0x10000, 0xe024aa33 )
11139 	ROM_LOAD( "scr1.rom", 0x10000, 0x10000, 0x8041b814 )
11140 	ROM_LOAD( "scr2.rom", 0x20000, 0x10000, 0xde32285e )
11141 
11142 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
11143 	ROM_LOAD( "obj0-e.rom", 0x00000, 0x10000, 0x90d31a8c )
11144 	ROM_LOAD( "obj0-o.rom", 0x10000, 0x10000, 0xf0c0f49d )
11145 
11146 	ROM_REGION( 0x20000, REGION_CPU2 ) /* sound CPU */
11147 	ROM_LOAD( "sound0.rom",	 0x00000, 0x20000, 0x6f2fc63c )
11148 ROM_END
11149 
11150 
11151 /*****************************************************************************/
11152 // Clutch Hitter
11153 // sys18
11154 ROM_START( cltchitr )
11155 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11156 	ROM_LOAD_EVEN( "epr13795.6a", 0x000000, 0x40000, 0xb0b60b67 )
11157 	ROM_LOAD_ODD ( "epr13751.4a", 0x000000, 0x40000, 0xc8d80233 )
11158 	ROM_LOAD_EVEN( "epr13786.7a", 0x080000, 0x40000, 0x3095dac0 )
11159 	ROM_LOAD_ODD ( "epr13784.5a", 0x080000, 0x40000, 0x80c8180d )
11160 
11161 	ROM_REGION( 0x180000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11162 	ROM_LOAD( "mpr13787.10a", 0x000000, 0x80000, 0xf05c68c6 )
11163 	ROM_LOAD( "mpr13788.11a", 0x080000, 0x80000, 0x0106fea6 )
11164 	ROM_LOAD( "mpr13789.12a", 0x100000, 0x80000, 0x09ba8835 )
11165 
11166 	ROM_REGION( 0x300000*2, REGION_GFX2 ) /* sprites */
11167 	ROM_LOAD( "mpr13773.1c",  0x000000, 0x80000, 0x3fc600e5 )
11168 	ROM_LOAD( "mpr13774.2c",  0x080000, 0x80000, 0x2411a824 )
11169 	ROM_LOAD( "mpr13775.3c",  0x100000, 0x80000, 0xcf527bf6 )
11170 	ROM_LOAD( "mpr13779.10c", 0x180000, 0x80000, 0xc707f416 )
11171 	ROM_LOAD( "mpr13780.11c", 0x200000, 0x80000, 0xa4c341e0 )
11172 	ROM_LOAD( "mpr13781.12c", 0x280000, 0x80000, 0xf33b13af )
11173 
11174 	ROM_REGION( 0x180000, REGION_CPU2 ) /* sound CPU */
11175 	ROM_LOAD( "epr13793.7c",    0x000000, 0x80000, 0xa3d31944 )
11176 	ROM_LOAD( "epr13791.5c",	0x080000, 0x80000, 0x35c16d80 )
11177 	ROM_LOAD( "epr13792.6c",    0x100000, 0x80000, 0x808f9695 )
11178 ROM_END
11179 
11180 
11181 /*****************************************************************************/
11182 // Cotton
11183 
11184 ROM_START( cotton )
11185 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11186 // custom cpu 317-?????
11187 	ROM_LOAD_EVEN( "epr13858.a7", 0x000000, 0x20000, 0x276f42fe )
11188 	ROM_LOAD_ODD ( "epr13856.a5", 0x000000, 0x20000, 0x14e6b5e7 )
11189 	ROM_LOAD_EVEN( "epr13859.a8", 0x040000, 0x20000, 0x4703ef9d )
11190 	ROM_LOAD_ODD ( "epr13857.a6", 0x040000, 0x20000, 0xde37e527 )
11191 
11192 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11193 	ROM_LOAD( "scr01.rom", 0x00000, 0x20000, 0xa47354b6 )
11194 	ROM_LOAD( "scr11.rom", 0x20000, 0x20000, 0xd38424b5 )
11195 	ROM_LOAD( "scr02.rom", 0x40000, 0x20000, 0x8c990026 )
11196 	ROM_LOAD( "scr12.rom", 0x60000, 0x20000, 0x21c15b8a )
11197 	ROM_LOAD( "scr03.rom", 0x80000, 0x20000, 0xd2b175bf )
11198 	ROM_LOAD( "scr13.rom", 0xa0000, 0x20000, 0xb9d62531 )
11199 
11200 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
11201 	ROM_LOAD( "obj0-e.rom", 0x000000, 0x20000, 0xab4b3468 )
11202 	ROM_LOAD( "obj0-o.rom", 0x020000, 0x20000, 0x7024f404 )
11203 	ROM_LOAD( "obj1-e.rom", 0x040000, 0x20000, 0x69b41ac3 )
11204 	ROM_LOAD( "obj1-o.rom", 0x060000, 0x20000, 0x6169bba4 )
11205 	ROM_LOAD( "obj2-e.rom", 0x080000, 0x20000, 0x0801cf02 )
11206 	ROM_LOAD( "obj2-o.rom", 0x0a0000, 0x20000, 0xb014f02d )
11207 	ROM_LOAD( "obj3-e.rom", 0x0c0000, 0x20000, 0xf066f315 )
11208 	ROM_LOAD( "obj3-o.rom", 0x0e0000, 0x20000, 0xe62a7cd6 )
11209 	ROM_LOAD( "obj4-e.rom", 0x100000, 0x20000, 0x1bd145f3 )
11210 	ROM_LOAD( "obj4-o.rom", 0x120000, 0x20000, 0x943aba8b )
11211 	ROM_LOAD( "obj5-e.rom", 0x140000, 0x20000, 0x4fd59bff )
11212 	ROM_LOAD( "obj5-o.rom", 0x160000, 0x20000, 0x7ea93200 )
11213 	ROM_LOAD( "obj6-e.rom", 0x180000, 0x20000, 0x6a66868d )
11214 	ROM_LOAD( "obj6-o.rom", 0x1a0000, 0x20000, 0x1c942190 )
11215 	ROM_LOAD( "obj7-e.rom", 0x1c0000, 0x20000, 0x1c5ffad8 )
11216 	ROM_LOAD( "obj7-o.rom", 0x1e0000, 0x20000, 0x856f3ee2 )
11217 
11218 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
11219 	ROM_LOAD( "s-prog.rom",	 0x00000, 0x08000, 0x6a57b027 )
11220 	ROM_LOAD( "speech0.rom", 0x10000, 0x20000, 0x4d21153f )
11221 ROM_END
11222 
11223 
11224 ROM_START( cottona )
11225 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11226 // custom cpu 317-0181a
11227 	ROM_LOAD_EVEN( "ep13921a.a7", 0x000000, 0x20000, 0xf047a037 )
11228 	ROM_LOAD_ODD ( "ep13919a.a5", 0x000000, 0x20000, 0x651108b1 )
11229 	ROM_LOAD_EVEN( "ep13922a.a8", 0x040000, 0x20000, 0x1ca248c5 )
11230 	ROM_LOAD_ODD ( "ep13920a.a6", 0x040000, 0x20000, 0xfa3610f9 )
11231 
11232 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11233 	ROM_LOAD( "scr01.rom", 0x00000, 0x20000, 0xa47354b6 )
11234 	ROM_LOAD( "scr11.rom", 0x20000, 0x20000, 0xd38424b5 )
11235 	ROM_LOAD( "scr02.rom", 0x40000, 0x20000, 0x8c990026 )
11236 	ROM_LOAD( "scr12.rom", 0x60000, 0x20000, 0x21c15b8a )
11237 	ROM_LOAD( "scr03.rom", 0x80000, 0x20000, 0xd2b175bf )
11238 	ROM_LOAD( "scr13.rom", 0xa0000, 0x20000, 0xb9d62531 )
11239 
11240 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
11241 	ROM_LOAD( "obj0-e.rom", 0x000000, 0x20000, 0xab4b3468 )
11242 	ROM_LOAD( "obj0-o.rom", 0x020000, 0x20000, 0x7024f404 )
11243 	ROM_LOAD( "obj1-e.rom", 0x040000, 0x20000, 0x69b41ac3 )
11244 	ROM_LOAD( "obj1-o.rom", 0x060000, 0x20000, 0x6169bba4 )
11245 	ROM_LOAD( "obj2-e.rom", 0x080000, 0x20000, 0x0801cf02 )
11246 	ROM_LOAD( "obj2-o.rom", 0x0a0000, 0x20000, 0xb014f02d )
11247 	ROM_LOAD( "obj3-e.rom", 0x0c0000, 0x20000, 0xf066f315 )
11248 	ROM_LOAD( "obj3-o.rom", 0x0e0000, 0x20000, 0xe62a7cd6 )
11249 	ROM_LOAD( "obj4-e.rom", 0x100000, 0x20000, 0x1bd145f3 )
11250 	ROM_LOAD( "obj4-o.rom", 0x120000, 0x20000, 0x943aba8b )
11251 	ROM_LOAD( "obj5-e.rom", 0x140000, 0x20000, 0x4fd59bff )
11252 	ROM_LOAD( "obj5-o.rom", 0x160000, 0x20000, 0x7ea93200 )
11253 	ROM_LOAD( "obj6-e.rom", 0x180000, 0x20000, 0x6a66868d )
11254 	ROM_LOAD( "obj6-o.rom", 0x1a0000, 0x20000, 0x1c942190 )
11255 	ROM_LOAD( "obj7-e.rom", 0x1c0000, 0x20000, 0x1c5ffad8 )
11256 	ROM_LOAD( "obj7-o.rom", 0x1e0000, 0x20000, 0x856f3ee2 )
11257 
11258 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
11259 	ROM_LOAD( "s-prog.rom",	 0x00000, 0x08000, 0x6a57b027 )
11260 	ROM_LOAD( "speech0.rom", 0x10000, 0x20000, 0x4d21153f )
11261 ROM_END
11262 
11263 
11264 /*****************************************************************************/
11265 // DD Crew
11266 
11267 ROM_START( ddcrew )
11268 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11269 	ROM_LOAD_EVEN( "14153.6a", 0x000000, 0x40000, 0xe01fae0c )
11270 	ROM_LOAD_ODD ( "14152.4a", 0x000000, 0x40000, 0x69c7b571 )
11271 	ROM_LOAD_EVEN( "14141.7a", 0x080000, 0x40000, 0x080a494b )
11272 	ROM_LOAD_ODD ( "14139.5a", 0x080000, 0x40000, 0x06c31531 )
11273 
11274 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11275 	ROM_LOAD( "14127.1c", 0x00000, 0x40000, 0x2228cd88 )
11276 	ROM_LOAD( "14128.2c", 0x40000, 0x40000, 0xedba8e10 )
11277 	ROM_LOAD( "14129.3c", 0x80000, 0x40000, 0xe8ecc305 )
11278 
11279 	ROM_REGION( 0x400000*2, REGION_GFX2 ) /* sprites */
11280 	ROM_LOAD( "14134.10c", 0x000000, 0x80000, 0x4fda6a4b )
11281 	ROM_LOAD( "14142.10a", 0x080000, 0x80000, 0x3cbf1f2a )
11282 	ROM_LOAD( "14135.11c", 0x100000, 0x80000, 0xe9c74876 )
11283 	ROM_LOAD( "14143.11a", 0x180000, 0x80000, 0x59022c31 )
11284 	ROM_LOAD( "14136.12c", 0x200000, 0x80000, 0x720d9858 )
11285 	ROM_LOAD( "14144.12a", 0x280000, 0x80000, 0x7775fdd4 )
11286 	ROM_LOAD( "14137.13c", 0x300000, 0x80000, 0x846c4265 )
11287 	ROM_LOAD( "14145.13a", 0x380000, 0x80000, 0x0e76c797 )
11288 
11289 	ROM_REGION( 0x1a0000, REGION_CPU2 ) /* sound CPU */
11290 	ROM_LOAD( "14133.7c",	 0x000000, 0x20000, 0xcff96665 )
11291 	ROM_LOAD( "14130.4c",    0x020000, 0x80000, 0x948f34a1 )
11292 	ROM_LOAD( "14131.5c",    0x0a0000, 0x80000, 0xbe5a7d0b )
11293 	ROM_LOAD( "14132.6c",    0x120000, 0x80000, 0x1fae0220 )
11294 ROM_END
11295 
11296 
11297 /*****************************************************************************/
11298 // Dunk Shot
11299 
11300 ROM_START( dunkshot )
11301 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11302 	ROM_LOAD_EVEN( "10468.bin", 0x000000, 0x8000, 0xe2d5f97a )
11303 	ROM_LOAD_ODD ( "10467.bin", 0x000000, 0x8000, 0x29774114 )
11304 	ROM_LOAD_EVEN( "10470.bin", 0x010000, 0x8000, 0x8c60761f )
11305 	ROM_LOAD_ODD ( "10469.bin", 0x010000, 0x8000, 0xaa442b81 )
11306 	ROM_LOAD_EVEN( "10472.bin", 0x020000, 0x8000, 0x206027a6 )
11307 	ROM_LOAD_ODD ( "10471.bin", 0x020000, 0x8000, 0x22777314 )
11308 
11309 	ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11310 	ROM_LOAD( "10485.bin", 0x00000, 0x8000, 0xf16dda29 )
11311 	ROM_LOAD( "10486.bin", 0x08000, 0x8000, 0x311d973c )
11312 	ROM_LOAD( "10487.bin", 0x10000, 0x8000, 0xa8fb179f )
11313 
11314 	ROM_REGION( 0x40000*2, REGION_GFX2 ) /* sprites */
11315 	ROM_LOAD( "10481.bin", 0x00000, 0x8000, 0xfeb04bc9 )
11316 	ROM_LOAD( "10477.bin", 0x08000, 0x8000, 0xf9d3b2cb )
11317 	ROM_LOAD( "10482.bin", 0x10000, 0x8000, 0x5bc07618 )
11318 	ROM_LOAD( "10478.bin", 0x18000, 0x8000, 0x5b5c5c92 )
11319 	ROM_LOAD( "10483.bin", 0x20000, 0x8000, 0x7cab4f9e )
11320 	ROM_LOAD( "10479.bin", 0x28000, 0x8000, 0xe84190a0 )
11321 	ROM_LOAD( "10484.bin", 0x30000, 0x8000, 0xbcb5fcc9 )
11322 	ROM_LOAD( "10480.bin", 0x38000, 0x8000, 0x5dffd9dd )
11323 
11324 	ROM_REGION( 0x28000, REGION_CPU2 ) /* sound CPU */
11325 	ROM_LOAD( "10473.bin",	 0x00000, 0x08000, 0x7f1f5a27 )
11326 	ROM_LOAD( "10474.bin",   0x10000, 0x08000, 0x419a656e )
11327 	ROM_LOAD( "10475.bin",   0x18000, 0x08000, 0x17d55e85 )
11328 	ROM_LOAD( "10476.bin",   0x20000, 0x08000, 0xa6be0956 )
11329 ROM_END
11330 
11331 
11332 
11333 /*****************************************************************************/
11334 // Laser Ghost
11335 
11336 // sys18
11337 ROM_START( lghost )
11338 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11339 	ROM_LOAD_EVEN( "13429", 0x000000, 0x20000, 0x0e0ccf26 )
11340 	ROM_LOAD_ODD ( "13437", 0x000000, 0x20000, 0x38b4dc2f )
11341 	ROM_LOAD_EVEN( "13411", 0x040000, 0x20000, 0xc3aeae07 )
11342 	ROM_LOAD_ODD ( "13413", 0x040000, 0x20000, 0x75f43e21 )
11343 
11344 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11345 	ROM_LOAD( "13414", 0x00000, 0x20000, 0x82025f3b )
11346 	ROM_LOAD( "13415", 0x20000, 0x20000, 0xa76852e9 )
11347 	ROM_LOAD( "13416", 0x40000, 0x20000, 0xe88db149 )
11348 
11349 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
11350 	ROM_LOAD( "13603", 0x00000, 0x20000, 0x2e3cc07b )
11351 	ROM_LOAD( "13604", 0x20000, 0x20000, 0x576388af )
11352 	ROM_LOAD( "13421", 0x40000, 0x20000, 0xabee8771 )
11353 	ROM_LOAD( "13424", 0x60000, 0x20000, 0x260ab077 )
11354 	ROM_LOAD( "13422", 0x80000, 0x20000, 0x36cef12c )
11355 	ROM_LOAD( "13425", 0xa0000, 0x20000, 0xe0ff8807 )
11356 	ROM_LOAD( "13423", 0xc0000, 0x20000, 0x5b8e0053 )
11357 	ROM_LOAD( "13426", 0xe0000, 0x20000, 0xc689853b )
11358 
11359 	ROM_REGION( 0x80000, REGION_CPU2 ) /* sound CPU */
11360 	ROM_LOAD( "13417",	 0x00000, 0x20000, 0xcd7beb49 )
11361 	ROM_LOAD( "13420",   0x20000, 0x20000, 0x03199cbb )
11362 	ROM_LOAD( "13419",   0x40000, 0x20000, 0xa918ef68 )
11363 	ROM_LOAD( "13418",   0x60000, 0x20000, 0x4006c9f1 )
11364 ROM_END
11365 
11366 /*****************************************************************************/
11367 // Line of Fire
11368 
11369 ROM_START( loffire )
11370 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11371 	ROM_LOAD_EVEN( "epr12850.rom", 0x000000, 0x20000, 0x14598f2a )
11372 	ROM_LOAD_ODD ( "epr12849.rom", 0x000000, 0x20000, 0x61cfd2fe )
11373 
11374 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11375 	ROM_LOAD( "opr12791.rom", 0x00000, 0x10000, 0xacfa69ba )
11376 	ROM_LOAD( "opr12792.rom", 0x10000, 0x10000, 0xe506723c )
11377 	ROM_LOAD( "opr12793.rom", 0x20000, 0x10000, 0x0ce8cce3 )
11378 
11379 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
11380 	ROM_LOAD( "epr12775.rom", 0x000000, 0x20000, 0x693056ec )
11381 	ROM_LOAD( "epr12776.rom", 0x020000, 0x20000, 0x61efbdfd )
11382 	ROM_LOAD( "epr12777.rom", 0x040000, 0x20000, 0x29d5b953 )
11383 	ROM_LOAD( "epr12778.rom", 0x060000, 0x20000, 0x2fb68e07 )
11384 
11385 	ROM_LOAD( "epr12779.rom", 0x080000, 0x20000, 0xae58af7c )
11386 	ROM_LOAD( "epr12780.rom", 0x0a0000, 0x20000, 0xee670c1e )
11387 	ROM_LOAD( "epr12781.rom", 0x0c0000, 0x20000, 0x538f6bc5 )
11388 	ROM_LOAD( "epr12782.rom", 0x0e0000, 0x20000, 0x5acc34f7 )
11389 
11390 	ROM_LOAD( "epr12783.rom", 0x100000, 0x20000, 0xc13feea9 )
11391 	ROM_LOAD( "epr12784.rom", 0x120000, 0x20000, 0x39b94c65 )
11392 	ROM_LOAD( "epr12785.rom", 0x140000, 0x20000, 0x05ed0059 )
11393 	ROM_LOAD( "epr12786.rom", 0x160000, 0x20000, 0xa4123165 )
11394 
11395 	ROM_LOAD( "epr12787.rom", 0x180000, 0x20000, 0x6431a3a6 )
11396 	ROM_LOAD( "epr12788.rom", 0x1a0000, 0x20000, 0x1982a0ce )
11397 	ROM_LOAD( "epr12789.rom", 0x1c0000, 0x20000, 0x97d03274 )
11398 	ROM_LOAD( "epr12790.rom", 0x1e0000, 0x20000, 0x816e76e6 )
11399 
11400 	ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
11401 	ROM_LOAD( "epr12798.rom",	 0x00000, 0x10000, 0x0587738d )
11402 	ROM_LOAD( "epr12799.rom",    0x10000, 0x20000, 0xbc60181c )
11403 	ROM_LOAD( "epr12800.rom",    0x30000, 0x20000, 0x1158c1a3 )
11404 	ROM_LOAD( "epr12801.rom",    0x50000, 0x20000, 0x2d6567c4 )
11405 
11406 	ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
11407 	ROM_LOAD_EVEN( "epr12803.rom", 0x000000, 0x20000, 0xc1d9e751 )
11408 	ROM_LOAD_ODD ( "epr12802.rom", 0x000000, 0x20000, 0xd746bb39 )
11409 	ROM_LOAD_EVEN( "epr12805.rom", 0x040000, 0x20000, 0x4a7200c3 )
11410 	ROM_LOAD_ODD ( "epr12804.rom", 0x040000, 0x20000, 0xb853480e )
11411 ROM_END
11412 
11413 
11414 /*****************************************************************************/
11415 // MVP
11416 
11417 ROM_START( mvp )
11418 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11419 	ROM_LOAD_EVEN( "13000.rom", 0x000000, 0x40000, 0x2e0e21ec )
11420 	ROM_LOAD_ODD ( "12999.rom", 0x000000, 0x40000, 0xfd213d28 )
11421 
11422 	ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11423 	ROM_LOAD( "13011.rom", 0x00000, 0x40000, 0x1cb871fc )
11424 	ROM_LOAD( "13012.rom", 0x40000, 0x40000, 0xb75e6821 )
11425 	ROM_LOAD( "13013.rom", 0x80000, 0x40000, 0xf1944a3c )
11426 
11427 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
11428 	ROM_LOAD( "13010.rom", 0x000000, 0x40000, 0xdf37c567 )
11429 	ROM_LOAD( "13009.rom", 0x040000, 0x40000, 0x126d2e37 )
11430 	ROM_LOAD( "13006.rom", 0x080000, 0x40000, 0x2e9afd2f )
11431 	ROM_LOAD( "13003.rom", 0x0c0000, 0x40000, 0x21424151 )
11432 	ROM_LOAD( "13007.rom", 0x100000, 0x40000, 0x55c8605b )
11433 	ROM_LOAD( "13004.rom", 0x140000, 0x40000, 0x0aa09dd3 )
11434 	ROM_LOAD( "13008.rom", 0x180000, 0x40000, 0xb3d46dfc )
11435 	ROM_LOAD( "13005.rom", 0x1c0000, 0x40000, 0xc899c810 )
11436 
11437 	ROM_REGION( 0x50000, REGION_CPU2 ) /* sound CPU */
11438 	ROM_LOAD( "13002.rom",	 0x00000, 0x08000, 0x1b6e1515 )
11439 	ROM_LOAD( "13001.rom",   0x10000, 0x40000, 0xe8cace8c )
11440 ROM_END
11441 
11442 
11443 /*****************************************************************************/
11444 // Thunder Blade
11445 
11446 // after burner hardware
11447 ROM_START( thndrbld )
11448 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11449 	ROM_LOAD_EVEN( "thnbld.58", 0x000000, 0x20000, 0xe057dd5a )
11450 	ROM_LOAD_ODD ( "thnbld.63", 0x000000, 0x20000, 0xc6b994b8 )
11451 	ROM_LOAD_EVEN( "11306.epr", 0x040000, 0x20000, 0x4b95f2b4 )
11452 	ROM_LOAD_ODD ( "11307.epr", 0x040000, 0x20000, 0x2d6833e4 )
11453 
11454 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11455 	ROM_LOAD( "11316.epr", 0x00000, 0x10000, 0x84290dff )
11456 	ROM_LOAD( "11315.epr", 0x10000, 0x10000, 0x35813088 )
11457 	ROM_LOAD( "11314.epr", 0x20000, 0x10000, 0xd4f954a9 )
11458 
11459 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
11460 	ROM_LOAD( "thnbld.105",0x000000, 0x20000, 0xb4a382f7 )
11461 	ROM_LOAD( "thnbld.101",0x020000, 0x20000, 0x525e2e1d )
11462 	ROM_LOAD( "thnbld.97", 0x040000, 0x20000, 0x5f2783be )
11463 	ROM_LOAD( "thnbld.93", 0x060000, 0x20000, 0x90775579 )
11464 
11465 	ROM_LOAD( "11328.epr", 0x080000, 0x20000, 0xda39e89c )
11466 	ROM_LOAD( "11329.epr", 0x0a0000, 0x20000, 0x31b20257 )
11467 	ROM_LOAD( "11330.epr", 0x0c0000, 0x20000, 0xaa7c70c5 )
11468 	ROM_LOAD( "11331.epr", 0x0e0000, 0x20000, 0x3a2c042e )
11469 
11470 	ROM_LOAD( "11324.epr", 0x100000, 0x20000, 0x9742b552 )
11471 	ROM_LOAD( "11325.epr", 0x120000, 0x20000, 0xb9e98ae9 )
11472 	ROM_LOAD( "11326.epr", 0x140000, 0x20000, 0x29198403 )
11473 	ROM_LOAD( "11327.epr", 0x160000, 0x20000, 0xdeae90f1 )
11474 
11475 	ROM_LOAD( "11320.epr", 0x180000, 0x20000, 0xa95c76b8 )
11476 //	ROM_LOAD( "11321.epr", 0x1a0000, 0x20000, 0x8e738f58 )
11477 	ROM_LOAD( "thnbld.98", 0x1a0000, 0x10000, 0xeb4b9e57 )
11478 	ROM_LOAD( "11322.epr", 0x1c0000, 0x20000, 0x10364d74 )
11479 	ROM_LOAD( "11323.epr", 0x1e0000, 0x20000, 0x27e40735 )
11480 
11481 	ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
11482 	ROM_LOAD( "thnbld.17",	 0x00000, 0x10000, 0xd37b54a4 )
11483 	ROM_LOAD( "11317.epr",   0x10000, 0x20000, 0xd4e7ac1f )
11484 	ROM_LOAD( "11318.epr",   0x30000, 0x20000, 0x70d3f02c )
11485 	ROM_LOAD( "11319.epr",   0x50000, 0x20000, 0x50d9242e )
11486 
11487 	ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
11488 	ROM_LOAD_EVEN( "thnbld.20", 0x000000, 0x20000, 0xed988fdb )
11489 	ROM_LOAD_ODD ( "thnbld.29", 0x000000, 0x20000, 0x12523bc1 )
11490 	ROM_LOAD_EVEN( "11310.epr", 0x040000, 0x20000, 0x5d9fa02c )
11491 	ROM_LOAD_ODD ( "11311.epr", 0x040000, 0x20000, 0x483de21b )
11492 
11493 	ROM_REGION( 0x10000, REGION_GFX3 ) /* ???? */
11494 	ROM_LOAD( "11313.epr",	 0x00000, 0x10000, 0x6a56c4c3 )
11495 ROM_END
11496 
11497 
11498 // Thunder Blade Japan
11499 
11500 // after burner hardware
11501 ROM_START( thndrbdj )
11502 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11503 	ROM_LOAD_EVEN( "11304.epr", 0x000000, 0x20000, 0xa90630ef )
11504 	ROM_LOAD_ODD ( "11305.epr", 0x000000, 0x20000, 0x9ba3ef61 )
11505 	ROM_LOAD_EVEN( "11306.epr", 0x040000, 0x20000, 0x4b95f2b4 )
11506 	ROM_LOAD_ODD ( "11307.epr", 0x040000, 0x20000, 0x2d6833e4 )
11507 
11508 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11509 	ROM_LOAD( "11316.epr", 0x00000, 0x10000, 0x84290dff )
11510 	ROM_LOAD( "11315.epr", 0x10000, 0x10000, 0x35813088 )
11511 	ROM_LOAD( "11314.epr", 0x20000, 0x10000, 0xd4f954a9 )
11512 
11513 	ROM_REGION( 0x200000*2, REGION_GFX2 ) /* sprites */
11514 	ROM_LOAD( "11332.epr", 0x000000, 0x20000, 0xdc089ec6 )
11515 	ROM_LOAD( "11333.epr", 0x020000, 0x20000, 0x05a2333f )
11516 	ROM_LOAD( "11334.epr", 0x040000, 0x20000, 0x348f91c7 )
11517 	ROM_LOAD( "11335.epr", 0x060000, 0x20000, 0xf19b3e86 )
11518 
11519 	ROM_LOAD( "11328.epr", 0x080000, 0x20000, 0xda39e89c )
11520 	ROM_LOAD( "11329.epr", 0x0a0000, 0x20000, 0x31b20257 )
11521 	ROM_LOAD( "11330.epr", 0x0c0000, 0x20000, 0xaa7c70c5 )
11522 	ROM_LOAD( "11331.epr", 0x0e0000, 0x20000, 0x3a2c042e )
11523 
11524 	ROM_LOAD( "11324.epr", 0x100000, 0x20000, 0x9742b552 )
11525 	ROM_LOAD( "11325.epr", 0x120000, 0x20000, 0xb9e98ae9 )
11526 	ROM_LOAD( "11326.epr", 0x140000, 0x20000, 0x29198403 )
11527 	ROM_LOAD( "11327.epr", 0x160000, 0x20000, 0xdeae90f1 )
11528 
11529 	ROM_LOAD( "11320.epr", 0x180000, 0x20000, 0xa95c76b8 )
11530 	ROM_LOAD( "11321.epr", 0x1a0000, 0x20000, 0x8e738f58 )
11531 	ROM_LOAD( "11322.epr", 0x1c0000, 0x20000, 0x10364d74 )
11532 	ROM_LOAD( "11323.epr", 0x1e0000, 0x20000, 0x27e40735 )
11533 
11534 	ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
11535 	ROM_LOAD( "11312.epr",   0x00000, 0x10000, 0x3b974ed2 )
11536 	ROM_LOAD( "11317.epr",   0x10000, 0x20000, 0xd4e7ac1f )
11537 	ROM_LOAD( "11318.epr",   0x30000, 0x20000, 0x70d3f02c )
11538 	ROM_LOAD( "11319.epr",   0x50000, 0x20000, 0x50d9242e )
11539 
11540 	ROM_REGION( 0x100000, REGION_CPU3 ) /* 2nd 68000 code */
11541 	ROM_LOAD_EVEN( "11308.epr", 0x000000, 0x20000, 0x7956c238 )
11542 	ROM_LOAD_ODD ( "11309.epr", 0x000000, 0x20000, 0xc887f620 )
11543 	ROM_LOAD_EVEN( "11310.epr", 0x040000, 0x20000, 0x5d9fa02c )
11544 	ROM_LOAD_ODD ( "11311.epr", 0x040000, 0x20000, 0x483de21b )
11545 
11546 	ROM_REGION( 0x10000, REGION_GFX3 ) /* ???? */
11547 	ROM_LOAD( "11313.epr",	 0x00000, 0x10000, 0x6a56c4c3 )
11548 ROM_END
11549 
11550 
11551 /*****************************************************************************/
11552 // Turbo Outrun
11553 
11554 ROM_START( toutrun )
11555 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11556 // custom cpu 317-0106
11557 	ROM_LOAD_EVEN( "epr12397.133", 0x000000, 0x10000, 0xe4b57d7d )
11558 	ROM_LOAD_ODD ( "epr12396.118", 0x000000, 0x10000, 0x5e7115cb )
11559 	ROM_LOAD_EVEN( "epr12399.132", 0x020000, 0x10000, 0x62c77b1b )
11560 	ROM_LOAD_ODD ( "epr12398.117", 0x020000, 0x10000, 0x18e34520 )
11561 	ROM_LOAD_EVEN( "epr12293.131", 0x040000, 0x10000, 0xf4321eea )
11562 	ROM_LOAD_ODD ( "epr12292.116", 0x040000, 0x10000, 0x51d98af0 )
11563 
11564 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11565 	ROM_LOAD( "opr12323.102", 0x00000, 0x10000, 0x4de43a6f )
11566 	ROM_LOAD( "opr12324.103", 0x10000, 0x10000, 0x24607a55 )
11567 	ROM_LOAD( "opr12325.104", 0x20000, 0x10000, 0x1405137a )
11568 
11569 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
11570 	ROM_LOAD( "opr12307.9",  0x00000, 0x10000, 0x437dcf09 )
11571 	ROM_LOAD( "opr12308.10", 0x10000, 0x10000, 0x0de70cc2 )
11572 	ROM_LOAD( "opr12309.11", 0x20000, 0x10000, 0xdeb8c242 )
11573 	ROM_LOAD( "opr12310.12", 0x30000, 0x10000, 0x45cf157e )
11574 
11575 	ROM_LOAD( "opr12311.13", 0x40000, 0x10000, 0xae2bd639 )
11576 	ROM_LOAD( "opr12312.14", 0x50000, 0x10000, 0x626000e7 )
11577 	ROM_LOAD( "opr12313.15", 0x60000, 0x10000, 0x52870c37 )
11578 	ROM_LOAD( "opr12314.16", 0x70000, 0x10000, 0x40c461ea )
11579 
11580 	ROM_LOAD( "opr12315.17", 0x80000, 0x10000, 0x3ff9a3a3 )
11581 	ROM_LOAD( "opr12316.18", 0x90000, 0x10000, 0x8a1e6dc8 )
11582 	ROM_LOAD( "opr12317.19", 0xa0000, 0x10000, 0x77e382d4 )
11583 	ROM_LOAD( "opr12318.20", 0xb0000, 0x10000, 0xd1afdea9 )
11584 
11585 	ROM_LOAD( "opr12320.22", 0xc0000, 0x10000, 0x7931e446 )
11586 	ROM_LOAD( "opr12321.23", 0xd0000, 0x10000, 0x830bacd4 )
11587 	ROM_LOAD( "opr12322.24", 0xe0000, 0x10000, 0x8b812492 )
11588 	ROM_LOAD( "opr12319.25", 0xf0000, 0x10000, 0xdf23baf9 )
11589 
11590 	ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
11591 	ROM_LOAD( "epr12300.88",	0x00000, 0x10000, 0xe8ff7011 )
11592 	ROM_LOAD( "opr12301.66",    0x10000, 0x10000, 0x6e78ad15 )
11593 	ROM_LOAD( "opr12302.67",    0x20000, 0x10000, 0xe72928af )
11594 	ROM_LOAD( "opr12303.68",    0x30000, 0x10000, 0x8384205c )
11595 	ROM_LOAD( "opr12304.69",    0x40000, 0x10000, 0xe1762ac3 )
11596 	ROM_LOAD( "opr12305.70",    0x50000, 0x10000, 0xba9ce677 )
11597 	ROM_LOAD( "opr12306.71",    0x60000, 0x10000, 0xe49249fd )
11598 
11599 	ROM_REGION( 0x100000, REGION_CPU3 ) /* 68000 code */
11600 	ROM_LOAD_EVEN( "opr12295.76", 0x000000, 0x10000, 0xd43a3a84 )
11601 	ROM_LOAD_ODD ( "opr12294.58", 0x000000, 0x10000, 0x27cdcfd3 )
11602 	ROM_LOAD_EVEN( "opr12297.75", 0x020000, 0x10000, 0x1d9b5677 )
11603 	ROM_LOAD_ODD ( "opr12296.57", 0x020000, 0x10000, 0x0a513671 )
11604 
11605 	ROM_REGION( 0x40000, REGION_GFX3 ) /* road */
11606 	ROM_LOAD_ODD ( "epr12298.11", 0x000000, 0x08000, 0xfc9bc41b )
11607 ROM_END
11608 
11609 
11610 ROM_START( toutruna )
11611 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11612 // custom cpu 317-0106
11613 	ROM_LOAD_EVEN( "epr12410.133", 0x000000, 0x10000, 0xaa74f3e9 )
11614 	ROM_LOAD_ODD ( "epr12409.118", 0x000000, 0x10000, 0xc11c8ef7 )
11615 	ROM_LOAD_EVEN( "epr12412.132", 0x020000, 0x10000, 0xb0534647 )
11616 	ROM_LOAD_ODD ( "epr12411.117", 0x020000, 0x10000, 0x12bb0d83 )
11617 	ROM_LOAD_EVEN( "epr12293.131", 0x040000, 0x10000, 0xf4321eea )
11618 	ROM_LOAD_ODD ( "epr12292.116", 0x040000, 0x10000, 0x51d98af0 )
11619 
11620 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11621 	ROM_LOAD( "opr12323.102", 0x00000, 0x10000, 0x4de43a6f )
11622 	ROM_LOAD( "opr12324.103", 0x10000, 0x10000, 0x24607a55 )
11623 	ROM_LOAD( "opr12325.104", 0x20000, 0x10000, 0x1405137a )
11624 
11625 	ROM_REGION( 0x100000*2, REGION_GFX2 ) /* sprites */
11626 	ROM_LOAD( "opr12307.9",  0x00000, 0x10000, 0x437dcf09 )
11627 	ROM_LOAD( "opr12308.10", 0x10000, 0x10000, 0x0de70cc2 )
11628 	ROM_LOAD( "opr12309.11", 0x20000, 0x10000, 0xdeb8c242 )
11629 	ROM_LOAD( "opr12310.12", 0x30000, 0x10000, 0x45cf157e )
11630 
11631 	ROM_LOAD( "opr12311.13", 0x40000, 0x10000, 0xae2bd639 )
11632 	ROM_LOAD( "opr12312.14", 0x50000, 0x10000, 0x626000e7 )
11633 	ROM_LOAD( "opr12313.15", 0x60000, 0x10000, 0x52870c37 )
11634 	ROM_LOAD( "opr12314.16", 0x70000, 0x10000, 0x40c461ea )
11635 
11636 	ROM_LOAD( "opr12315.17", 0x80000, 0x10000, 0x3ff9a3a3 )
11637 	ROM_LOAD( "opr12316.18", 0x90000, 0x10000, 0x8a1e6dc8 )
11638 	ROM_LOAD( "opr12317.19", 0xa0000, 0x10000, 0x77e382d4 )
11639 	ROM_LOAD( "opr12318.20", 0xb0000, 0x10000, 0xd1afdea9 )
11640 
11641 	ROM_LOAD( "opr12320.22", 0xc0000, 0x10000, 0x7931e446 )
11642 	ROM_LOAD( "opr12321.23", 0xd0000, 0x10000, 0x830bacd4 )
11643 	ROM_LOAD( "opr12322.24", 0xe0000, 0x10000, 0x8b812492 )
11644 	ROM_LOAD( "opr12319.25", 0xf0000, 0x10000, 0xdf23baf9 )
11645 
11646 	ROM_REGION( 0x70000, REGION_CPU2 ) /* sound CPU */
11647 	ROM_LOAD( "epr12300.88",	0x00000, 0x10000, 0xe8ff7011 )
11648 	ROM_LOAD( "opr12301.66",    0x10000, 0x10000, 0x6e78ad15 )
11649 	ROM_LOAD( "opr12302.67",    0x20000, 0x10000, 0xe72928af )
11650 	ROM_LOAD( "opr12303.68",    0x30000, 0x10000, 0x8384205c )
11651 	ROM_LOAD( "opr12304.69",    0x40000, 0x10000, 0xe1762ac3 )
11652 	ROM_LOAD( "opr12305.70",    0x50000, 0x10000, 0xba9ce677 )
11653 	ROM_LOAD( "opr12306.71",    0x60000, 0x10000, 0xe49249fd )
11654 
11655 	ROM_REGION( 0x100000, REGION_CPU3 ) /* 68000 code */
11656 	ROM_LOAD_EVEN( "opr12295.76", 0x000000, 0x10000, 0xd43a3a84 )
11657 	ROM_LOAD_ODD ( "opr12294.58", 0x000000, 0x10000, 0x27cdcfd3 )
11658 	ROM_LOAD_EVEN( "opr12297.75", 0x020000, 0x10000, 0x1d9b5677 )
11659 	ROM_LOAD_ODD ( "opr12296.57", 0x020000, 0x10000, 0x0a513671 )
11660 
11661 	ROM_REGION( 0x40000, REGION_GFX3 ) /* road */
11662 	ROM_LOAD_ODD ( "epr12298.11", 0x000000, 0x08000, 0xfc9bc41b )
11663 ROM_END
11664 
11665 
11666 /*****************************************************************************/
11667 // Excite League
11668 
11669 ROM_START( exctleag )
11670 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11671 	ROM_LOAD_EVEN( "epr11937.a02",0x00000,0x10000, 0x4ebda367 )
11672 	ROM_LOAD_ODD ( "epr11936.a01",0x00000,0x10000, 0x0863de60 )
11673 	ROM_LOAD_EVEN( "epr11939.a04",0x20000,0x10000, 0x117dd98f )
11674 	ROM_LOAD_ODD ( "epr11938.a03",0x20000,0x10000, 0x07c08d47 )
11675 	ROM_LOAD_EVEN( "epr11941.a06",0x40000,0x10000, 0x4df2d451 )
11676 	ROM_LOAD_ODD ( "epr11940.a05",0x40000,0x10000, 0xdec83274 )
11677 
11678 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11679 	ROM_LOAD( "epr11942.b09",0x00000,0x10000, 0xeb70e827 )
11680 	ROM_LOAD( "epr11943.b10",0x10000,0x10000, 0xd97c8982 )
11681 	ROM_LOAD( "epr11944.b11",0x20000,0x10000, 0xa75cae80 )
11682 
11683 	ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
11684 	ROM_LOAD( "epr11950.b01",0x00000,0x10000, 0xaf497849 )
11685 	ROM_LOAD( "epr11951.b02",0x10000,0x10000, 0xc04fa974 )
11686 	ROM_LOAD( "epr11952.b03",0x20000,0x10000, 0xe64a9761 )
11687 	ROM_LOAD( "epr11953.b04",0x30000,0x10000, 0x4cae3999 )
11688 	ROM_LOAD( "epr11954.b05",0x40000,0x10000, 0x5fa2106c )
11689 	ROM_LOAD( "epr11955.b06",0x50000,0x10000, 0x86a0c368 )
11690 	ROM_LOAD( "epr11956.b07",0x60000,0x10000, 0xaff5c2fa )
11691 	ROM_LOAD( "epr11957.b08",0x70000,0x10000, 0x218f835b )
11692 
11693 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
11694 	ROM_LOAD( "epr11945.a07",0x00000,0x8000, 0xc2a83012 )
11695 	ROM_LOAD( "epr11140.a08",0x10000,0x8000, 0xb297371b )
11696 	ROM_LOAD( "epr11141.a09",0x18000,0x8000, 0x19756aa6 )
11697 	ROM_LOAD( "epr11142.a10",0x20000,0x8000, 0x25d26c66 )
11698 	ROM_LOAD( "epr11143.a11",0x28000,0x8000, 0x848b7b77 )
11699 
11700 ROM_END
11701 
11702 
11703 
11704 /*****************************************************************************/
11705 // Super League
11706 
11707 ROM_START( suprleag )
11708 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11709 	ROM_LOAD_EVEN( "epr11131.a02",0x00000,0x10000, 0x9b78c2cc )
11710 	ROM_LOAD_ODD ( "epr11130.a01",0x00000,0x10000, 0xe2451676 )
11711 	ROM_LOAD_EVEN( "epr11133.a04",0x20000,0x10000, 0xeed72f37 )
11712 	ROM_LOAD_ODD ( "epr11132.a03",0x20000,0x10000, 0xff199325 )
11713 	ROM_LOAD_EVEN( "epr11135.a06",0x40000,0x10000, 0x3735e0e1 )
11714 	ROM_LOAD_ODD ( "epr11134.a05",0x40000,0x10000, 0xccd857f5 )
11715 
11716 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11717 	ROM_LOAD( "epr11136.b09",0x00000,0x10000, 0xc3860ce4 )
11718 	ROM_LOAD( "epr11137.b10",0x10000,0x10000, 0x92d96187 )
11719 	ROM_LOAD( "epr11138.b11",0x20000,0x10000, 0xc01dc773 )
11720 
11721 	ROM_REGION( 0x80000*2, REGION_GFX2 ) /* sprites */
11722 	ROM_LOAD( "epr11144.b01",0x00000,0x10000, 0xb31de51c )
11723 	ROM_LOAD( "epr11145.b02",0x10000,0x10000, 0x4223d2c3 )
11724 	ROM_LOAD( "epr11146.b03",0x20000,0x10000, 0xbf0359b6 )
11725 	ROM_LOAD( "epr11147.b04",0x30000,0x10000, 0x3e592772 )
11726 	ROM_LOAD( "epr11148.b05",0x40000,0x10000, 0x126e1309 )
11727 	ROM_LOAD( "epr11149.b06",0x50000,0x10000, 0x694d3765 )
11728 	ROM_LOAD( "epr11150.b07",0x60000,0x10000, 0x9fc0aded )
11729 	ROM_LOAD( "epr11151.b08",0x70000,0x10000, 0x9de95169 )
11730 
11731 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
11732 	ROM_LOAD( "epr11139.a07",0x00000,0x08000, 0x9cbd99da )
11733 	ROM_LOAD( "epr11140.a08",0x10000,0x08000, 0xb297371b )
11734 	ROM_LOAD( "epr11141.a09",0x18000,0x08000, 0x19756aa6 )
11735 	ROM_LOAD( "epr11142.a10",0x20000,0x08000, 0x25d26c66 )
11736 	ROM_LOAD( "epr11143.a11",0x28000,0x08000, 0x848b7b77 )
11737 
11738 ROM_END
11739 
11740 /*****************************************************************************/
11741 // Action Fighter
11742 
11743 ROM_START( afighter )
11744 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11745 // cpu 317-0018
11746 	ROM_LOAD_EVEN( "10348",0x00000,0x08000, 0xe51e3012 )
11747 	ROM_LOAD_ODD ( "10349",0x00000,0x08000, 0x4b434c37 )
11748 	ROM_LOAD_EVEN( "10350",0x20000,0x08000, 0xf2cd6b3f )
11749 	ROM_LOAD_ODD ( "10351",0x20000,0x08000, 0xede21d8d )
11750 	ROM_LOAD_EVEN( "10352",0x40000,0x08000, 0xf8abb143 )
11751 	ROM_LOAD_ODD ( "10353",0x40000,0x08000, 0x5a757dc9 )
11752 
11753 	ROM_REGION( 0x30000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11754 	ROM_LOAD( "10281",0x00000,0x10000, 0x30e92cda )
11755 	ROM_LOAD( "10282",0x10000,0x10000, 0xb67b8910 )
11756 	ROM_LOAD( "10283",0x20000,0x10000, 0xe7dbfd2d )
11757 
11758 	ROM_REGION( 0x40000*2, REGION_GFX2 ) /* sprites */
11759 	ROM_LOAD( "10285",0x00000,0x08000, 0x98aa3d04 )
11760 	ROM_LOAD( "10286",0x08000,0x08000, 0x8da050cf )
11761 	ROM_LOAD( "10287",0x10000,0x08000, 0x7989b74a )
11762 	ROM_LOAD( "10288",0x18000,0x08000, 0xd3ce551a )
11763 	ROM_LOAD( "10289",0x20000,0x08000, 0xc59d1b98 )
11764 	ROM_LOAD( "10290",0x28000,0x08000, 0x39354223 )
11765 	ROM_LOAD( "10291",0x30000,0x08000, 0x6e4b245c )
11766 	ROM_LOAD( "10292",0x38000,0x08000, 0xcef289a3 )
11767 
11768 	ROM_REGION( 0x10000, REGION_CPU2 ) /* sound CPU */
11769 	ROM_LOAD( "10284",0x00000,0x8000, 0x8ff09116 )
11770 
11771 ROM_END
11772 
11773 /*****************************************************************************/
11774 // Ryukyu
11775 
11776 ROM_START( ryukyu )
11777 	ROM_REGION( 0x100000, REGION_CPU1 ) /* 68000 code */
11778 // cpu 317-5023
11779 	ROM_LOAD_EVEN( "13347",0x00000,0x10000, 0x398031fa )
11780 	ROM_LOAD_ODD ( "13348",0x00000,0x10000, 0x5f0e0c86 )
11781 
11782 	ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE ) /* tiles */
11783 	ROM_LOAD( "13351",0x00000,0x20000, 0xa68a4e6d )
11784 	ROM_LOAD( "13352",0x20000,0x20000, 0x5e5531e4 )
11785 	ROM_LOAD( "13353",0x40000,0x20000, 0x6d23dfd8 )
11786 
11787 	ROM_REGION( 0x40000*2, REGION_GFX2 ) /* sprites */
11788 	ROM_LOAD( "13354",0x00000,0x20000, 0xf07aad99 )
11789 	ROM_LOAD( "13355",0x20000,0x20000, 0x67890019 )
11790 	ROM_LOAD( "13356",0x30000,0x20000, 0x5498290b )
11791 	ROM_LOAD( "13357",0x40000,0x20000, 0xf9e7cf03 )
11792 
11793 	ROM_REGION( 0x30000, REGION_CPU2 ) /* sound CPU */
11794 	ROM_LOAD( "13349",0x00000,0x08000, 0xb83183f8 )
11795 	ROM_LOAD( "13350",0x10000,0x20000, 0x3c59a658 )
11796 
11797 ROM_END
11798 
11799 
11800 
11801 /***************************************************************************/
11802 
11803 GAMEX(1986, alexkidd, 0,        alexkidd, alexkidd, alexkidd, ROT0,         "Sega",    "Alex Kidd (set 1)", GAME_NOT_WORKING)
11804 GAME( 1986, alexkida, alexkidd, alexkidd, alexkidd, alexkidd, ROT0,         "Sega",    "Alex Kidd (set 2)")
11805 GAME( 1987, aliensyn, 0,        aliensyn, aliensyn, aliensyn, ROT0,         "Sega",    "Alien Syndrome (set 1)")
11806 GAMEX(1987, aliensya, aliensyn, aliensyn, aliensyn, aliensyn, ROT0,         "Sega",    "Alien Syndrome (set 2)", GAME_NOT_WORKING)
11807 GAMEX(1987, aliensyj, aliensyn, aliensyn, aliensyn, aliensyn, ROT0,         "Sega",    "Alien Syndrome (Japan)", GAME_NOT_WORKING)
11808 GAMEX(1987, aliensyb, aliensyn, aliensyn, aliensyn, aliensyn, ROT0,         "Sega",    "Alien Syndrome (set 3)", GAME_NOT_WORKING)
11809 GAME( 1988, altbeast, 0,        altbeast, altbeast, altbeast, ROT0,         "Sega",    "Altered Beast (Version 1)")
11810 GAMEX(1988, jyuohki,  altbeast, altbeast, altbeast, altbeast, ROT0,         "Sega",    "Jyuohki (Japan)",           GAME_NOT_WORKING)
11811 GAMEX(1988, altbeas2, altbeast, altbeas2, altbeast, altbeast, ROT0,         "Sega",    "Altered Beast (Version 2)", GAME_NO_SOUND)
11812 GAMEX(1990, astorm,   0,        astorm,   astorm,   astorm,   ROT0_16BIT,   "Sega",    "Alien Storm", GAME_NOT_WORKING)
11813 GAMEX(1990, astorm2p, astorm,   astorm,   astorm,   astorm,   ROT0_16BIT,   "Sega",    "Alien Storm (2 Player)", GAME_NOT_WORKING)
11814 GAME( 1990, astormbl, astorm,   astorm,   astorm,   astorm,   ROT0_16BIT,   "bootleg", "Alien Storm (bootleg)")
11815 GAMEX(1990, atomicp,  0,        atomicp,  atomicp,  atomicp,  ROT0,         "Philko",  "Atomic Point", GAME_NO_SOUND)
11816 GAME( 1990, aurail,   0,        aurail,   aurail,   aurail,   ROT0,         "Sega / Westone", "Aurail (set 1)")
11817 GAME( 1990, auraila,  aurail,   aurail,   aurail,   auraila,  ROT0,         "Sega / Westone", "Aurail (set 2)")
11818 GAME( 1989, bayroute, 0,        bayroute, bayroute, bayroute, ROT0,         "Sunsoft / Sega", "Bay Route (set 1)")
11819 GAMEX(1989, bayrouta, bayroute, bayroute, bayroute, bayrouta, ROT0,         "Sunsoft / Sega", "Bay Route (set 2)", GAME_NOT_WORKING)
11820 GAMEX(1989, bayrtbl1, bayroute, bayroute, bayroute, bayrtbl1, ROT0,         "bootleg", "Bay Route (bootleg set 1)", GAME_NOT_WORKING)
11821 GAMEX(1989, bayrtbl2, bayroute, bayroute, bayroute, bayrtbl1, ROT0,         "bootleg", "Bay Route (bootleg set 2)", GAME_NOT_WORKING)
11822 GAME( 1986, bodyslam, 0,        bodyslam, bodyslam, bodyslam, ROT0,         "Sega",    "Body Slam")
11823 GAME( 1986, dumpmtmt, bodyslam, bodyslam, bodyslam, bodyslam, ROT0,         "Sega",    "Dump Matsumoto (Japan)")
11824 GAME( 1989, dduxbl,   0,        dduxbl,   dduxbl,   dduxbl,   ROT0,         "bootleg", "Dynamite Dux (bootleg)")
11825 GAMEX(1989, eswat,    0,        eswat,    eswat,    eswat,    ROT0,         "Sega",    "E-Swat", GAME_NOT_WORKING)
11826 GAME( 1989, eswatbl,  eswat,    eswat,    eswat,    eswat,    ROT0,         "bootleg", "E-Swat (bootleg)")
11827 GAME( 1986, fantzone, 0,        fantzone, fantzone, fantzone, ROT0,         "Sega",    "Fantasy Zone (Japan New Ver.)")
11828 GAME( 1986, fantzono, fantzone, fantzono, fantzone, fantzone, ROT0,         "Sega",    "Fantasy Zone (Old Ver.)")
11829 GAMEX(1989, fpoint,   0,        fpoint,   fpoint,   fpoint,   ROT0,         "Sega",    "Flash Point", GAME_NOT_WORKING)
11830 GAME( 1989, fpointbl, fpoint,   fpoint,   fpoint,   fpointbl, ROT0,         "bootleg", "Flash Point (bootleg)")
11831 GAME( 1989, goldnaxe, 0,        goldnaxe, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 1)")
11832 GAMEX(1989, goldnaxj, goldnaxe, goldnaxe, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 1, Japan)", GAME_NOT_WORKING)
11833 GAMEX(1989, goldnabl, goldnaxe, goldnaxe, goldnaxe, goldnabl, ROT0,         "bootleg", "Golden Axe (bootleg)", GAME_NOT_WORKING)
11834 GAME( 1989, goldnaxa, goldnaxe, goldnaxa, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 2)")
11835 GAMEX(1989, goldnaxb, goldnaxe, goldnaxa, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 2 317-0110)", GAME_NOT_WORKING)
11836 GAMEX(1989, goldnaxc, goldnaxe, goldnaxa, goldnaxe, goldnaxe, ROT0,         "Sega",    "Golden Axe (Version 2 317-0122)", GAME_NOT_WORKING)
11837 GAME( 1987, hwchamp,  0,        hwchamp,  hwchamp,  hwchamp,  ROT0,         "Sega",    "Heavyweight Champ")
11838 GAME( 1985, mjleague, 0,        mjleague, mjleague, mjleague, ROT270,       "Sega",    "Major League")
11839 GAMEX(1990, moonwalk, 0,        moonwalk, moonwalk, moonwalk, ROT0,         "Sega",    "Moon Walker (Set 1)", GAME_NOT_WORKING)
11840 GAMEX(1990, moonwlka, moonwalk, moonwalk, moonwalk, moonwalk, ROT0,         "Sega",    "Moon Walker (Set 2)", GAME_NOT_WORKING)
11841 GAME( 1990, moonwlkb, moonwalk, moonwalk, moonwalk, moonwalk, ROT0,         "bootleg", "Moon Walker (bootleg)")
11842 GAMEX(????, passsht,  0,        passsht,  passsht,  passsht,  ROT270,       "Sega",    "Passing Shot (2 Players)", GAME_NOT_WORKING)
11843 GAME( ????, passshtb, passsht,  passsht,  passsht,  passsht,  ROT270,       "bootleg", "Passing Shot (2 Players) (bootleg)")
11844 GAMEX(????, passht4b, passsht,  passht4b, passht4b, passht4b, ROT270,       "bootleg", "Passing Shot (4 Players) (bootleg)", GAME_NO_SOUND)
11845 GAME( 1986, quartet,  0,        quartet,  quartet,  quartet,  ROT0,         "Sega",    "Quartet")
11846 GAME( 1986, quartetj, quartet,  quartet,  quartet,  quartet,  ROT0,         "Sega",    "Quartet (Japan)")
11847 GAME( 1986, quartet2, quartet,  quartet2, quartet2, quartet2, ROT0,         "Sega",    "Quartet II")
11848 GAME( 1991, riotcity, 0,        riotcity, riotcity, riotcity, ROT0,         "Sega / Westone", "Riot City")
11849 GAME( 1987, sdi,      0,        sdi,      sdi,      sdi,      ROT0,         "Sega",    "SDI - Strategic Defense Initiative")
11850 GAMEX(1987, sdioj,    sdi,      sdi,      sdi,      sdi,      ROT0,         "Sega",    "SDI - Strategic Defense Initiative (Japan)", GAME_NOT_WORKING)
11851 GAME( 1989, shdancer, 0,        shdancer, shdancer, shdancer, ROT0,         "Sega",    "Shadow Dancer (US)")
11852 GAMEX(1989, shdancbl, shdancer, shdancbl, shdancer, shdancbl, ROT0,         "bootleg", "Shadow Dancer (bootleg)", GAME_NOT_WORKING)
11853 GAME( 1989, shdancrj, shdancer, shdancrj, shdancer, shdancrj, ROT0,         "Sega",    "Shadow Dancer (Japan)")
11854 GAME( 1987, shinobi,  0,        shinobi,  shinobi,  shinobi,  ROT0,         "Sega",    "Shinobi (set 1)")
11855 GAMEX(1987, shinobib, shinobi,  shinobi,  shinobi,  shinobi,  ROT0,         "Sega",    "Shinobi (set 3)", GAME_NOT_WORKING)
11856 GAMEX(1987, shinobia, shinobi,  shinobl,  shinobi,  shinobi,  ROT0,         "Sega",    "Shinobi (set 2)", GAME_NOT_WORKING)
11857 GAME( 1987, shinobl,  shinobi,  shinobl,  shinobi,  shinobi,  ROT0,         "bootleg", "Shinobi (bootleg)")
11858 GAMEX(1988, tetris,   0,        tetris,   tetris,   tetris,   ROT0,         "Sega",    "Tetris (Sega Set 1)", GAME_NOT_WORKING)
11859 GAME( 1988, tetrisbl, tetris,   tetris,   tetris,   tetrisbl, ROT0,         "bootleg", "Tetris (Sega bootleg)")
11860 GAMEX(1988, tetrisa,  tetris,   tetris,   tetris,   tetrisbl, ROT0,         "Sega",    "Tetris (Sega Set 2)", GAME_NOT_WORKING)
11861 GAME( 1987, timscanr, 0,        timscanr, timscanr, timscanr, ROT270,       "Sega",    "Time Scanner")
11862 GAME (1994, toryumon, 0,        toryumon, toryumon, toryumon, ROT0,         "Sega",    "Toryumon")
11863 GAMEX(1989, tturf,    0,        tturf,    tturf,    tturf,    ROT0_16BIT,   "Sega / Sunsoft", "Tough Turf (Japan)", GAME_NO_SOUND)
11864 GAMEX(1989, tturfu,   tturf,    tturfu,   tturf,    tturf,    ROT0_16BIT,   "Sega / Sunsoft", "Tough Turf (US)", GAME_NO_SOUND)
11865 GAMEX(1989, tturfbl,  tturf,    tturfbl,  tturf,    tturfbl,  ROT0_16BIT,   "bootleg", "Tough Turf (bootleg)", GAME_IMPERFECT_SOUND)
11866 GAME( 1988, wb3,      0,        wb3,      wb3,      wb3,      ROT0,         "Sega / Westone", "Wonder Boy III - Monster Lair (set 1)")
11867 GAMEX(1988, wb3a,     wb3,      wb3,      wb3,      wb3,      ROT0,         "Sega / Westone", "Wonder Boy III - Monster Lair (set 2)", GAME_NOT_WORKING)
11868 GAME( 1988, wb3bl,    wb3,      wb3bl,    wb3,      wb3bl,    ROT0,         "bootleg", "Wonder Boy III - Monster Lair (bootleg)")
11869 GAME( 1989, wrestwar, 0,        wrestwar, wrestwar, wrestwar, ROT270_16BIT, "Sega",    "Wrestle War")
11870 
11871 GAME( 1985, hangon,   0,        hangon,   hangon,   hangon,   ROT0,         "Sega",    "Hang-On")
11872 GAME( 1985, sharrier, 0,        sharrier, sharrier, sharrier, ROT0_16BIT,   "Sega",    "Space Harrier")
11873 GAMEX(1992, shangon,  0,        shangon,  shangon,  shangon,  ROT0,         "Sega",    "Super Hang-On", GAME_NOT_WORKING)
11874 GAME( 1992, shangonb, shangon,  shangon,  shangon,  shangonb, ROT0,         "bootleg", "Super Hang-On (bootleg)")
11875 GAME( 1986, outrun,   0,        outrun,   outrun,   outrun,   ROT0,         "Sega",    "Out Run (set 1)")
11876 GAME( 1986, outruna,  outrun,   outruna,  outrun,   outrun,   ROT0,         "Sega",    "Out Run (set 2)")
11877 GAME( 1986, outrunb,  outrun,   outruna,  outrun,   outrunb,  ROT0,         "Sega",    "Out Run (set 3)")
11878 GAMEX(1985, enduror,  0,        enduror,  enduror,  enduror,  ROT0,         "Sega",    "Enduro Racer", GAME_NOT_WORKING)
11879 GAME( 1985, endurobl, enduror,  enduror,  enduror,  endurobl, ROT0,         "bootleg", "Enduro Racer (bootleg set 1)")
11880 GAME( 1985, endurob2, enduror,  endurob2, enduror,  endurob2, ROT0,         "bootleg", "Enduro Racer (bootleg set 2)")
11881 
11882 
11883 
11884 GAMEX(????, aceattac, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Ace Attacker", GAME_NOT_WORKING)
11885 GAMEX(????, aburner,  0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "After Burner (Japan)", GAME_NOT_WORKING)
11886 GAMEX(????, aburner2, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "After Burner II", GAME_NOT_WORKING)
11887 GAMEX(????, bloxeed,  0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Bloxeed", GAME_NOT_WORKING)
11888 GAMEX(????, cltchitr, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Clutch Hitter", GAME_NOT_WORKING)
11889 GAMEX(????, cotton,   0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Cotton (Japan)", GAME_NOT_WORKING)
11890 GAMEX(????, cottona,  cotton,   s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Cotton", GAME_NOT_WORKING)
11891 GAMEX(????, ddcrew,   0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "DD Crew", GAME_NOT_WORKING)
11892 GAMEX(????, dunkshot, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Dunk Shot", GAME_NOT_WORKING)
11893 GAMEX(????, lghost,   0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Laser Ghost", GAME_NOT_WORKING)
11894 GAMEX(????, loffire,  0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Line of Fire", GAME_NOT_WORKING)
11895 GAMEX(????, mvp,      0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "MVP", GAME_NOT_WORKING)
11896 GAMEX(????, thndrbld, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Thunder Blade", GAME_NOT_WORKING)
11897 GAMEX(????, thndrbdj, thndrbld, s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Thunder Blade (Japan)", GAME_NOT_WORKING)
11898 GAMEX(????, toutrun,  0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Turbo Outrun (set 1)", GAME_NOT_WORKING)
11899 GAMEX(????, toutruna, toutrun,  s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Turbo Outrun (set 2)", GAME_NOT_WORKING)
11900 GAMEX(????, exctleag, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Excite League", GAME_NOT_WORKING)
11901 GAMEX(????, suprleag, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Super League", GAME_NOT_WORKING)
11902 GAMEX(????, afighter, 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Action Fighter", GAME_NOT_WORKING)
11903 GAMEX(????, ryukyu  , 0,        s16dummy, s16dummy, s16dummy, ROT0,         "Sega", "Ryukyu", GAME_NOT_WORKING)
11904 
11905 
11906