1 /***************************************************************************
2 
3 Cops 01      (c) 1985 Nichibutsu
4 Mighty Guy   (c) 1986 Nichibutsu
5 
6 driver by Carlos A. Lozano <calb@gsyc.inf.uc3m.es>
7 
8 TODO:
9 ----
10 mightguy:
11 - crashes during the confrontation with the final boss (only tested with Invincibility on)
12 - missing emulation of the 1412M2 protection chip, used by the sound CPU.
13 
14 
15 Mighty Guy board layout:
16 -----------------------
17 
18   cpu
19 
20 12MHz     SW1
21           SW2                 clr.13D clr.14D clr.15D      clr.19D
22 
23       Nichibutsu
24       NBB 60-06                        4     5
25 
26   1 2 3  6116 6116                    6116   6116
27 
28 -------
29 
30  video
31 
32  6116   11  Nichibutsu
33             NBA 60-07    13B                               20MHz
34                                 2148                2148
35                                 2148                2148
36 
37               6116             9                        8  2E
38  20G          10               7                        6
39  -------
40 
41  audio sub-board MT-S3
42  plugs into 40 pin socket at 20G
43 
44                      10.IC2
45 
46                      Nichibutsu
47                      1412M2 (Yamaha 3810?)
48                                8MHz
49                      YM3526
50 
51 ***************************************************************************/
52 #include "driver.h"
53 #include "vidhrdw/generic.h"
54 
55 #define MIGHTGUY_HACK	0
56 
57 
58 extern data8_t *cop01_bgvideoram,*cop01_fgvideoram;
59 
60 PALETTE_INIT( cop01 );
61 VIDEO_START( cop01 );
62 VIDEO_UPDATE( cop01 );
63 WRITE_HANDLER( cop01_background_w );
64 WRITE_HANDLER( cop01_foreground_w );
65 WRITE_HANDLER( cop01_vreg_w );
66 
67 
WRITE_HANDLER(cop01_sound_command_w)68 static WRITE_HANDLER( cop01_sound_command_w )
69 {
70 	soundlatch_w(offset,data);
71 	cpu_set_irq_line_and_vector(1,0,HOLD_LINE,0xff);
72 }
73 
READ_HANDLER(cop01_sound_command_r)74 static READ_HANDLER( cop01_sound_command_r )
75 {
76 	int res;
77 	static int pulse;
78 #define TIMER_RATE 12000	/* total guess */
79 
80 
81 	res = (soundlatch_r(offset) & 0x7f) << 1;
82 
83 	/* bit 0 seems to be a timer */
84 	if ((activecpu_gettotalcycles() / TIMER_RATE) & 1)
85 	{
86 		if (pulse == 0) res |= 1;
87 		pulse = 1;
88 	}
89 	else pulse = 0;
90 
91 	return res;
92 }
93 
94 
READ_HANDLER(mightguy_dsw_r)95 static READ_HANDLER( mightguy_dsw_r )
96 {
97 	int data = 0xff;
98 
99 	switch (offset)
100 	{
101 		case 0 :				/* DSW1*/
102 			data = (readinputport(3) & 0x7f) | ((readinputport(5) & 0x04) << 5);
103 			break;
104 		case 1 :				/* DSW2*/
105 			data = (readinputport(4) & 0x3f) | ((readinputport(5) & 0x03) << 6);
106 			break;
107 		}
108 
109 	return (data);
110 }
111 
112 
MEMORY_READ_START(readmem)113 static MEMORY_READ_START( readmem )
114 	{ 0x0000, 0xbfff, MRA_ROM },
115 	{ 0xc000, 0xcfff, MRA_RAM },	/* c000-c7ff in cop01 */
116 	{ 0xd000, 0xdfff, MRA_RAM },
117 MEMORY_END
118 
119 static MEMORY_WRITE_START( writemem )
120 	{ 0x0000, 0xbfff, MWA_ROM },
121 	{ 0xc000, 0xcfff, MWA_RAM },	/* c000-c7ff in cop01 */
122 	{ 0xd000, 0xdfff, cop01_background_w, &cop01_bgvideoram },
123 	{ 0xe000, 0xe0ff, MWA_RAM, &spriteram, &spriteram_size },
124 	{ 0xf000, 0xf3ff, cop01_foreground_w, &cop01_fgvideoram },
125 MEMORY_END
126 
127 static PORT_READ_START( readport )
128 	{ 0x00, 0x00, input_port_0_r },
129 	{ 0x01, 0x01, input_port_1_r },
130 	{ 0x02, 0x02, input_port_2_r },
131 	{ 0x03, 0x03, input_port_3_r },
132 	{ 0x04, 0x04, input_port_4_r },
133 PORT_END
134 
135 static PORT_READ_START( mightguy_readport )
136 	{ 0x00, 0x00, input_port_0_r },
137 	{ 0x01, 0x01, input_port_1_r },
138 	{ 0x02, 0x02, input_port_2_r },
139 	{ 0x03, 0x04, mightguy_dsw_r },
140 PORT_END
141 
142 static PORT_WRITE_START( writeport )
143 	{ 0x40, 0x43, cop01_vreg_w },
144 	{ 0x44, 0x44, cop01_sound_command_w },
145 	{ 0x45, 0x45, watchdog_reset_w }, /* ? */
146 PORT_END
147 
148 static MEMORY_READ_START( sound_readmem )
149 	{ 0x0000, 0x7fff, MRA_ROM },
150 	{ 0x8000, 0x8000, MRA_NOP },	/* irq ack? */
151 	{ 0xc000, 0xc7ff, MRA_RAM },
152 MEMORY_END
153 
154 static MEMORY_WRITE_START( sound_writemem )
155 	{ 0x0000, 0x7fff, MWA_ROM },
156 	{ 0xc000, 0xc7ff, MWA_RAM },
157 MEMORY_END
158 
159 static PORT_READ_START( sound_readport )
160 	{ 0x06, 0x06, cop01_sound_command_r },
161 PORT_END
162 
163 static PORT_WRITE_START( sound_writeport )
164 	{ 0x00, 0x00, AY8910_control_port_0_w },
165 	{ 0x01, 0x01, AY8910_write_port_0_w },
166 	{ 0x02, 0x02, AY8910_control_port_1_w },
167 	{ 0x03, 0x03, AY8910_write_port_1_w },
168 	{ 0x04, 0x04, AY8910_control_port_2_w },
169 	{ 0x05, 0x05, AY8910_write_port_2_w },
170 PORT_END
171 
172 /* this just gets some garbage out of the YM3526 */
173 static READ_HANDLER( kludge ) { static int timer; return timer++; }
174 
PORT_READ_START(mightguy_sound_readport)175 static PORT_READ_START( mightguy_sound_readport )
176 	{ 0x03, 0x03, kludge },		/* 1412M2? */
177 	{ 0x06, 0x06, cop01_sound_command_r },
178 PORT_END
179 
180 static PORT_WRITE_START( mightguy_sound_writeport )
181 	{ 0x00, 0x00, YM3526_control_port_0_w },
182 	{ 0x01, 0x01, YM3526_write_port_0_w },
183 	{ 0x02, 0x02, MWA_NOP },	/* 1412M2? */
184 	{ 0x03, 0x03, MWA_NOP },	/* 1412M2? */
185 PORT_END
186 
187 
188 
189 INPUT_PORTS_START( cop01 )
190 	PORT_START	/* IN0 */
191 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
192 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
193 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
194 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
195 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
196 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
197 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
198 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
199 
200 	PORT_START	/* IN1 */
201 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
202 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
203 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
204 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
205 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
206 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
207 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
208 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
209 
210 	PORT_START	/* TEST, COIN, START */
211 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
212 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
213 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
214 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
215 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
216 	PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
217 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
218 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
219 
220 	PORT_START	/* DSW1 */
221 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
222 	PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
223 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
224 	PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
225 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
226 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
227 	PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
228 	PORT_DIPSETTING(    0x08, DEF_STR( 2C_3C ) )
229 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_3C ) )
230 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_6C ) )
231 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
232 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
233 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
234 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
235 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
236 	PORT_DIPSETTING(    0x20, DEF_STR( On ) )
237 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
238 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
239 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
240 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
241 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
242 	PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
243 
244 	PORT_START	/* DSW2 */
245 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
246 	PORT_DIPSETTING(    0x03, "Easy" )
247 	PORT_DIPSETTING(    0x01, "Medium" )
248 	PORT_DIPSETTING(    0x02, "Hard" )
249 	PORT_DIPSETTING(    0x00, "Hardest" )
250 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
251 	PORT_DIPSETTING(    0x0c, "3" )
252 	PORT_DIPSETTING(    0x04, "4" )
253 	PORT_DIPSETTING(    0x08, "5" )
254 	PORT_DIPSETTING(    0x00, "6" )
255 	PORT_DIPNAME( 0x10, 0x10, "1st Bonus Life" )
256 	PORT_DIPSETTING(    0x10, "20000" )
257 	PORT_DIPSETTING(    0x00, "30000" )
258 	PORT_DIPNAME( 0x60, 0x60, "2nd Bonus Life" )
259 	PORT_DIPSETTING(    0x60, "30000" )
260 	PORT_DIPSETTING(    0x20, "50000" )
261 	PORT_DIPSETTING(    0x40, "100000" )
262 	PORT_DIPSETTING(    0x00, "150000" )
263 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
264 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
265 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
266 INPUT_PORTS_END
267 
268 /* There is an ingame bug at 0x00e4 to 0x00e6 that performs the 'rrca' instead of 'rlca'
269    so you DSW1-8 has no effect and you can NOT start a game at areas 5 to 8. */
270 INPUT_PORTS_START( mightguy )
271 	PORT_START	/* IN0 */
272 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
273 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
274 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
275 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
276 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
277 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
278 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
279 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
280 
281 	PORT_START	/* IN1 */
282 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
283 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
284 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
285 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
286 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
287 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
288 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
289 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
290 
291 	PORT_START	/* IN2 */
292 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
293 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
294 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
295 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
296 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
297 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE )	/* same as the service dip switch */
298 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
299 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
300 
301 	PORT_START	/* DSW1 */
302 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
303 	PORT_DIPSETTING(	0x03, "3" )
304 	PORT_DIPSETTING(	0x02, "4" )
305 	PORT_DIPSETTING(	0x01, "5" )
306 	PORT_DIPSETTING(	0x00, "6" )
307 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
308 	PORT_DIPSETTING(	0x04, "every 200000" )
309 	PORT_DIPSETTING(	0x00, "only 500000" )
310 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
311 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
312 	PORT_DIPSETTING(	0x08, DEF_STR( On ) )
313 	PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
314 	PORT_DIPSETTING(	0x00, DEF_STR( Upright ) )
315 	PORT_DIPSETTING(	0x10, DEF_STR( Cocktail ) )
316 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) )
317 	PORT_DIPSETTING(	0x20, DEF_STR( Off ) )
318 	PORT_DIPSETTING(	0x00, DEF_STR( On ) )
319 	PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
320 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL )	/* "Start Area" - see fake Dip Switch*/
321 
322 	PORT_START	/* DSW2 */
323 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
324 	PORT_DIPSETTING(	0x01, DEF_STR( 2C_1C ) )
325 	PORT_DIPSETTING(	0x03, DEF_STR( 1C_1C ) )
326 	PORT_DIPSETTING(	0x02, DEF_STR( 1C_2C ) )
327 	PORT_DIPSETTING(	0x00, DEF_STR( Free_Play ) )
328 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
329 	PORT_DIPSETTING(	0x00, DEF_STR( 3C_1C ) )
330 	PORT_DIPSETTING(	0x04, DEF_STR( 2C_3C ) )
331 	PORT_DIPSETTING(	0x0c, DEF_STR( 1C_3C ) )
332 	PORT_DIPSETTING(	0x08, DEF_STR( 1C_6C ) )
333 	PORT_DIPNAME( 0x30, 0x20, DEF_STR( Difficulty ) )
334 	PORT_DIPSETTING(	0x30, "Easy" )
335 	PORT_DIPSETTING(	0x20, "Normal" )
336 	PORT_DIPSETTING(	0x10, "Hard" )
337 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Invincibility", IP_KEY_NONE, IP_JOY_NONE )
338 	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_SPECIAL )	/* "Start Area" - see fake Dip Switch*/
339 
340 	PORT_START	/* FAKE Dip Switch */
341 	PORT_DIPNAME( 0x07, 0x07, "Starting Area" )
342 	PORT_DIPSETTING(	0x07, "1" )
343 	PORT_DIPSETTING(	0x06, "2" )
344 	PORT_DIPSETTING(	0x05, "3" )
345 	PORT_DIPSETTING(	0x04, "4" )
346 	/* Not working due to ingame bug (see above) */
347 #if MIGHTGUY_HACK
348 	PORT_DIPSETTING(	0x03, "5" )
349 	PORT_DIPSETTING(	0x02, "6" )
350 	PORT_DIPSETTING(	0x01, "7" )
351 	PORT_DIPSETTING(	0x00, "8" )
352 #endif
353 INPUT_PORTS_END
354 
355 
356 
357 static struct GfxLayout charlayout =
358 {
359 	8,8,
360 	RGN_FRAC(1,1),
361 	4,
362 	{ 0, 1, 2, 3 },
363 	{ 1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4 },
364 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
365 	32*8
366 };
367 
368 static struct GfxLayout tilelayout =
369 {
370 	8,8,
371 	RGN_FRAC(1,1),
372 	4,
373 	{ 0, 1, 2, 3 },
374 	{ 4+8*0, 0+8*0, 4+8*1, 0+8*1, 4+8*2, 0+8*2, 4+8*3, 0+8*3 },
375 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
376 	32*8
377 };
378 
379 static struct GfxLayout spritelayout =
380 {
381 	16,16,
382 	RGN_FRAC(1,2),
383 	4,
384 	{ 0, 1, 2, 3 },
385 	{
386 		RGN_FRAC(1,2)+4, RGN_FRAC(1,2)+0,   4, 0,
387 		RGN_FRAC(1,2)+12, RGN_FRAC(1,2)+8,  12, 8,
388 		RGN_FRAC(1,2)+20, RGN_FRAC(1,2)+16, 20, 16,
389 		RGN_FRAC(1,2)+28, RGN_FRAC(1,2)+24, 28, 24,
390 	},
391 	{
392 		0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
393 		8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32
394 	},
395 	64*8
396 };
397 
398 static struct GfxDecodeInfo gfxdecodeinfo[] =
399 {
400 	{ REGION_GFX1, 0, &charlayout,         0,  1 },
401 	{ REGION_GFX2, 0, &tilelayout,        16,  8 },
402 	{ REGION_GFX3, 0, &spritelayout, 16+8*16, 16 },
403 	{ -1 }
404 };
405 
406 
407 
408 static struct AY8910interface ay8910_interface =
409 {
410 	3,	/* 3 chips */
411 	1500000,	/* 1.5 MHz?????? */
412 	{ 15, 15, 15 },
413 	{ 0 },
414 	{ 0 },
415 	{ 0 },
416 	{ 0 }
417 };
418 
419 static struct YM3526interface YM3526_interface =
420 {
421 	1,
422 	4000000,	/* 4 MHz??? */
423 	{ 100 }
424 };
425 
426 
427 
428 static MACHINE_DRIVER_START( cop01 )
429 
430 	/* basic machine hardware */
431 	MDRV_CPU_ADD(Z80, 4000000)	/* ???? */
MDRV_CPU_MEMORY(readmem,writemem)432 	MDRV_CPU_MEMORY(readmem,writemem)
433 	MDRV_CPU_PORTS(readport,writeport)
434 	MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
435 
436 	MDRV_CPU_ADD(Z80, 3000000)
437 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	/* ???? */
438 	MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
439 	MDRV_CPU_PORTS(sound_readport,sound_writeport)
440 
441 	MDRV_FRAMES_PER_SECOND(60)
442 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
443 
444 	/* video hardware */
445 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
446 	MDRV_SCREEN_SIZE(32*8, 32*8)
447 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
448 	MDRV_GFXDECODE(gfxdecodeinfo)
449 	MDRV_PALETTE_LENGTH(256)
450 	MDRV_COLORTABLE_LENGTH(16+8*16+16*16)
451 
452 	MDRV_PALETTE_INIT(cop01)
453 	MDRV_VIDEO_START(cop01)
454 	MDRV_VIDEO_UPDATE(cop01)
455 
456 	/* sound hardware */
457 	MDRV_SOUND_ADD(AY8910, ay8910_interface)
458 MACHINE_DRIVER_END
459 
460 static MACHINE_DRIVER_START( mightguy )
461 
462 	/* basic machine hardware */
463 	MDRV_CPU_ADD(Z80, 4000000)	/* ???? */
464 	MDRV_CPU_MEMORY(readmem,writemem)
465 	MDRV_CPU_PORTS(mightguy_readport,writeport)
466 	MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
467 
468 	MDRV_CPU_ADD(Z80, 3000000)
469 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	/* ???? */
470 	MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
471 	MDRV_CPU_PORTS(mightguy_sound_readport,mightguy_sound_writeport)
472 
473 	MDRV_FRAMES_PER_SECOND(60)
474 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
475 
476 	/* video hardware */
477 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
478 	MDRV_SCREEN_SIZE(32*8, 32*8)
479 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
480 	MDRV_GFXDECODE(gfxdecodeinfo)
481 	MDRV_PALETTE_LENGTH(256)
482 	MDRV_COLORTABLE_LENGTH(16+8*16+16*16)
483 
484 	MDRV_PALETTE_INIT(cop01)
485 	MDRV_VIDEO_START(cop01)
486 	MDRV_VIDEO_UPDATE(cop01)
487 
488 	/* sound hardware */
489 	MDRV_SOUND_ADD(YM3526, YM3526_interface)
490 MACHINE_DRIVER_END
491 
492 
493 
494 ROM_START( cop01 )
495 	ROM_REGION( 0x10000, REGION_CPU1, 0 )     /* 64k for code */
496 	ROM_LOAD( "cop01.2b",     0x0000, 0x4000, CRC(5c2734ab) SHA1(dd6724dfb1c58e6ce3c1c99cad8732a0f5c9b773) )
497 	ROM_LOAD( "cop02.4b",     0x4000, 0x4000, CRC(9c7336ef) SHA1(2aa58aea19dafb53190d9bef7b3aa9c3004522f0) )
498 	ROM_LOAD( "cop03.5b",     0x8000, 0x4000, CRC(2566c8bf) SHA1(c9d98afd1f02a208b1af1d418e69e88f8703afa5) )
499 
500 	ROM_REGION( 0x10000, REGION_CPU2, 0 )     /* 64k for code */
501 	ROM_LOAD( "cop15.17b",    0x0000, 0x4000, CRC(6a5f08fa) SHA1(8838549502b1a6ac72dd5efd58e0968f8abe338a) )
502 	ROM_LOAD( "cop16.18b",    0x4000, 0x4000, CRC(56bf6946) SHA1(5414d00c6de96cfb5a3e68c35376333df6c525ee) )
503 
504 	ROM_REGION( 0x02000, REGION_GFX1, ROMREGION_DISPOSE )
505 	ROM_LOAD( "cop14.15g",    0x00000, 0x2000, CRC(066d1c55) SHA1(017a0576799d39b919e6ca9b4a7f106ed04c0f94) )	/* chars */
506 
507 	ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE )
508 	ROM_LOAD( "cop04.15c",    0x00000, 0x4000, CRC(622d32e6) SHA1(982b585e9a1115bce25c1788999d34423ccb83ab) )	/* tiles */
509 	ROM_LOAD( "cop05.16c",    0x04000, 0x4000, CRC(c6ac5a35) SHA1(dab3500981663ee19abac5bfeaaf6a07a3953d75) )
510 
511 	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )
512 	ROM_LOAD( "cop06.3g",     0x00000, 0x2000, CRC(f1c1f4a5) SHA1(139aa23416e71361fe62ce336e3f0529a21acb81) )	/* sprites */
513 	ROM_LOAD( "cop07.5g",     0x02000, 0x2000, CRC(11db7b72) SHA1(47a1223ed3e7b294d7e59c05d119488ef6b3dc7a) )
514 	ROM_LOAD( "cop08.6g",     0x04000, 0x2000, CRC(a63ddda6) SHA1(59aaa1fe0c023c4f0d4cfbdb9ca922182201c145) )
515 	ROM_LOAD( "cop09.8g",     0x06000, 0x2000, CRC(855a2ec3) SHA1(8a54c0ceedeeafd7c1a6a35b4efab28046967951) )
516 	ROM_LOAD( "cop10.3e",     0x08000, 0x2000, CRC(444cb19d) SHA1(e74118b027db65ba06291bc0fe0ff50bcacc32c2) )
517 	ROM_LOAD( "cop11.5e",     0x0a000, 0x2000, CRC(9078bc04) SHA1(3d8614415027f5db9ddb77b89656e4c7fc9d28de) )
518 	ROM_LOAD( "cop12.6e",     0x0c000, 0x2000, CRC(257a6706) SHA1(9e7ef1f40630b94849bdc3fd13ee6e7311fffd45) )
519 	ROM_LOAD( "cop13.8e",     0x0e000, 0x2000, CRC(07c4ea66) SHA1(12665c0fb648fd208805e81d056ab377d65b267a) )
520 
521 	ROM_REGION( 0x0500, REGION_PROMS, 0 )
522 	ROM_LOAD( "copproma.13d", 0x0000, 0x0100, CRC(97f68a7a) SHA1(010eaca95eeb5caec083bd184ec31e0f433fff8c) )	/* red */
523 	ROM_LOAD( "coppromb.14d", 0x0100, 0x0100, CRC(39a40b4c) SHA1(456b7f97fbd1cb4beb756033ec76a89ffe8de168) )	/* green */
524 	ROM_LOAD( "coppromc.15d", 0x0200, 0x0100, CRC(8181748b) SHA1(0098ae250095b4ac8af1811b4e41d86e3f587c7b) )	/* blue */
525 	ROM_LOAD( "coppromd.19d", 0x0300, 0x0100, CRC(6a63dbb8) SHA1(50f971f173147203cd24dc4fa7f0a27d2179f1cc) )	/* tile lookup table */
526 	ROM_LOAD( "copprome.2e",  0x0400, 0x0100, CRC(214392fa) SHA1(59d235c3e584e7fd484edf5c78c43d2597c1c3a8) )	/* sprite lookup table */
527 ROM_END
528 
529 ROM_START( cop01a )
530 	ROM_REGION( 0x10000, REGION_CPU1, 0 )     /* 64k for code */
531 	ROM_LOAD( "cop01alt.001", 0x0000, 0x4000, CRC(a13ee0d3) SHA1(2f28f901bdc041c79f785821d0052823654983a2) )
532 	ROM_LOAD( "cop01alt.002", 0x4000, 0x4000, CRC(20bad28e) SHA1(79155880ae1c9e8d19390c163cac31093ee11604) )
533 	ROM_LOAD( "cop01alt.003", 0x8000, 0x4000, CRC(a7e10b79) SHA1(ec7e4153a211d070c2dc09ab98a59f61ab10ea78) )
534 
535 	ROM_REGION( 0x10000, REGION_CPU2, 0 )     /* 64k for code */
536 	ROM_LOAD( "cop01alt.015", 0x0000, 0x4000, CRC(95be9270) SHA1(ffb4786e354c4c6ddce134ae3362da660199fd44) )
537 	ROM_LOAD( "cop01alt.016", 0x4000, 0x4000, CRC(c20bf649) SHA1(a719ad6bf35811957ad32e6f07494bb00f256965) )
538 
539 	ROM_REGION( 0x02000, REGION_GFX1, ROMREGION_DISPOSE )
540 	ROM_LOAD( "cop01alt.014", 0x00000, 0x2000, CRC(edd8a474) SHA1(42f0655535f1e10840da383129da69627d67ff8a) )	/* chars */
541 
542 	ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE )
543 	ROM_LOAD( "cop04.15c",    0x00000, 0x4000, CRC(622d32e6) SHA1(982b585e9a1115bce25c1788999d34423ccb83ab) )	/* tiles */
544 	ROM_LOAD( "cop05.16c",    0x04000, 0x4000, CRC(c6ac5a35) SHA1(dab3500981663ee19abac5bfeaaf6a07a3953d75) )
545 
546 	ROM_REGION( 0x10000, REGION_GFX3, ROMREGION_DISPOSE )
547 	ROM_LOAD( "cop01alt.006", 0x00000, 0x2000, CRC(cac7dac8) SHA1(25990ac4614de2ae61d663323bd67acc137bbc4a) )	/* sprites */
548 	ROM_LOAD( "cop07.5g",     0x02000, 0x2000, CRC(11db7b72) SHA1(47a1223ed3e7b294d7e59c05d119488ef6b3dc7a) )
549 	ROM_LOAD( "cop08.6g",     0x04000, 0x2000, CRC(a63ddda6) SHA1(59aaa1fe0c023c4f0d4cfbdb9ca922182201c145) )
550 	ROM_LOAD( "cop09.8g",     0x06000, 0x2000, CRC(855a2ec3) SHA1(8a54c0ceedeeafd7c1a6a35b4efab28046967951) )
551 	ROM_LOAD( "cop01alt.010", 0x08000, 0x2000, CRC(94aee9d6) SHA1(dd6f27dcee761c84447b8326bfa0532b7d708721) )
552 	ROM_LOAD( "cop11.5e",     0x0a000, 0x2000, CRC(9078bc04) SHA1(3d8614415027f5db9ddb77b89656e4c7fc9d28de) )
553 	ROM_LOAD( "cop12.6e",     0x0c000, 0x2000, CRC(257a6706) SHA1(9e7ef1f40630b94849bdc3fd13ee6e7311fffd45) )
554 	ROM_LOAD( "cop13.8e",     0x0e000, 0x2000, CRC(07c4ea66) SHA1(12665c0fb648fd208805e81d056ab377d65b267a) )
555 
556 	ROM_REGION( 0x0500, REGION_PROMS, 0 )
557 	ROM_LOAD( "copproma.13d", 0x0000, 0x0100, CRC(97f68a7a) SHA1(010eaca95eeb5caec083bd184ec31e0f433fff8c) )	/* red */
558 	ROM_LOAD( "coppromb.14d", 0x0100, 0x0100, CRC(39a40b4c) SHA1(456b7f97fbd1cb4beb756033ec76a89ffe8de168) )	/* green */
559 	ROM_LOAD( "coppromc.15d", 0x0200, 0x0100, CRC(8181748b) SHA1(0098ae250095b4ac8af1811b4e41d86e3f587c7b) )	/* blue */
560 	ROM_LOAD( "coppromd.19d", 0x0300, 0x0100, CRC(6a63dbb8) SHA1(50f971f173147203cd24dc4fa7f0a27d2179f1cc) )	/* tile lookup table */
561 	ROM_LOAD( "copprome.2e",  0x0400, 0x0100, CRC(214392fa) SHA1(59d235c3e584e7fd484edf5c78c43d2597c1c3a8) )	/* sprite lookup table */
562 	/* a timing PROM (13B?) is probably missing */
563 ROM_END
564 
565 ROM_START( mightguy )
566 	ROM_REGION( 0x60000, REGION_CPU1, 0 ) /* Z80 code (main cpu) */
567 	ROM_LOAD( "1.2b",       0x0000, 0x4000,CRC(bc8e4557) SHA1(4304ac1a0e11bad254ad937195f0be6e7186577d) )
568 	ROM_LOAD( "2.4b",       0x4000, 0x4000,CRC(fb73d684) SHA1(d8a4b6fb93b2c3710fc66f92df05c1459e4171c3) )
569 	ROM_LOAD( "3.5b",       0x8000, 0x4000,CRC(b14b6ab8) SHA1(a60059dd54c8cc974334fd879ff0cfd436a7a981) )
570 
571 	ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Z80 code (sound cpu) */
572 	ROM_LOAD( "11.15b",     0x0000, 0x4000, CRC(576183ea) SHA1(e3f28e8e8c34ab396d158da122584ed226729c99) )
573 
574 	ROM_REGION( 0x8000, REGION_USER1, 0 ) /* 1412M2 protection data */
575 	ROM_LOAD( "10.ic2",     0x0000, 0x8000, CRC(1a5d2bb1) SHA1(0fd4636133a980ba9ffa076f9010474586d37635) )
576 
577 	ROM_REGION( 0x02000, REGION_GFX1, ROMREGION_DISPOSE ) /* alpha */
578 	ROM_LOAD( "10.15g",     0x0000, 0x2000, CRC(17874300) SHA1(f97bee0ab491b04fe4950ebe9587031db6c815a3) )
579 
580 	ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE ) /* tiles */
581 	ROM_LOAD( "4.15c",      0x0000, 0x4000,CRC(84d29e76) SHA1(98e6c6e4a95471c5bef9fcb85a663b86eeda6b6d) )
582 	ROM_LOAD( "5.16c",      0x4000, 0x4000,CRC(f7bb8d82) SHA1(6ab6585827482fd23c3be129977a4443623d831c) )
583 
584 	ROM_REGION( 0x14000, REGION_GFX3, ROMREGION_DISPOSE ) /* sprites */
585 	ROM_LOAD( "6.3g",       0x00000, 0x2000, CRC(6ff88615) SHA1(8bfeab97bd1a14861e3a7538c0dd3c073adf29aa) )
586 	ROM_LOAD( "7.8g",       0x02000, 0x8000, CRC(e79ea66f) SHA1(2db80eef5375294bf9c7819f4090ec71f7f2be25) )
587 	ROM_LOAD( "8.3e",       0x0a000, 0x2000, CRC(29f6eb44) SHA1(d7957c8579d7d32c52c19d2fe7b90d1c890f29ea) )
588 	ROM_LOAD( "9.8e",       0x0c000, 0x8000, CRC(b9f64c6f) SHA1(82ec6ba689f16fed1141cd32640a8b1f1ab14bdd) )
589 
590 	ROM_REGION( 0x600, REGION_PROMS, 0 )
591 	ROM_LOAD( "clr.13d",    0x000, 0x100, CRC(c4cf0bdd) SHA1(350842c46a71fb5db43c8823662378f178bbda4f) ) /* red */
592 	ROM_LOAD( "clr.14d",    0x100, 0x100, CRC(5b3b8a9b) SHA1(6b660f5f7b0efdc20a79a9fd5a1eb30c85b27324) ) /* green */
593 	ROM_LOAD( "clr.15d",    0x200, 0x100, CRC(6c072a64) SHA1(5ce5306af478330eb3e94aa7c8bff08f34ba6ea5) ) /* blue */
594 	ROM_LOAD( "clr.19d",    0x300, 0x100, CRC(19b66ac6) SHA1(5e7de11f40685effa077377e7a55d7fecf752508) ) /* tile lookup table */
595 	ROM_LOAD( "2e",         0x400, 0x100, CRC(d9c45126) SHA1(aafebe424afa400ed320f17afc2b910eaada29f5) ) /* sprite lookup table */
596 	ROM_LOAD( "13b",        0x500, 0x100, CRC(4a6f9a6d) SHA1(65f1e0bfacd1f354ece1b18598a551044c27c4d1) ) /* state machine data used for video signals generation (not used in emulation)*/
597 ROM_END
598 
599 
600 static DRIVER_INIT( mightguy )
601 {
602 #if MIGHTGUY_HACK
603 	/* This is a hack to fix the game code to get a fully working
604 	   "Starting Area" fake Dip Switch */
605 	data8_t *RAM = (data8_t *)memory_region(REGION_CPU1);
606 	RAM[0x00e4] = 0x07;	/* rlca*/
607 	RAM[0x00e5] = 0x07;	/* rlca*/
608 	RAM[0x00e6] = 0x07;	/* rlca*/
609 	/* To avoid checksum error */
610 	RAM[0x027f] = 0x00;
611 	RAM[0x0280] = 0x00;
612 #endif
613 }
614 
615 
616 GAME( 1985, cop01,    0,     cop01,    cop01,    0,        ROT0,   "Nichibutsu", "Cop 01 (set 1)" )
617 GAME( 1985, cop01a,   cop01, cop01,    cop01,    0,        ROT0,   "Nichibutsu", "Cop 01 (set 2)" )
618 GAMEX(1986, mightguy, 0,     mightguy, mightguy, mightguy, ROT270, "Nichibutsu", "Mighty Guy", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND )
619