1 #include "../vidhrdw/psikyo.c"
2 
3 /***************************************************************************
4 
5 							-= Psikyo Games =-
6 
7 				driver by	Luca Elia (eliavit@unina.it)
8 
9 
10 CPU:	68EC020
11 
12 Sound:	Z80A				+	YM2610
13    Or:	LZ8420M (Z80 core)	+	YMF286-K
14 
15 Chips:	PS2001B PS3103 PS3204 PS3305
16 
17 ---------------------------------------------------------------------------
18 Name					Year	Board	Notes
19 ---------------------------------------------------------------------------
20 Sengoku Ace 		(J)	1993	SH201B
21 Gun Bird    		(J)	1994	KA302C
22 Strikers 1945		(J)	1995	SH404	Not Working: Protected (PIC16C57)
23 Sengoku Blade		(J)	1996	""		""
24 ---------------------------------------------------------------------------
25 
26 To Do:
27 
28 - YMF286 emulation
29 - Protection in s1945, sngkblade
30 - Flip Screen support
31 
32 ***************************************************************************/
33 
34 #include "driver.h"
35 #include "vidhrdw/generic.h"
36 
37 
38 /* Variables defined in vidhrdw */
39 
40 extern unsigned char *psikyo_vram_0, *psikyo_vram_1, *psikyo_vregs;
41 
42 /* Functions defined in vidhrdw */
43 
44 WRITE_HANDLER( psikyo_vram_0_w );
45 WRITE_HANDLER( psikyo_vram_1_w );
46 
47 int  psikyo_vh_start(void);
48 void psikyo_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
49 
50 /* Variables only used here */
51 
52 static int ack_latch;
53 
54 
55 /***************************************************************************
56 
57 
58 								Main CPU
59 
60 
61 ***************************************************************************/
62 
WRITE_HANDLER(psikyo_soundlatch_w)63 WRITE_HANDLER( psikyo_soundlatch_w )
64 {
65 	if (Machine->sample_rate == 0)		return;
66 
67 	ack_latch = 1;
68 	soundlatch_w(0,data);
69 	cpu_set_nmi_line(1,PULSE_LINE);
70 }
71 
72 
READ_HANDLER(gunbird_input_r)73 READ_HANDLER( gunbird_input_r )
74 {
75 	switch(offset)
76 	{
77 		case 0x0:	return readinputport(0);
78 		case 0x2:
79 		{
80 					const int bit = 0x80;
81 					int ret = ack_latch ? bit : 0;
82 					if (Machine->sample_rate == 0)	ret = 0;
83 					return (readinputport(1) & ~bit) | ret;
84 		}
85 		case 0x4:	return readinputport(2);
86 		case 0x6:	return readinputport(3);
87 
88 //		case 0x8:
89 //		case 0xa:
90 		default:	//logerror("PC %06X - Read input %02X !\n", cpu_get_pc(), offset);
91 					return 0;
92 	}
93 }
94 
95 
96 
97 
98 
READ_HANDLER(s1945_input_r)99 READ_HANDLER( s1945_input_r )
100 {
101 	switch(offset)
102 	{
103 		case 0x0:	return readinputport(0);
104 		case 0x2:
105 		{
106 					const int bit = 0x04;
107 					int ret = ack_latch ? bit : 0;
108 					if (Machine->sample_rate == 0)	ret = 0;
109 					return (readinputport(1) & ~bit) | ret;
110 		}
111 		case 0x4:	return readinputport(2);
112 		case 0x6:	return readinputport(3);
113 
114 		case 0x8:	return (rand() & 0xffff);	// protection??
115 
116 //		case 0xa:
117 		default:	//logerror("PC %06X - Read input %02X !\n", cpu_get_pc(), offset);
118 					return 0;
119 	}
120 }
121 
122 
123 
124 
READ_HANDLER(sngkace_input_r)125 READ_HANDLER( sngkace_input_r )
126 {
127 	switch(offset)
128 	{
129 		case 0x0:	return readinputport(0);
130 		case 0x2:	return 0xffff;	// NC
131 		case 0x4:	return readinputport(1);
132 		case 0x6:	return 0xffff;	// NC
133 		case 0x8:
134 		{
135 					const int bit = 0x80;
136 					int ret = ack_latch ? bit : 0;
137 					if (Machine->sample_rate == 0)	ret = 0;
138 					return (readinputport(2) & ~bit) | ret;
139 		}
140 		case 0xa:	return readinputport(3);
141 
142 		default:	//logerror("PC %06X - Read input %02X !\n", cpu_get_pc(), offset);
143 					return 0;
144 	}
145 }
146 
147 
148 
149 /***************************************************************************
150 								Sengoku Ace
151 ***************************************************************************/
152 
153 static struct MemoryReadAddress sngkace_readmem[] =
154 {
155 	{ 0x000000, 0x0fffff, MRA_ROM			},	// ROM (not all used)
156 	{ 0xfe0000, 0xffffff, MRA_BANK1			},	// RAM
157 	{ 0x400000, 0x4017ff, MRA_BANK2			},	// Sprites Data
158 	{ 0x401800, 0x401fff, MRA_BANK3			},	// Sprites List
159 	{ 0x600000, 0x601fff, MRA_BANK4			},	// Palette
160 	{ 0x800000, 0x801fff, MRA_BANK5			},	// Layer 0
161 	{ 0x802000, 0x803fff, MRA_BANK6			},	// Layer 1
162 	{ 0x804000, 0x807fff, MRA_BANK7			},	// RAM + Vregs
163 	{ 0xc00000, 0xc0000b, sngkace_input_r	},	// Input Ports
164 	{ -1 }
165 };
166 static struct MemoryWriteAddress sngkace_writemem[] =
167 {
168 	{ 0x000000, 0x0fffff, MWA_ROM							},	// ROM (not all used)
169 	{ 0xfe0000, 0xffffff, MWA_BANK1							},	// RAM
170 	{ 0x400000, 0x4017ff, MWA_BANK2, &spriteram				},	// Sprites Data
171 	{ 0x401800, 0x401fff, MWA_BANK3, &spriteram_2			},	// Sprites List
172 	{ 0x600000, 0x601fff, paletteram_xRRRRRGGGGGBBBBB_word_w, &paletteram	},	// Palette
173 	{ 0x800000, 0x801fff, psikyo_vram_0_w, &psikyo_vram_0	},	// Layer 0
174 	{ 0x802000, 0x803fff, psikyo_vram_1_w, &psikyo_vram_1	},	// Layer 1
175 	{ 0x804000, 0x807fff, MWA_BANK7, &psikyo_vregs			},	// RAM + Vregs
176 	{ 0xc00010, 0xc00011, MWA_NOP							},	// To Sound CPU
177 	{ 0xc00012, 0xc00013, psikyo_soundlatch_w				},	//
178 	{ -1 }
179 };
180 
181 
182 
183 
184 /***************************************************************************
185 
186 
187 								Sound CPU
188 
189 
190 ***************************************************************************/
191 
192 
WRITE_HANDLER(psikyo_ack_latch_w)193 WRITE_HANDLER( psikyo_ack_latch_w )
194 {
195 	ack_latch = 0;
196 }
197 
198 
199 /***************************************************************************
200 								Gun Bird
201 ***************************************************************************/
202 
WRITE_HANDLER(gunbird_sound_bankswitch_w)203 WRITE_HANDLER( gunbird_sound_bankswitch_w )
204 {
205 	unsigned char *RAM = memory_region(REGION_CPU2);
206 	int bank = (data >> 4) & 3;
207 
208 	/* I'm not sure here: since the banked rom is seen at 8200-ffff
209 	   are the first 0x200 or the last 0x200 bytes of the rom not
210 	   reachable ? */
211 
212 //	cpu_setbank(15, &RAM[bank * 0x8000 + 0x10000 + 0x200]);
213 	cpu_setbank(15, &RAM[bank * 0x8000 + 0x10000]);
214 }
215 
216 static struct MemoryReadAddress gunbird_sound_readmem[] =
217 {
218 	{ 0x0000, 0x7fff, MRA_ROM		},	// ROM
219 	{ 0x8000, 0x81ff, MRA_RAM		},	// RAM
220 	{ 0x8200, 0xffff, MRA_BANK15	},	// Banked ROM
221 	{ -1 }
222 };
223 static struct MemoryWriteAddress gunbird_sound_writemem[] =
224 {
225 	{ 0x0000, 0x7fff, MWA_ROM		},	// ROM
226 	{ 0x8000, 0x81ff, MWA_RAM		},	// RAM
227 	{ 0x8200, 0xffff, MWA_ROM		},	// Banked ROM
228 	{ -1 }
229 };
230 
231 
232 static struct IOReadPort gunbird_sound_readport[] =
233 {
234 	{ 0x04, 0x04, YM2610_status_port_0_A_r		},
235 	{ 0x06, 0x06, YM2610_status_port_0_B_r		},
236 	{ 0x08, 0x08, soundlatch_r					},
237 	{ -1 }
238 };
239 static struct IOWritePort gunbird_sound_writeport[] =
240 {
241 	{ 0x00, 0x00, gunbird_sound_bankswitch_w	},
242 	{ 0x04, 0x04, YM2610_control_port_0_A_w		},
243 	{ 0x05, 0x05, YM2610_data_port_0_A_w		},
244 	{ 0x06, 0x06, YM2610_control_port_0_B_w		},
245 	{ 0x07, 0x07, YM2610_data_port_0_B_w		},
246 	{ 0x0c, 0x0c, psikyo_ack_latch_w			},
247 	{ -1 }
248 };
249 
250 
251 
252 /***************************************************************************
253 								Sengoku Ace
254 ***************************************************************************/
255 
WRITE_HANDLER(sngkace_sound_bankswitch_w)256 WRITE_HANDLER( sngkace_sound_bankswitch_w )
257 {
258 	unsigned char *RAM = memory_region(REGION_CPU2);
259 	int bank = data & 3;
260 	cpu_setbank(15, &RAM[bank * 0x8000 + 0x10000]);
261 }
262 
263 static struct MemoryReadAddress sngkace_sound_readmem[] =
264 {
265 	{ 0x0000, 0x77ff, MRA_ROM		},	// ROM
266 	{ 0x7800, 0x7fff, MRA_RAM		},	// RAM
267 	{ 0x8000, 0xffff, MRA_BANK15	},	// Banked ROM
268 	{ -1 }
269 };
270 static struct MemoryWriteAddress sngkace_sound_writemem[] =
271 {
272 	{ 0x0000, 0x77ff, MWA_ROM		},	// ROM
273 	{ 0x7800, 0x7fff, MWA_RAM		},	// RAM
274 	{ 0x8000, 0xffff, MWA_ROM		},	// Banked ROM
275 	{ -1 }
276 };
277 
278 
279 static struct IOReadPort sngkace_sound_readport[] =
280 {
281 	{ 0x00, 0x00, YM2610_status_port_0_A_r		},
282 	{ 0x02, 0x02, YM2610_status_port_0_B_r		},
283 	{ 0x08, 0x08, soundlatch_r					},
284 	{ -1 }
285 };
286 static struct IOWritePort sngkace_sound_writeport[] =
287 {
288 	{ 0x00, 0x00, YM2610_control_port_0_A_w		},
289 	{ 0x01, 0x01, YM2610_data_port_0_A_w		},
290 	{ 0x02, 0x02, YM2610_control_port_0_B_w		},
291 	{ 0x03, 0x03, YM2610_data_port_0_B_w		},
292 	{ 0x04, 0x04, sngkace_sound_bankswitch_w	},
293 	{ 0x0c, 0x0c, psikyo_ack_latch_w			},
294 	{ -1 }
295 };
296 
297 
298 /***************************************************************************
299 						Strikers 1945 / Sengoku Blade
300 ***************************************************************************/
301 
302 
303 static struct IOReadPort s1945_sound_readport[] =
304 {
305 	{ 0x08, 0x08, YM2610_status_port_0_A_r		},
306 //	{ 0x06, 0x06, YM2610_status_port_0_B_r		},
307 	{ 0x10, 0x10, soundlatch_r					},
308 	{ -1 }
309 };
310 static struct IOWritePort s1945_sound_writeport[] =
311 {
312 	{ 0x00, 0x00, gunbird_sound_bankswitch_w	},
313 //	{ 0x02, 0x02, IOWP_NOP	},
314 //	{ 0x03, 0x03, IOWP_NOP	},
315 	{ 0x08, 0x08, YM2610_control_port_0_A_w		},
316 	{ 0x09, 0x09, YM2610_data_port_0_A_w		},
317 	{ 0x0a, 0x0a, YM2610_control_port_0_B_w		},
318 	{ 0x0b, 0x0b, YM2610_data_port_0_B_w		},
319 //	{ 0x0c, 0x0c, IOWP_NOP	},
320 //	{ 0x0d, 0x0d, IOWP_NOP	},
321 	{ 0x18, 0x18, psikyo_ack_latch_w			},
322 	{ -1 }
323 };
324 
325 
326 /***************************************************************************
327 
328 
329 								Input Ports
330 
331 
332 ***************************************************************************/
333 
334 
335 /***************************************************************************
336 								Gun Bird
337 ***************************************************************************/
338 
339 INPUT_PORTS_START( gunbird )
340 
341 	PORT_START	// IN0 - c00000&1
342 	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_START2                       )
343 	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON3        | IPF_PLAYER2 )
344 	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER2 )
345 	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER2 )
346 	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 )
347 	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
348 	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 )
349 	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 )
350 
351 	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_START1                       )
352 	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_BUTTON3        | IPF_PLAYER1 )
353 	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER1 )
354 	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER1 )
355 	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 )
356 	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
357 	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
358 	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
359 
360 	PORT_START	// IN1 - c00002&3
361 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
362 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
363 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
364 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
365 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
366 	PORT_BITX(0x0020, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
367 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_TILT     )
368 /*	PORT_BIT( 0x0080,  From Sound CPU here ) */
369 
370 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
371 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
372 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
373 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
374 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
375 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
376 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
377 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
378 
379 	PORT_START	// IN2 - c00004&5
380 	PORT_DIPNAME( 0x0001, 0x0001, "Unknown 2-0" )
381 	PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
382 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
383 	PORT_DIPNAME( 0x0002, 0x0000, "Sound" )
384 	PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
385 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
386 	PORT_DIPNAME( 0x000c, 0x000c, "?Difficulty?" )
387 	PORT_DIPSETTING(      0x0008, "0" )
388 	PORT_DIPSETTING(      0x000c, "1" )
389 	PORT_DIPSETTING(      0x0004, "2" )
390 	PORT_DIPSETTING(      0x0000, "3" )
391 	PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Lives ) )
392 	PORT_DIPSETTING(      0x0020, "1" )
393 	PORT_DIPSETTING(      0x0010, "2" )
394 	PORT_DIPSETTING(      0x0030, "3" )
395 	PORT_DIPSETTING(      0x0000, "4" )
396 	PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Bonus_Life ) )
397 	PORT_DIPSETTING(      0x0040, "400K" )
398 	PORT_DIPSETTING(      0x0000, "600K" )
399 	PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
400 
401 	PORT_DIPNAME( 0x0100, 0x0100, "Credits/Coinage" )	// [Free Play] on all for free play
402 	PORT_DIPSETTING(      0x0100, "A+B/A&B" )
403 	PORT_DIPSETTING(      0x0000, "A&B/A [Free Play]" )
404 	PORT_DIPNAME( 0x0e00, 0x0e00, DEF_STR( Coin_A ) )
405 	PORT_DIPSETTING(      0x0a00, DEF_STR( 3C_1C ) )
406 	PORT_DIPSETTING(      0x0c00, DEF_STR( 2C_1C ) )
407 	PORT_DIPSETTING(      0x0e00, DEF_STR( 1C_1C ) )
408 	PORT_DIPSETTING(      0x0800, DEF_STR( 1C_2C ) )
409 	PORT_DIPSETTING(      0x0600, DEF_STR( 1C_3C ) )
410 	PORT_DIPSETTING(      0x0400, DEF_STR( 1C_4C ) )
411 	PORT_DIPSETTING(      0x0200, DEF_STR( 1C_5C ) )
412 	PORT_DIPSETTING(      0x0000, "1C 6C [Free Play]" )
413 	PORT_DIPNAME( 0x7000, 0x7000, DEF_STR( Coin_B ) )
414 	PORT_DIPSETTING(      0x5000, DEF_STR( 3C_1C ) )
415 	PORT_DIPSETTING(      0x6000, DEF_STR( 2C_1C ) )
416 	PORT_DIPSETTING(      0x7000, DEF_STR( 1C_1C ) )
417 	PORT_DIPSETTING(      0x4000, DEF_STR( 1C_2C ) )
418 	PORT_DIPSETTING(      0x3000, DEF_STR( 1C_3C ) )
419 	PORT_DIPSETTING(      0x2000, DEF_STR( 1C_4C ) )
420 	PORT_DIPSETTING(      0x1000, DEF_STR( 1C_5C ) )
421 	PORT_DIPSETTING(      0x0000, "1C 6C [Free Play]" )
422 	PORT_DIPNAME( 0x8000, 0x8000, "Force 1C 1C" )
423 	PORT_DIPSETTING(      0x8000, DEF_STR( No ) )
424 	PORT_DIPSETTING(      0x0000, "Yes   [Free Play]" )
425 
426 	PORT_START	// IN3 - c00006&7
427 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )	// bits 3-0 -> !fffe0256, but unused?
428 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
429 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
430 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
431 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
432 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
433 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
434 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_VBLANK  )	// vblank
435 
436 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )
437 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
438 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )	// tested!
439 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
440 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
441 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
442 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
443 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )	// tested!
444 
445 INPUT_PORTS_END
446 
447 
448 
449 /***************************************************************************
450 								Sengoku Ace
451 ***************************************************************************/
452 
453 INPUT_PORTS_START( sngkace )
454 
455 	PORT_START	// IN0 - c00000&1
456 	PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_START2                       )
457 	PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON3        | IPF_PLAYER2 )
458 	PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER2 )
459 	PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER2 )
460 	PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 )
461 	PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
462 	PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 )
463 	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 )
464 
465 	PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_START1                       )
466 	PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_BUTTON3        | IPF_PLAYER1 )
467 	PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_BUTTON2        | IPF_PLAYER1 )
468 	PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_BUTTON1        | IPF_PLAYER1 )
469 	PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 )
470 	PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
471 	PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
472 	PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
473 
474 	PORT_START	// IN1 - c00004&5
475 	PORT_DIPNAME( 0x0001, 0x0001, "Unknown 2-0" )
476 	PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
477 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
478 	PORT_DIPNAME( 0x0002, 0x0000, "Sound" )
479 	PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
480 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
481 	PORT_DIPNAME( 0x000c, 0x000c, "?Difficulty?" )
482 	PORT_DIPSETTING(      0x0008, "0" )
483 	PORT_DIPSETTING(      0x000c, "1" )
484 	PORT_DIPSETTING(      0x0004, "2" )
485 	PORT_DIPSETTING(      0x0000, "3" )
486 	PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Lives ) )
487 	PORT_DIPSETTING(      0x0020, "1" )
488 	PORT_DIPSETTING(      0x0010, "2" )
489 	PORT_DIPSETTING(      0x0030, "3" )
490 	PORT_DIPSETTING(      0x0000, "4" )
491 	PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Bonus_Life ) )
492 	PORT_DIPSETTING(      0x0040, "400K" )
493 	PORT_DIPSETTING(      0x0000, "600K" )
494 	PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
495 
496 	PORT_DIPNAME( 0x0100, 0x0100, "Credits/Coinage" )	// [Free Play] on all for free play
497 	PORT_DIPSETTING(      0x0100, "A+B/A&B" )
498 	PORT_DIPSETTING(      0x0000, "A&B/A [Free Play]" )
499 	PORT_DIPNAME( 0x0e00, 0x0e00, DEF_STR( Coin_A ) )
500 	PORT_DIPSETTING(      0x0a00, DEF_STR( 3C_1C ) )
501 	PORT_DIPSETTING(      0x0c00, DEF_STR( 2C_1C ) )
502 	PORT_DIPSETTING(      0x0e00, DEF_STR( 1C_1C ) )
503 	PORT_DIPSETTING(      0x0800, DEF_STR( 1C_2C ) )
504 	PORT_DIPSETTING(      0x0600, DEF_STR( 1C_3C ) )
505 	PORT_DIPSETTING(      0x0400, DEF_STR( 1C_4C ) )
506 	PORT_DIPSETTING(      0x0200, DEF_STR( 1C_5C ) )
507 	PORT_DIPSETTING(      0x0000, "1C 6C [Free Play]" )
508 	PORT_DIPNAME( 0x7000, 0x7000, DEF_STR( Coin_B ) )
509 	PORT_DIPSETTING(      0x5000, DEF_STR( 3C_1C ) )
510 	PORT_DIPSETTING(      0x6000, DEF_STR( 2C_1C ) )
511 	PORT_DIPSETTING(      0x7000, DEF_STR( 1C_1C ) )
512 	PORT_DIPSETTING(      0x4000, DEF_STR( 1C_2C ) )
513 	PORT_DIPSETTING(      0x3000, DEF_STR( 1C_3C ) )
514 	PORT_DIPSETTING(      0x2000, DEF_STR( 1C_4C ) )
515 	PORT_DIPSETTING(      0x1000, DEF_STR( 1C_5C ) )
516 	PORT_DIPSETTING(      0x0000, "1C 6C [Free Play]" )
517 	PORT_DIPNAME( 0x8000, 0x8000, "Force 1C 1C" )
518 	PORT_DIPSETTING(      0x8000, DEF_STR( No ) )
519 	PORT_DIPSETTING(      0x0000, "Yes   [Free Play]" )
520 
521 	PORT_START	// IN2 - c00008&9
522 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1    )
523 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2    )
524 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
525 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
526 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
527 	PORT_BITX(0x0020, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
528 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_TILT     )
529 /*	PORT_BIT( 0x0080,  From Sound CPU here ) */
530 
531 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )	// unused?
532 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
533 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
534 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
535 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
536 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
537 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
538 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
539 
540 	PORT_START	// IN3
541 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK  )	// vblank
542 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )	// unused?
543 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
544 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
545 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
546 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
547 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
548 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
549 
550 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN )	// unused?
551 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
552 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
553 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
554 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
555 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
556 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
557 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
558 
559 INPUT_PORTS_END
560 
561 
562 
563 
564 
565 
566 /***************************************************************************
567 
568 
569 								Gfx Layouts
570 
571 
572 ***************************************************************************/
573 
574 static struct GfxLayout layout_16x16x4 =
575 {
576 	16,16,
577 	RGN_FRAC(1,1),
578 	4,
579 	{0,1,2,3},
580 	{2*4,3*4,0*4,1*4,6*4,7*4,4*4,5*4,
581 	 10*4,11*4,8*4,9*4,14*4,15*4,12*4,13*4},
582 	{0*64,1*64,2*64,3*64,4*64,5*64,6*64,7*64,
583 	 8*64,9*64,10*64,11*64,12*64,13*64,14*64,15*64},
584 	16*16*4
585 };
586 
587 /***************************************************************************
588 								Sengoku Ace
589 ***************************************************************************/
590 
591 static struct GfxDecodeInfo sngkace_gfxdecodeinfo[] =
592 {
593 	{ REGION_GFX1, 0, &layout_16x16x4, 0x000, 0x20 }, // [0] Sprites
594 	{ REGION_GFX2, 0, &layout_16x16x4, 0x800, 0x08 }, // [1] Layer 0
595 	{ REGION_GFX3, 0, &layout_16x16x4, 0xc00, 0x08 }, // [2] Layer 1
596 	{ -1 }
597 };
598 
599 
600 
601 /***************************************************************************
602 
603 
604 								Machine Drivers
605 
606 
607 ***************************************************************************/
608 
sound_irq(int irq)609 static void sound_irq( int irq )
610 {
611 	cpu_set_irq_line(1,0,irq ? ASSERT_LINE : CLEAR_LINE);
612 }
613 
614 
615 /***************************************************************************
616 								Gun Bird
617 ***************************************************************************/
618 
619 
620 struct YM2610interface gunbird_ym2610_interface =
621 {
622 	1,
623 	8000000,	/* ? */
624 	{ MIXERG(30,MIXER_GAIN_4x,MIXER_PAN_CENTER) },
625 	{ 0 },	/* A_r */
626 	{ 0 },	/* B_r */
627 	{ 0 },	/* A_w */
628 	{ 0 },	/* B_w */
629 	{ sound_irq },	/* irq */
630 	{ REGION_SOUND1 },	/* delta_t */
631 	{ REGION_SOUND2 },	/* adpcm */
632 	{ YM3012_VOL(50,MIXER_PAN_LEFT,50,MIXER_PAN_RIGHT) }
633 };
634 
635 static struct MachineDriver machine_driver_gunbird =
636 {
637 	{
638 		{
639 			CPU_M68EC020,
640 //			16000000,
641 32000000,	/* 16 MHz - bumped because the game slows down
642 			   (the 020 core timing has to be tuned up, I guess) */
643 			sngkace_readmem,sngkace_writemem,0,0,
644 			m68_level1_irq, 1
645 		},
646 		{
647 			CPU_Z80 | CPU_AUDIO_CPU,	/* ! LZ8420M (Z80 core) ! */
648 			4000000,	/* ? */
649 			gunbird_sound_readmem,  gunbird_sound_writemem,
650 			gunbird_sound_readport, gunbird_sound_writeport,
651 			ignore_interrupt, 1		/* */
652 		}
653 	},
654 	60,DEFAULT_REAL_60HZ_VBLANK_DURATION,	// we're using IPT_VBLANK
655 	1,
656 	0,
657 
658 	/* video hardware */
659 	320, 256, { 0, 320-1, 0, 256-32-1 },
660 	sngkace_gfxdecodeinfo,
661 	0x1000, 0x1000,
662 	0,
663 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
664 	0,
665 	psikyo_vh_start,
666 	0,
667 	psikyo_vh_screenrefresh,
668 
669 	/* sound hardware */
670 	SOUND_SUPPORTS_STEREO,0,0,0,
671 	{
672 		{
673 			SOUND_YM2610,				/* ! YMF286-K ! */
674 			&gunbird_ym2610_interface,
675 		},
676 	}
677 };
678 
679 
680 
681 
682 
683 /***************************************************************************
684 								Sengoku Ace
685 ***************************************************************************/
686 
687 
688 struct YM2610interface sngkace_ym2610_interface =
689 {
690 	1,
691 	8000000,	/* ? */
692 	{ MIXERG(30,MIXER_GAIN_4x,MIXER_PAN_CENTER) },
693 	{ 0 },	/* A_r */
694 	{ 0 },	/* B_r */
695 	{ 0 },	/* A_w */
696 	{ 0 },	/* B_w */
697 	{ sound_irq },	/* irq */
698 	{ REGION_SOUND1 },	/* delta_t */
699 	{ REGION_SOUND1 },	/* adpcm */
700 	{ YM3012_VOL(50,MIXER_PAN_LEFT,50,MIXER_PAN_RIGHT) }
701 };
702 
703 static struct MachineDriver machine_driver_sngkace =
704 {
705 	{
706 		{
707 			CPU_M68EC020,
708 //			16000000,
709 32000000,	/* 16 MHz - bumped because the game slows down
710 			   (the 020 core timing has to be tuned up, I guess) */
711 			sngkace_readmem,sngkace_writemem,0,0,
712 			m68_level1_irq, 1
713 		},
714 		{
715 			CPU_Z80 | CPU_AUDIO_CPU,
716 			4000000,	/* ? */
717 			sngkace_sound_readmem,  sngkace_sound_writemem,
718 			sngkace_sound_readport, sngkace_sound_writeport,
719 			ignore_interrupt, 1		/* NMI caused by main CPU, IRQ by the YM2610 */
720 		}
721 	},
722 	60,DEFAULT_REAL_60HZ_VBLANK_DURATION,	// we're using IPT_VBLANK
723 	1,
724 	0,
725 
726 	/* video hardware */
727 	320, 256, { 0, 320-1, 0, 256-32-1 },
728 	sngkace_gfxdecodeinfo,
729 	0x1000, 0x1000,
730 	0,
731 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
732 	0,
733 	psikyo_vh_start,
734 	0,
735 	psikyo_vh_screenrefresh,
736 
737 	/* sound hardware */
738 	SOUND_SUPPORTS_STEREO,0,0,0,
739 	{
740 		{
741 			SOUND_YM2610,
742 			&sngkace_ym2610_interface,
743 		},
744 	}
745 };
746 
747 
748 /***************************************************************************
749 						Strikers 1945 / Sengoku Blade
750 ***************************************************************************/
751 
752 
753 struct YM2610interface s1945_ym2610_interface =
754 {
755 	1,
756 	8000000,	/* ? */
757 	{ MIXERG(30,MIXER_GAIN_4x,MIXER_PAN_CENTER) },
758 	{ 0 },	/* A_r */
759 	{ 0 },	/* B_r */
760 	{ 0 },	/* A_w */
761 	{ 0 },	/* B_w */
762 	{ sound_irq },	/* irq */
763 	{ REGION_SOUND1 },	/* delta_t */
764 	{ REGION_SOUND1 },	/* adpcm */
765 	{ YM3012_VOL(50,MIXER_PAN_LEFT,50,MIXER_PAN_RIGHT) }
766 };
767 
768 static struct MachineDriver machine_driver_s1945 =
769 {
770 	{
771 		{
772 			CPU_M68EC020,
773 			16000000,
774 			sngkace_readmem,sngkace_writemem,0,0,
775 			m68_level1_irq, 1
776 		},
777 		{
778 			CPU_Z80 | CPU_AUDIO_CPU,	/* ! LZ8420M (Z80 core) ! */
779 			4000000,	/* ? */
780 			gunbird_sound_readmem, gunbird_sound_writemem,
781 			s1945_sound_readport,  s1945_sound_writeport,
782 			ignore_interrupt, 1		/* */
783 		}
784 
785 		/* MCU should go here */
786 
787 	},
788 	60,DEFAULT_REAL_60HZ_VBLANK_DURATION,	// we're using IPT_VBLANK
789 	1,
790 	0,
791 
792 	/* video hardware */
793 	320, 256, { 0, 320-1, 0, 256-32-1 },
794 	sngkace_gfxdecodeinfo,
795 	0x1000, 0x1000,
796 	0,
797 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
798 	0,
799 	psikyo_vh_start,
800 	0,
801 	psikyo_vh_screenrefresh,
802 
803 	/* sound hardware */
804 	SOUND_SUPPORTS_STEREO,0,0,0,
805 	{
806 		{
807 			SOUND_YM2610,				/* ! YMF286-K ! */
808 			&s1945_ym2610_interface,
809 		},
810 	}
811 };
812 
813 
814 
815 
816 
817 /***************************************************************************
818 
819 
820 								ROMs Loading
821 
822 
823 ***************************************************************************/
824 
825 
826 /* Untangle the 68020 code */
init_psikyo(void)827 void init_psikyo(void)
828 {
829 	unsigned char *RAM	=	memory_region(REGION_CPU1);
830 	int len				=	memory_region_length(REGION_CPU1);
831 	int i;
832 
833 	for (i = 0 ; i < len; i+=4)
834 	{
835 		unsigned char t[4];
836 		t[0]=RAM[i+0]; t[1]=RAM[i+1]; t[2]=RAM[i+2]; t[3]=RAM[i+3];
837 #ifdef MSB_FIRST
838 		RAM[i+0]=t[2]; RAM[i+1]=t[0]; RAM[i+2]=t[3]; RAM[i+3]=t[1];
839 #else
840 		RAM[i+0]=t[1]; RAM[i+1]=t[3]; RAM[i+2]=t[0]; RAM[i+3]=t[2];
841 #endif
842 	}
843 }
844 
845 
846 
847 
848 /***************************************************************************
849 
850 								Gun Bird (Japan)
851 
852 Board:	KA302C
853 CPU:	MC68EC020FG16
854 Sound:	LZ8420M (Z80 core) + YMF286-K
855 OSC:	16.000,	14.31818 MHz
856 
857 Chips:	PS2001B
858 		PS3103
859 		PS3204
860 		PS3305
861 
862 ***************************************************************************/
863 
864 ROM_START( gunbird )
865 
866 	ROM_REGION( 0x080000, REGION_CPU1 )		/* Main CPU Code */
867 	ROM_LOAD_EVEN( "1-u46.bin", 0x000000, 0x040000, 0x474abd69 ) // 1&0
868 	ROM_LOAD_ODD(  "2-u39.bin", 0x000000, 0x040000, 0x3e3e661f ) // 3&2
869 
870 	ROM_REGION( 0x030000, REGION_CPU2 )		/* Sound CPU Code */
871 	ROM_LOAD( "3-u71.bin", 0x00000, 0x20000, 0x2168e4ba )
872 	ROM_RELOAD(            0x10000, 0x20000             )
873 
874 	ROM_REGION( 0x700000, REGION_GFX1 | REGIONFLAG_DISPOSE )	/* Sprites */
875 	ROM_LOAD( "u14.bin",  0x000000, 0x200000, 0x7d7e8a00 )
876 	ROM_LOAD( "u24.bin",  0x200000, 0x200000, 0x5e3ffc9d )
877 	ROM_LOAD( "u15.bin",  0x400000, 0x200000, 0xa827bfb5 )
878 	ROM_LOAD( "u25.bin",  0x600000, 0x100000, 0xef652e0c )
879 
880 	ROM_REGION( 0x200000, REGION_GFX2 | REGIONFLAG_DISPOSE )	/* Layer 0 */
881 	ROM_LOAD( "u33.bin",  0x000000, 0x200000, 0x54494e6b )
882 
883 	ROM_REGION( 0x100000, REGION_GFX3 | REGIONFLAG_DISPOSE )	/* Layer 1 */
884 	ROM_LOAD( "u33.bin",  0x000000, 0x100000, 0x54494e6b )
885 	ROM_CONTINUE(         0x000000, 0x100000             )
886 
887 	ROM_REGION( 0x080000, REGION_SOUND1 | REGIONFLAG_SOUNDONLY )	/* DELTA-T Samples */
888 	ROM_LOAD( "u64.bin",  0x000000, 0x080000, 0xe187ed4f )
889 
890 	ROM_REGION( 0x100000, REGION_SOUND2 | REGIONFLAG_SOUNDONLY )	/* ADPCM Samples */
891 	ROM_LOAD( "u56.bin",  0x000000, 0x100000, 0x9e07104d )
892 
893 	ROM_REGION( 0x040000, REGION_USER1 )	/* Sprites LUT */
894 	ROM_LOAD( "u3.bin",  0x000000, 0x040000, 0x0905aeb2 )
895 
896 ROM_END
897 
898 
init_gunbird(void)899 void init_gunbird(void)
900 {
901 	init_psikyo();	// untangle code first!
902 
903 	/* The input ports are different */
904 	install_mem_read_handler(0, 0x00c00000, 0x00c0000b, gunbird_input_r);
905 }
906 
907 
908 
909 
910 
911 /***************************************************************************
912 
913 								Sengoku Ace
914 						  (Samurai Ace JPN Ver.)
915 
916 Board:	SH201B
917 CPU:	TMP68EC020F-16
918 Sound:	Z80A + YM2610
919 OSC:	32.000, 14.31818 MHz
920 
921 
922 fe0252.w:	country code (0 = Japan)
923 
924 ***************************************************************************/
925 
926 ROM_START( sngkace )
927 
928 	ROM_REGION( 0x080000, REGION_CPU1 )		/* Main CPU Code */
929 	ROM_LOAD_EVEN( "1-u127.bin", 0x000000, 0x040000, 0x6c45b2f8 ) // 1&0
930 	ROM_LOAD_ODD(  "2-u126.bin", 0x000000, 0x040000, 0x845a6760 ) // 3&2
931 
932 	ROM_REGION( 0x030000, REGION_CPU2 )		/* Sound CPU Code */
933 	ROM_LOAD( "3-u58.bin", 0x00000, 0x20000, 0x310f5c76 )
934 	ROM_RELOAD(            0x10000, 0x20000             )
935 
936 	ROM_REGION( 0x200000, REGION_GFX1 | REGIONFLAG_DISPOSE )	/* Sprites */
937 	ROM_LOAD( "u14.bin",  0x000000, 0x200000, 0x00a546cb )
938 
939 	ROM_REGION( 0x100000, REGION_GFX2 | REGIONFLAG_DISPOSE )	/* Layer 0 */
940 	ROM_LOAD( "u34.bin",  0x000000, 0x100000, 0xe6a75bd8 )
941 
942 	ROM_REGION( 0x100000, REGION_GFX3 | REGIONFLAG_DISPOSE )	/* Layer 1 */
943 	ROM_LOAD( "u35.bin",  0x000000, 0x100000, 0xc4ca0164 )
944 
945 //	ROM_REGION( 0x100000, REGION_SOUND1 | REGIONFLAG_SOUNDONLY )	/* Samples */
946 	ROM_REGION( 0x100000, REGION_SOUND1 )	/* Samples */
947 	ROM_LOAD( "u68.bin",  0x000000, 0x100000, 0x9a7f6c34 )
948 
949 	ROM_REGION( 0x040000, REGION_USER1 )	/* Sprites LUT */
950 	ROM_LOAD( "u11.bin",  0x000000, 0x040000, 0x11a04d91 ) // x1xxxxxxxxxxxxxxxx = 0xFF
951 
952 ROM_END
953 
954 
init_sngkace(void)955 void init_sngkace(void)
956 {
957 	unsigned char *RAM	=	memory_region(REGION_SOUND1);
958 	int len				=	memory_region_length(REGION_SOUND1);
959 	int i;
960 
961 	/* Bit 6&7 of the samples are swapped. Naughty, naughty... */
962 	for (i=0;i<len;i++)
963 	{
964 		int x = RAM[i];
965 		RAM[i] = ((x & 0x40) << 1) | ((x & 0x80) >> 1) | (x & 0x3f);
966 	}
967 
968 	init_psikyo();	// untangle code first!
969 }
970 
971 
972 /***************************************************************************
973 
974 								Sengoku Blade
975 							  (Tengai JPN Ver.)
976 
977 Board:	SH404
978 CPU:	MC68EC020FG16
979 Sound:	LZ8420M (Z80 core)
980 		YMF278B-F
981 OSC:	16.000MHz
982 		14.3181MHz
983 		33.8688MHz (YMF)
984 		4.000MHz (PIC)
985 Chips:	PS2001B
986 		PS3103
987 		PS3204
988 		PS3305
989 
990 4-U59      security (PIC16C57; not dumped)
991 
992 ***************************************************************************/
993 
994 ROM_START( sngkblad )
995 
996 	ROM_REGION( 0x100000, REGION_CPU1 )		/* Main CPU Code */
997 	ROM_LOAD_EVEN( "2-u40.bin", 0x000000, 0x080000, 0xab6fe58a ) // 1&0
998 	ROM_LOAD_ODD(  "3-u41.bin", 0x000000, 0x080000, 0x02e42e39 ) // 3&2
999 
1000 	ROM_REGION( 0x030000, REGION_CPU2 )		/* Sound CPU Code */
1001 	ROM_LOAD( "1-u63.bin", 0x00000, 0x20000, 0x2025e387 )
1002 	ROM_RELOAD(            0x10000, 0x20000             )
1003 
1004 	ROM_REGION( 0x000100, REGION_CPU3 )		/* MCU? */
1005 	ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, 0x00000000 )
1006 
1007 	ROM_REGION( 0x600000, REGION_GFX1 | REGIONFLAG_DISPOSE )	/* Sprites */
1008 	ROM_LOAD_GFX_SWAP( "u20.bin",  0x000000, 0x200000, 0xed42ef73 )
1009 	ROM_LOAD_GFX_SWAP( "u21.bin",  0x200000, 0x200000, 0xefe34eed )
1010 	ROM_LOAD_GFX_SWAP( "u22.bin",  0x400000, 0x200000, 0x8d21caee )
1011 
1012 	ROM_REGION( 0x400000, REGION_GFX2 | REGIONFLAG_DISPOSE )	/* Layer 0 */
1013 	ROM_LOAD_GFX_SWAP( "u34.bin",  0x000000, 0x400000, 0x2a2e2eeb )
1014 
1015 	ROM_REGION( 0x200000, REGION_GFX3 | REGIONFLAG_DISPOSE )	/* Layer 1 */
1016 	ROM_LOAD_GFX_SWAP( "u34.bin",  0x000000, 0x200000, 0x2a2e2eeb )
1017 	ROM_LOAD_GFX_SWAP( 0,          0x000000, 0x200000, 0          )	/* CONTINUE */
1018 
1019 	ROM_REGION( 0x400000, REGION_SOUND1 | REGIONFLAG_SOUNDONLY )	/* Samples */
1020 	ROM_LOAD( "u61.bin",  0x000000, 0x200000, 0xa63633c5 )	// 8 bit signed pcm (16KHz)
1021 	ROM_LOAD( "u62.bin",  0x200000, 0x200000, 0x3ad0c357 )
1022 
1023 	ROM_REGION( 0x040000, REGION_USER1 )	/* Sprites LUT */
1024 	ROM_LOAD( "u1.bin",  0x000000, 0x040000, 0x681d7d55 )
1025 
1026 ROM_END
1027 
init_sngkblad(void)1028 void init_sngkblad(void)
1029 {
1030 	unsigned char *RAM	= memory_region(REGION_CPU1);
1031 
1032 	init_psikyo();	// untangle code first!
1033 
1034 	WRITE_WORD(&RAM[0x1a34c], 0x4e71);	// protection check -> NOP
1035 
1036 	/* The input ports are different */
1037 	install_mem_read_handler(0, 0x00c00000, 0x00c0000b, s1945_input_r);
1038 
1039 	/* protection */
1040 	install_mem_write_handler(0, 0x00c00006, 0x00c0000b, MWA_NOP);
1041 
1042 }
1043 
1044 
1045 
1046 
1047 /***************************************************************************
1048 
1049 							Strikers 1945 (Japan)
1050 
1051 Board:	SH404
1052 CPU:	MC68EC020FG16
1053 Sound:	LZ8420M (Z80 core)
1054 		YMF278B-F
1055 OSC:	16.000MHz
1056 		14.3181MHz
1057 		33.8688MHz (YMF)
1058 		4.000MHz (PIC)
1059 
1060 Chips:	PS2001B
1061 		PS3103
1062 		PS3204
1063 		PS3305
1064 
1065 
1066 1-U59      security (PIC16C57; not dumped)
1067 
1068 ***************************************************************************/
1069 
1070 ROM_START( s1945 )
1071 
1072 	ROM_REGION( 0x080000, REGION_CPU1 )		/* Main CPU Code */
1073 	ROM_LOAD_EVEN( "1-u40.bin", 0x000000, 0x040000, 0xc00eb012 ) // 1&0
1074 	ROM_LOAD_ODD(  "2-u41.bin", 0x000000, 0x040000, 0x3f5a134b ) // 3&2
1075 
1076 	ROM_REGION( 0x030000, REGION_CPU2 )		/* Sound CPU Code */
1077 	ROM_LOAD( "3-u63.bin", 0x00000, 0x20000, 0x42d40ae1 )
1078 	ROM_RELOAD(            0x10000, 0x20000             )
1079 
1080 	ROM_REGION( 0x000100, REGION_CPU3 )		/* MCU? */
1081 	ROM_LOAD( "4-u59.bin", 0x00000, 0x00100, 0x00000000 )
1082 
1083 	ROM_REGION( 0x800000, REGION_GFX1 | REGIONFLAG_DISPOSE )	/* Sprites */
1084 	ROM_LOAD( "u20.bin",  0x000000, 0x200000, 0x28a27fee )
1085 	ROM_LOAD( "u21.bin",  0x200000, 0x200000, 0xc5d60ea9 )
1086 	ROM_LOAD( "u22.bin",  0x400000, 0x200000, 0xca152a32 )
1087 	ROM_LOAD( "u23.bin",  0x600000, 0x200000, 0x48710332 )
1088 
1089 	ROM_REGION( 0x200000, REGION_GFX2 | REGIONFLAG_DISPOSE )	/* Layer 0 */
1090 	ROM_LOAD( "u34.bin",  0x000000, 0x200000, 0xaaf83e23 )
1091 
1092 	ROM_REGION( 0x100000, REGION_GFX3 | REGIONFLAG_DISPOSE )	/* Layer 1 */
1093 	ROM_LOAD( "u34.bin",  0x000000, 0x100000, 0xaaf83e23 )
1094 	ROM_CONTINUE(         0x000000, 0x100000             )
1095 
1096 	ROM_REGION( 0x200000, REGION_SOUND1 | REGIONFLAG_SOUNDONLY )	/* Samples */
1097 	ROM_LOAD( "u61.bin",  0x000000, 0x200000, 0xa839cf47 )	// 8 bit signed pcm (16KHz)
1098 
1099 	ROM_REGION( 0x040000, REGION_USER1 )	/* */
1100 	ROM_LOAD( "u1.bin",  0x000000, 0x040000, 0xdee22654 )
1101 
1102 ROM_END
1103 
1104 
init_s1945(void)1105 void init_s1945(void)
1106 {
1107 	unsigned char *RAM	= memory_region(REGION_CPU1);
1108 
1109 	init_psikyo();	// untangle code first!
1110 
1111 	WRITE_WORD(&RAM[0x19568], 0x4e71);	// protection check -> NOP
1112 //	WRITE_WORD(&RAM[0x1994c], 0x4e75);	// JSR $400 -> RTS
1113 
1114 	/* The input ports are different */
1115 	install_mem_read_handler(0, 0x00c00000, 0x00c0000b, s1945_input_r);
1116 
1117 	/* protection */
1118 	install_mem_write_handler(0, 0x00c00006, 0x00c0000b, MWA_NOP);
1119 
1120 }
1121 
1122 
1123 
1124 
1125 /***************************************************************************
1126 
1127 
1128 								Game Drivers
1129 
1130 
1131 ***************************************************************************/
1132 
1133 GAMEX( 1993, sngkace,  0, sngkace,  sngkace,  sngkace,  ROT270, "Psikyo", "Sengoku Ace (Japan)",   GAME_NO_COCKTAIL ) // Banpresto?
1134 GAMEX( 1994, gunbird,  0, gunbird,  gunbird,  gunbird,  ROT270, "Psikyo", "Gun Bird (Japan)",      GAME_NO_COCKTAIL )
1135 GAMEX( 1995, s1945,    0, s1945,    gunbird,  s1945,    ROT270, "Psikyo", "Strikers 1945 (Japan)", GAME_NOT_WORKING )
1136 GAMEX( 1996, sngkblad, 0, s1945,    gunbird,  sngkblad, ROT0,   "Psikyo", "Sengoku Blade (Japan)", GAME_NOT_WORKING )
1137