1 #include "../vidhrdw/gaelco.c"
2 
3 /***************************************************************************
4 
5 	Gaelco game hardware from 1991-1996
6 
7 	Driver by Manuel Abadia <manu@teleline.es>
8 
9 	Supported games:
10 
11 		* Big Karnak
12 		* Biomechanical Toy
13 		* Maniac Square
14 
15 	Known games running on this hardware:
16 
17 		* Squash
18 		* Thunder Hoop
19 		* World Rally
20 		* Strike Back
21 
22 ***************************************************************************/
23 
24 #include "driver.h"
25 #include "vidhrdw/generic.h"
26 #include "cpu/m6809/m6809.h"
27 #include "cpu/m68000/m68000.h"
28 
29 extern unsigned char *gaelco_vregs;
30 extern unsigned char *gaelco_videoram;
31 extern unsigned char *gaelco_spriteram;
32 
33 /* from vidhrdw/gaelco.c */
34 READ_HANDLER( gaelco_vram_r );
35 WRITE_HANDLER( gaelco_vram_w );
36 void gaelco_vh_stop(void);
37 
38 
39 #define TILELAYOUT8(NUM) static struct GfxLayout tilelayout8_##NUM =	\
40 {																		\
41 	8,8,									/* 8x8 tiles */				\
42 	NUM/8,									/* number of tiles */		\
43 	4,										/* bitplanes */				\
44 	{ 0*NUM*8, 1*NUM*8, 2*NUM*8, 3*NUM*8 }, /* plane offsets */			\
45 	{ 0,1,2,3,4,5,6,7 },												\
46 	{ 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 },								\
47 	8*8																	\
48 }
49 
50 #define TILELAYOUT16(NUM) static struct GfxLayout tilelayout16_##NUM =				\
51 {																					\
52 	16,16,									/* 16x16 tiles */						\
53 	NUM/32,									/* number of tiles */					\
54 	4,										/* bitplanes */							\
55 	{ 0*NUM*8, 1*NUM*8, 2*NUM*8, 3*NUM*8 }, /* plane offsets */						\
56 	{ 0,1,2,3,4,5,6,7, 16*8+0,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7 },	\
57 	{ 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8, 8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 },		\
58 	32*8																			\
59 }
60 
61 #define GFXDECODEINFO(NUM,ENTRIES) static struct GfxDecodeInfo gfxdecodeinfo_##NUM[] =	\
62 {																						\
63 	{ REGION_GFX1, 0x000000, &tilelayout8_##NUM,0,	ENTRIES },							\
64 	{ REGION_GFX1, 0x000000, &tilelayout16_##NUM,0,	ENTRIES },							\
65 	{ -1 }																				\
66 }
67 
68 /*============================================================================
69 							BIG KARNAK
70   ============================================================================*/
71 
72 int bigkarnk_vh_start( void );
73 void bigkarnk_vh_screenrefresh( struct osd_bitmap *bitmap,int full_refresh );
74 
75 
76 static struct MemoryReadAddress bigkarnk_readmem[] =
77 {
78 	{ 0x000000, 0x07ffff, MRA_ROM },			/* ROM */
79 	{ 0x100000, 0x101fff, gaelco_vram_r },		/* Video RAM */
80 	{ 0x102000, 0x103fff, MRA_BANK1 },			/* Screen RAM */
81 	{ 0x200000, 0x2007ff, paletteram_word_r },	/* Palette */
82 	{ 0x440000, 0x440fff, MRA_BANK3 },			/* Sprite RAM */
83 	{ 0x700000, 0x700001, input_port_0_r },		/* DIPSW #1 */
84 	{ 0x700002, 0x700003, input_port_1_r },		/* DIPSW #2 */
85 	{ 0x700004, 0x700005, input_port_2_r },		/* INPUT #1 */
86 	{ 0x700006, 0x700007, input_port_3_r },		/* INPUT #2 */
87 	{ 0x700008, 0x700009, input_port_4_r },		/* Service + Test */
88 	{ 0xff8000, 0xffffff, MRA_BANK4 },			/* Work RAM */
89 	{ -1 }
90 };
91 
WRITE_HANDLER(bigkarnk_sound_command_w)92 WRITE_HANDLER( bigkarnk_sound_command_w )
93 {
94 	soundlatch_w(0,data & 0xff);
95 	cpu_cause_interrupt(1,M6809_INT_FIRQ);
96 }
97 
WRITE_HANDLER(bigkarnk_coin_w)98 WRITE_HANDLER( bigkarnk_coin_w )
99 {
100 	switch ((offset >> 4)){
101 		case 0x00:	/* Coin Lockouts */
102 		case 0x01:
103 			coin_lockout_w( (offset >> 4) & 0x01, ~data & 0x01);
104 			break;
105 		case 0x02:	/* Coin Counters */
106 		case 0x03:
107 			coin_counter_w( (offset >> 4) & 0x01, data & 0x01);
108 			break;
109 	}
110 }
111 
112 static struct MemoryWriteAddress bigkarnk_writemem[] =
113 {
114 	{ 0x000000, 0x07ffff, MWA_ROM },								/* ROM */
115 	{ 0x100000, 0x101fff, gaelco_vram_w, &gaelco_videoram },		/* Video RAM */
116 	{ 0x102000, 0x103fff, MWA_BANK1 },								/* Screen RAM */
117 	{ 0x108000, 0x108007, MWA_BANK2, &gaelco_vregs },				/* Video Registers */
118 //	{ 0x10800c, 0x10800d, watchdog_reset_w },						/* INT 6 ACK/Watchdog timer */
119 	{ 0x200000, 0x2007ff, paletteram_xBBBBBGGGGGRRRRR_word_w, &paletteram },/* Palette */
120 	{ 0x440000, 0x440fff, MWA_BANK3, &gaelco_spriteram },			/* Sprite RAM */
121 	{ 0x70000e, 0x70000f, bigkarnk_sound_command_w },				/* Triggers a FIRQ on the sound CPU */
122 	{ 0x70000a, 0x70003b, bigkarnk_coin_w },						/* Coin Counters + Coin Lockout */
123 	{ 0xff8000, 0xffffff, MWA_BANK4 },								/* Work RAM */
124 	{ -1 }
125 };
126 
127 
128 static struct MemoryReadAddress bigkarnk_readmem_snd[] =
129 {
130 	{ 0x0000, 0x07ff, MRA_RAM },				/* RAM */
131 	{ 0x0800, 0x0800, OKIM6295_status_0_r },	/* OKI6295 */
132 	{ 0x0a00, 0x0a00, YM3812_status_port_0_r },	/* YM3812 */
133 	{ 0x0b00, 0x0b00, soundlatch_r },			/* Sound latch */
134 	{ 0x0c00, 0xffff, MRA_ROM },				/* ROM */
135 	{ -1 }
136 };
137 
138 static struct MemoryWriteAddress bigkarnk_writemem_snd[] =
139 {
140 	{ 0x0000, 0x07ff, MWA_RAM },				/* RAM */
141 	{ 0x0800, 0x0800, OKIM6295_data_0_w },		/* OKI6295 */
142 //	{ 0x0900, 0x0900, MWA_NOP },				/* enable sound output? */
143 	{ 0x0a00, 0x0a00, YM3812_control_port_0_w },/* YM3812 */
144 	{ 0x0a01, 0x0a01, YM3812_write_port_0_w },	/* YM3812 */
145 	{ 0x0c00, 0xffff, MWA_ROM },				/* ROM */
146 	{ -1 }
147 };
148 
149 INPUT_PORTS_START( bigkarnk )
150 	PORT_START	/* DSW #1 */
151 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
152 	PORT_DIPSETTING(    0x07, DEF_STR( 4C_1C ) )
153 	PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
154 	PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) )
155 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
156 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
157 	PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
158 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
159 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
160 	PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
161 	PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
162 	PORT_DIPSETTING(    0x00, "Free Play (if Coin B too)" )
163 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
164 	PORT_DIPSETTING(    0x70, DEF_STR( 4C_1C ) )
165 	PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) )
166 	PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) )
167 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
168 	PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) )
169 	PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
170 	PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
171 	PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
172 	PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
173 	PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
174 	PORT_DIPSETTING(    0x00, "Free Play (if Coin A too)" )
175 
176 	PORT_START	/* DSW #2 */
177 	PORT_DIPNAME( 0x07, 0x06, DEF_STR( Difficulty ) )
178 	PORT_DIPSETTING(    0x07, "0" )
179 	PORT_DIPSETTING(    0x06, "1" )
180 	PORT_DIPSETTING(    0x05, "2" )
181 	PORT_DIPSETTING(    0x04, "3" )
182 	PORT_DIPSETTING(    0x03, "4" )
183 	PORT_DIPSETTING(    0x02, "5" )
184 	PORT_DIPSETTING(    0x01, "6" )
185 	PORT_DIPSETTING(    0x00, "7" )
186 	PORT_DIPNAME( 0x18, 0x08, DEF_STR( Lives ) )
187 	PORT_DIPSETTING(    0x18, "1" )
188 	PORT_DIPSETTING(    0x10, "2" )
189 	PORT_DIPSETTING(    0x08, "3" )
190 	PORT_DIPSETTING(    0x00, "4" )
191 	PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) )
192 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
193 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
194 	PORT_DIPNAME( 0x40, 0x40, "Impact" )
195 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
196 	PORT_DIPSETTING(    0x40, DEF_STR( On ) )
197 	PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
198 
199 	PORT_START	/* 1P INPUTS & COINSW */
200 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER1 )
201 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER1 )
202 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
203 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER1 )
204 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
205 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
206 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
207 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
208 
209 	PORT_START	/* 2P INPUTS & STARTSW */
210 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
211 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
212 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
213 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
214 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
215 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
216 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
217 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
218 
219 	PORT_START	/* Service + Test */
220 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
221 	PORT_DIPNAME( 0x02, 0x02, "Go to test mode now" )
222 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
223 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
224 	PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
225 INPUT_PORTS_END
226 
227 
228 TILELAYOUT8(0x100000);
229 TILELAYOUT16(0x100000);
230 
231 GFXDECODEINFO(0x100000,64);
232 
233 
234 static struct YM3812interface bigkarnk_ym3812_interface =
235 {
236 	1,						/* 1 chip */
237 	8867000/3,				/* 2.9556667 MHz? */
238 	{ 60 },					/* volume */
239 	{ 0 }					/* IRQ handler */
240 };
241 
242 static struct OKIM6295interface bigkarnk_okim6295_interface =
243 {
244 	1,                  /* 1 chip */
245 	{ 8000 },			/* 8000 KHz? */
246 	{ REGION_SOUND1 },  /* memory region */
247 	{ 100 }				/* volume */
248 };
249 
250 
251 static struct MachineDriver machine_driver_bigkarnk =
252 {
253 	{
254 		{
255 			CPU_M68000,					/* MC68000P10 */
256 			10000000,					/* 10 MHz */
257 			bigkarnk_readmem,bigkarnk_writemem,0,0,
258 			m68_level6_irq,1
259 		},
260 		{
261 			CPU_M6809 | CPU_AUDIO_CPU,	/* 68B09 */
262 			8867000/4,					/* 2.21675 MHz? */
263 			bigkarnk_readmem_snd,bigkarnk_writemem_snd,0,0,
264 			ignore_interrupt,1
265 		}
266 	},
267 	60,DEFAULT_REAL_60HZ_VBLANK_DURATION,
268 	10,
269 	0,
270 
271 	/* video hardware */
272 	32*16, 32*16, { 0, 320-1, 16, 256-1 },
273 	gfxdecodeinfo_0x100000,
274 	1024, 1024,
275 	0,
276 
277 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
278 	0,
279 	bigkarnk_vh_start,
280 	gaelco_vh_stop,
281 	bigkarnk_vh_screenrefresh,
282 
283 	/* sound hardware */
284 	0,0,0,0,
285 	{
286 		{
287 			SOUND_YM3812,
288 			&bigkarnk_ym3812_interface
289 		},
290 		{
291 			SOUND_OKIM6295,
292 			&bigkarnk_okim6295_interface
293 		}
294 	}
295 };
296 
297 
298 ROM_START( bigkarnk )
299 	ROM_REGION( 0x080000, REGION_CPU1 )	/* 68000 code */
300 	ROM_LOAD_EVEN(	"d16",	0x000000, 0x040000, 0x44fb9c73 )
301 	ROM_LOAD_ODD(	"d19",	0x000000, 0x040000, 0xff79dfdd )
302 
303 	ROM_REGION( 0x01e000, REGION_CPU2 )	/* 6809 code */
304 	ROM_LOAD(	"d5",	0x000000, 0x010000, 0x3b73b9c5 )
305 
306 	ROM_REGION( 0x400000, REGION_GFX1 | REGIONFLAG_DISPOSE )
307 	ROM_LOAD( "h5",	0x000000, 0x080000, 0x20e239ff )
308 	ROM_RELOAD(		0x080000, 0x080000 )
309 	ROM_LOAD( "h10",0x100000, 0x080000, 0xab442855 )
310 	ROM_RELOAD(		0x180000, 0x080000 )
311 	ROM_LOAD( "h8",	0x200000, 0x080000, 0x83dce5a3 )
312 	ROM_RELOAD(		0x280000, 0x080000 )
313 	ROM_LOAD( "h6",	0x300000, 0x080000, 0x24e84b24 )
314 	ROM_RELOAD(		0x380000, 0x080000 )
315 
316 	ROM_REGION( 0x040000, REGION_SOUND1 )	/* ADPCM samples - sound chip is OKIM6295 */
317 	ROM_LOAD( "d1",	0x000000, 0x040000, 0x26444ad1 )
318 ROM_END
319 
320 
321 /*============================================================================
322 					BIOMECHANICAL TOY & MANIAC SQUARE
323   ============================================================================*/
324 
325 int maniacsq_vh_start( void );
326 void maniacsq_vh_screenrefresh( struct osd_bitmap *bitmap,int full_refresh );
327 
328 
329 static struct MemoryReadAddress maniacsq_readmem[] =
330 {
331 	{ 0x000000, 0x0fffff, MRA_ROM },			/* ROM */
332 	{ 0x100000, 0x101fff, gaelco_vram_r },		/* Video RAM */
333 	{ 0x200000, 0x2007ff, paletteram_word_r },	/* Palette */
334 	{ 0x440000, 0x440fff, MRA_BANK2 },			/* Sprite RAM */
335 	{ 0x700000, 0x700001, input_port_0_r },		/* DIPSW #2 */
336 	{ 0x700002, 0x700003, input_port_1_r },		/* DIPSW #1 */
337 	{ 0x700004, 0x700005, input_port_2_r },		/* INPUT #1 */
338 	{ 0x700006, 0x700007, input_port_3_r },		/* INPUT #2 */
339 	{ 0x70000e, 0x70000f, OKIM6295_status_0_r },/* OKI6295 status register */
340 	{ 0xff0000, 0xffffff, MRA_BANK3 },			/* Work RAM */
341 	{ -1 }
342 };
343 
WRITE_HANDLER(OKIM6295_bankswitch_w)344 static WRITE_HANDLER( OKIM6295_bankswitch_w )
345 {
346 	unsigned char *RAM = memory_region(REGION_SOUND1);
347 
348 	memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f)*0x10000], 0x10000);
349 }
350 
351 static struct MemoryWriteAddress maniacsq_writemem[] =
352 {
353 	{ 0x000000, 0x0fffff, MWA_ROM },								/* ROM */
354 	{ 0x100000, 0x101fff, gaelco_vram_w, &gaelco_videoram },		/* Video RAM */
355 	{ 0x108000, 0x108007, MWA_BANK1, &gaelco_vregs },				/* Video Registers */
356 //	{ 0x10800c, 0x10800d, watchdog_reset_w },						/* INT 6 ACK/Watchdog timer */
357 	{ 0x200000, 0x2007ff, paletteram_xBBBBBGGGGGRRRRR_word_w, &paletteram },/* Palette */
358 	{ 0x440000, 0x440fff, MWA_BANK2, &gaelco_spriteram },			/* Sprite RAM */
359 	{ 0x70000c, 0x70000d, OKIM6295_bankswitch_w },					/* OKI6295 bankswitch */
360 	{ 0x70000e, 0x70000f, OKIM6295_data_0_w },						/* OKI6295 data register */
361 	{ 0xff0000, 0xffffff, MWA_BANK3 },								/* Work RAM */
362 	{ -1 }
363 };
364 
365 
366 INPUT_PORTS_START( maniacsq )
367 
368 PORT_START	/* DSW #2 */
369 	PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
370 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
371 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
372 	PORT_DIPSETTING(    0x02, DEF_STR( On ) )
373 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) )
374 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
375 	PORT_DIPSETTING(    0x04, DEF_STR( On ) )
376 	PORT_DIPNAME( 0x08, 0x00, "Sound Type" )
377 	PORT_DIPSETTING(    0x00, "Stereo" )
378 	PORT_DIPSETTING(    0x08, "Mono" )
379 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
380 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
381 	PORT_DIPSETTING(    0x10, DEF_STR( On ) )
382 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
383 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
384 	PORT_DIPSETTING(    0x20, DEF_STR( On ) )
385 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
386 	PORT_DIPSETTING(    0x40, "Easy" )
387 	PORT_DIPSETTING(    0xc0, "Normal" )
388 	PORT_DIPSETTING(    0x80, "Hard" )
389 	PORT_DIPSETTING(    0x00, "Hardest" )
390 
391 PORT_START	/* DSW #1 */
392 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_B ) )
393 	PORT_DIPSETTING(    0x0e, DEF_STR( 4C_1C ) )
394 	PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
395 	PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) )
396 	PORT_DIPSETTING(    0x0a, DEF_STR( 3C_2C ) )
397 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
398 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
399 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_2C ) )
400 	PORT_DIPSETTING(    0x0b, DEF_STR( 1C_3C ) )
401 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) )
402 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_5C ) )
403 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_6C ) )
404 	PORT_DIPSETTING(    0x00, "1C/1C or Free Play (if Coin A too)" )
405 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_A ) )
406 	PORT_DIPSETTING(    0xe0, DEF_STR( 4C_1C ) )
407 	PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
408 	PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) )
409 	PORT_DIPSETTING(    0xa0, DEF_STR( 3C_2C ) )
410 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
411 	PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) )
412 	PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )
413 	PORT_DIPSETTING(    0xb0, DEF_STR( 1C_3C ) )
414 	PORT_DIPSETTING(    0x30, DEF_STR( 1C_4C ) )
415 	PORT_DIPSETTING(    0xd0, DEF_STR( 1C_5C ) )
416 	PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
417 	PORT_DIPSETTING(    0x00, "1C/1C or Free Play (if Coin B too)" )
418 
419 PORT_START	/* 1P INPUTS & COINSW */
420 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER1 )
421 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER1 )
422 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
423 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER1 )
424 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
425 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
426 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
427 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
428 
429 PORT_START	/* 2P INPUTS & STARTSW */
430 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
431 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
432 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
433 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
434 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
435 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
436 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
437 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
438 INPUT_PORTS_END
439 
440 
441 INPUT_PORTS_START( biomtoy )
442 	PORT_START	/* DSW #2 */
443 	PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
444 	PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
445 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
446 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
447 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
448 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
449 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
450 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
451 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
452 	PORT_DIPSETTING(    0x08, DEF_STR( On ) )
453 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
454 	PORT_DIPSETTING(    0x20, "0" )
455 	PORT_DIPSETTING(    0x10, "1" )
456 	PORT_DIPSETTING(    0x30, "2" )
457 	PORT_DIPSETTING(    0x00, "3" )
458 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) )
459 	PORT_DIPSETTING(    0x40, "Easy" )
460 	PORT_DIPSETTING(    0xc0, "Normal" )
461 	PORT_DIPSETTING(    0x80, "Hard" )
462 	PORT_DIPSETTING(    0x00, "Hardest" )
463 
464 	PORT_START	/* DSW #1 */
465 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_B ) )
466 	PORT_DIPSETTING(    0x0e, DEF_STR( 4C_1C ) )
467 	PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
468 	PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) )
469 	PORT_DIPSETTING(    0x0a, DEF_STR( 3C_2C ) )
470 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
471 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
472 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_2C ) )
473 	PORT_DIPSETTING(    0x0b, DEF_STR( 1C_3C ) )
474 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) )
475 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_5C ) )
476 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_6C ) )
477 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
478 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_A ) )
479 	PORT_DIPSETTING(    0xe0, DEF_STR( 4C_1C ) )
480 	PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
481 	PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) )
482 	PORT_DIPSETTING(    0xa0, DEF_STR( 3C_2C ) )
483 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
484 	PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) )
485 	PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )
486 	PORT_DIPSETTING(    0xb0, DEF_STR( 1C_3C ) )
487 	PORT_DIPSETTING(    0x30, DEF_STR( 1C_4C ) )
488 	PORT_DIPSETTING(    0xd0, DEF_STR( 1C_5C ) )
489 	PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
490 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
491 
492 	PORT_START	/* 1P INPUTS & COINSW */
493 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER1 )
494 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER1 )
495 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
496 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER1 )
497 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
498 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
499 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
500 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
501 
502 	PORT_START	/* 2P INPUTS & STARTSW */
503 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
504 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
505 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
506 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
507 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
508 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
509 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
510 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
511 INPUT_PORTS_END
512 
513 
514 static struct OKIM6295interface maniacsq_okim6295_interface =
515 {
516 	1,                  /* 1 chip */
517 	{ 8000 },			/* 8000 KHz? */
518 	{ REGION_SOUND1 },  /* memory region */
519 	{ 100 }				/* volume */
520 };
521 
522 static struct MachineDriver machine_driver_maniacsq =
523 {
524 	{
525 		{
526 			CPU_M68000,
527 			24000000/2,			/* 12 MHz */
528 			maniacsq_readmem,maniacsq_writemem,0,0,
529 			m68_level6_irq,1
530 		}
531 	},
532 	60,DEFAULT_REAL_60HZ_VBLANK_DURATION,
533 	1,
534 	0,
535 
536 	/* video hardware */
537 	32*16, 32*16, { 0, 320-1, 16, 256-1 },
538 	gfxdecodeinfo_0x100000,
539 	1024, 1024,
540 	0,
541 
542 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
543 	0,
544 	maniacsq_vh_start,
545 	gaelco_vh_stop,
546 	maniacsq_vh_screenrefresh,
547 
548 	/* sound hardware */
549 	0,0,0,0,
550 	{
551 		{
552 			SOUND_OKIM6295,
553 			&maniacsq_okim6295_interface
554 		}
555 	}
556 };
557 
558 
559 ROM_START( maniacsq )
560 	ROM_REGION( 0x100000, REGION_CPU1 )	/* 68000 code */
561 	ROM_LOAD_EVEN(	"d18",	0x000000, 0x020000, 0x740ecab2 )
562 	ROM_LOAD_ODD(	"d16",	0x000000, 0x020000, 0xc6c42729 )
563 
564 	ROM_REGION( 0x400000, REGION_GFX1 | REGIONFLAG_DISPOSE )
565 	ROM_LOAD( "f3",	0x000000, 0x040000, 0xe7f6582b )
566 	ROM_RELOAD(		0x080000, 0x040000 )
567 	/* 0x040000-0x07ffff and 0x0c0000-0x0fffff empty */
568 	ROM_LOAD( "f2",	0x100000, 0x040000, 0xca43a5ae )
569 	ROM_RELOAD(		0x180000, 0x040000 )
570 	/* 0x140000-0x17ffff and 0x1c0000-0x1fffff empty */
571 	ROM_LOAD( "f1",	0x200000, 0x040000, 0xfca112e8 )
572 	ROM_RELOAD(		0x280000, 0x040000 )
573 	/* 0x240000-0x27ffff and 0x2c0000-0x2fffff empty */
574 	ROM_LOAD( "f0",	0x300000, 0x040000, 0x6e829ee8 )
575 	ROM_RELOAD(		0x380000, 0x040000 )
576 	/* 0x340000-0x37ffff and 0x3c0000-0x3fffff empty */
577 
578 	ROM_REGION( 0x140000, REGION_SOUND1 )	/* ADPCM samples - sound chip is OKIM6295 */
579 	ROM_LOAD( "c1",	0x000000, 0x080000, 0x2557f2d6 )
580 	/* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
581 	ROM_RELOAD(		0x040000, 0x080000 )
582 	ROM_RELOAD(		0x0c0000, 0x080000 )
583 ROM_END
584 
585 
586 ROM_START( biomtoy )
587 	ROM_REGION( 0x100000, REGION_CPU1 )	/* 68000 code */
588 	ROM_LOAD_EVEN(	"d18",	0x000000, 0x080000, 0x4569ce64 )
589 	ROM_LOAD_ODD(	"d16",	0x000000, 0x080000, 0x739449bd )
590 
591 	ROM_REGION( 0x400000, REGION_GFX1 | REGIONFLAG_DISPOSE )
592 	/* weird gfx ordering */
593 	ROM_LOAD( "h6",		0x040000, 0x040000, 0x9416a729 )
594 	ROM_CONTINUE(		0x0c0000, 0x040000 )
595 	ROM_LOAD( "j6",		0x000000, 0x040000, 0xe923728b )
596 	ROM_CONTINUE(		0x080000, 0x040000 )
597 	ROM_LOAD( "h7",		0x140000, 0x040000, 0x9c984d7b )
598 	ROM_CONTINUE(		0x1c0000, 0x040000 )
599 	ROM_LOAD( "j7",		0x100000, 0x040000, 0x0e18fac2 )
600 	ROM_CONTINUE(		0x180000, 0x040000 )
601 	ROM_LOAD( "h9",		0x240000, 0x040000, 0x8c1f6718 )
602 	ROM_CONTINUE(		0x2c0000, 0x040000 )
603 	ROM_LOAD( "j9",		0x200000, 0x040000, 0x1c93f050 )
604 	ROM_CONTINUE(		0x280000, 0x040000 )
605 	ROM_LOAD( "h10",	0x340000, 0x040000, 0xaca1702b )
606 	ROM_CONTINUE(		0x3c0000, 0x040000 )
607 	ROM_LOAD( "j10",	0x300000, 0x040000, 0x8e3e96cc )
608 	ROM_CONTINUE(		0x380000, 0x040000 )
609 
610 	ROM_REGION( 0x140000, REGION_SOUND1 )	/* ADPCM samples - sound chip is OKIM6295 */
611 	ROM_LOAD( "c1",	0x000000, 0x080000, 0x0f02de7e )
612 	/* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
613 	ROM_RELOAD(		0x040000, 0x080000 )
614 	ROM_LOAD( "c3",	0x0c0000, 0x080000, 0x914e4bbc )
615 ROM_END
616 
617 
618 
619 GAME( 1991, bigkarnk, 0, bigkarnk, bigkarnk, 0, ROT0_16BIT, "Gaelco", "Big Karnak" )
620 GAME( 1995, biomtoy,  0, maniacsq, biomtoy,  0, ROT0_16BIT, "Gaelco", "Biomechanical Toy (Unprotected)" )
621 GAME( 1996, maniacsq, 0, maniacsq, maniacsq, 0, ROT0_16BIT, "Gaelco", "Maniac Square (Prototype)" )
622