1 /***************************************************************************
2 
3 Ninja Gaiden memory map (preliminary)
4 
5 000000-03ffff ROM
6 060000-063fff RAM
7 070000-070fff Video RAM (text layer)
8 072000-075fff VRAM (backgrounds)
9 076000-077fff Sprite RAM
10 078000-079fff Palette RAM
11 
12 07a100-07a1ff Unknown
13 
14 memory mapped ports:
15 
16 read:
17 07a001    IN0
18 07a002    IN2
19 07a003    IN1
20 07a004    DWSB
21 07a005    DSWA
22 see the input_ports definition below for details on the input bits
23 
24 write:
25 07a104-07a105 text  layer Y scroll
26 07a10c-07a10d text  layer X scroll
27 07a204-07a205 front layer Y scroll
28 07a20c-07a20d front layer X scroll
29 07a304-07a305 back  layer Y scroll
30 07a30c-07a30d back  layer X scroll
31 
32 Notes:
33 - The sprite Y size control is slightly different from gaiden/wildfang to
34   raiga. In the first two, size X and Y change together, while in the latter
35   they are changed independently. This is handled with a variable set in
36   DRIVER_INIT, but it might also be a selectable hardware feature, since
37   the two extra bits used by raiga are perfectly merged with the rest.
38   Raiga also uses more sprites than the others, but there's no way to tell
39   if hardware is more powerful or the extra sprites were just not needed
40   in the earlier games.
41 
42 - The hardware supports blending sprites and background.
43   There are 3 copies of the palette;
44   - one for pixels that aren't blended
45   - one for pixels that are behind the object that will be blended
46   - one for the object that will be blended
47   Blending is performed by switching to the appropriate palettes for the
48   pixels behind the blended object and the object itself, and then adding
49   the RGB values.
50 
51 todo:
52 
53 - make sure all of the protection accesses in raiga are handled correctly.
54 - work out how lower priority sprites are affected by blended sprites.
55 
56 ***************************************************************************/
57 /***************************************************************************
58 
59 Strato Fighter (US version)
60 Tecmo, 1991
61 
62 
63 PCB Layout
64 ----------
65 
66 Top Board
67 ---------
68 0210-A
69 MG-Y.VO
70 -----------------------------------------------
71 |         MN50005XTA         4MHz  DSW2 DSW1  |
72 |                    6264 6264       8049     |
73 |           IOP8     1.3S 2.4S                |
74 |24MHz                                        |
75 |                                             |
76 |18.432MHz                                   J|
77 |                                             |
78 |              68000P10                      A|
79 |                                             |
80 |          6116                              M|
81 |          6116                               |
82 |          6116                              M|
83 |                                             |
84 |                                            A|
85 |                                             |
86 |              6264    YM2203  YM3014         |
87 |       Z80    3.4B                           |
88 | 4MHz  6295   4.4A    YM2203  YM3014         |
89 -----------------------------------------------
90 
91 Bottom Board
92 ------------
93 0210-B
94 MG-Y.VO
95 -----------------------------------------------
96 |                TECMO-5                      |
97 |               -----------                   |
98 |               | TECMO-06|                   |
99 | ROM.M1 ROM.M3 | YM6048  |     6264          |
100 |               -----------     6264          |
101 |   4164  4164  4164  4164                    |
102 |   4164  4164  4164  4164                    |
103 |   4164  4164  4164  4164                    |
104 |                                             |
105 |                                             |
106 |        TECMO-3      TECMO-3      TECMO-3    |
107 | TECMO-4      TECMO-4      TECMO-4           |
108 |                                             |
109 |                                             |
110 |                                             |
111 |  6264  6264   6116   6116   6264            |
112 | ROM.1B        ROM.4B        6116            |
113 |                             ROM.7A          |
114 -----------------------------------------------
115 
116 Notes:
117 	68k clock:		9.216 MHz (18.432 / 2)
118 	Z80 clock:		4.000 MHz
119 	YM2203 clock:		4.000 MHz
120 	MSM6295 clock:	1.000 MHz (samplerate 7575Hz, i.e. / 132)
121 
122 	IOP8 manufactured by Ricoh. Full part number: RICOH EPLIOP8BP (PAL or PIC?)
123 
124 ***************************************************************************/
125 
126 
127 #include "driver.h"
128 #include "vidhrdw/generic.h"
129 #include "cpu/m68000/m68000.h"
130 #include "cpu/z80/z80.h"
131 
132 extern data16_t *gaiden_videoram,*gaiden_videoram2,*gaiden_videoram3;
133 extern int gaiden_sprite_sizey;
134 
135 extern int raiga_alpha;
136 
137 VIDEO_START( gaiden );
138 VIDEO_START( raiga );
139 
140 VIDEO_UPDATE( gaiden );
141 VIDEO_UPDATE( raiga );
142 
143 WRITE16_HANDLER( gaiden_videoram_w );
144 WRITE16_HANDLER( gaiden_videoram2_w );
145 READ16_HANDLER( gaiden_videoram2_r );
146 WRITE16_HANDLER( gaiden_videoram3_w );
147 READ16_HANDLER( gaiden_videoram3_r );
148 
149 WRITE16_HANDLER( gaiden_txscrollx_w );
150 WRITE16_HANDLER( gaiden_txscrolly_w );
151 WRITE16_HANDLER( gaiden_fgscrollx_w );
152 WRITE16_HANDLER( gaiden_fgscrolly_w );
153 WRITE16_HANDLER( gaiden_bgscrollx_w );
154 WRITE16_HANDLER( gaiden_bgscrolly_w );
155 WRITE16_HANDLER( gaiden_flip_w );
156 
157 
158 
WRITE16_HANDLER(gaiden_sound_command_w)159 static WRITE16_HANDLER( gaiden_sound_command_w )
160 {
161 	if (ACCESSING_LSB) soundlatch_w(0,data & 0xff);	/* Ninja Gaiden */
162 	if (ACCESSING_MSB) soundlatch_w(0,data >> 8);	/* Tecmo Knight */
163 	cpu_set_irq_line(1,IRQ_LINE_NMI,PULSE_LINE);
164 }
165 
166 
167 
168 /* Wild Fang / Tecmo Knight has a simple protection. It writes codes to 0x07a804, */
169 /* and reads the answer from 0x07a007. The returned values contain the address of */
170 /* a function to jump to. */
171 
172 static int prot;
173 
WRITE16_HANDLER(wildfang_protection_w)174 static WRITE16_HANDLER( wildfang_protection_w )
175 {
176 	if (ACCESSING_MSB)
177 	{
178 		static int jumpcode;
179 		static int jumppoints[] =
180 		{
181 			0x0c0c,0x0cac,0x0d42,0x0da2,0x0eea,0x112e,0x1300,0x13fa,
182 			0x159a,0x1630,0x109a,0x1700,0x1750,0x1806,0x18d6,0x1a44,
183 			0x1b52
184 		};
185 
186 		data >>= 8;
187 
188 /*		log_cb(RETRO_LOG_DEBUG, LOGPRE "PC %06x: prot = %02x\n",activecpu_get_pc(),data);*/
189 
190 		switch (data & 0xf0)
191 		{
192 			case 0x00:	/* init */
193 				prot = 0x00;
194 				break;
195 			case 0x10:	/* high 4 bits of jump code */
196 				jumpcode = (data & 0x0f) << 4;
197 				prot = 0x10;
198 				break;
199 			case 0x20:	/* low 4 bits of jump code */
200 				jumpcode |= data & 0x0f;
201 				if (jumpcode >= sizeof(jumppoints)/sizeof(jumppoints[0]))
202 				{
203 					log_cb(RETRO_LOG_DEBUG, LOGPRE "unknown jumpcode %02x\n",jumpcode);
204 					jumpcode = 0;
205 				}
206 				prot = 0x20;
207 				break;
208 			case 0x30:	/* ask for bits 12-15 of function address */
209 				prot = 0x40 | ((jumppoints[jumpcode] >> 12) & 0x0f);
210 				break;
211 			case 0x40:	/* ask for bits 8-11 of function address */
212 				prot = 0x50 | ((jumppoints[jumpcode] >> 8) & 0x0f);
213 				break;
214 			case 0x50:	/* ask for bits 4-7 of function address */
215 				prot = 0x60 | ((jumppoints[jumpcode] >> 4) & 0x0f);
216 				break;
217 			case 0x60:	/* ask for bits 0-3 of function address */
218 				prot = 0x70 | ((jumppoints[jumpcode] >> 0) & 0x0f);
219 				break;
220 		}
221 	}
222 }
223 
READ16_HANDLER(wildfang_protection_r)224 static READ16_HANDLER( wildfang_protection_r )
225 {
226 /*	log_cb(RETRO_LOG_DEBUG, LOGPRE "PC %06x: read prot %02x\n",activecpu_get_pc(),prot);*/
227 	return prot;
228 }
229 
230 
231 
232 /*
233 
234 Raiga Protection
235 MCU read routine is at D9CE
236 
237 startup codes
238 
239 it reads 00/36/0e/11/33/34/2d, fetching some code copied to RAM,
240 and a value which is used as an offset to point to the code in RAM.
241 19/12/31/28 are read repeatedly, from the interrupt, and the returned
242 value chanes, some kind of mode set command?
243 
244 level codes
245 
246 00 | score screen after level 1 (5457)
247 01 | score screen after level 2 (494e)
248 02 | score screen after level 3 (5f4b)
249 03 | score screen after level 4 (4149)
250 04 | score screen after level 5 (5345)
251 05 | score screen after level 6 + first loop end sequence (525f)
252 06 | score screen after second loop level 1 (4d49)
253 07 | score screen after second loop level 2 (5941)
254 08 | score screen after second loop level 3 (5241)
255 09 | score screen after second loop level 4 (5349)
256 0a | score screen after second loop level 5 (4d4f)
257 0b | score screen after second loop level 6 + final end sequence (4a49)
258 
259 
260 other game codes
261 
262 13 | Game over (594f)
263 15 | at the start of second level attract mode (4e75)
264 1c | start of level 4 attract mode (4e75)
265 1e | after continue .. (5349)
266 23 | after entering hi-score (4e75)
267 25 | after attract level 1 (4849)
268 2b | after japan / wdud screen, to get back to 'tecmo presents' (524f)
269 
270 also bonus life + when the boss appears but I think they use the
271 same commands as some of the above
272 
273 */
274 
275 /* these are used during startup */
276 static int jumppoints_00[0x100] =
277 {
278 	0x6669,	   -1,    -1,    -1,    -1,    -1,    -1,    -1,
279 	    -1,    -1,    -1,    -1,    -1,    -1,0x4a46,    -1,
280 	    -1,0x6704,    -2,    -1,    -1,    -1,    -1,    -1,
281 	    -1,    -2,    -1,    -1,    -1,    -1,    -1,    -1,
282 	    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
283 	    -2,    -1,    -1,    -1,    -1,0x4e75,    -1,    -1,
284 	    -1,    -2,    -1,0x4e71,0x60fc,    -1,0x7288,    -1,
285 	    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1
286 };
287 
288 /* these are used the rest of the time */
289 static int jumppoints_other[0x100] =
290 {
291 	0x5457,0x494e,0x5f4b,0x4149,0x5345,0x525f,0x4d49,0x5941,
292 	0x5241,0x5349,0x4d4f,0x4a49,    -1,    -1,    -1,    -1,
293 	    -1,    -1,    -2,0x594f,    -1,0x4e75,    -1,    -1,
294 	    -1,    -2,    -1,    -1,0x4e75,    -1,0x5349,    -1,
295 	    -1,    -1,    -1,0x4e75,    -1,0x4849,    -1,    -1,
296 	    -2,    -1,    -1,0x524f,    -1,    -1,    -1,    -1,
297 	    -1,    -2,    -1,    -1,    -1,    -1,    -1,    -1,
298 	    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1
299 };
300 
301 static int *raiga_jumppoints = jumppoints_00;
302 
MACHINE_INIT(raiga)303 static MACHINE_INIT ( raiga )
304 {
305 	raiga_jumppoints = jumppoints_00;
306 }
307 
WRITE16_HANDLER(raiga_protection_w)308 static WRITE16_HANDLER( raiga_protection_w )
309 {
310 	if (ACCESSING_MSB)
311 	{
312 		static int jumpcode;
313 
314 		data >>= 8;
315 
316 /*		log_cb(RETRO_LOG_DEBUG, LOGPRE "PC %06x: prot = %02x\n",activecpu_get_pc(),data);*/
317 
318 		switch (data & 0xf0)
319 		{
320 			case 0x00:	/* init */
321 				prot = 0x00;
322 				break;
323 			case 0x10:	/* high 4 bits of jump code */
324 				jumpcode = (data & 0x0f) << 4;
325 				prot = 0x10;
326 				break;
327 			case 0x20:	/* low 4 bits of jump code */
328 				jumpcode |= data & 0x0f;
329 				log_cb(RETRO_LOG_DEBUG, LOGPRE "requested protection jumpcode %02x\n",jumpcode);
330 /*				jumpcode = 0;*/
331 				if (raiga_jumppoints[jumpcode] == -2)
332 				{
333 					raiga_jumppoints = jumppoints_other;
334 				}
335 
336 				if (raiga_jumppoints[jumpcode] == -1)
337 				{
338 					log_cb(RETRO_LOG_DEBUG, LOGPRE "unknown jumpcode %02x\n",jumpcode);
339 					usrintf_showmessage("unknown jumpcode %02x",jumpcode);
340 					jumpcode = 0;
341 				}
342 				prot = 0x20;
343 				break;
344 			case 0x30:	/* ask for bits 12-15 of function address */
345 				prot = 0x40 | ((raiga_jumppoints[jumpcode] >> 12) & 0x0f);
346 				break;
347 			case 0x40:	/* ask for bits 8-11 of function address */
348 				prot = 0x50 | ((raiga_jumppoints[jumpcode] >> 8) & 0x0f);
349 				break;
350 			case 0x50:	/* ask for bits 4-7 of function address */
351 				prot = 0x60 | ((raiga_jumppoints[jumpcode] >> 4) & 0x0f);
352 				break;
353 			case 0x60:	/* ask for bits 0-3 of function address */
354 				prot = 0x70 | ((raiga_jumppoints[jumpcode] >> 0) & 0x0f);
355 				break;
356 		}
357 	}
358 }
359 
READ16_HANDLER(raiga_protection_r)360 static READ16_HANDLER( raiga_protection_r )
361 {
362 /*	log_cb(RETRO_LOG_DEBUG, LOGPRE "PC %06x: read prot %02x\n",activecpu_get_pc(),prot);*/
363 	return prot;
364 }
365 
MEMORY_READ16_START(readmem)366 static MEMORY_READ16_START( readmem )
367 	{ 0x000000, 0x03ffff, MRA16_ROM },
368 	{ 0x060000, 0x063fff, MRA16_RAM },
369 	{ 0x070000, 0x070fff, MRA16_RAM },
370 	{ 0x072000, 0x073fff, gaiden_videoram2_r },
371 	{ 0x074000, 0x075fff, gaiden_videoram3_r },
372 	{ 0x076000, 0x077fff, MRA16_RAM },
373 	{ 0x078000, 0x0787ff, MRA16_RAM },
374 	{ 0x078800, 0x079fff, MRA16_NOP },   /* extra portion of palette RAM, not really used */
375 	{ 0x07a000, 0x07a001, input_port_0_word_r },
376 	{ 0x07a002, 0x07a003, input_port_1_word_r },
377 	{ 0x07a004, 0x07a005, input_port_2_word_r },
378 MEMORY_END
379 
380 static MEMORY_WRITE16_START( writemem )
381 	{ 0x000000, 0x03ffff, MWA16_ROM },
382 	{ 0x060000, 0x063fff, MWA16_RAM },
383 	{ 0x070000, 0x070fff, gaiden_videoram_w, &gaiden_videoram },
384 	{ 0x072000, 0x073fff, gaiden_videoram2_w, &gaiden_videoram2 },
385 	{ 0x074000, 0x075fff, gaiden_videoram3_w, &gaiden_videoram3 },
386 	{ 0x076000, 0x077fff, MWA16_RAM, &spriteram16, &spriteram_size },
387 	{ 0x078000, 0x079fff, paletteram16_xxxxBBBBGGGGRRRR_word_w, &paletteram16 },
388 	{ 0x07a104, 0x07a105, gaiden_txscrolly_w },
389 	{ 0x07a10c, 0x07a10d, gaiden_txscrollx_w },
390 	{ 0x07a204, 0x07a205, gaiden_fgscrolly_w },
391 	{ 0x07a20c, 0x07a20d, gaiden_fgscrollx_w },
392 	{ 0x07a304, 0x07a305, gaiden_bgscrolly_w },
393 	{ 0x07a30c, 0x07a30d, gaiden_bgscrollx_w },
394 	{ 0x07a800, 0x07a801, watchdog_reset16_w },
395 	{ 0x07a802, 0x07a803, gaiden_sound_command_w },
396 	{ 0x07a806, 0x07a807, MWA16_NOP },
397 	{ 0x07a808, 0x07a809, gaiden_flip_w },
398 MEMORY_END
399 
400 static MEMORY_READ_START( sound_readmem )
401 	{ 0x0000, 0xdfff, MRA_ROM },
402 	{ 0xf000, 0xf7ff, MRA_RAM },
403 	{ 0xf800, 0xf800, OKIM6295_status_0_r },
404 	{ 0xfc00, 0xfc00, MRA_NOP },	/* ?? */
405 	{ 0xfc20, 0xfc20, soundlatch_r },
406 MEMORY_END
407 
408 static MEMORY_WRITE_START( sound_writemem )
409 	{ 0x0000, 0xdfff, MWA_ROM },
410 	{ 0xf000, 0xf7ff, MWA_RAM },
411 	{ 0xf800, 0xf800, OKIM6295_data_0_w },
412 	{ 0xf810, 0xf810, YM2203_control_port_0_w },
413 	{ 0xf811, 0xf811, YM2203_write_port_0_w },
414 	{ 0xf820, 0xf820, YM2203_control_port_1_w },
415 	{ 0xf821, 0xf821, YM2203_write_port_1_w },
416 	{ 0xfc00, 0xfc00, MWA_NOP },	/* ?? */
417 MEMORY_END
418 
419 
420 
421 INPUT_PORTS_START( shadoww )
422 	PORT_START	/* System Inputs */
423 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
424 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
425 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
426 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
427 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
428 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
429 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
430 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
431 
432 	PORT_START	/* Players Inputs */
433 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
434 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
435 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
436 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
437 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
438 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
439 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
440 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
441 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
442 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
443 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
444 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
445 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
446 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
447 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
448 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
449 
450 	/* Dip Switches order fits the first screen */
451 
452 	PORT_START	/* DSW */
453 	PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) )
454 	PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
455 	PORT_DIPSETTING(      0x0080, DEF_STR( 4C_1C ) )
456 	PORT_DIPSETTING(      0x0040, DEF_STR( 3C_1C ) )
457 	PORT_DIPSETTING(      0x0020, DEF_STR( 2C_1C ) )
458 	PORT_DIPSETTING(      0x00e0, DEF_STR( 1C_1C ) )
459 	PORT_DIPSETTING(      0x0060, DEF_STR( 1C_2C ) )
460 	PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_3C ) )
461 	PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_4C ) )
462 	PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) )
463 	PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
464 	PORT_DIPSETTING(      0x0010, DEF_STR( 4C_1C ) )
465 	PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
466 	PORT_DIPSETTING(      0x0004, DEF_STR( 2C_1C ) )
467 	PORT_DIPSETTING(      0x001c, DEF_STR( 1C_1C ) )
468 	PORT_DIPSETTING(      0x000c, DEF_STR( 1C_2C ) )
469 	PORT_DIPSETTING(      0x0014, DEF_STR( 1C_3C ) )
470 	PORT_DIPSETTING(      0x0018, DEF_STR( 1C_4C ) )
471 	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )
472 	PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
473 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
474 	PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Demo_Sounds ) )
475 	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
476 	PORT_DIPSETTING(      0x0001, DEF_STR( On ) )
477 	PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Lives ) )
478 	PORT_DIPSETTING(      0x0000, "1" )
479 	PORT_DIPSETTING(      0xc000, "2" )
480 	PORT_DIPSETTING(      0x4000, "3" )
481 	PORT_DIPSETTING(      0x8000, "4" )
482 	PORT_DIPNAME( 0x3000, 0x3000, "Energy" )
483 	PORT_DIPSETTING(      0x0000, "2" )
484 	PORT_DIPSETTING(      0x3000, "3" )
485 	PORT_DIPSETTING(      0x1000, "4" )
486 	PORT_DIPSETTING(      0x2000, "5" )
487 	PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unused ) )
488 	PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
489 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
490 	PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) )
491 	PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
492 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
493 	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unused ) )
494 	PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
495 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
496 	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unused ) )
497 	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
498 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
499 INPUT_PORTS_END
500 
501 INPUT_PORTS_START( wildfang )
502 	PORT_START	/* System Inputs */
503 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
504 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
505 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
506 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
507 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
508 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
509 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
510 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
511 
512 	PORT_START	/* Players Inputs */
513 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
514 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
515 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
516 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
517 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
518 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
519 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
520 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
521 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
522 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
523 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
524 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
525 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
526 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
527 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
528 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
529 
530 	/* Dip Switches order fits the first screen */
531 
532 	PORT_START	/* DSW */
533 	PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) )
534 	PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
535 	PORT_DIPSETTING(      0x0080, DEF_STR( 4C_1C ) )
536 	PORT_DIPSETTING(      0x0040, DEF_STR( 3C_1C ) )
537 	PORT_DIPSETTING(      0x0020, DEF_STR( 2C_1C ) )
538 	PORT_DIPSETTING(      0x00e0, DEF_STR( 1C_1C ) )
539 	PORT_DIPSETTING(      0x0060, DEF_STR( 1C_2C ) )
540 	PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_3C ) )
541 	PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_4C ) )
542 	PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) )
543 	PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
544 	PORT_DIPSETTING(      0x0010, DEF_STR( 4C_1C ) )
545 	PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
546 	PORT_DIPSETTING(      0x0004, DEF_STR( 2C_1C ) )
547 	PORT_DIPSETTING(      0x001c, DEF_STR( 1C_1C ) )
548 	PORT_DIPSETTING(      0x000c, DEF_STR( 1C_2C ) )
549 	PORT_DIPSETTING(      0x0014, DEF_STR( 1C_3C ) )
550 	PORT_DIPSETTING(      0x0018, DEF_STR( 1C_4C ) )
551 	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )
552 	PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
553 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
554 	PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Demo_Sounds ) )
555 	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
556 	PORT_DIPSETTING(      0x0001, DEF_STR( On ) )
557 	PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Lives ) )
558 	PORT_DIPSETTING(      0x8000, "1" )
559 	PORT_DIPSETTING(      0xc000, "2" )
560 	PORT_DIPSETTING(      0x4000, "3" )
561 /*	PORT_DIPSETTING(      0x0000, "2" ) */
562 	/* When bit 0 is On,  use bits 4 and 5 for difficulty */
563 	PORT_DIPNAME( 0x3000, 0x3000, "Difficulty (Tecmo Knight)" )
564 	PORT_DIPSETTING(      0x3000, "Easy" )
565 	PORT_DIPSETTING(      0x1000, "Normal" )
566 	PORT_DIPSETTING(      0x2000, "Hard" )
567 	PORT_DIPSETTING(      0x0000, "Hardest" )
568 	/* When bit 0 is 0ff, use bits 2 and 3 for difficulty */
569 	PORT_DIPNAME( 0x0c00, 0x0c00, "Difficulty (Wild Fang)" )
570 	PORT_DIPSETTING(      0x0c00, "Easy" )
571 	PORT_DIPSETTING(      0x0400, "Normal" )
572 	PORT_DIPSETTING(      0x0800, "Hard" )
573 	PORT_DIPSETTING(      0x0000, "Hardest" )
574 	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unused ) )
575 	PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
576 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
577 	PORT_DIPNAME( 0x0100, 0x0100, "Title" )	/* also affects Difficulty Table (see above)*/
578 	PORT_DIPSETTING(      0x0100, "Wild Fang" )
579 	PORT_DIPSETTING(      0x0000, "Tecmo Knight" )
580 INPUT_PORTS_END
581 
582 INPUT_PORTS_START( tknight )
583 	PORT_START	/* System Inputs */
584 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
585 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
586 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
587 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
588 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
589 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
590 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
591 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
592 
593 	PORT_START	/* Players Inputs */
594 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
595 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
596 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
597 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
598 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
599 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
600 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
601 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
602 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
603 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
604 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
605 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
606 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
607 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
608 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
609 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
610 
611 	/* Dip Switches order fits the first screen */
612 
613 	PORT_START	/* DSW */
614 	PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) )
615 	PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
616 	PORT_DIPSETTING(      0x0080, DEF_STR( 4C_1C ) )
617 	PORT_DIPSETTING(      0x0040, DEF_STR( 3C_1C ) )
618 	PORT_DIPSETTING(      0x0020, DEF_STR( 2C_1C ) )
619 	PORT_DIPSETTING(      0x00e0, DEF_STR( 1C_1C ) )
620 	PORT_DIPSETTING(      0x0060, DEF_STR( 1C_2C ) )
621 	PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_3C ) )
622 	PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_4C ) )
623 	PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) )
624 	PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
625 	PORT_DIPSETTING(      0x0010, DEF_STR( 4C_1C ) )
626 	PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
627 	PORT_DIPSETTING(      0x0004, DEF_STR( 2C_1C ) )
628 	PORT_DIPSETTING(      0x001c, DEF_STR( 1C_1C ) )
629 	PORT_DIPSETTING(      0x000c, DEF_STR( 1C_2C ) )
630 	PORT_DIPSETTING(      0x0014, DEF_STR( 1C_3C ) )
631 	PORT_DIPSETTING(      0x0018, DEF_STR( 1C_4C ) )
632 	PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) )
633 	PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
634 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
635 	PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Demo_Sounds ) )
636 	PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
637 	PORT_DIPSETTING(      0x0001, DEF_STR( On ) )
638 	PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Lives ) )
639 	PORT_DIPSETTING(      0x8000, "1" )
640 	PORT_DIPSETTING(      0xc000, "2" )
641 	PORT_DIPSETTING(      0x4000, "3" )
642 /*	PORT_DIPSETTING(      0x0000, "2" ) */
643 	PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unused ) )
644 	PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
645 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
646 	PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unused ) )
647 	PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
648 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
649 	PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) )
650 	PORT_DIPSETTING(      0x0c00, "Easy" )
651 	PORT_DIPSETTING(      0x0400, "Normal" )
652 	PORT_DIPSETTING(      0x0800, "Hard" )
653 	PORT_DIPSETTING(      0x0000, "Hardest" )
654 	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unused ) )
655 	PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
656 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
657 	PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unused ) )
658 	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
659 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
660 INPUT_PORTS_END
661 
662 INPUT_PORTS_START( raiga )
663 	PORT_START	/* System Inputs */
664 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
665 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
666 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
667 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
668 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
669 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
670 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
671 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
672 
673 	PORT_START	/* Players Inputs */
674 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
675 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
676 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
677 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
678 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
679 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
680 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
681 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
682 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
683 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
684 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
685 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
686 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
687 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
688 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
689 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
690 
691 	/* Dip Switches order fits the first screen */
692 
693 	PORT_START	/* DSW */
694 	PORT_DIPNAME( 0x00f0, 0x00f0, DEF_STR( Coin_A ) )
695 	PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
696 	PORT_DIPSETTING(      0x0040, DEF_STR( 4C_1C ) )
697 	PORT_DIPSETTING(      0x00a0, DEF_STR( 3C_1C ) )
698 	PORT_DIPSETTING(      0x0010, DEF_STR( 2C_1C ) )
699 	PORT_DIPSETTING(      0x0020, DEF_STR( 3C_2C ) )
700 	PORT_DIPSETTING(      0x0080, DEF_STR( 4C_3C ) )
701 	PORT_DIPSETTING(      0x00f0, DEF_STR( 1C_1C ) )
702 	PORT_DIPSETTING(      0x00c0, DEF_STR( 3C_4C ) )
703 	PORT_DIPSETTING(      0x00e0, DEF_STR( 2C_3C ) )
704 	PORT_DIPSETTING(      0x0070, DEF_STR( 1C_2C ) )
705 	PORT_DIPSETTING(      0x0060, DEF_STR( 2C_5C ) )
706 	PORT_DIPSETTING(      0x00b0, DEF_STR( 1C_3C ) )
707 	PORT_DIPSETTING(      0x0030, DEF_STR( 1C_4C ) )
708 	PORT_DIPSETTING(      0x00d0, DEF_STR( 1C_5C ) )
709 	PORT_DIPSETTING(      0x0050, DEF_STR( 1C_6C ) )
710 	PORT_DIPSETTING(      0x0090, DEF_STR( 1C_7C ) )
711 	PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_B ) )
712 	PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
713 	PORT_DIPSETTING(      0x0004, DEF_STR( 4C_1C ) )
714 	PORT_DIPSETTING(      0x000a, DEF_STR( 3C_1C ) )
715 	PORT_DIPSETTING(      0x0001, DEF_STR( 2C_1C ) )
716 	PORT_DIPSETTING(      0x0002, DEF_STR( 3C_2C ) )
717 	PORT_DIPSETTING(      0x0008, DEF_STR( 4C_3C ) )
718 	PORT_DIPSETTING(      0x000f, DEF_STR( 1C_1C ) )
719 	PORT_DIPSETTING(      0x000c, DEF_STR( 3C_4C ) )
720 	PORT_DIPSETTING(      0x000e, DEF_STR( 2C_3C ) )
721 	PORT_DIPSETTING(      0x0007, DEF_STR( 1C_2C ) )
722 	PORT_DIPSETTING(      0x0006, DEF_STR( 2C_5C ) )
723 	PORT_DIPSETTING(      0x000b, DEF_STR( 1C_3C ) )
724 	PORT_DIPSETTING(      0x0003, DEF_STR( 1C_4C ) )
725 	PORT_DIPSETTING(      0x000d, DEF_STR( 1C_5C ) )
726 	PORT_DIPSETTING(      0x0005, DEF_STR( 1C_6C ) )
727 	PORT_DIPSETTING(      0x0009, DEF_STR( 1C_7C ) )
728 	PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Demo_Sounds ) )
729 	PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
730 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
731 	PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unused ) )
732 	PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
733 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
734 	PORT_DIPNAME( 0x3000, 0x1000, DEF_STR( Difficulty ) )
735 	PORT_DIPSETTING(      0x3000, "Easy" )
736 	PORT_DIPSETTING(      0x1000, "Normal" )
737 	PORT_DIPSETTING(      0x2000, "Hard" )
738 	PORT_DIPSETTING(      0x0000, "Hardest" )
739 	PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Lives ) )
740 	PORT_DIPSETTING(      0x0000, "2" )
741 	PORT_DIPSETTING(      0x0c00, "3" )
742 	PORT_DIPSETTING(      0x0400, "4" )
743 	PORT_DIPSETTING(      0x0800, "5" )
744 	PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Bonus_Life ) )
745 	PORT_DIPSETTING(      0x0300, "50k 200k" )
746 	PORT_DIPSETTING(      0x0100, "100k 300k" )
747 	PORT_DIPSETTING(      0x0200, "50k only" )
748 	PORT_DIPSETTING(      0x0000, "None" )
749 INPUT_PORTS_END
750 
751 
752 
753 static struct GfxLayout tilelayout =
754 {
755 	8,8,	/* tile size */
756 	RGN_FRAC(1,1),	/* number of tiles */
757 	4,	/* 4 bits per pixel */
758 	{ 0, 1, 2, 3 },
759 	{ 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
760 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
761 	32*8	/* offset to next tile */
762 };
763 
764 static struct GfxLayout tile2layout =
765 {
766 	16,16,	/* tile size */
767 	RGN_FRAC(1,1),	/* number of tiles */
768 	4,	/* 4 bits per pixel */
769 	{ 0, 1, 2, 3 },	/* the bitplanes are packed in one nibble */
770 	{ 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
771 	  32*8+0*4, 32*8+1*4, 32*8+2*4, 32*8+3*4,
772 	  32*8+4*4, 32*8+5*4, 32*8+6*4, 32*8+7*4,},
773 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
774 	  16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32},
775 	128*8	/* offset to next tile */
776 };
777 
778 static struct GfxLayout spritelayout =
779 {
780 	8,8,	/* sprites size */
781 	RGN_FRAC(1,2),	/* number of sprites */
782 	4,	/* 4 bits per pixel */
783 	{ 0, 1, 2, 3 },	/* the bitplanes are packed in one nibble */
784 	{ 0,4,RGN_FRAC(1,2),4+RGN_FRAC(1,2),8,12,8+RGN_FRAC(1,2),12+RGN_FRAC(1,2) },
785 	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
786 	16*8	/* offset to next sprite */
787 };
788 
789 static struct GfxDecodeInfo gfxdecodeinfo[] =
790 {
791 	{ REGION_GFX1, 0, &tilelayout,        256, 4096 - 256 },	/* tiles 8x8  */
792 	{ REGION_GFX2, 0, &tile2layout,       768, 4096 - 768 },	/* tiles 16x16 */
793 	{ REGION_GFX3, 0, &tile2layout,       512, 4096 - 512 },	/* tiles 16x16 */
794 	{ REGION_GFX4, 0, &spritelayout,        0, 4096 -   0 },	/* sprites 8x8 */
795 
796 	{ -1 } /* end of array */
797 };
798 
799 
800 
801 /* handler called by the 2203 emulator when the internal timers cause an IRQ */
irqhandler(int irq)802 static void irqhandler(int irq)
803 {
804 	cpu_set_irq_line(1,0,irq ? ASSERT_LINE : CLEAR_LINE);
805 }
806 
807 static struct YM2203interface ym2203_interface =
808 {
809 	2,			/* 2 chips */
810 	4000000,	/* 4 MHz ? (hand tuned) */
811 	{ YM2203_VOL(60,15), YM2203_VOL(60,15) },
812 	{ 0 },
813 	{ 0 },
814 	{ 0 },
815 	{ 0 },
816 	{ irqhandler }
817 };
818 
819 
820 static struct OKIM6295interface okim6295_interface =
821 {
822 	1,                  /* 1 chip */
823 	{ 7575 },			/* 7575Hz frequency */
824 	{ REGION_SOUND1 },	/* memory region */
825 	{ 20 }
826 };
827 
828 
829 static MACHINE_DRIVER_START( shadoww )
830 
831 	/* basic machine hardware */
832 	MDRV_CPU_ADD(M68000, 18432000/2)	/* 9.216 MHz */
MDRV_CPU_MEMORY(readmem,writemem)833 	MDRV_CPU_MEMORY(readmem,writemem)
834 	MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
835 
836 	MDRV_CPU_ADD(Z80, 4000000)	/* 4 MHz */
837 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)
838 	MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
839 								/* IRQs are triggered by the YM2203 */
840 	MDRV_FRAMES_PER_SECOND(60)
841 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
842 
843 	MDRV_MACHINE_INIT(raiga)
844 
845 	/* video hardware */
846 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
847 	MDRV_SCREEN_SIZE(32*8, 32*8)
848 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
849 	MDRV_GFXDECODE(gfxdecodeinfo)
850 	MDRV_PALETTE_LENGTH(4096)
851 
852 	MDRV_VIDEO_START(gaiden)
853 	MDRV_VIDEO_UPDATE(gaiden)
854 
855 	/* sound hardware */
856 	MDRV_SOUND_ADD(YM2203, ym2203_interface)
857 	MDRV_SOUND_ADD(OKIM6295, okim6295_interface)
858 MACHINE_DRIVER_END
859 
860 static MACHINE_DRIVER_START( raiga )
861 	MDRV_IMPORT_FROM(shadoww)
862 
863 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_NEEDS_6BITS_PER_GUN | VIDEO_RGB_DIRECT)
864 
865 	MDRV_VIDEO_START(raiga)
866 	MDRV_VIDEO_UPDATE(raiga)
867 MACHINE_DRIVER_END
868 
869 
870 /***************************************************************************
871 
872   Game driver(s)
873 
874 ***************************************************************************/
875 
876 ROM_START( shadoww )
877 	ROM_REGION( 0x40000, REGION_CPU1, 0 )	/* 2*128k for 68000 code */
878 	ROM_LOAD16_BYTE( "shadowa.1",     0x00000, 0x20000, CRC(8290d567) SHA1(1e2f80c1548c853ec1127e79438f62eda6592a07) )
879 	ROM_LOAD16_BYTE( "shadowa.2",     0x00001, 0x20000, CRC(f3f08921) SHA1(df6bb7302714e0eab12cbd0a7f2a4ca751a600e1) )
880 
881 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the audio CPU */
882 	ROM_LOAD( "gaiden.3",     0x0000, 0x10000, CRC(75fd3e6a) SHA1(3333e84ed4983caa133e60a8e8895fa897ab4949) )   /* Audio CPU is a Z80  */
883 
884 	ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )
885 	ROM_LOAD( "gaiden.5",     0x000000, 0x10000, CRC(8d4035f7) SHA1(3473456cdd24e312e3073586d7e8f24eb71bbea1) )	/* 8x8 tiles */
886 
887 	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )
888 	ROM_LOAD( "14.bin",       0x000000, 0x20000, CRC(1ecfddaa) SHA1(e71d60ae1a98fe8512498f91cce01c16be9f0871) )
889 	ROM_LOAD( "15.bin",       0x020000, 0x20000, CRC(1291a696) SHA1(023b05260214adc39bdba81d5e2aa246b6d74a6a) )
890 	ROM_LOAD( "16.bin",       0x040000, 0x20000, CRC(140b47ca) SHA1(6ffd9b7116658a46a124f9085602d88aa143d829) )
891 	ROM_LOAD( "17.bin",       0x060000, 0x20000, CRC(7638cccb) SHA1(780d47d3aa248346e0e7abc6e6284542e7392919) )
892 
893 	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE )
894 	ROM_LOAD( "18.bin",       0x000000, 0x20000, CRC(3fadafd6) SHA1(0cb5387a354c631d5c6aca8f77ecbbc0d175a574) )
895 	ROM_LOAD( "19.bin",       0x020000, 0x20000, CRC(ddae9d5b) SHA1(108b202ae7ae124a32400a0a404c7d2b614c60bd) )
896 	ROM_LOAD( "20.bin",       0x040000, 0x20000, CRC(08cf7a93) SHA1(fd3278c3fb3ef30ed03c8a95656d86ba82a163d8) )
897 	ROM_LOAD( "21.bin",       0x060000, 0x20000, CRC(1ac892f5) SHA1(28364266ca9d1955fb7953f5c2d6f35e114beec6) )
898 
899 	ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE )
900 	ROM_LOAD( "gaiden.6",     0x000000, 0x20000, CRC(e7ccdf9f) SHA1(80ffcefc95660471124898a9c2bee55df36bda13) )	/* sprites A1 */
901 	ROM_LOAD( "gaiden.8",     0x020000, 0x20000, CRC(7ef7f880) SHA1(26ba9a76adce24beea3cffa1cb95aeafe6f82f96) )	/* sprites B1 */
902 	ROM_LOAD( "gaiden.10",    0x040000, 0x20000, CRC(a6451dec) SHA1(553e7a1453b59055fa0b10ca04125543d9f8987c) )	/* sprites C1 */
903 	ROM_LOAD( "shadoww.12a",  0x060000, 0x10000, CRC(9bb07731) SHA1(b799b1958dc9b84797fdab2591e33bd5d28884a3) )	/* sprites D1 */
904 	ROM_LOAD( "shadoww.12b",  0x070000, 0x10000, CRC(a4a950a2) SHA1(9766b5e88edd16554e59179a37cca49d29f83367) )	/* sprites D1 */
905 	ROM_LOAD( "gaiden.7",     0x080000, 0x20000, CRC(016bec95) SHA1(6a6757c52ca9a2398ea43d1af4a8d5adde6f4cd2) )	/* sprites A2 */
906 	ROM_LOAD( "gaiden.9",     0x0a0000, 0x20000, CRC(6e9b7fd3) SHA1(c86ff61844fc94c02625bb812b9062d0649c8fdf) )	/* sprites B2 */
907 	ROM_LOAD( "gaiden.11",    0x0c0000, 0x20000, CRC(7fbfdf5e) SHA1(ab67b72dcadb5f2236d29de751de5bf890a9e423) )	/* sprites C2 */
908 	ROM_LOAD( "shadoww.13a",  0x0e0000, 0x10000, CRC(996d2fa5) SHA1(a32526949af3635914927ebbbe684c3de9562a9d) )	/* sprites D2 */
909 	ROM_LOAD( "shadoww.13b",  0x0f0000, 0x10000, CRC(b8df8a34) SHA1(6810f7961052a983b8c78b42d550038051012c6d) )	/* sprites D2 */
910 
911 	ROM_REGION( 0x20000, REGION_SOUND1, 0 )	/* 128k for ADPCM samples - sound chip is OKIM6295 */
912 	ROM_LOAD( "gaiden.4",     0x0000, 0x20000, CRC(b0e0faf9) SHA1(2275d2ef5eee356ccf80b9e9644d16fc30a4d107) ) /* samples */
913 ROM_END
914 
915 ROM_START( shadowwa )
916 	ROM_REGION( 0x40000, REGION_CPU1, 0 )	/* 2*128k for 68000 code */
917 	ROM_LOAD16_BYTE( "shadoww.1",    0x00000, 0x20000, CRC(fefba387) SHA1(20ce28da5877009494c3f3f67488bbe805d91340) )
918 	ROM_LOAD16_BYTE( "shadoww.2",    0x00001, 0x20000, CRC(9b9d6b18) SHA1(75068611fb1de61120be8bf840f61d90c0dc86ca) )
919 
920 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the audio CPU */
921 	ROM_LOAD( "gaiden.3",     0x0000, 0x10000, CRC(75fd3e6a) SHA1(3333e84ed4983caa133e60a8e8895fa897ab4949) )   /* Audio CPU is a Z80  */
922 
923 	ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )
924 	ROM_LOAD( "gaiden.5",     0x000000, 0x10000, CRC(8d4035f7) SHA1(3473456cdd24e312e3073586d7e8f24eb71bbea1) )	/* 8x8 tiles */
925 
926 	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )
927 	ROM_LOAD( "14.bin",       0x000000, 0x20000, CRC(1ecfddaa) SHA1(e71d60ae1a98fe8512498f91cce01c16be9f0871) )
928 	ROM_LOAD( "15.bin",       0x020000, 0x20000, CRC(1291a696) SHA1(023b05260214adc39bdba81d5e2aa246b6d74a6a) )
929 	ROM_LOAD( "16.bin",       0x040000, 0x20000, CRC(140b47ca) SHA1(6ffd9b7116658a46a124f9085602d88aa143d829) )
930 	ROM_LOAD( "17.bin",       0x060000, 0x20000, CRC(7638cccb) SHA1(780d47d3aa248346e0e7abc6e6284542e7392919) )
931 
932 	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE )
933 	ROM_LOAD( "18.bin",       0x000000, 0x20000, CRC(3fadafd6) SHA1(0cb5387a354c631d5c6aca8f77ecbbc0d175a574) )
934 	ROM_LOAD( "19.bin",       0x020000, 0x20000, CRC(ddae9d5b) SHA1(108b202ae7ae124a32400a0a404c7d2b614c60bd) )
935 	ROM_LOAD( "20.bin",       0x040000, 0x20000, CRC(08cf7a93) SHA1(fd3278c3fb3ef30ed03c8a95656d86ba82a163d8) )
936 	ROM_LOAD( "21.bin",       0x060000, 0x20000, CRC(1ac892f5) SHA1(28364266ca9d1955fb7953f5c2d6f35e114beec6) )
937 
938 	ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE )
939 	ROM_LOAD( "gaiden.6",     0x000000, 0x20000, CRC(e7ccdf9f) SHA1(80ffcefc95660471124898a9c2bee55df36bda13) )	/* sprites A1 */
940 	ROM_LOAD( "gaiden.8",     0x020000, 0x20000, CRC(7ef7f880) SHA1(26ba9a76adce24beea3cffa1cb95aeafe6f82f96) )	/* sprites B1 */
941 	ROM_LOAD( "gaiden.10",    0x040000, 0x20000, CRC(a6451dec) SHA1(553e7a1453b59055fa0b10ca04125543d9f8987c) )	/* sprites C1 */
942 	ROM_LOAD( "shadoww.12a",  0x060000, 0x10000, CRC(9bb07731) SHA1(b799b1958dc9b84797fdab2591e33bd5d28884a3) )	/* sprites D1 */
943 	ROM_LOAD( "shadoww.12b",  0x070000, 0x10000, CRC(a4a950a2) SHA1(9766b5e88edd16554e59179a37cca49d29f83367) )	/* sprites D1 */
944 	ROM_LOAD( "gaiden.7",     0x080000, 0x20000, CRC(016bec95) SHA1(6a6757c52ca9a2398ea43d1af4a8d5adde6f4cd2) )	/* sprites A2 */
945 	ROM_LOAD( "gaiden.9",     0x0a0000, 0x20000, CRC(6e9b7fd3) SHA1(c86ff61844fc94c02625bb812b9062d0649c8fdf) )	/* sprites B2 */
946 	ROM_LOAD( "gaiden.11",    0x0c0000, 0x20000, CRC(7fbfdf5e) SHA1(ab67b72dcadb5f2236d29de751de5bf890a9e423) )	/* sprites C2 */
947 	ROM_LOAD( "shadoww.13a",  0x0e0000, 0x10000, CRC(996d2fa5) SHA1(a32526949af3635914927ebbbe684c3de9562a9d) )	/* sprites D2 */
948 	ROM_LOAD( "shadoww.13b",  0x0f0000, 0x10000, CRC(b8df8a34) SHA1(6810f7961052a983b8c78b42d550038051012c6d) )	/* sprites D2 */
949 
950 	ROM_REGION( 0x20000, REGION_SOUND1, 0 )	/* 128k for ADPCM samples - sound chip is OKIM6295 */
951 	ROM_LOAD( "gaiden.4",     0x0000, 0x20000, CRC(b0e0faf9) SHA1(2275d2ef5eee356ccf80b9e9644d16fc30a4d107) ) /* samples */
952 ROM_END
953 
954 ROM_START( gaiden )
955 	ROM_REGION( 0x40000, REGION_CPU1, 0 )	/* 2*128k for 68000 code */
956 	ROM_LOAD16_BYTE( "gaiden.1",     0x00000, 0x20000, CRC(e037ff7c) SHA1(5418bcb80d4c52f05e3c26668193452fd51f1283) )
957 	ROM_LOAD16_BYTE( "gaiden.2",     0x00001, 0x20000, CRC(454f7314) SHA1(231296423870f00ea2e545faf0fbb37577430a4f) )
958 
959 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the audio CPU */
960 	ROM_LOAD( "gaiden.3",     0x0000, 0x10000, CRC(75fd3e6a) SHA1(3333e84ed4983caa133e60a8e8895fa897ab4949) )   /* Audio CPU is a Z80  */
961 
962 	ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )
963 	ROM_LOAD( "gaiden.5",     0x000000, 0x10000, CRC(8d4035f7) SHA1(3473456cdd24e312e3073586d7e8f24eb71bbea1) )	/* 8x8 tiles */
964 
965 	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )
966 	ROM_LOAD( "14.bin",       0x000000, 0x20000, CRC(1ecfddaa) SHA1(e71d60ae1a98fe8512498f91cce01c16be9f0871) )
967 	ROM_LOAD( "15.bin",       0x020000, 0x20000, CRC(1291a696) SHA1(023b05260214adc39bdba81d5e2aa246b6d74a6a) )
968 	ROM_LOAD( "16.bin",       0x040000, 0x20000, CRC(140b47ca) SHA1(6ffd9b7116658a46a124f9085602d88aa143d829) )
969 	ROM_LOAD( "17.bin",       0x060000, 0x20000, CRC(7638cccb) SHA1(780d47d3aa248346e0e7abc6e6284542e7392919) )
970 
971 	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE )
972 	ROM_LOAD( "18.bin",       0x000000, 0x20000, CRC(3fadafd6) SHA1(0cb5387a354c631d5c6aca8f77ecbbc0d175a574) )
973 	ROM_LOAD( "19.bin",       0x020000, 0x20000, CRC(ddae9d5b) SHA1(108b202ae7ae124a32400a0a404c7d2b614c60bd) )
974 	ROM_LOAD( "20.bin",       0x040000, 0x20000, CRC(08cf7a93) SHA1(fd3278c3fb3ef30ed03c8a95656d86ba82a163d8) )
975 	ROM_LOAD( "21.bin",       0x060000, 0x20000, CRC(1ac892f5) SHA1(28364266ca9d1955fb7953f5c2d6f35e114beec6) )
976 
977 	ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE )
978 	ROM_LOAD( "gaiden.6",     0x000000, 0x20000, CRC(e7ccdf9f) SHA1(80ffcefc95660471124898a9c2bee55df36bda13) )	/* sprites A1 */
979 	ROM_LOAD( "gaiden.8",     0x020000, 0x20000, CRC(7ef7f880) SHA1(26ba9a76adce24beea3cffa1cb95aeafe6f82f96) )	/* sprites B1 */
980 	ROM_LOAD( "gaiden.10",    0x040000, 0x20000, CRC(a6451dec) SHA1(553e7a1453b59055fa0b10ca04125543d9f8987c) )	/* sprites C1 */
981 	ROM_LOAD( "gaiden.12",    0x060000, 0x20000, CRC(90f1e13a) SHA1(3fe9fe62aa9e92c871c791a3b11f96c9a48099a9) )	/* sprites D1 */
982 	ROM_LOAD( "gaiden.7",     0x080000, 0x20000, CRC(016bec95) SHA1(6a6757c52ca9a2398ea43d1af4a8d5adde6f4cd2) )	/* sprites A2 */
983 	ROM_LOAD( "gaiden.9",     0x0a0000, 0x20000, CRC(6e9b7fd3) SHA1(c86ff61844fc94c02625bb812b9062d0649c8fdf) )	/* sprites B2 */
984 	ROM_LOAD( "gaiden.11",    0x0c0000, 0x20000, CRC(7fbfdf5e) SHA1(ab67b72dcadb5f2236d29de751de5bf890a9e423) )	/* sprites C2 */
985 	ROM_LOAD( "gaiden.13",    0x0e0000, 0x20000, CRC(7d9f5c5e) SHA1(200102532ea9a88c7c708e03f8893c46dff827d1) )	/* sprites D2 */
986 
987 	ROM_REGION( 0x20000, REGION_SOUND1, 0 )	/* 128k for ADPCM samples - sound chip is OKIM6295 */
988 	ROM_LOAD( "gaiden.4",     0x0000, 0x20000, CRC(b0e0faf9) SHA1(2275d2ef5eee356ccf80b9e9644d16fc30a4d107) ) /* samples */
989 ROM_END
990 
991 ROM_START( ryukendn )
992 	ROM_REGION( 0x40000, REGION_CPU1, 0 )	/* 2*128k for 68000 code */
993 	ROM_LOAD16_BYTE( "ryukendn.1",  0x00000, 0x20000, CRC(6203a5e2) SHA1(8cfe05c483a351e938b067ffa642d515e28605a3) )
994 	ROM_LOAD16_BYTE( "ryukendn.2",  0x00001, 0x20000, CRC(9e99f522) SHA1(b2277d8934b5e6e2f556aee5092f5d1050774a34) )
995 
996 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the audio CPU */
997 	ROM_LOAD( "ryukendn.3",   0x0000, 0x10000, CRC(6b686b69) SHA1(f0fa553acb3945f8dbbf466073c8bae35a0375ef) )   /* Audio CPU is a Z80  */
998 
999 	ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )
1000 	ROM_LOAD( "ryukendn.5",   0x000000, 0x10000, CRC(765e7baa) SHA1(4d0a50f091b284739b6d9a8ceb4f81999da445fc) )	/* 8x8 tiles */
1001 
1002 	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )
1003 	ROM_LOAD( "14.bin",       0x000000, 0x20000, CRC(1ecfddaa) SHA1(e71d60ae1a98fe8512498f91cce01c16be9f0871) )
1004 	ROM_LOAD( "15.bin",       0x020000, 0x20000, CRC(1291a696) SHA1(023b05260214adc39bdba81d5e2aa246b6d74a6a) )
1005 	ROM_LOAD( "16.bin",       0x040000, 0x20000, CRC(140b47ca) SHA1(6ffd9b7116658a46a124f9085602d88aa143d829) )
1006 	ROM_LOAD( "17.bin",       0x060000, 0x20000, CRC(7638cccb) SHA1(780d47d3aa248346e0e7abc6e6284542e7392919) )
1007 
1008 	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE )
1009 	ROM_LOAD( "18.bin",       0x000000, 0x20000, CRC(3fadafd6) SHA1(0cb5387a354c631d5c6aca8f77ecbbc0d175a574) )
1010 	ROM_LOAD( "19.bin",       0x020000, 0x20000, CRC(ddae9d5b) SHA1(108b202ae7ae124a32400a0a404c7d2b614c60bd) )
1011 	ROM_LOAD( "20.bin",       0x040000, 0x20000, CRC(08cf7a93) SHA1(fd3278c3fb3ef30ed03c8a95656d86ba82a163d8) )
1012 	ROM_LOAD( "21.bin",       0x060000, 0x20000, CRC(1ac892f5) SHA1(28364266ca9d1955fb7953f5c2d6f35e114beec6) )
1013 
1014 	ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE )
1015 	ROM_LOAD( "gaiden.6",     0x000000, 0x20000, CRC(e7ccdf9f) SHA1(80ffcefc95660471124898a9c2bee55df36bda13) )	/* sprites A1 */
1016 	ROM_LOAD( "gaiden.8",     0x020000, 0x20000, CRC(7ef7f880) SHA1(26ba9a76adce24beea3cffa1cb95aeafe6f82f96) )	/* sprites B1 */
1017 	ROM_LOAD( "gaiden.10",    0x040000, 0x20000, CRC(a6451dec) SHA1(553e7a1453b59055fa0b10ca04125543d9f8987c) )	/* sprites C1 */
1018 	ROM_LOAD( "shadoww.12a",  0x060000, 0x10000, CRC(9bb07731) SHA1(b799b1958dc9b84797fdab2591e33bd5d28884a3) )	/* sprites D1 */
1019 	ROM_LOAD( "ryukendn.12b", 0x070000, 0x10000, CRC(1773628a) SHA1(e7eacc880f2a4174f17b263bedf8c1bc64007dbd) )	/* sprites D1 */
1020 	ROM_LOAD( "gaiden.7",     0x080000, 0x20000, CRC(016bec95) SHA1(6a6757c52ca9a2398ea43d1af4a8d5adde6f4cd2) )	/* sprites A2 */
1021 	ROM_LOAD( "ryukendn.9a",  0x0a0000, 0x10000, CRC(c821e200) SHA1(5867e5055e16c8739d7699ede5e4a708e4c48895) )	/* sprites B2 */
1022 	ROM_LOAD( "ryukendn.9b",  0x0b0000, 0x10000, CRC(6a6233b3) SHA1(21b8693335496b851628e6b62c6012e6624d13bf) )	/* sprites B2 */
1023 	ROM_LOAD( "gaiden.11",    0x0c0000, 0x20000, CRC(7fbfdf5e) SHA1(ab67b72dcadb5f2236d29de751de5bf890a9e423) )	/* sprites C2 */
1024 	ROM_LOAD( "shadoww.13a",  0x0e0000, 0x10000, CRC(996d2fa5) SHA1(a32526949af3635914927ebbbe684c3de9562a9d) )	/* sprites D2 */
1025 	ROM_LOAD( "ryukendn.13b", 0x0f0000, 0x10000, CRC(1f43c507) SHA1(29f655442c16677855073284c7ab41059c99c497) )	/* sprites D2 */
1026 
1027 	ROM_REGION( 0x20000, REGION_SOUND1, 0 )	/* 128k for ADPCM samples - sound chip is OKIM6295 */
1028 	ROM_LOAD( "gaiden.4",     0x0000, 0x20000, CRC(b0e0faf9) SHA1(2275d2ef5eee356ccf80b9e9644d16fc30a4d107) ) /* samples */
1029 ROM_END
1030 
1031 ROM_START( tknight )
1032 	ROM_REGION( 0x40000, REGION_CPU1, 0 )	/* 2*128k for 68000 code */
1033 	ROM_LOAD16_BYTE( "tkni1.bin",    0x00000, 0x20000, CRC(9121daa8) SHA1(06ba7779602df8fae32e859371d27c0dbb8d3430) )
1034 	ROM_LOAD16_BYTE( "tkni2.bin",    0x00001, 0x20000, CRC(6669cd87) SHA1(8888522a3aef76a979ffc80ba457dd49f279abf1) )
1035 
1036 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the audio CPU */
1037 	ROM_LOAD( "tkni3.bin",    0x0000, 0x10000, CRC(15623ec7) SHA1(db43fe6c417117d7cd90a26e12a52efb0e1a5ca6) )   /* Audio CPU is a Z80  */
1038 
1039 	ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )
1040 	ROM_LOAD( "tkni5.bin",    0x000000, 0x10000, CRC(5ed15896) SHA1(87bdddb26934af0b2c4e704e6d85c69a7531aeb1) )	/* 8x8 tiles */
1041 
1042 	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )
1043 	ROM_LOAD( "tkni7.bin",    0x000000, 0x80000, CRC(4b4d4286) SHA1(d386aa223eb288ea829c98d3f39279a75dc66b71) )
1044 
1045 	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE )
1046 	ROM_LOAD( "tkni6.bin",    0x000000, 0x80000, CRC(f68fafb1) SHA1(aeca38eaea2f6dfc484e48ac1114c0c4abaafb9c) )
1047 
1048 	ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE )
1049 	ROM_LOAD( "tkni9.bin",    0x000000, 0x80000, CRC(d22f4239) SHA1(360a9a821faabe911eef407ef85452d8b706538f) )	/* sprites */
1050 	ROM_LOAD( "tkni8.bin",    0x080000, 0x80000, CRC(4931b184) SHA1(864e827ac109c0ee52a898034c021cd5e92ff000) )	/* sprites */
1051 
1052 	ROM_REGION( 0x20000, REGION_SOUND1, 0 )	/* 128k for ADPCM samples - sound chip is OKIM6295 */
1053 	ROM_LOAD( "tkni4.bin",    0x0000, 0x20000, CRC(a7a1dbcf) SHA1(2fee1d9745ce2ab54b0b9cbb6ab2e66ba9677245) ) /* samples */
1054 ROM_END
1055 
1056 ROM_START( wildfang )
1057 	ROM_REGION( 0x40000, REGION_CPU1, 0 )	/* 2*128k for 68000 code */
1058 	ROM_LOAD16_BYTE( "1.3st",    0x00000, 0x20000, CRC(ab876c9b) SHA1(b02c822f107df4c9c4f0024998f225c1ddbbd496) )
1059 	ROM_LOAD16_BYTE( "2.5st",    0x00001, 0x20000, CRC(1dc74b3b) SHA1(c99051ebefd6ce666b13ab56c0a10b188f15ec28) )
1060 
1061 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the audio CPU */
1062 	ROM_LOAD( "tkni3.bin",    0x0000, 0x10000, CRC(15623ec7) SHA1(db43fe6c417117d7cd90a26e12a52efb0e1a5ca6) )   /* Audio CPU is a Z80  */
1063 
1064 	ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )
1065 	ROM_LOAD( "tkni5.bin",    0x000000, 0x10000, CRC(5ed15896) SHA1(87bdddb26934af0b2c4e704e6d85c69a7531aeb1) )	/* 8x8 tiles */
1066 
1067 	ROM_REGION( 0x080000, REGION_GFX2, ROMREGION_DISPOSE )
1068 	ROM_LOAD( "14.3a",        0x000000, 0x20000, CRC(0d20c10c) SHA1(209ca4e166d0b91ff99a338e135e5388af2c51f5) )
1069 	ROM_LOAD( "15.3b",        0x020000, 0x20000, CRC(3f40a6b4) SHA1(7486ddfe4b0ac4198512548b74402f4194c804f1) )
1070 	ROM_LOAD( "16.1a",        0x040000, 0x20000, CRC(0f31639e) SHA1(e150db4f617c5fcf505e5ca95d94073c1f6b7d0d) )
1071 	ROM_LOAD( "17.1b",        0x060000, 0x20000, CRC(f32c158e) SHA1(2861754bda37e30799151b5ca73771937edf38a9) )
1072 
1073 	ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE )
1074 	ROM_LOAD( "tkni6.bin",    0x000000, 0x80000, CRC(f68fafb1) SHA1(aeca38eaea2f6dfc484e48ac1114c0c4abaafb9c) )
1075 
1076 	ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE )
1077 	ROM_LOAD( "tkni9.bin",    0x000000, 0x80000, CRC(d22f4239) SHA1(360a9a821faabe911eef407ef85452d8b706538f) )	/* sprites */
1078 	ROM_LOAD( "tkni8.bin",    0x080000, 0x80000, CRC(4931b184) SHA1(864e827ac109c0ee52a898034c021cd5e92ff000) )	/* sprites */
1079 
1080 	ROM_REGION( 0x20000, REGION_SOUND1, 0 )	/* 128k for ADPCM samples - sound chip is OKIM6295 */
1081 	ROM_LOAD( "tkni4.bin",    0x0000, 0x20000, CRC(a7a1dbcf) SHA1(2fee1d9745ce2ab54b0b9cbb6ab2e66ba9677245) ) /* samples */
1082 ROM_END
1083 
1084 ROM_START( stratof )
1085 	ROM_REGION( 0x40000, REGION_CPU1, 0 )
1086 	ROM_LOAD16_BYTE( "1.3s",        0x00000, 0x20000, CRC(060822a4) SHA1(82abf6ea64695d2f7b5934ad2487e857648aeecf) )
1087 	ROM_LOAD16_BYTE( "2.4s",        0x00001, 0x20000, CRC(339358fa) SHA1(b662bccc2206ae888ea36f355d44bf98fcd2ee2c) )
1088 
1089 	ROM_REGION( 0x10000, REGION_CPU2, 0 )
1090 	ROM_LOAD( "a-4b.3",           0x00000, 0x10000, CRC(18655c95) SHA1(8357e0520565a201bb930cadffc759463931ec41) )
1091 
1092 	ROM_REGION( 0x1000, REGION_CPU3, 0 )	/* protection NEC D8749 */
1093 	ROM_LOAD( "a-6v.mcu",         0x00000, 0x1000, NO_DUMP )
1094 
1095 	ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE )
1096 	ROM_LOAD( "b-7a.5",           0x00000, 0x10000, CRC(6d2e4bf1) SHA1(edcf96bbcc109da71e3adbb37d119254d3873b29) )
1097 
1098 	ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE )
1099 	ROM_LOAD( "b-1b",  0x00000, 0x80000, CRC(781d1bd2) SHA1(680d91ea02f1e9cb911501f595008f46ad77ded4) )
1100 
1101 	ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE )
1102 	ROM_LOAD( "b-4b",  0x00000, 0x80000, CRC(89468b84) SHA1(af60fe957c98fa3f00623d420a0941a941f5bc6b) )
1103 
1104 	ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE )
1105 	ROM_LOAD( "b-2m",  0x00000, 0x80000, CRC(5794ec32) SHA1(07e78d8bcb2373da77ef9f8cde6a01f384f8bf7e) )
1106 	ROM_LOAD( "b-1m",  0x80000, 0x80000, CRC(b0de0ded) SHA1(45c74d0c58e3e73c79e587722d9fea9f7ba9cb0a) )
1107 
1108 	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
1109 	ROM_LOAD( "a-4a.4", 0x00000, 0x20000, CRC(ef9acdcf) SHA1(8d62a666843f0cb22e8926ae18a961052d4f9ed5) )
1110 ROM_END
1111 
1112 ROM_START( raiga )
1113 	ROM_REGION( 0x40000, REGION_CPU1, 0 )
1114 	ROM_LOAD16_BYTE( "a-3s.1",      0x00000, 0x20000, CRC(303c2a6c) SHA1(cd825329fd1f7d87661114f07cc87e43fd34e251) )
1115 	ROM_LOAD16_BYTE( "a-4s.2",      0x00001, 0x20000, CRC(5f31fecb) SHA1(b0c88d260d0108100c157ea92f7defdc3cbb8933) )
1116 
1117 	ROM_REGION( 0x10000, REGION_CPU2, 0 )
1118 	ROM_LOAD( "a-4b.3",           0x00000, 0x10000, CRC(18655c95) SHA1(8357e0520565a201bb930cadffc759463931ec41) )
1119 
1120 	ROM_REGION( 0x1000, REGION_CPU3, 0 )	/* protection NEC D8749 */
1121 	ROM_LOAD( "a-6v.mcu",         0x00000, 0x1000, NO_DUMP )
1122 
1123 	ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE )
1124 	ROM_LOAD( "b-7a.5",           0x00000, 0x10000, CRC(6d2e4bf1) SHA1(edcf96bbcc109da71e3adbb37d119254d3873b29) )
1125 
1126 	ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE )
1127 	ROM_LOAD( "b-1b",  0x00000, 0x80000, CRC(781d1bd2) SHA1(680d91ea02f1e9cb911501f595008f46ad77ded4) )
1128 
1129 	ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE )
1130 	ROM_LOAD( "b-4b",  0x00000, 0x80000, CRC(89468b84) SHA1(af60fe957c98fa3f00623d420a0941a941f5bc6b) )
1131 
1132 	ROM_REGION( 0x100000, REGION_GFX4, ROMREGION_DISPOSE )
1133 	ROM_LOAD( "b-2m",  0x00000, 0x80000, CRC(5794ec32) SHA1(07e78d8bcb2373da77ef9f8cde6a01f384f8bf7e) )
1134 	ROM_LOAD( "b-1m",  0x80000, 0x80000, CRC(b0de0ded) SHA1(45c74d0c58e3e73c79e587722d9fea9f7ba9cb0a) )
1135 
1136 	ROM_REGION( 0x20000, REGION_SOUND1, 0 )
1137 	ROM_LOAD( "a-4a.4", 0x00000, 0x20000, CRC(ef9acdcf) SHA1(8d62a666843f0cb22e8926ae18a961052d4f9ed5) )
1138 ROM_END
1139 
1140 
1141 
1142 static DRIVER_INIT( shadoww )
1143 {
1144 	/* sprite size Y = sprite size X */
1145 	gaiden_sprite_sizey = 0;
1146 }
1147 
DRIVER_INIT(wildfang)1148 static DRIVER_INIT( wildfang )
1149 {
1150 	/* sprite size Y = sprite size X */
1151 	gaiden_sprite_sizey = 0;
1152 
1153 	install_mem_read16_handler (0, 0x07a006, 0x07a007, wildfang_protection_r);
1154 	install_mem_write16_handler(0, 0x07a804, 0x07a805, wildfang_protection_w);
1155 }
1156 
DRIVER_INIT(raiga)1157 static DRIVER_INIT( raiga )
1158 {
1159 	/* sprite size Y independent from sprite size X */
1160 	gaiden_sprite_sizey = 2;
1161 
1162 	install_mem_read16_handler (0, 0x07a006, 0x07a007, raiga_protection_r);
1163 	install_mem_write16_handler(0, 0x07a804, 0x07a805, raiga_protection_w);
1164 }
1165 
1166 
1167 
1168 GAME( 1988, shadoww,  0,        shadoww, shadoww,  shadoww,  ROT0, "Tecmo", "Shadow Warriors (World set 1)" )
1169 GAME( 1988, shadowwa, shadoww,  shadoww, shadoww,  shadoww,  ROT0, "Tecmo", "Shadow Warriors (World set 2)" )
1170 GAME( 1988, gaiden,   shadoww,  shadoww, shadoww,  shadoww,  ROT0, "Tecmo", "Ninja Gaiden (US)" )
1171 GAME( 1989, ryukendn, shadoww,  shadoww, shadoww,  shadoww,  ROT0, "Tecmo", "Ninja Ryukenden (Japan)" )
1172 GAME( 1989, wildfang, 0,        shadoww, wildfang, wildfang, ROT0, "Tecmo", "Wild Fang - Tecmo Knight" )
1173 GAME( 1989, tknight,  wildfang, shadoww, tknight,  wildfang, ROT0, "Tecmo", "Tecmo Knight" )
1174 GAMEX(1991, stratof,  0,        raiga,	 raiga,    raiga,    ROT0, "Tecmo", "Raiga - Strato Fighter (US)", GAME_IMPERFECT_GRAPHICS )
1175 GAMEX(1991, raiga,    stratof,  raiga,	 raiga,    raiga,    ROT0, "Tecmo", "Raiga - Strato Fighter (Japan)", GAME_IMPERFECT_GRAPHICS )
1176