1 /***************************************************************************
2 
3 Wiz/Stinger/Scion/Kung-Fu Taikun  memory map (preliminary)
4 
5 Driver by Zsolt Vasvari
6 
7 
8 These boards are similar to a Galaxian board in the way it handles scrolling
9 and sprites, but the similarities pretty much end there. The most notable
10 difference is that there are 2 independently scrollable playfields.
11 
12 
13 Main CPU:
14 
15 0000-BFFF  ROM
16 C000-C7FF  RAM
17 D000-D3FF  Video RAM (Foreground)
18 D400-D7FF  Color RAM (Foreground) (Wiz)
19 D800-D83F  Attributes RAM (Foreground)
20 D840-D85F  Sprite RAM 1
21 E000-E3FF  Video RAM (Background)
22 E400-E7FF  Color RAM (Background) (Wiz)
23 E800-E83F  Attributes RAM (Background)
24 E840-E85F  Sprite RAM 2
25 
26 I/O read:
27 d400 Protection (Wiz)
28 f000 DIP SW#1
29 f008 DIP SW#2
30 f010 Input Port 1
31 f018 Input Port 2
32 f800 Watchdog
33 
34 I/O write:
35 c800 Coin Counter A
36 c801 Coin Counter B
37 f000 Sprite bank select (Wiz)
38 f001 NMI enable
39 f002 \ Palette select
40 f003 /
41 f004 \ Character bank select
42 f005 /
43 f006 \ Flip screen
44 f007 /
45 f800 Sound Command write
46 f818 (?) Sound or Background color
47 
48 
49 Sound CPU:
50 
51 0000-1FFF  ROM
52 2000-23FF  RAM
53 
54 I/O read:
55 3000 Sound Command Read (Stinger/Scion)
56 7000 Sound Command Read (Wiz)
57 
58 I/O write:
59 3000 NMI enable	(Stinger/Scion)
60 4000 AY8910 Control Port #1	(Wiz)
61 4001 AY8910 Write Port #1	(Wiz)
62 5000 AY8910 Control Port #2
63 5001 AY8910 Write Port #2
64 6000 AY8910 Control Port #3
65 6001 AY8910 Write Port #3
66 7000 NMI enable (Wiz)
67 
68 
69 TODO:
70 
71 - Verify sprite colors in stinger/scion
72 - Background noise in scion (but not scionc). Note that the sound program is
73   almost identical, except for three patches affecting noise period, noise
74   channel C enable and channel C volume. So it looks just like a bug in the
75   original (weird), or some strange form of protection.
76 
77 Wiz:
78 - Possible sprite/char priority issues.
79 - There is unknown device (Sony CXK5808-55) on the board.
80 - And the supplier of the screenshot says there still may be some wrong
81   colors. Just before the break on Level 2 there is a cresent moon,
82   the background should probably be black.
83 
84 2001-Jun-24 Fixed protection and added save states (SJ)
85 
86 2002-Nov-30 Kung-Fu Taikun added
87   2xZ80 , 3x AY8910
88   (DSW 1 , bit 2 )
89   "THE MICROPHONE IS OUT OF CONTROL, SO THIS GAME DEPENDS ON THE BUTTONS"
90   There's no additional hw or connectors on the pcb
91   (except for small (bit 0 - ON, bit 1 - ON)  DSW near AY chips )
92   Tomasz Slanina -  dox@space.pl
93 
94 Notes:
95   The microphone is for summoning clouds. The game falls back to use
96   buttons if it's not functioning.
97 
98 2003-JUL-30 updated Scion/Stinger analogue sound framework (AT)
99 
100 
101 Stephh's notes (based on the games Z80 code and some tests) :
102 
103 1a) 'stinger'
104 
105   - Here are some infos about the "Debug Mode" Dip Switch :
106 
107       * when it it set to OFF, the value which was previously written
108         to 0xc500 is NOT erased, but the only value written to it is 0x00.
109       * when it is set to ON, 0x00 is ALWAYS written to 0xc500.
110         (check code at 0x0ef6)
111 
112     As you can see, there is no VISIBLE difference ...
113 
114     This is because it's in fact a leftover from 'stinger2' (the code for the
115     "TEST PLAY" still exists !)
116 
117 
118 1b) 'stinger2'
119 
120   - Here are some infos about the "Debug Mode" Dip Switch :
121 
122       * when it it set to OFF, the value which was previously written
123         to 0xc500 is NOT erased, but the only value written to it is 0x00.
124       * when it is set to ON, 0x01 is ALWAYS written to 0xc500.
125         (check code at 0x0ef6)
126 
127   - When 0xc500 = 0x01, you enter what the game calls "TEST PLAY".
128 
129   - "TEST PLAY" features :
130 
131       * automatically sets credits to 1
132       * impossible to insert a coin
133       * only one player game is available
134       * player 1 has infinite lives (always set to 5)
135 
136   - "Coin B" settings also affect the "difficulty" and the "bongo time" :
137     compare the code from 0x0e69 to 0x0e9c in the 2 sets, and you'll notice
138     that it is the SAME ! That's why I've set the default coinage to be
139     the same as the "difficulty" and "bongo time" settings in 'stinger'.
140 
141 
142 2)  'scion*'
143 
144   - Dip Switches 1-6 to 1-8 must remain OFF because of code at 0x28bf :
145     there is NO "and $03" instruction, so it goes over the "coin B" table,
146     which means that you have really weird coinage if you set them ON !
147 
148 
149 3)  'kungfut'
150 
151   - When "Microphone" Dip Switch is OFF, press BUTTON3 (bit 4 of IN1 -
152     shared by the 2 players) to make a little cloud appear so players
153     can climb it to go up.
154   - "20000 60000" setting for the "Bonus Life" Dip Switch is NEVER used
155     due to the "bit 0,a" instruction at 0x94fd !
156 
157 
158 ***************************************************************************/
159 
160 #include "driver.h"
161 #include "vidhrdw/generic.h"
162 
163 extern unsigned char *wiz_videoram2;
164 extern unsigned char *wiz_colorram2;
165 extern unsigned char *wiz_attributesram;
166 extern unsigned char *wiz_attributesram2;
167 extern unsigned char *wiz_sprite_bank;
168 
169 WRITE_HANDLER( wiz_char_bank_select_w );
170 WRITE_HANDLER( wiz_attributes_w );
171 WRITE_HANDLER( wiz_palettebank_w );
172 WRITE_HANDLER( wiz_bgcolor_w );
173 WRITE_HANDLER( wiz_flipx_w );
174 WRITE_HANDLER( wiz_flipy_w );
175 VIDEO_START( wiz );
176 PALETTE_INIT( wiz );
177 VIDEO_UPDATE( wiz );
178 VIDEO_UPDATE( stinger );
179 VIDEO_UPDATE( kungfut );
180 
WRITE_HANDLER(sound_command_w)181 static WRITE_HANDLER( sound_command_w )
182 {
183 	static int dsc0=1, dsc1=1;
184 
185 	switch (offset)
186 	{
187 		// 0x90 triggers a jump to non-existant address(development system?) and must be filtered
188 		case 0x00:
189 			if (data != 0x90) soundlatch_w(0, data);
190 		break;
191 
192 		// explosion sound trigger(analog?)
193 		case 0x08:
194 			discrete_sound_w(2, dsc1);
195 			discrete_sound_w(3, dsc1^=1);
196 		break;
197 
198 		// player shot sound trigger(analog?)
199 		case 0x0a:
200 			discrete_sound_w(0, dsc0);
201 			discrete_sound_w(1, dsc0^=1);
202 		break;
203 	}
204 }
205 
READ_HANDLER(wiz_protection_r)206 static READ_HANDLER( wiz_protection_r )
207 {
208 	switch (wiz_colorram2[0])
209 	{
210 	case 0x35: return 0x25;	/* FIX: sudden player death + free play afterwards   */
211 	case 0x8f: return 0x1f;	/* FIX: early boss appearance with corrupt graphics  */
212 	case 0xa0: return 0x00;	/* FIX: executing junk code after defeating the boss */
213 	}
214 
215 	return wiz_colorram2[0];
216 }
217 
WRITE_HANDLER(wiz_coin_counter_w)218 static WRITE_HANDLER( wiz_coin_counter_w )
219 {
220 	coin_counter_w(offset,data);
221 }
222 
MEMORY_READ_START(readmem)223 static MEMORY_READ_START( readmem )
224 	{ 0x0000, 0xbfff, MRA_ROM },
225 	{ 0xc000, 0xc7ff, MRA_RAM },
226 	{ 0xd000, 0xd85f, MRA_RAM },
227 	{ 0xe000, 0xe85f, MRA_RAM },
228 	{ 0xf000, 0xf000, input_port_2_r },	/* DSW0 */
229 	{ 0xf008, 0xf008, input_port_3_r },	/* DSW1 */
230 	{ 0xf010, 0xf010, input_port_0_r },	/* IN0 */
231 	{ 0xf018, 0xf018, input_port_1_r },	/* IN1 */
232 	{ 0xf800, 0xf800, watchdog_reset_r },
233 MEMORY_END
234 
235 static MEMORY_WRITE_START( writemem )
236 	{ 0x0000, 0xbfff, MWA_ROM },
237 	{ 0xc000, 0xc7ff, MWA_RAM },
238 	{ 0xc800, 0xc801, wiz_coin_counter_w },
239 	{ 0xd000, 0xd3ff, MWA_RAM, &wiz_videoram2 },
240 	{ 0xd400, 0xd7ff, MWA_RAM, &wiz_colorram2 },
241 	{ 0xd800, 0xd83f, MWA_RAM, &wiz_attributesram2 },
242 	{ 0xd840, 0xd85f, MWA_RAM, &spriteram_2, &spriteram_size },
243 	{ 0xe000, 0xe3ff, videoram_w, &videoram, &videoram_size },
244 	{ 0xe400, 0xe7ff, colorram_w, &colorram },
245 	{ 0xe800, 0xe83f, wiz_attributes_w, &wiz_attributesram },
246 	{ 0xe840, 0xe85f, MWA_RAM, &spriteram },
247 	{ 0xf000, 0xf000, MWA_RAM, &wiz_sprite_bank },
248 	{ 0xf001, 0xf001, interrupt_enable_w },
249 	{ 0xf002, 0xf003, wiz_palettebank_w },
250 	{ 0xf004, 0xf005, wiz_char_bank_select_w },
251 	{ 0xf006, 0xf006, wiz_flipx_w },
252 	{ 0xf007, 0xf007, wiz_flipy_w },
253 	{ 0xf008, 0xf00f, MWA_NOP },			// initialized by Stinger/Scion
254 	{ 0xf800, 0xf80f, sound_command_w },	// sound registers
255 	{ 0xf818, 0xf818, wiz_bgcolor_w },
256 MEMORY_END
257 
258 
259 static MEMORY_READ_START( sound_readmem )
260 	{ 0x0000, 0x1fff, MRA_ROM },
261 	{ 0x2000, 0x23ff, MRA_RAM },
262 	{ 0x3000, 0x3000, soundlatch_r },	/* Stinger/Scion */
263 	{ 0x7000, 0x7000, soundlatch_r },	/* Wiz */
264 MEMORY_END
265 
266 static MEMORY_WRITE_START( sound_writemem )
267 	{ 0x2000, 0x23ff, MWA_RAM },
268 	{ 0x3000, 0x3000, interrupt_enable_w },			/* Stinger/Scion */
269 	{ 0x4000, 0x4000, AY8910_control_port_2_w },
270 	{ 0x4001, 0x4001, AY8910_write_port_2_w },
271 	{ 0x5000, 0x5000, AY8910_control_port_0_w },
272 	{ 0x5001, 0x5001, AY8910_write_port_0_w },
273 	{ 0x6000, 0x6000, AY8910_control_port_1_w },	/* Wiz only */
274 	{ 0x6001, 0x6001, AY8910_write_port_1_w },		/* Wiz only */
275 	{ 0x7000, 0x7000, interrupt_enable_w },			/* Wiz */
276 MEMORY_END
277 
278 
279 
280 INPUT_PORTS_START( stinger )
281 	PORT_START	/* IN0 */
282 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
283 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
284 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 )
285 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
286 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
287 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
288 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )
289 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
290 
291 	PORT_START	/* IN1 */
292 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
293 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
294 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
295 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
296 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
297 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
298 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
299 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
300 
301 	PORT_START	/* DSW0 */
302 	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
303 	PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
304 	PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
305 	PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
306 	PORT_DIPSETTING(    0x00, DEF_STR( 3C_2C ) )
307 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
308 	PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
309 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
310 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
311 	PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) )
312 	PORT_DIPSETTING(    0x00, "2" )
313 	PORT_DIPSETTING(    0x08, "3" )
314 	PORT_DIPSETTING(    0x10, "4" )
315 	PORT_DIPSETTING(    0x18, "5" )
316 	PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Bonus_Life ) )
317 	PORT_DIPSETTING(    0xe0, "20000 50000" )
318 	PORT_DIPSETTING(    0xc0, "20000 60000" )
319 	PORT_DIPSETTING(    0xa0, "20000 70000" )
320 	PORT_DIPSETTING(    0x80, "20000 80000" )
321 	PORT_DIPSETTING(    0x60, "20000 90000" )
322 	PORT_DIPSETTING(    0x40, "30000 80000" )
323 	PORT_DIPSETTING(    0x20, "30000 90000" )
324 	PORT_DIPSETTING(    0x00, "None" )
325 
326 	PORT_START	/* DSW1 */
327 	PORT_DIPNAME( 0x01, 0x00, "Debug Mode" )		/* See notes */
328 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
329 	PORT_DIPSETTING(    0x01, DEF_STR( On ) )
330 	PORT_DIPNAME( 0x0e, 0x0e, DEF_STR( Coin_B ) )
331 	PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
332 	PORT_DIPSETTING(    0x08, DEF_STR( 4C_1C ) )
333 	PORT_DIPSETTING(    0x0c, DEF_STR( 3C_1C ) )
334 	PORT_DIPSETTING(    0x0a, DEF_STR( 2C_1C ) )
335 	PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
336 	PORT_DIPSETTING(    0x0e, DEF_STR( 1C_1C ) )
337 	PORT_DIPSETTING(    0x02, DEF_STR( 2C_3C ) )
338 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
339 	PORT_DIPNAME( 0x30, 0x20, "Bongo Time" )
340 	PORT_DIPSETTING(    0x30, "Long" )
341 	PORT_DIPSETTING(    0x20, "Medium" )
342 	PORT_DIPSETTING(    0x10, "Short" )
343 	PORT_DIPSETTING(    0x00, "Shortest" )
344 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )
345 	PORT_DIPSETTING(    0x00, "Normal" )
346 	PORT_DIPSETTING(    0x40, "Hard" )
347 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
348 	PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
349 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
350 INPUT_PORTS_END
351 
352 INPUT_PORTS_START( stinger2 )
353 	PORT_START	/* IN0 */
354 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
355 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
356 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 )
357 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
358 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
359 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
360 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )
361 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
362 
363 	PORT_START	/* IN1 */
364 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
365 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
366 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
367 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
368 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
369 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
370 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
371 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
372 
373 	PORT_START	/* DSW0 */
374 	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
375 	PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
376 	PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
377 	PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
378 	PORT_DIPSETTING(    0x00, DEF_STR( 3C_2C ) )
379 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
380 	PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
381 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
382 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
383 	PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) )
384 	PORT_DIPSETTING(    0x00, "2" )
385 	PORT_DIPSETTING(    0x08, "3" )
386 	PORT_DIPSETTING(    0x10, "4" )
387 	PORT_DIPSETTING(    0x18, "5" )
388 	PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Bonus_Life ) )
389 	PORT_DIPSETTING(    0xe0, "20000 50000" )
390 	PORT_DIPSETTING(    0xc0, "20000 60000" )
391 	PORT_DIPSETTING(    0xa0, "20000 70000" )
392 	PORT_DIPSETTING(    0x80, "20000 80000" )
393 	PORT_DIPSETTING(    0x60, "20000 90000" )
394 	PORT_DIPSETTING(    0x40, "30000 80000" )
395 	PORT_DIPSETTING(    0x20, "30000 90000" )
396 	PORT_DIPSETTING(    0x00, "None" )
397 
398 	PORT_START	/* DSW1 */
399 	PORT_DIPNAME( 0x01, 0x00, "Debug Mode" )		/* See notes */
400 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
401 	PORT_DIPSETTING(    0x01, DEF_STR( On ) )
402 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unused ) )
403 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
404 	PORT_DIPSETTING(    0x02, DEF_STR( On ) )
405 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unused ) )
406 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
407 	PORT_DIPSETTING(    0x04, DEF_STR( On ) )
408 	PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unused ) )
409 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
410 	PORT_DIPSETTING(    0x08, DEF_STR( On ) )
411 	PORT_DIPNAME( 0x70, 0x20, DEF_STR( Coin_B ) )	/* See notes */
412 	PORT_DIPSETTING(    0x70, DEF_STR( 1C_1C ) )
413 	PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
414 	PORT_DIPSETTING(    0x50, DEF_STR( 1C_3C ) )
415 	PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )
416 	PORT_DIPSETTING(    0x30, DEF_STR( 1C_5C ) )
417 	PORT_DIPSETTING(    0x20, DEF_STR( 1C_6C ) )
418 	PORT_DIPSETTING(    0x10, DEF_STR( 1C_7C ) )
419 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_8C ) )
420 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
421 	PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
422 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
423 INPUT_PORTS_END
424 
425 INPUT_PORTS_START( scion )
426 	PORT_START	/* IN0 */
427 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
428 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
429 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 )
430 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
431 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
432 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
433 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )
434 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
435 
436 	PORT_START	/* IN1 */
437 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
438 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
439 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
440 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
441 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
442 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
443 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
444 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
445 
446 	PORT_START	/* DSW0 */
447 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
448 	PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
449 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
450 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Difficulty ) )
451 	PORT_DIPSETTING(    0x00, "Easy" )
452 	PORT_DIPSETTING(    0x02, "Hard" )
453 	PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Lives ) )
454 	PORT_DIPSETTING(    0x00, "2" )
455 	PORT_DIPSETTING(    0x04, "3" )
456 	PORT_DIPSETTING(    0x08, "4" )
457 	PORT_DIPSETTING(    0x0c, "5" )
458 	PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
459 	PORT_DIPSETTING(    0x00, "20000 40000" )
460 	PORT_DIPSETTING(    0x20, "20000 60000" )
461 	PORT_DIPSETTING(    0x10, "20000 80000" )
462 	PORT_DIPSETTING(    0x30, "30000 90000" )
463 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
464 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
465 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
466 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
467 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
468 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
469 
470 	PORT_START	/* DSW1 */
471 	PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
472 	PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
473 	PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
474 	PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
475 	PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
476 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
477 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
478 	PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
479 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_5C ) )
480 	PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coin_B ) )
481 	PORT_DIPSETTING(    0x18, DEF_STR( 3C_1C ) )
482 	PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
483 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
484 	PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
485 	PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) )
486 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
487 //	PORT_DIPSETTING(    0x20, DEF_STR( On ) )		/* See notes */
488 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
489 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
490 //	PORT_DIPSETTING(    0x40, DEF_STR( On ) )		/* See notes */
491 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
492 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
493 //	PORT_DIPSETTING(    0x80, DEF_STR( On ) )		/* See notes */
494 INPUT_PORTS_END
495 
496 INPUT_PORTS_START( kungfut )
497 	PORT_START	/* IN0 */
498 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
499 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_PLAYER2 )
500 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_PLAYER1 )
501 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
502 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
503 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
504 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER1 )
505 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
506 
507 	PORT_START	/* IN1 */
508 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER1 )
509 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_2WAY | IPF_PLAYER1 )
510 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 )
511 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
512 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 )
513 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
514 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_2WAY | IPF_PLAYER2 )
515 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
516 
517 	PORT_START	/* DSW0 */
518 	PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
519 	PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
520 	PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
521 	PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
522 	PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
523 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
524 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
525 	PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
526 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_5C ) )
527 	PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coin_B ) )
528 	PORT_DIPSETTING(    0x18, DEF_STR( 3C_1C ) )
529 	PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
530 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
531 	PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
532 	PORT_DIPNAME( 0x20, 0x20, "2 Players Game" )
533 	PORT_DIPSETTING(    0x00, "1 Credit" )
534 	PORT_DIPSETTING(    0x20, "2 Credits" )
535 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
536 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
537 	PORT_DIPSETTING(    0x40, DEF_STR( On ) )
538 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
539 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
540 	PORT_DIPSETTING(    0x80, DEF_STR( On ) )
541 
542 	PORT_START	/* DSW1 */
543 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Difficulty ) )
544 	PORT_DIPSETTING(    0x00, "Easy" )
545 	PORT_DIPSETTING(    0x01, "Hard" )
546 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unused ) )
547 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
548 	PORT_DIPSETTING(    0x02, DEF_STR( On ) )
549 	PORT_DIPNAME( 0x04, 0x04, "Microphone" )		/* See notes */
550 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
551 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
552 	PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) )
553 	PORT_DIPSETTING(    0x00, "2" )
554 	PORT_DIPSETTING(    0x08, "3" )
555 	PORT_DIPSETTING(    0x10, "4" )
556 	PORT_DIPSETTING(    0x18, "5" )
557 	PORT_DIPNAME( 0x60, 0x00, DEF_STR( Bonus_Life ) )
558 	PORT_DIPSETTING(    0x00, "20000 40000" )
559 //	PORT_DIPSETTING(    0x20, "20000 40000" )		// duplicated setting
560 	PORT_DIPSETTING(    0x10, "20000 80000" )
561 	PORT_DIPSETTING(    0x30, "30000 90000" )
562 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
563 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
564 	PORT_DIPSETTING(    0x80, DEF_STR( On ) )
565 INPUT_PORTS_END
566 
567 INPUT_PORTS_START( wiz )
568 	PORT_START	/* IN1 */
569 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
570 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
571 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
572 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
573 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
574 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
575 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 )
576 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
577 
578 	PORT_START	/* IN2 */
579 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
580 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
581 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
582 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
583 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
584 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
585 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
586 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
587 
588 	PORT_START	/* DSW 0 */
589 	PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
590 	PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
591 	PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
592 	PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
593 	PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
594 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
595 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
596 	PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
597 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_5C ) )
598 	PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coin_B ) )
599 	PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
600 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
601 	PORT_DIPSETTING(    0x18, DEF_STR( 2C_3C ) )
602 	PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
603 	PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) )
604 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
605 	PORT_DIPSETTING(    0x20, DEF_STR( On ) )
606 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
607 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
608 	PORT_DIPSETTING(    0x40, DEF_STR( On ) )
609 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Free_Play ) )
610 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
611 	PORT_DIPSETTING(    0x80, DEF_STR( On ) )
612 
613 	PORT_START	/* DSW 1 */
614 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
615 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
616 	PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
617 	PORT_DIPNAME( 0x06, 0x00, DEF_STR( Difficulty ) )
618 	PORT_DIPSETTING(    0x00, "Easy" )
619 	PORT_DIPSETTING(    0x02, "Normal" )
620 	PORT_DIPSETTING(    0x04, "Hard" )
621 	PORT_DIPSETTING(    0x06, "Hardest" )
622 	PORT_DIPNAME( 0x18, 0x10, DEF_STR( Lives ) )
623 	PORT_DIPSETTING(    0x08, "1" )
624 	PORT_DIPSETTING(    0x10, "3" )
625 	PORT_DIPSETTING(    0x18, "5" )
626 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "255", IP_KEY_NONE, IP_JOY_NONE )
627 	PORT_DIPNAME( 0x60, 0x00, DEF_STR( Bonus_Life ) )
628 	PORT_DIPSETTING(    0x00, "10000 30000" )
629 	PORT_DIPSETTING(    0x20, "20000 40000" )
630 	PORT_DIPSETTING(    0x40, "30000 60000" )
631 	PORT_DIPSETTING(    0x60, "40000 80000" )
632 	PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
633 INPUT_PORTS_END
634 
635 
636 
637 static struct GfxLayout charlayout =
638 {
639 	8,8,	/* 8*8 characters */
640 	256,	/* 256 characters */
641 	3,		/* 3 bits per pixel */
642 	{ 0x4000*8, 0x2000*8, 0 },	/* the three bitplanes are separated */
643 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
644 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
645 	8*8	/* every char takes 8 consecutive bytes */
646 };
647 
648 
649 static struct GfxLayout spritelayout =
650 {
651 	16,16,	/* 16*16 sprites */
652 	256,	/* 256 sprites */
653 	3,		/* 3 bits per pixel */
654 	{ 0x4000*8, 0x2000*8, 0 },	/* the three bitplanes are separated */
655 	{ 0, 1, 2, 3, 4, 5, 6, 7,
656 	 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
657 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
658 	  16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
659 	32*8	/* every sprite takes 32 consecutive bytes */
660 };
661 
662 
663 static struct GfxDecodeInfo wiz_gfxdecodeinfo[] =
664 {
665 	{ REGION_GFX1, 0x0000, &charlayout,   0, 32 },
666 	{ REGION_GFX1, 0x0800, &charlayout,   0, 32 },
667 	{ REGION_GFX2, 0x6000, &charlayout,   0, 32 },
668 	{ REGION_GFX2, 0x0000, &charlayout,   0, 32 },
669 	{ REGION_GFX2, 0x0800, &charlayout,   0, 32 },
670 	{ REGION_GFX2, 0x6800, &charlayout,   0, 32 },
671 	{ REGION_GFX1, 0x0000, &spritelayout, 0, 32 },
672 	{ REGION_GFX2, 0x0000, &spritelayout, 0, 32 },
673 	{ REGION_GFX2, 0x6000, &spritelayout, 0, 32 },
674 	{ -1 }	/* end of array */
675 };
676 
677 static struct GfxDecodeInfo stinger_gfxdecodeinfo[] =
678 {
679 	{ REGION_GFX1, 0x0000, &charlayout,   0, 32 },
680 	{ REGION_GFX1, 0x0800, &charlayout,   0, 32 },
681 	{ REGION_GFX2, 0x0000, &charlayout,   0, 32 },
682 	{ REGION_GFX2, 0x0800, &charlayout,   0, 32 },
683 	{ REGION_GFX1, 0x0000, &spritelayout, 0, 32 },
684 	{ REGION_GFX2, 0x0000, &spritelayout, 0, 32 },
685 	{ -1 }	/* end of array */
686 };
687 
688 
689 static struct AY8910interface wiz_ay8910_interface =
690 {
691 	3,				/* 3 chips */
692 	18432000/12,	/* ? */
693 	{ 10, 10, 10 },
694 	{ 0 },
695 	{ 0 },
696 	{ 0 },
697 	{ 0 }
698 };
699 
700 static struct AY8910interface stinger_ay8910_interface =
701 {
702 	2,				/* 2 chips */
703 	18432000/12,	/* ? */
704 	{ 12, 12 },		// 25 causes clipping
705 	{ 0 },
706 	{ 0 },
707 	{ 0 },
708 	{ 0 }
709 };
710 
711 
712 //* ANALOG SOUND STARTS
713 
714 // cut-and-pasted from Asteroid
715 const struct discrete_lfsr_desc stinger_lfsr={
716 	16,			/* Bit Length */
717 	0,			/* Reset Value */
718 	6,			/* Use Bit 6 as XOR input 0 */
719 	14,			/* Use Bit 14 as XOR input 1 */
720 	DISC_LFSR_XNOR,		/* Feedback stage1 is XNOR */
721 	DISC_LFSR_OR,		/* Feedback stage2 is just stage 1 output OR with external feed */
722 	DISC_LFSR_REPLACE,	/* Feedback stage3 replaces the shifted register contents */
723 	0x000001,		/* Everything is shifted into the first bit only */
724 	0,			/* Output is already inverted by XNOR */
725 	16			/* Output bit is feedback bit */
726 };
727 
728 DISCRETE_SOUND_START(stinger_discrete_interface)
729 
730 #define STINGER_FINAL_GAIN	NODE_99
731 #define STINGER_FINAL_MIX	NODE_98
732 #define STINGER_SHOT_EN1	NODE_97
733 #define STINGER_SHOT_EN2	NODE_96
734 #define STINGER_SHOT_OUT	NODE_95
735 #define STINGER_BOOM_EN1	NODE_94
736 #define STINGER_BOOM_EN2	NODE_93
737 #define STINGER_BOOM_OUT	NODE_92
738 
739 	// triggers are interleaved to give each circuit sufficient time to reset
740 	DISCRETE_INPUT	(STINGER_SHOT_EN1, 0, 0x000f, 0) // even-inteval shots
741 	DISCRETE_INPUT	(STINGER_SHOT_EN2, 1, 0x000f, 0) // odd-inteval shots
742 	DISCRETE_INPUT	(STINGER_BOOM_EN1, 2, 0x000f, 0) // even-inteval explosions
743 	DISCRETE_INPUT	(STINGER_BOOM_EN2, 3, 0x000f, 0) // odd-inteval explosions
744 
745 	//---------------------------------------
746 	// Sample Shot Sound Circuit
747 
748 	#define SHOT_IN1	NODE_01
749 	#define SHOT_IN2	NODE_02
750 	#define SHOT_MOD	NODE_03
751 	#define SHOT_FRQ	NODE_04
752 	#define SHOT_AMP	NODE_05
753 
754 	DISCRETE_RCDISC		(SHOT_IN1, STINGER_SHOT_EN1, 1.0, 0.2, 1.0)
755 	DISCRETE_RCDISC		(SHOT_IN2, STINGER_SHOT_EN2, 1.0, 0.2, 1.0)
756 	DISCRETE_SWITCH		(SHOT_MOD, 1, STINGER_SHOT_EN1, SHOT_IN2, SHOT_IN1)
757 	DISCRETE_MULTIPLY	(SHOT_FRQ, 1, SHOT_MOD, 2000)
758 	DISCRETE_MULTIPLY	(SHOT_AMP, 1, SHOT_MOD,  800)
759 	DISCRETE_SQUAREWAVE	(STINGER_SHOT_OUT, 1, SHOT_FRQ, SHOT_AMP, 50, 0, 0)
760 
761 	//---------------------------------------
762 	// Sample Explosion Sound Circuit
763 
764 	#define BOOM_IN1	NODE_11
765 	#define BOOM_IN2	NODE_12
766 	#define BOOM_MOD	NODE_13
767 	#define BOOM_AMP	NODE_14
768 
769 	DISCRETE_RCDISC		(BOOM_IN1, STINGER_BOOM_EN1, 1.0, 0.25, 1.0)
770 	DISCRETE_RCDISC		(BOOM_IN2, STINGER_BOOM_EN2, 1.0, 0.25, 1.0)
771 	DISCRETE_SWITCH		(BOOM_MOD, 1, STINGER_BOOM_EN1, BOOM_IN2, BOOM_IN1)
772 	DISCRETE_MULTIPLY	(BOOM_AMP, 1, BOOM_MOD, 1500)
773 	DISCRETE_LFSR_NOISE	(STINGER_BOOM_OUT, 1, 1, 1800, BOOM_AMP, 0, 0, &stinger_lfsr)
774 
775 	//---------------------------------------
776 
777 	DISCRETE_ADDER2	(STINGER_FINAL_MIX, 1, STINGER_SHOT_OUT, STINGER_BOOM_OUT)
778 	DISCRETE_GAIN	(STINGER_FINAL_GAIN, STINGER_FINAL_MIX, 5.0)
779 	DISCRETE_OUTPUT	(STINGER_FINAL_GAIN, 100)
780 
781 DISCRETE_SOUND_END
782 //* ANALOG SOUND ENDS
783 
784 
MACHINE_DRIVER_START(wiz)785 static MACHINE_DRIVER_START( wiz )
786 
787 	/* basic machine hardware */
788 	MDRV_CPU_ADD(Z80, 18432000/6)	/* 3.072 MHz ??? */
789 	MDRV_CPU_MEMORY(readmem,writemem)
790 	MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
791 
792 	MDRV_CPU_ADD(Z80, 14318000/8)	/* ? */
793 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)
794 	MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
795 	MDRV_CPU_VBLANK_INT(nmi_line_pulse,4)	/* ??? */
796 
797 	MDRV_FRAMES_PER_SECOND(60)
798 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)	/* frames per second, vblank duration */
799 
800 	/* video hardware */
801 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
802 	MDRV_SCREEN_SIZE(32*8, 32*8)
803 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
804 	MDRV_GFXDECODE(wiz_gfxdecodeinfo)
805 	MDRV_PALETTE_LENGTH(256)
806 	MDRV_COLORTABLE_LENGTH(32*8)
807 
808 	MDRV_PALETTE_INIT(wiz)
809 	MDRV_VIDEO_START(wiz)
810 	MDRV_VIDEO_UPDATE(wiz)
811 
812 	/* sound hardware */
813 	MDRV_SOUND_ADD_TAG("8910", AY8910, wiz_ay8910_interface)
814 
815 MACHINE_DRIVER_END
816 
817 
818 static MACHINE_DRIVER_START( stinger )
819 
820 	/* basic machine hardware */
821 	MDRV_IMPORT_FROM(wiz)
822 
823 	/* video hardware */
824 	MDRV_GFXDECODE(stinger_gfxdecodeinfo)
825 	MDRV_VIDEO_UPDATE(stinger)
826 
827 	/* sound hardware */
828 	MDRV_SOUND_REPLACE("8910", AY8910, stinger_ay8910_interface)
829 	MDRV_SOUND_ADD(DISCRETE, stinger_discrete_interface)
830 
831 MACHINE_DRIVER_END
832 
833 
834 static MACHINE_DRIVER_START( scion )
835 
836 	/* basic machine hardware */
837 	MDRV_IMPORT_FROM(stinger)
838 
839 	/* video hardware */
840 	MDRV_VISIBLE_AREA(2*8, 32*8-1, 2*8, 30*8-1)
841 
842 MACHINE_DRIVER_END
843 
844 
845 static MACHINE_DRIVER_START( kungfut )
846 
847 	/* basic machine hardware */
848 	MDRV_IMPORT_FROM(wiz)
849 
850 	/* video hardware */
851 	MDRV_GFXDECODE(stinger_gfxdecodeinfo)
852 	MDRV_VIDEO_UPDATE(kungfut)
853 
854 MACHINE_DRIVER_END
855 
856 
857 
858 /***************************************************************************
859 
860   Game driver(s)
861 
862 ***************************************************************************/
863 
864 ROM_START( kungfut )
865 	ROM_REGION( 0x10000, REGION_CPU1, 0 )
866 	ROM_LOAD( "p1.bin",  0x0000, 0x4000, CRC(b1e56960) SHA1(993388bbb663412110d1012be9ffc00b06fce4d0) )
867 	ROM_LOAD( "p3.bin",  0x4000, 0x4000, CRC(6fc346f8) SHA1(bd1663fa780e41eafd668bf502b40c9750270e55) )
868 	ROM_LOAD( "p2.bin",  0x8000, 0x4000, CRC(042cc9c5) SHA1(09f87e240c2aaa19fe7b8cb548ded828ab67b18b) )
869 
870 	ROM_REGION( 0x10000, REGION_CPU2, 0 )
871 	ROM_LOAD( "1.bin",  0x0000, 0x2000, CRC(68028a5d) SHA1(2fabf5e55e09a34cd090d123737d31970e4086e8) )
872 
873 	ROM_REGION( 0x6000,  REGION_GFX1, ROMREGION_DISPOSE )
874 	ROM_LOAD( "2.bin",  0x0000, 0x2000, CRC(5c3ef697) SHA1(5218d361e6020aefb1925a8034a5ed6eb7bb1001) )
875 	ROM_LOAD( "3.bin",  0x2000, 0x2000, CRC(905e81fa) SHA1(8d3328b2dc7e99ab1e43420a517f04ec4d463b05) )
876 	ROM_LOAD( "4.bin",  0x4000, 0x2000, CRC(965bb5d1) SHA1(ea837118d98378303cf9173005cfd50823b1596a) )
877 
878 	ROM_REGION( 0x6000,  REGION_GFX2, ROMREGION_DISPOSE )
879 	ROM_LOAD( "5.bin",  0x0000, 0x2000, CRC(763bb61a) SHA1(9bea4a929db5d2e8c925a847591b9e5b2ad5aaaa) )
880 	ROM_LOAD( "6.bin",  0x2000, 0x2000, CRC(c9649fce) SHA1(f65e75355d2f7b0899ea3769146a55b187da37d3) )
881 	ROM_LOAD( "7.bin",  0x4000, 0x2000, CRC(32f02c13) SHA1(85781f03cca622ce8ee66924a1e72758ce42bdfe) )
882 	ROM_REGION( 0x0300,  REGION_PROMS, 0 )
883 	ROM_LOAD( "82s129.0", 0x0000, 0x0100, CRC(eb823177) SHA1(a28233dbf87744a9896fe675b76603557e7f596b) )
884 	ROM_LOAD( "82s129.1", 0x0100, 0x0100, CRC(6eec5dd9) SHA1(e846209c167b2a7d790faacea082a7edc1338e47) )
885 	ROM_LOAD( "82s129.2", 0x0200, 0x0100, CRC(c31eb3e6) SHA1(94fb8c6d83432c5f456510d628971147d373faf5) )
886 ROM_END
887 
888 ROM_START( wiz )
889 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
890 	ROM_LOAD( "ic07_01.bin",  0x0000, 0x4000, CRC(c05f2c78) SHA1(98b93234684a3a228552ef41a08512fef1befedd) )
891 	ROM_LOAD( "ic05_03.bin",  0x4000, 0x4000, CRC(7978d879) SHA1(866efdff3c111793d5a3cc2fa0b03a2b4e371c49) )
892 	ROM_LOAD( "ic06_02.bin",  0x8000, 0x4000, CRC(9c406ad2) SHA1(cd82c3dc622886b6ebb30ba565f3c34d5a4e229b) )
893 
894 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the audio CPU */
895 	ROM_LOAD( "ic57_10.bin",  0x0000, 0x2000, CRC(8a7575bd) SHA1(5470c4c3a40139f45db7a9e260f40b5244f10123) )
896 
897 	ROM_REGION( 0x6000,  REGION_GFX1, ROMREGION_DISPOSE )	/* sprites/chars */
898 	ROM_LOAD( "ic12_04.bin",  0x0000, 0x2000, CRC(8969acdd) SHA1(f37c4697232b4fb4171d6290c9407f740e7d1448) )
899 	ROM_LOAD( "ic13_05.bin",  0x2000, 0x2000, CRC(2868e6a5) SHA1(1b8ac71a6b901df845bab945bfcf11df47932990) )
900 	ROM_LOAD( "ic14_06.bin",  0x4000, 0x2000, CRC(b398e142) SHA1(1cafaf5cbfa96b410ae236a298473ff51122d9fc) )
901 
902 	ROM_REGION( 0xc000,  REGION_GFX2, ROMREGION_DISPOSE )	/* sprites/chars */
903 	ROM_LOAD( "ic03_07.bin",  0x0000, 0x2000, CRC(297c02fc) SHA1(8eee765a660e3ff1b6cdcdac0d068177098cc339) )
904 	ROM_CONTINUE(		      0x6000, 0x2000  )
905 	ROM_LOAD( "ic02_08.bin",  0x2000, 0x2000, CRC(ede77d37) SHA1(01fe35fc3373b7513ea90e8262d66200629b89fe) )
906 	ROM_CONTINUE(		      0x8000, 0x2000  )
907 	ROM_LOAD( "ic01_09.bin",  0x4000, 0x2000, CRC(4d86b041) SHA1(fe7f8c89ef16020f45a97ed875ddd7396a32665d) )
908 	ROM_CONTINUE(		      0xa000, 0x2000  )
909 
910 	ROM_REGION( 0x0300, REGION_PROMS, 0 )
911 	ROM_LOAD( "ic23_3-1.bin", 0x0000, 0x0100, CRC(2dd52fb2) SHA1(61722aba7a370f4a97cafbd5df88ec7c6263c4ad) )	/* palette red component */
912 	ROM_LOAD( "ic23_3-2.bin", 0x0100, 0x0100, CRC(8c2880c9) SHA1(9b4c17f7fa5d6dc01d79c40cec9725ab97f514cb) )	/* palette green component */
913 	ROM_LOAD( "ic23_3-3.bin", 0x0200, 0x0100, CRC(a488d761) SHA1(6dade1dd16905b4751778d49f374936795c3fb6e) )	/* palette blue component */
914 ROM_END
915 
916 ROM_START( wizt )
917 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
918 	ROM_LOAD( "wiz1.bin",  	  0x0000, 0x4000, CRC(5a6d3c60) SHA1(faeb7e7ddeee9638ec046655e87f866d81fdbee0) )
919 	ROM_LOAD( "ic05_03.bin",  0x4000, 0x4000, CRC(7978d879) SHA1(866efdff3c111793d5a3cc2fa0b03a2b4e371c49) )
920 	ROM_LOAD( "ic06_02.bin",  0x8000, 0x4000, CRC(9c406ad2) SHA1(cd82c3dc622886b6ebb30ba565f3c34d5a4e229b) )
921 
922 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the audio CPU */
923 	ROM_LOAD( "ic57_10.bin",  0x0000, 0x2000, CRC(8a7575bd) SHA1(5470c4c3a40139f45db7a9e260f40b5244f10123) )
924 
925 	ROM_REGION( 0x6000,  REGION_GFX1, ROMREGION_DISPOSE )	/* sprites/chars */
926 	ROM_LOAD( "wiz4.bin",     0x0000, 0x2000, CRC(e6c636b3) SHA1(0d5b98d404d2d87f375cde5d5a90c7d6318ea197) )
927 	ROM_LOAD( "wiz5.bin",     0x2000, 0x2000, CRC(77986058) SHA1(8002affdd9ac246a0b9c887654d0db8d3a6913b2) )
928 	ROM_LOAD( "wiz6.bin",     0x4000, 0x2000, CRC(f6970b23) SHA1(82d1fe0fee6bf9c6c2f472ed3479c02da85d5f69) )
929 
930 	ROM_REGION( 0xc000,  REGION_GFX2, ROMREGION_DISPOSE )	/* sprites/chars */
931 	ROM_LOAD( "wiz7.bin",     0x0000, 0x2000, CRC(601f2f3f) SHA1(6c0cc7de5fd94628eaecca409c4faa155f684bdc) )
932 	ROM_CONTINUE(		      0x6000, 0x2000  )
933 	ROM_LOAD( "wiz8.bin",     0x2000, 0x2000, CRC(f5ab982d) SHA1(5e0e72ec702dd5f48814a15f1a92bcdd29c944d8) )
934 	ROM_CONTINUE(		      0x8000, 0x2000  )
935 	ROM_LOAD( "wiz9.bin",     0x4000, 0x2000, CRC(f6c662e2) SHA1(54e904d731ea30f532dfea60d47edf2da99f32eb) )
936 	ROM_CONTINUE(		      0xa000, 0x2000  )
937 
938 	ROM_REGION( 0x0300, REGION_PROMS, 0 )
939 	ROM_LOAD( "ic23_3-1.bin", 0x0000, 0x0100, CRC(2dd52fb2) SHA1(61722aba7a370f4a97cafbd5df88ec7c6263c4ad) )	/* palette red component */
940 	ROM_LOAD( "ic23_3-2.bin", 0x0100, 0x0100, CRC(8c2880c9) SHA1(9b4c17f7fa5d6dc01d79c40cec9725ab97f514cb) )	/* palette green component */
941 	ROM_LOAD( "ic23_3-3.bin", 0x0200, 0x0100, CRC(a488d761) SHA1(6dade1dd16905b4751778d49f374936795c3fb6e) )	/* palette blue component */
942 ROM_END
943 
944 ROM_START( stinger )
945 	ROM_REGION( 2*0x10000, REGION_CPU1, 0 )	/* 64k for code + 64k for decrypted opcodes */
946 	ROM_LOAD( "1-5j.bin",     0x0000, 0x2000, CRC(1a2ca600) SHA1(473e89f2c49f6e6f38df5d6fc2267ffecf84c6c8) )	/* encrypted */
947 	ROM_LOAD( "2-6j.bin",     0x2000, 0x2000, CRC(957cd39c) SHA1(38bb589b3bfd962415b31d1151adf4bdb661122f) )	/* encrypted */
948 	ROM_LOAD( "3-8j.bin",     0x4000, 0x2000, CRC(404c932e) SHA1(c23eac49e06ff38564062c0e8c8cdadf877f1d6a) )	/* encrypted */
949 	ROM_LOAD( "4-9j.bin",     0x6000, 0x2000, CRC(2d570f91) SHA1(31d54d9fd5254c33f07c605bd6112c7eb53c42a1) )	/* encrypted */
950 	ROM_LOAD( "5-10j.bin",    0x8000, 0x2000, CRC(c841795c) SHA1(e03860813c03ca1c737935accc2b5fe87c6b624a) )	/* encrypted */
951 
952 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for sound cpu */
953 	ROM_LOAD( "6-9f.bin",     0x0000, 0x2000, CRC(79757f0c) SHA1(71be938c32c6a84618763761786ecc5d7d47581a) )
954 
955 	ROM_REGION( 0x6000,  REGION_GFX1, ROMREGION_DISPOSE )	/* sprites/chars */
956 	ROM_LOAD( "7-9e.bin",     0x0000, 0x2000, CRC(775489be) SHA1(5fccede323895626cf2eabd606ed21282aa36356) )
957 	ROM_LOAD( "8-11e.bin",    0x2000, 0x2000, CRC(43c61b3f) SHA1(5cdb6a5096b42406c2f2784d37e4e39207c35d40) )
958 	ROM_LOAD( "9-14e.bin",    0x4000, 0x2000, CRC(c9ed8fc7) SHA1(259d7681b663adb1c5fe057e2ef08469ddcbd3c3) )
959 
960 	ROM_REGION( 0x6000,  REGION_GFX2, ROMREGION_DISPOSE )	/* sprites/chars */
961 	ROM_LOAD( "10-9h.bin",    0x0000, 0x2000, CRC(6fc3a22d) SHA1(6875b86d60a06aa329d8ff18d0eb48d158074c5d) )
962 	ROM_LOAD( "11-11h.bin",   0x2000, 0x2000, CRC(3df1f57e) SHA1(e365ee4cc8c055cc39abb4598ad80597d3ae19c7) )
963 	ROM_LOAD( "12-14h.bin",   0x4000, 0x2000, CRC(2fbe1391) SHA1(669edc154164944d82dfccda328774ea4a2318ba) )
964 
965 	ROM_REGION( 0x0300,  REGION_PROMS, 0 )
966 	ROM_LOAD( "stinger.a7",   0x0000, 0x0100, CRC(52c06fc2) SHA1(b416077fcfabe0dbb1ca30752de6a219ea896f75) )	/* red component */
967 	ROM_LOAD( "stinger.b7",   0x0100, 0x0100, CRC(9985e575) SHA1(b0d609968917121325760f8d4777066abdb7ccfc) )	/* green component */
968 	ROM_LOAD( "stinger.a8",   0x0200, 0x0100, CRC(76b57629) SHA1(836763948753b7fed97c9e5d90a16dc4ba68f42a) )	/* blue component */
969 ROM_END
970 
971 ROM_START( stinger2 )
972 	ROM_REGION( 2*0x10000, REGION_CPU1, 0 )	/* 64k for code + 64k for decrypted opcodes */
973 	ROM_LOAD( "n1.bin",       0x0000, 0x2000, CRC(f2d2790c) SHA1(0e5e92ef45b5bc27b0818f83c89b3bda0e701403) )	/* encrypted */
974 	ROM_LOAD( "n2.bin",       0x2000, 0x2000, CRC(8fd2d8d8) SHA1(d3318a81fddeb3fa50d01569c1e1145e26ce7277) )	/* encrypted */
975 	ROM_LOAD( "n3.bin",       0x4000, 0x2000, CRC(f1794d36) SHA1(7954500f489c0bc58cda8e7ffc2e4474759fdc33) )	/* encrypted */
976 	ROM_LOAD( "n4.bin",       0x6000, 0x2000, CRC(230ba682) SHA1(c419ffebd021d41b3f5021948007fb6bcdb1cdf7) )	/* encrypted */
977 	ROM_LOAD( "n5.bin",       0x8000, 0x2000, CRC(a03a01da) SHA1(28fecac7a821ac4718242919840266a907160df0) )	/* encrypted */
978 
979 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for sound cpu */
980 	ROM_LOAD( "6-9f.bin",     0x0000, 0x2000, CRC(79757f0c) SHA1(71be938c32c6a84618763761786ecc5d7d47581a) )
981 
982 	ROM_REGION( 0x6000,  REGION_GFX1, ROMREGION_DISPOSE )	/* sprites/chars */
983 	ROM_LOAD( "7-9e.bin",     0x0000, 0x2000, CRC(775489be) SHA1(5fccede323895626cf2eabd606ed21282aa36356) )
984 	ROM_LOAD( "8-11e.bin",    0x2000, 0x2000, CRC(43c61b3f) SHA1(5cdb6a5096b42406c2f2784d37e4e39207c35d40) )
985 	ROM_LOAD( "9-14e.bin",    0x4000, 0x2000, CRC(c9ed8fc7) SHA1(259d7681b663adb1c5fe057e2ef08469ddcbd3c3) )
986 
987 	ROM_REGION( 0x6000,  REGION_GFX2, ROMREGION_DISPOSE )	/* sprites/chars */
988 	ROM_LOAD( "10.bin",       0x0000, 0x2000, CRC(f6721930) SHA1(fb903f1deb5f093ff5fe129e213966af58a68339) )
989 	ROM_LOAD( "11.bin",       0x2000, 0x2000, CRC(a4404e63) SHA1(50ae99748547af20e04f6c6c8c7eba85f967b9dc) )
990 	ROM_LOAD( "12.bin",       0x4000, 0x2000, CRC(b60fa88c) SHA1(2d3bca35076625251933989f5e566d5d3290542b) )
991 
992 	ROM_REGION( 0x0300,  REGION_PROMS, 0 )
993 	ROM_LOAD( "stinger.a7",   0x0000, 0x0100, CRC(52c06fc2) SHA1(b416077fcfabe0dbb1ca30752de6a219ea896f75) )	/* red component */
994 	ROM_LOAD( "stinger.b7",   0x0100, 0x0100, CRC(9985e575) SHA1(b0d609968917121325760f8d4777066abdb7ccfc) )	/* green component */
995 	ROM_LOAD( "stinger.a8",   0x0200, 0x0100, CRC(76b57629) SHA1(836763948753b7fed97c9e5d90a16dc4ba68f42a) )	/* blue component */
996 ROM_END
997 
998 ROM_START( scion )
999 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
1000 	ROM_LOAD( "sc1",          0x0000, 0x2000, CRC(8dcad575) SHA1(3f194ece25e730b1cbbf3f332bbdebc3a6a72b0f) )
1001 	ROM_LOAD( "sc2",          0x2000, 0x2000, CRC(f608e0ba) SHA1(e55b0ad4dc117339d45a999e13760f4ab3ca4ce0) )
1002 	ROM_LOAD( "sc3",          0x4000, 0x2000, CRC(915289b9) SHA1(b32b40f93de4501619486a8c5a8367d3b2e357a6) )
1003 	ROM_LOAD( "4.9j",         0x6000, 0x2000, CRC(0f40d002) SHA1(13b04f3902ebdda02670fcb667e181cf70594c37) )
1004 	ROM_LOAD( "5.10j",        0x8000, 0x2000, CRC(dc4923b7) SHA1(ec5c22ef1f9ba0fe4da3de62a63a44aa3ff850f4) )
1005 
1006 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for sound cpu */
1007 	ROM_LOAD( "sc6",          0x0000, 0x2000, CRC(09f5f9c1) SHA1(83e489f32597880fb1a13f0bafedd275facb21f7) )
1008 	ROM_LOAD_OPTIONAL("6.9f", 0x0000, 0x2000, CRC(a66a0ce6) SHA1(b2d6a8ded007c362c58496ead33d1561a982440a) )
1009 
1010 	ROM_REGION( 0x6000,  REGION_GFX1, ROMREGION_DISPOSE )	/* sprites/chars */
1011 	ROM_LOAD( "7.10e",        0x0000, 0x2000, CRC(223e0d2a) SHA1(073638172ce0762d103cc07705fc493432e5aa63) )
1012 	ROM_LOAD( "8.12e",        0x2000, 0x2000, CRC(d3e39b48) SHA1(c686ef35bf866d044637df295bb70c9c005fc98c) )
1013 	ROM_LOAD( "9.15e",        0x4000, 0x2000, CRC(630861b5) SHA1(a6ccfa10e43e92407c452f9744aa1735b257c28e) )
1014 
1015 	ROM_REGION( 0x6000,  REGION_GFX2, ROMREGION_DISPOSE )	/* sprites/chars */
1016 	ROM_LOAD( "10.10h",       0x0000, 0x2000, CRC(0d2a0d1e) SHA1(518689f91019e64138ed3560e161d3ef93d0671d) )
1017 	ROM_LOAD( "11.12h",       0x2000, 0x2000, CRC(dc6ef8ab) SHA1(ba93392a494a66336197d28e45832b9f8f3e4376) )
1018 	ROM_LOAD( "12.15h",       0x4000, 0x2000, CRC(c82c28bf) SHA1(8952b515f01027a94bee0186221a1989ea2cd919) )
1019 
1020 	ROM_REGION( 0x0300,  REGION_PROMS, 0 )
1021 	ROM_LOAD( "82s129.7a",    0x0000, 0x0100, CRC(2f89d9ea) SHA1(37adbddb9b3253b995a02a74e0de27ad594dc544) )	/* red component */
1022 	ROM_LOAD( "82s129.7b",    0x0100, 0x0100, CRC(ba151e6a) SHA1(3d3139936de9e1913dee94317420a171bd3d2062) )	/* green component */
1023 	ROM_LOAD( "82s129.8a",    0x0200, 0x0100, CRC(f681ce59) SHA1(4ac74c1d04e6b3f14a0f4530a41ba188f5a8f6be) )	/* blue component */
1024 ROM_END
1025 
1026 ROM_START( scionc )
1027 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
1028 	ROM_LOAD( "1.5j",         0x0000, 0x2000, CRC(5aaf571e) SHA1(53becfad13e95012dce6597625c64dcba9ac4433) )
1029 	ROM_LOAD( "2.6j",         0x2000, 0x2000, CRC(d5a66ac9) SHA1(3192da12b2d6a07e203999ed97cdba16d4917a98) )
1030 	ROM_LOAD( "3.8j",         0x4000, 0x2000, CRC(6e616f28) SHA1(ea32add6173251152ca84426c098c92ace123878) )
1031 	ROM_LOAD( "4.9j",         0x6000, 0x2000, CRC(0f40d002) SHA1(13b04f3902ebdda02670fcb667e181cf70594c37) )
1032 	ROM_LOAD( "5.10j",        0x8000, 0x2000, CRC(dc4923b7) SHA1(ec5c22ef1f9ba0fe4da3de62a63a44aa3ff850f4) )
1033 
1034 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for sound cpu */
1035 	ROM_LOAD( "6.9f",         0x0000, 0x2000, CRC(a66a0ce6) SHA1(b2d6a8ded007c362c58496ead33d1561a982440a) )
1036 
1037 	ROM_REGION( 0x6000,  REGION_GFX1, ROMREGION_DISPOSE )	/* sprites/chars */
1038 	ROM_LOAD( "7.10e",        0x0000, 0x2000, CRC(223e0d2a) SHA1(073638172ce0762d103cc07705fc493432e5aa63) )
1039 	ROM_LOAD( "8.12e",        0x2000, 0x2000, CRC(d3e39b48) SHA1(c686ef35bf866d044637df295bb70c9c005fc98c) )
1040 	ROM_LOAD( "9.15e",        0x4000, 0x2000, CRC(630861b5) SHA1(a6ccfa10e43e92407c452f9744aa1735b257c28e) )
1041 
1042 	ROM_REGION( 0x6000,  REGION_GFX2, ROMREGION_DISPOSE )	/* sprites/chars */
1043 	ROM_LOAD( "10.10h",       0x0000, 0x2000, CRC(0d2a0d1e) SHA1(518689f91019e64138ed3560e161d3ef93d0671d) )
1044 	ROM_LOAD( "11.12h",       0x2000, 0x2000, CRC(dc6ef8ab) SHA1(ba93392a494a66336197d28e45832b9f8f3e4376) )
1045 	ROM_LOAD( "12.15h",       0x4000, 0x2000, CRC(c82c28bf) SHA1(8952b515f01027a94bee0186221a1989ea2cd919) )
1046 
1047 	ROM_REGION( 0x0300,  REGION_PROMS, 0 )
1048 	ROM_LOAD( "82s129.7a",    0x0000, 0x0100, CRC(2f89d9ea) SHA1(37adbddb9b3253b995a02a74e0de27ad594dc544) )	/* red component */
1049 	ROM_LOAD( "82s129.7b",    0x0100, 0x0100, CRC(ba151e6a) SHA1(3d3139936de9e1913dee94317420a171bd3d2062) )	/* green component */
1050 	ROM_LOAD( "82s129.8a",    0x0200, 0x0100, CRC(f681ce59) SHA1(4ac74c1d04e6b3f14a0f4530a41ba188f5a8f6be) )	/* blue component */
1051 ROM_END
1052 
1053 
1054 
1055 static DRIVER_INIT( stinger )
1056 {
1057 	static const unsigned char swap_xor_table[4][4] =
1058 	{
1059 		{ 7,3,5, 0xa0 },
1060 		{ 3,7,5, 0x88 },
1061 		{ 5,3,7, 0x80 },
1062 		{ 5,7,3, 0x28 }
1063 	};
1064 	unsigned char *rom = memory_region(REGION_CPU1);
1065 	int diff = memory_region_length(REGION_CPU1) / 2;
1066 	int A;
1067 	const unsigned char *tbl;
1068 
1069 
1070 	memory_set_opcode_base(0,rom+diff);
1071 
1072 	for (A = 0x0000;A < 0x10000;A++)
1073 	{
1074 		int row;
1075 		unsigned char src;
1076 
1077 
1078 		if (A & 0x2040)
1079 		{
1080 			/* not encrypted */
1081 			rom[A+diff] = rom[A];
1082 		}
1083 		else
1084 		{
1085 			src = rom[A];
1086 
1087 			/* pick the translation table from bits 3 and 5 of the address */
1088 			row = ((A >> 3) & 1) + (((A >> 5) & 1) << 1);
1089 
1090 			/* decode the opcodes */
1091 			tbl = swap_xor_table[row];
1092 			rom[A+diff] = BITSWAP8(src,tbl[0],6,tbl[1],4,tbl[2],2,1,0) ^ tbl[3];
1093 		}
1094 	}
1095 }
1096 
1097 
DRIVER_INIT(wiz)1098 static DRIVER_INIT( wiz )
1099 {
1100 	install_mem_read_handler(0, 0xd400, 0xd400, wiz_protection_r);
1101 }
1102 
1103 
1104 GAMEX(1983, stinger,  0,       stinger, stinger,  stinger, ROT90,  "Seibu Denshi", "Stinger", GAME_IMPERFECT_SOUND )
1105 GAMEX(1983, stinger2, stinger, stinger, stinger2, stinger, ROT90,  "Seibu Denshi", "Stinger (prototype?)", GAME_IMPERFECT_SOUND )
1106 GAMEX(1984, scion,    0,       scion,   scion,    0,       ROT0,   "Seibu Denshi", "Scion", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_COLORS )
1107 GAMEX(1984, scionc,   scion,   scion,   scion,    0,       ROT0,   "Seibu Denshi (Cinematronics license)", "Scion (Cinematronics)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_COLORS )
1108 GAME( 1984, kungfut,  0,       kungfut, kungfut,  0,       ROT0,   "Seibu Kaihatsu Inc.", "Kung-Fu Taikun" )
1109 GAME( 1985, wiz,      0,       wiz,     wiz,      wiz,     ROT270, "Seibu Kaihatsu Inc.", "Wiz" )
1110 GAME( 1985, wizt,     wiz,     wiz,     wiz,      wiz,     ROT270, "[Seibu] (Taito license)", "Wiz (Taito)" )
1111