1 /***************************************************************************
2 
3 Slapshot (c) Taito 1994
4 Operation Wolf 3 (c) Taito 1994
5 --------
6 
7 David Graves
8 
9 (this is based on the F2 driver by Bryan McPhail, Brad Oliver, Andrew Prime,
10 Nicola Salmoria.)
11 
12 				*****
13 
14 Slapshot uses one or two newer Taito custom ics, but the hardware is
15 very similar to the Taito F2 system, especially F2 games using the same
16 TC0480SCP tilemap generator (e.g. Metal Black).
17 
18 This game has 6 separate layers of graphics - four 32x32 tiled scrolling
19 zoomable background planes of 16x16 tiles, a text plane with 64x64 8x8
20 character tiles with character definitions held in ram, and a sprite
21 plane with zoomable 16x16 sprites. This sprite system appears to be
22 identical to the one used in F2 and F3 games.
23 
24 Slapshot switches in and out of the double-width tilemap mode of the
25 TC0480SCP. This is unusual, as most games stick to one width.
26 
27 The palette generator is 8 bits per color gun like the Taito F3 system.
28 Like Metal Black the palette space is doubled, and the first half used
29 for sprites only so the second half can be devoted to tilemaps.
30 
31 The main cpu is a 68000.
32 
33 There is a slave Z80 which interfaces with a YM2610B for sound.
34 Commands are written to it by the 68000 (as in the Taito F2 games).
35 
36 
37 Slapshot custom ics
38 -------------------
39 
40 TC0480SCP (IC61)	- known tilemap chip
41 TC0640FIO (IC83)	- new version of TC0510NIO io chip?
42 TC0650FDA (IC84)	- (palette?)
43 TC0360PRI (IC56)	- (common in pri/color combo on F2 boards)
44 TC0530SYC (IC58)	- known sound comm chip
45 TC0520TBC (IC36)	- known object chip
46 TC0540OBN (IC54)	- known object chip
47 
48 
49 TODO
50 ====
51 
52 Some hanging notes (try F2 while music is playing).
53 
54 Sprite colors issue: when you do a super-shot, on the cut
55 screen the man (it's always the American) should be black.
56 
57 Col $f8 is used for the man, col $fc for the red/pink
58 "explosion" under the puck. (Use this to track where they are
59 in spriteram quickly.) Both of these colors are only set
60 when the first super-shot happens, so it's clear those
61 colors are for the super-shot... but screenshot evidence
62 proves the man should be entirely black.
63 
64 Extract common sprite stuff from this and taito_f2 ?
65 
66 
67 Code
68 ----
69 $854 marks start of service mode
70 
71 -----------------
72 
73 Operation Wolf 3 is on almost identical hardware to Slapshot. It uses
74 far more graphics data and samples than Slapshot.
75 
76 Compared to Taito's gun game Under Fire (1993), the hardware here is
77 obviously underpowered. Large data roms help the 68000 throw around the
78 gfx (a method used in Dino Rex) but can't disguise that it should have
79 been done using enhanced Z system or F3 system hardware.
80 
81 ***************************************************************************
82 
83 Operation Wolf 3 (US Version) - (c) 1994 Taito America Corp.
84 
85 Main Board K11E0801A - Not to Scale:-)
86 
87        D74 17                       Sub Board Connector
88   D74 20      MC68000P12F                                    D74-05     SW2
89        D74 18                                                D74-06
90   D74 16         MK48T08B-10        TCO480SCP                84256A-70L
91                                                              84256A-70L
92 MB8421-90LP  D74-02  84256A-70L             26.6860MHz  TCO640FIO
93              D74-03  84256A-70L
94              D74-04
95                      TCO540OBN    TCO360PRI              TCO650FDA
96                  TCO520TBC
97                                     32.0000MHz    Y3016-F
98                D74-01     TCO530SYC     D74 19    YM2610B
99                                                   Z0840004PSC
100 
101 
102 
103 Sub Board K91X0488A
104  Basicly a few connectors, Caps, resistors & ADC0809CNN
105 
106 Chips:
107  Main: MC68000P12F
108 Sound: Z084004PSC, YM2610B, Y3016-F
109   OSC: 32.000MHz, 26.6860MHz
110 
111 Taito Custom:
112   TCO480SCP
113   TCO640FIO
114   TCO650FDA
115   TCO530SYC
116   TCO520TBC
117   TCO540OBN
118   TCO360PRI
119 
120 ST TimeKeeper Ram MK48T08B-10 - Lithuim Batery backed RAM chip
121 MB8421-90LP - Dual Port SRAM
122 ADC0809CNN - 8-bit Microprocessor Compatible A/D Converter
123              With 8-Channel Multiplexer
124  DataSheet:  http://www.national.com/ds/AD/ADC0808.pdf
125 
126 Region byte at offset 0x031:
127 	d74_21.1  0x02	World Version
128 	d74_20.1  0x01	US Version
129 	d74_??.1  0x00	Will Produce a Japanese Version, but it's unknown if the
130 					actual sound CPU code is the same as the World version,
131 					US versions or different then both.
132 ***************************************************************************/
133 
134 #include "driver.h"
135 #include "state.h"
136 #include "cpu/m68000/m68000.h"
137 #include "vidhrdw/generic.h"
138 #include "vidhrdw/taitoic.h"
139 #include "sndhrdw/taitosnd.h"
140 
141 
142 VIDEO_EOF( opwolf3_full_buffer_delayed );
143 VIDEO_EOF( taito_no_buffer );
144 VIDEO_START( slapshot );
145 VIDEO_UPDATE( slapshot );
146 
147 static data16_t *color_ram;
148 
149 extern data16_t *taito_sprite_ext;
150 extern size_t taito_spriteext_size;
151 
152 
153 /******************************************************
154 				COLOR
155 ******************************************************/
156 
READ16_HANDLER(color_ram_word_r)157 static READ16_HANDLER( color_ram_word_r )
158 {
159 	return color_ram[offset];
160 }
161 
WRITE16_HANDLER(color_ram_word_w)162 static WRITE16_HANDLER( color_ram_word_w )
163 {
164 	int r,g,b;
165 	COMBINE_DATA(&color_ram[offset]);
166 
167 	if ((offset % 2) == 1)	/* assume words written sequentially */
168 	{
169 		r = (color_ram[offset-1] &0xff);
170 		g = (color_ram[offset] &0xff00) >> 8;
171 		b = (color_ram[offset] &0xff);
172 
173 		palette_set_color(offset/2,r,g,b);
174 	}
175 }
176 
177 
178 /***********************************************************
179 				INTERRUPTS
180 ***********************************************************/
181 
slapshot_interrupt6(int x)182 void slapshot_interrupt6(int x)
183 {
184 	cpu_set_irq_line(0,6,HOLD_LINE);
185 }
186 
187 
INTERRUPT_GEN(slapshot_interrupt)188 static INTERRUPT_GEN( slapshot_interrupt )
189 {
190 	timer_set(TIME_IN_CYCLES(200000-500,0),0, slapshot_interrupt6);
191 	cpu_set_irq_line(0,5,HOLD_LINE);
192 }
193 
194 
195 /**********************************************************
196 				GAME INPUTS
197 **********************************************************/
198 
READ16_HANDLER(slapshot_service_input_r)199 static READ16_HANDLER( slapshot_service_input_r )
200 {
201 	switch (offset)
202 	{
203 		case 0x03:
204 			return ((input_port_3_word_r(0,0) & 0xef) |
205 				  (input_port_5_word_r(0,0) & 0x10))  << 8;	/* IN3 + service switch */
206 
207 		default:
208 			return TC0640FIO_r(offset) << 8;
209 	}
210 }
211 
READ16_HANDLER(opwolf3_service_input_r)212 static READ16_HANDLER( opwolf3_service_input_r )
213 {
214 	switch (offset)
215 	{
216 		case 0x03:
217 			return ((input_port_3_word_r(0,0) & 0xef) |
218 				  (input_port_5_word_r(0,0) & 0x10))  << 8;	/* IN3 + service switch */
219 
220 		default:
221 			return TC0640FIO_r(offset) << 8;
222 	}
223 }
224 
READ16_HANDLER(opwolf3_adc_r)225 static READ16_HANDLER( opwolf3_adc_r )
226 {
227 	return readinputport(6 + offset)<<8;
228 }
229 
WRITE16_HANDLER(opwolf3_adc_req_w)230 static WRITE16_HANDLER( opwolf3_adc_req_w )
231 {
232 	/* 4 writes a frame - one for each analogue port */
233 	cpu_set_irq_line(0,3,HOLD_LINE);
234 }
235 
236 /*****************************************************
237 				SOUND
238 *****************************************************/
239 
240 static int banknum = -1;
241 
reset_sound_region(void)242 static void reset_sound_region(void)
243 {
244 	cpu_setbank( 10, memory_region(REGION_CPU2) + (banknum * 0x4000) + 0x10000 );
245 }
246 
WRITE_HANDLER(sound_bankswitch_w)247 static WRITE_HANDLER( sound_bankswitch_w )
248 {
249 	banknum = (data - 1) & 7;
250 	reset_sound_region();
251 }
252 
WRITE16_HANDLER(slapshot_msb_sound_w)253 static WRITE16_HANDLER( slapshot_msb_sound_w )
254 {
255 	if (offset == 0)
256 		taitosound_port_w (0,(data >> 8) & 0xff);
257 	else if (offset == 1)
258 		taitosound_comm_w (0,(data >> 8) & 0xff);
259 
260 #ifdef MAME_DEBUG
261 	if (data & 0xff)
262 		usrintf_showmessage("taito_msb_sound_w to low byte: %04x",data);
263 #endif
264 }
265 
READ16_HANDLER(slapshot_msb_sound_r)266 static READ16_HANDLER( slapshot_msb_sound_r )
267 {
268 	if (offset == 1)
269 		return ((taitosound_comm_r (0) & 0xff) << 8);
270 	else return 0;
271 }
272 
273 
274 /***********************************************************
275 			 MEMORY STRUCTURES
276 ***********************************************************/
277 
MEMORY_READ16_START(slapshot_readmem)278 static MEMORY_READ16_START( slapshot_readmem )
279 	{ 0x000000, 0x0fffff, MRA16_ROM },
280 	{ 0x500000, 0x50ffff, MRA16_RAM },	/* main RAM */
281 	{ 0x600000, 0x60ffff, MRA16_RAM },	/* sprite ram */
282 	{ 0x700000, 0x701fff, MRA16_RAM },	/* debugging */
283 	{ 0x800000, 0x80ffff, TC0480SCP_word_r },	/* tilemaps */
284 	{ 0x830000, 0x83002f, TC0480SCP_ctrl_word_r },
285 	{ 0x900000, 0x907fff, color_ram_word_r },	/* 8bpg palette */
286 	{ 0xa00000, 0xa03fff, MRA16_RAM },	/* nvram (only low bytes used) */
287 	{ 0xc00000, 0xc0000f, TC0640FIO_halfword_byteswap_r },
288 	{ 0xc00020, 0xc0002f, slapshot_service_input_r },	/* service mirror */
289 	{ 0xd00000, 0xd00003, slapshot_msb_sound_r },
290 MEMORY_END
291 
292 static MEMORY_WRITE16_START( slapshot_writemem )
293 	{ 0x000000, 0x0fffff, MWA16_ROM },
294 	{ 0x500000, 0x50ffff, MWA16_RAM },
295 	{ 0x600000, 0x60ffff, MWA16_RAM, &spriteram16, &spriteram_size },
296 	{ 0x700000, 0x701fff, MWA16_RAM, &taito_sprite_ext, &taito_spriteext_size },
297 	{ 0x800000, 0x80ffff, TC0480SCP_word_w },	  /* tilemaps */
298 	{ 0x830000, 0x83002f, TC0480SCP_ctrl_word_w },
299 	{ 0x900000, 0x907fff, color_ram_word_w, &color_ram },
300 	{ 0xa00000, 0xa03fff, MWA16_RAM, (data16_t **)&generic_nvram, &generic_nvram_size },
301 	{ 0xb00000, 0xb0001f, TC0360PRI_halfword_swap_w },	/* priority chip */
302 	{ 0xc00000, 0xc0000f, TC0640FIO_halfword_byteswap_w },
303 	{ 0xd00000, 0xd00003, slapshot_msb_sound_w },
304 MEMORY_END
305 
306 static MEMORY_READ16_START( opwolf3_readmem )
307 	{ 0x000000, 0x1fffff, MRA16_ROM },
308 	{ 0x500000, 0x50ffff, MRA16_RAM },	/* main RAM */
309 	{ 0x600000, 0x60ffff, MRA16_RAM },	/* sprite ram */
310 	{ 0x700000, 0x701fff, MRA16_RAM },	/* debugging */
311 	{ 0x800000, 0x80ffff, TC0480SCP_word_r },	/* tilemaps */
312 	{ 0x830000, 0x83002f, TC0480SCP_ctrl_word_r },
313 	{ 0x900000, 0x907fff, color_ram_word_r },	/* 8bpg palette */
314 	{ 0xa00000, 0xa03fff, MRA16_RAM },	/* nvram (only low bytes used) */
315 	{ 0xc00000, 0xc0000f, TC0640FIO_halfword_byteswap_r },
316 	{ 0xc00020, 0xc0002f, slapshot_service_input_r },	/* service mirror */
317 	{ 0xd00000, 0xd00003, slapshot_msb_sound_r },
318 	{ 0xe00000, 0xe00007, opwolf3_adc_r },
319 MEMORY_END
320 
321 static MEMORY_WRITE16_START( opwolf3_writemem )
322 	{ 0x000000, 0x1fffff, MWA16_ROM },
323 	{ 0x500000, 0x50ffff, MWA16_RAM },
324 	{ 0x600000, 0x60ffff, MWA16_RAM, &spriteram16, &spriteram_size },
325 	{ 0x700000, 0x701fff, MWA16_RAM, &taito_sprite_ext, &taito_spriteext_size },
326 	{ 0x800000, 0x80ffff, TC0480SCP_word_w },	  /* tilemaps */
327 	{ 0x830000, 0x83002f, TC0480SCP_ctrl_word_w },
328 	{ 0x900000, 0x907fff, color_ram_word_w, &color_ram },
329 	{ 0xa00000, 0xa03fff, MWA16_RAM, (data16_t **)&generic_nvram, &generic_nvram_size },
330 	{ 0xb00000, 0xb0001f, TC0360PRI_halfword_swap_w },	/* priority chip */
331 	{ 0xc00000, 0xc0000f, TC0640FIO_halfword_byteswap_w },
332 	{ 0xd00000, 0xd00003, slapshot_msb_sound_w },
333 	{ 0xe00000, 0xe00007, opwolf3_adc_req_w },
334 MEMORY_END
335 
336 /***************************************************************************/
337 
338 static MEMORY_READ_START( z80_sound_readmem )
339 	{ 0x0000, 0x3fff, MRA_ROM },
340 	{ 0x4000, 0x7fff, MRA_BANK10 },
341 	{ 0xc000, 0xdfff, MRA_RAM },
342 	{ 0xe000, 0xe000, YM2610_status_port_0_A_r },
343 	{ 0xe001, 0xe001, YM2610_read_port_0_r },
344 	{ 0xe002, 0xe002, YM2610_status_port_0_B_r },
345 	{ 0xe200, 0xe200, MRA_NOP },
346 	{ 0xe201, 0xe201, taitosound_slave_comm_r },
347 	{ 0xea00, 0xea00, MRA_NOP },
348 MEMORY_END
349 
350 static MEMORY_WRITE_START( z80_sound_writemem )
351 	{ 0x0000, 0x7fff, MWA_ROM },
352 	{ 0xc000, 0xdfff, MWA_RAM },
353 	{ 0xe000, 0xe000, YM2610_control_port_0_A_w },
354 	{ 0xe001, 0xe001, YM2610_data_port_0_A_w },
355 	{ 0xe002, 0xe002, YM2610_control_port_0_B_w },
356 	{ 0xe003, 0xe003, YM2610_data_port_0_B_w },
357 	{ 0xe200, 0xe200, taitosound_slave_port_w },
358 	{ 0xe201, 0xe201, taitosound_slave_comm_w },
359 	{ 0xe400, 0xe403, MWA_NOP }, /* pan */
360 	{ 0xee00, 0xee00, MWA_NOP }, /* ? */
361 	{ 0xf000, 0xf000, MWA_NOP }, /* ? */
362 	{ 0xf200, 0xf200, sound_bankswitch_w },
363 MEMORY_END
364 
365 
366 /***********************************************************
367 			 INPUT PORTS (DIPs in nvram)
368 ***********************************************************/
369 
370 INPUT_PORTS_START( slapshot )
371 	PORT_START      /* IN0 */
372 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
373 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
374 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
375 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
376 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
377 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
378 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
379 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
380 
381 	PORT_START      /* IN1 */
382 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
383 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
384 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
385 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
386 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
387 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
388 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
389 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
390 
391 	PORT_START      /* IN2 */
392 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
393 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
394 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
395 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
396 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
397 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
398 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
399 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
400 
401 	PORT_START      /* IN3 */
402 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
403 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
404 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
405 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
406 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )	/* bit is service switch at c0002x */
407 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
408 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
409 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
410 
411 	PORT_START      /* IN4 */
412 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER1 )
413 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER1 )
414 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER1 )
415 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
416 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
417 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
418 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
419 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
420 
421 	PORT_START      /* IN5, so we can OR in service switch */
422 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
423 INPUT_PORTS_END
424 
425 INPUT_PORTS_START( opwolf3 )
426 	PORT_START      /* IN0, all bogus */
427 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
428 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
429 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
430 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
431 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
432 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
433 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
434 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
435 
436 	PORT_START      /* IN1 */
437 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
438 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
439 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
440 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
441 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
442 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
443 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
444 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4 )
445 
446 	PORT_START      /* IN2 */
447 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
448 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
449 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )	// also button 3
450 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
451 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
452 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
453 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )	// also button 3
454 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
455 
456 	PORT_START      /* IN3 */
457 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
458 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
459 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
460 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
461 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )	/* bit is service switch at c0002x */
462 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
463 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
464 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
465 
466 	PORT_START      /* IN4 */
467 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
468 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
469 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
470 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
471 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
472 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
473 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
474 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
475 
476 	PORT_START      /* IN5, so we can OR in service switch */
477 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
478 
479 	PORT_START	/* IN 6, P1X */
480 	PORT_ANALOG( 0xff, 0x80, IPT_LIGHTGUN_X | IPF_REVERSE | IPF_PLAYER1, 30, 20, 0, 0xff)
481 
482 	PORT_START	/* IN 7, P1Y */
483 	PORT_ANALOG( 0xff, 0x80, IPT_LIGHTGUN_Y | IPF_PLAYER1, 30, 20, 0, 0xff)
484 
485 	PORT_START	/* IN 8, P2X */
486 	PORT_ANALOG( 0xff, 0x80, IPT_LIGHTGUN_X | IPF_REVERSE | IPF_PLAYER2, 30, 20, 0, 0xff)
487 
488 	PORT_START	/* IN 9, P2Y */
489 	PORT_ANALOG( 0xff, 0x80, IPT_LIGHTGUN_Y | IPF_PLAYER2, 30, 20, 0, 0xff)
490 INPUT_PORTS_END
491 
492 /***********************************************************
493 				GFX DECODING
494 
495 ***********************************************************/
496 
497 static struct GfxLayout tilelayout =
498 {
499 	16,16,
500 	RGN_FRAC(1,2),
501 	6,
502 	{ RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+1, 0, 1, 2, 3 },
503 	{
504 	4, 0, 12, 8,
505 	16+4, 16+0, 16+12, 16+8,
506 	32+4, 32+0, 32+12, 32+8,
507 	48+4, 48+0, 48+12, 48+8 },
508 	{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
509 			8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
510 	128*8	/* every sprite takes 128 consecutive bytes */
511 };
512 
513 static struct GfxLayout slapshot_charlayout =
514 {
515 	16,16,    /* 16*16 characters */
516 	RGN_FRAC(1,1),
517 	4,        /* 4 bits per pixel */
518 	{ 0, 1, 2, 3 },
519 	{ 1*4, 0*4, 5*4, 4*4, 3*4, 2*4, 7*4, 6*4, 9*4, 8*4, 13*4, 12*4, 11*4, 10*4, 15*4, 14*4 },
520 	{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
521 	128*8     /* every sprite takes 128 consecutive bytes */
522 };
523 
524 static struct GfxDecodeInfo slapshot_gfxdecodeinfo[] =
525 {
526 	{ REGION_GFX2, 0x0, &tilelayout,  0, 256 },	/* sprite parts */
527 	{ REGION_GFX1, 0x0, &slapshot_charlayout,  0, 256 },	/* sprites & playfield */
528 	{ -1 } /* end of array */
529 };
530 
531 
532 
533 /**************************************************************
534 			     YM2610B (SOUND)
535 **************************************************************/
536 
537 /* handler called by the YM2610 emulator when the internal timers cause an IRQ */
irqhandler(int irq)538 static void irqhandler(int irq)
539 {
540 	cpu_set_irq_line(1,0,irq ? ASSERT_LINE : CLEAR_LINE);
541 }
542 
543 static struct YM2610interface ym2610_interface =
544 {
545 	1,	/* 1 chip */
546 	16000000/2,	/* 8 MHz ?? */
547 	{ 25 },
548 	{ 0 },
549 	{ 0 },
550 	{ 0 },
551 	{ 0 },
552 	{ irqhandler },
553 	{ REGION_SOUND2 },	/* Delta-T */
554 	{ REGION_SOUND1 },	/* ADPCM */
555 	{ YM3012_VOL(100,MIXER_PAN_LEFT,100,MIXER_PAN_RIGHT) }
556 };
557 
558 
559 /***********************************************************
560 			     MACHINE DRIVERS
561 ***********************************************************/
562 
563 static MACHINE_DRIVER_START( slapshot )
564 
565 	/* basic machine hardware */
566 	MDRV_CPU_ADD(M68000, 14346000)	/* 28.6860 MHz / 2 ??? */
MDRV_CPU_MEMORY(slapshot_readmem,slapshot_writemem)567 	MDRV_CPU_MEMORY(slapshot_readmem,slapshot_writemem)
568 	MDRV_CPU_VBLANK_INT(slapshot_interrupt,1)
569 
570 	MDRV_CPU_ADD(Z80,32000000/8)
571 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	/* 4 MHz */
572 	MDRV_CPU_MEMORY(z80_sound_readmem,z80_sound_writemem)
573 
574 	MDRV_FRAMES_PER_SECOND(60)
575 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
576 	MDRV_INTERLEAVE(10)
577 
578 	MDRV_NVRAM_HANDLER(generic_1fill)
579 
580 	/* video hardware */
581 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_NEEDS_6BITS_PER_GUN)
582 	MDRV_SCREEN_SIZE(40*8, 32*8)
583 	MDRV_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
584 	MDRV_GFXDECODE(slapshot_gfxdecodeinfo)
585 	MDRV_PALETTE_LENGTH(8192)
586 
587 	MDRV_VIDEO_START(slapshot)
588 	MDRV_VIDEO_EOF(taito_no_buffer)
589 	MDRV_VIDEO_UPDATE(slapshot)
590 
591 	/* sound hardware */
592 	MDRV_SOUND_ATTRIBUTES(SOUND_SUPPORTS_STEREO)
593 	MDRV_SOUND_ADD(YM2610B, ym2610_interface)
594 MACHINE_DRIVER_END
595 
596 static MACHINE_DRIVER_START( opwolf3 )
597 
598 	/* basic machine hardware */
599 	MDRV_CPU_ADD(M68000, 14346000)	/* 28.6860 MHz / 2 ??? */
600 	MDRV_CPU_MEMORY(opwolf3_readmem,opwolf3_writemem)
601 	MDRV_CPU_VBLANK_INT(slapshot_interrupt,1)
602 
603 	MDRV_CPU_ADD(Z80,32000000/8)
604 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	/* 4 MHz */
605 	MDRV_CPU_MEMORY(z80_sound_readmem,z80_sound_writemem)
606 
607 	MDRV_FRAMES_PER_SECOND(60)
608 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
609 	MDRV_INTERLEAVE(10)
610 
611 	MDRV_NVRAM_HANDLER(generic_1fill)
612 
613 	/* video hardware */
614 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_NEEDS_6BITS_PER_GUN)
615 	MDRV_SCREEN_SIZE(40*8, 32*8)
616 	MDRV_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
617 	MDRV_GFXDECODE(slapshot_gfxdecodeinfo)
618 	MDRV_PALETTE_LENGTH(8192)
619 
620 	MDRV_VIDEO_START(slapshot)
621 	MDRV_VIDEO_EOF(taito_no_buffer)
622 	MDRV_VIDEO_UPDATE(slapshot)
623 
624 	/* sound hardware */
625 	MDRV_SOUND_ATTRIBUTES(SOUND_SUPPORTS_STEREO)
626 	MDRV_SOUND_ADD(YM2610B, ym2610_interface)
627 MACHINE_DRIVER_END
628 
629 /***************************************************************************
630 					DRIVERS
631 ***************************************************************************/
632 
633 ROM_START( slapshot )
634 	ROM_REGION( 0x100000, REGION_CPU1, 0 )	/* 1024K for 68000 code */
635 	ROM_LOAD16_BYTE( "d71-15.3",  0x00000, 0x80000, CRC(1470153f) SHA1(63fd5314fcaafba7326fd9481e3c686901dde65c) )
636 	ROM_LOAD16_BYTE( "d71-16.1",  0x00001, 0x80000, CRC(f13666e0) SHA1(e8b475163ea7da5ee3f2b900004cc67c684bab75) )
637 
638 	ROM_REGION( 0x1c000, REGION_CPU2, 0 )	/* sound cpu */
639 	ROM_LOAD    ( "d71-07.77",    0x00000, 0x4000, CRC(dd5f670c) SHA1(743a9563c40fe40178c9ec8eece71a08380c2239) )
640 	ROM_CONTINUE(                 0x10000, 0xc000 )	/* banked stuff */
641 
642 	ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE )
643 	ROM_LOAD16_BYTE( "d71-04.79", 0x00000, 0x80000, CRC(b727b81c) SHA1(9f56160e2b3e4d59cfa96b5c013f4e368781666e) )	/* SCR */
644 	ROM_LOAD16_BYTE( "d71-05.80", 0x00001, 0x80000, CRC(7b0f5d6d) SHA1(a54e4a651dc7cdc160286afb3d38531c7b9396b1) )
645 
646 	ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )
647 	ROM_LOAD16_BYTE( "d71-01.23", 0x000000, 0x100000, CRC(0b1e8c27) SHA1(ffa452f7414f3d61edb69bb61b29a0cc8d9176d0) )	/* OBJ 6bpp */
648 	ROM_LOAD16_BYTE( "d71-02.24", 0x000001, 0x100000, CRC(ccaaea2d) SHA1(71b507f215f37e991abae5523642417a6b23a70d) )
649 	ROM_LOAD       ( "d71-03.25", 0x300000, 0x100000, CRC(dccef9ec) SHA1(ee7a49727b822cf4c1d7acff994b77ea6191c423) )
650 	ROM_FILL       (              0x200000, 0x100000, 0 )
651 
652 	ROM_REGION( 0x80000, REGION_SOUND1, 0 )	/* ADPCM samples */
653 	ROM_LOAD( "d71-06.37", 0x00000, 0x80000, CRC(f3324188) SHA1(70dd724441eae8614218bc7f0f51860bd2462f0c) )
654 
655 	/* no Delta-T samples */
656 
657 //	Pals (not dumped)
658 //	ROM_LOAD( "d71-08.40",  0x00000, 0x00???, NO_DUMP )
659 //	ROM_LOAD( "d71-09.57",  0x00000, 0x00???, NO_DUMP )
660 //	ROM_LOAD( "d71-10.60",  0x00000, 0x00???, NO_DUMP )
661 //	ROM_LOAD( "d71-11.42",  0x00000, 0x00???, NO_DUMP )
662 //	ROM_LOAD( "d71-12.59",  0x00000, 0x00???, NO_DUMP )
663 //	ROM_LOAD( "d71-13.8",   0x00000, 0x00???, NO_DUMP )
664 ROM_END
665 
666 ROM_START( opwolf3 )
667 	ROM_REGION( 0x200000, REGION_CPU1, 0 )	/* 1024K for 68000 code */
668 	ROM_LOAD16_BYTE( "d74_16.3",  0x000000, 0x80000, CRC(198ff1f6) SHA1(f5b51e39cd73ea56cbf53731d3c885bfcecbd696) )
669 	ROM_LOAD16_BYTE( "d74_21.1",  0x000001, 0x80000, CRC(c61c558b) SHA1(6340eb83ba4cd8d7c63b22ea738c8367c87c1de1) )
670 	ROM_LOAD16_BYTE( "d74_18.18", 0x100000, 0x80000, CRC(bd5d7cdb) SHA1(29f1cd7b86bc05f873e93f088194113da87a3b86) )	// data ???
671 	ROM_LOAD16_BYTE( "d74_17.17", 0x100001, 0x80000, CRC(ac35a672) SHA1(8136bd076443bfaeb3d339971d88951e8b2b59b4) )	// data ???
672 
673 	ROM_REGION( 0x1c000, REGION_CPU2, 0 )	/* sound cpu */
674 	ROM_LOAD    ( "d74_22.77",    0x00000, 0x4000, CRC(118374a6) SHA1(cc1d0d28efdf1df3e648e7d932405811854ba4ee) )
675 	ROM_CONTINUE(                 0x10000, 0xc000 )	/* banked stuff */
676 
677 	ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE )
678 	ROM_LOAD16_BYTE( "d74_05.80", 0x000000, 0x200000, CRC(85ea64cc) SHA1(1960a934191c451df1554323d47f6fc64939b0ce) )	/* SCR */
679 	ROM_LOAD16_BYTE( "d74_06.81", 0x000001, 0x200000, CRC(2fa1e08d) SHA1(f1f34b308202fe08e73535424b5b4e3d91295224) )
680 
681 	ROM_REGION( 0x800000, REGION_GFX2, ROMREGION_DISPOSE )
682 	ROM_LOAD16_BYTE( "d74_02.23", 0x000000, 0x200000, CRC(aab86332) SHA1(b9133407504e9ef4fd5ae7d284cdb0c7f78f9a99) )	/* OBJ 6bpp */
683 	ROM_LOAD16_BYTE( "d74_03.24", 0x000001, 0x200000, CRC(3f398916) SHA1(4b6a3ee0baf5f32e24e5040f233300f1ca347fe7) )
684 	ROM_LOAD       ( "d74_04.25", 0x600000, 0x200000, CRC(2f385638) SHA1(1ba2ec7d9b1c491e1cc6d7e646e09ef2bc063f25) )
685 	ROM_FILL       (              0x400000, 0x200000, 0 )
686 
687 	ROM_REGION( 0x200000, REGION_SOUND1, 0 )	/* ADPCM samples */
688 	ROM_LOAD( "d74_01.37",  0x000000, 0x200000, CRC(115313e0) SHA1(51a69e7a26960b1328ccefeaec0fb26bdccc39f2) )
689 
690 	/* no Delta-T samples */
691 ROM_END
692 
693 ROM_START( opwolf3u )
694 	ROM_REGION( 0x200000, REGION_CPU1, 0 )	/* 1024K for 68000 code */
695 	ROM_LOAD16_BYTE( "d74_16.3",  0x000000, 0x80000, CRC(198ff1f6) SHA1(f5b51e39cd73ea56cbf53731d3c885bfcecbd696) )
696 	ROM_LOAD16_BYTE( "d74_20.1",  0x000001, 0x80000, CRC(960fd892) SHA1(2584a048d29a96b69428fba2b71269ea6ccf9010) )
697 	ROM_LOAD16_BYTE( "d74_18.18", 0x100000, 0x80000, CRC(bd5d7cdb) SHA1(29f1cd7b86bc05f873e93f088194113da87a3b86) )	// data ???
698 	ROM_LOAD16_BYTE( "d74_17.17", 0x100001, 0x80000, CRC(ac35a672) SHA1(8136bd076443bfaeb3d339971d88951e8b2b59b4) )	// data ???
699 
700 	ROM_REGION( 0x1c000, REGION_CPU2, 0 )	/* sound cpu */
701 	ROM_LOAD    ( "d74_19.77",    0x00000, 0x4000, CRC(05d53f06) SHA1(48b0cd68ad3758f424552a4e3833c5a1c2f1825b) )
702 	ROM_CONTINUE(                 0x10000, 0xc000 )	/* banked stuff */
703 
704 	ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE )
705 	ROM_LOAD16_BYTE( "d74_05.80", 0x000000, 0x200000, CRC(85ea64cc) SHA1(1960a934191c451df1554323d47f6fc64939b0ce) )	/* SCR */
706 	ROM_LOAD16_BYTE( "d74_06.81", 0x000001, 0x200000, CRC(2fa1e08d) SHA1(f1f34b308202fe08e73535424b5b4e3d91295224) )
707 
708 	ROM_REGION( 0x800000, REGION_GFX2, ROMREGION_DISPOSE )
709 	ROM_LOAD16_BYTE( "d74_02.23", 0x000000, 0x200000, CRC(aab86332) SHA1(b9133407504e9ef4fd5ae7d284cdb0c7f78f9a99) )	/* OBJ 6bpp */
710 	ROM_LOAD16_BYTE( "d74_03.24", 0x000001, 0x200000, CRC(3f398916) SHA1(4b6a3ee0baf5f32e24e5040f233300f1ca347fe7) )
711 	ROM_LOAD       ( "d74_04.25", 0x600000, 0x200000, CRC(2f385638) SHA1(1ba2ec7d9b1c491e1cc6d7e646e09ef2bc063f25) )
712 	ROM_FILL       (              0x400000, 0x200000, 0 )
713 
714 	ROM_REGION( 0x200000, REGION_SOUND1, 0 )	/* ADPCM samples */
715 	ROM_LOAD( "d74_01.37",  0x000000, 0x200000, CRC(115313e0) SHA1(51a69e7a26960b1328ccefeaec0fb26bdccc39f2) )
716 
717 	/* no Delta-T samples */
718 ROM_END
719 
720 
721 static DRIVER_INIT( slapshot )
722 {
723 	unsigned int offset,i;
724 	UINT8 *gfx = memory_region(REGION_GFX2);
725 	int size=memory_region_length(REGION_GFX2);
726 	int data;
727 
728 	offset = size/2;
729 	for (i = size/2+size/4; i<size; i++)
730 	{
731 		int d1,d2,d3,d4;
732 
733 		/* Expand 2bits into 4bits format */
734 		data = gfx[i];
735 		d1 = (data>>0) & 3;
736 		d2 = (data>>2) & 3;
737 		d3 = (data>>4) & 3;
738 		d4 = (data>>6) & 3;
739 
740 		gfx[offset] = (d1<<2) | (d2<<6);
741 		offset++;
742 
743 		gfx[offset] = (d3<<2) | (d4<<6);
744 		offset++;
745 	}
746 
747 	state_save_register_int("sound1", 0, "sound region", &banknum);
748 	state_save_register_func_postload(reset_sound_region);
749 }
750 
751 GAME( 1994, slapshot, 0,       slapshot, slapshot, slapshot, ROT0, "Taito Corporation",         "Slap Shot (Japan)" )
752 GAME( 1994, opwolf3,  0,       opwolf3,  opwolf3,  slapshot, ROT0, "Taito Corporation Japan",   "Operation Wolf 3 (World)" )
753 GAME( 1994, opwolf3u, opwolf3, opwolf3,  opwolf3,  slapshot, ROT0, "Taito America Corporation", "Operation Wolf 3 (US)" )
754