1 /***************************************************************************
2 
3   Vigilante
4 
5 If you have any questions about how this driver works, don't hesitate to
6 ask.  - Mike Balfour (mab22@po.cwru.edu)
7 
8 ***************************************************************************/
9 
10 #include "driver.h"
11 #include "vidhrdw/generic.h"
12 #include "sndhrdw/m72.h"
13 
14 /* vidhrdw/vigilant.c */
15 VIDEO_START( vigilant );
16 WRITE_HANDLER( vigilant_paletteram_w );
17 WRITE_HANDLER( vigilant_sprite_paletteram_w );
18 WRITE_HANDLER( vigilant_horiz_scroll_w );
19 WRITE_HANDLER( vigilant_rear_horiz_scroll_w );
20 WRITE_HANDLER( vigilant_rear_color_w );
21 VIDEO_UPDATE( vigilant );
22 VIDEO_UPDATE( kikcubic );
23 
24 
WRITE_HANDLER(vigilant_bank_select_w)25 WRITE_HANDLER( vigilant_bank_select_w )
26 {
27 	int bankaddress;
28 	unsigned char *RAM = memory_region(REGION_CPU1);
29 
30 	bankaddress = 0x10000 + (data & 0x07) * 0x4000;
31 	cpu_setbank(1,&RAM[bankaddress]);
32 }
33 
34 /***************************************************************************
35  vigilant_out2_w
36  **************************************************************************/
WRITE_HANDLER(vigilant_out2_w)37 WRITE_HANDLER( vigilant_out2_w )
38 {
39 	/* D0 = FILP = Flip screen? */
40 	/* D1 = COA1 = Coin Counter A? */
41 	/* D2 = COB1 = Coin Counter B? */
42 
43 	/* The hardware has both coin counters hooked up to a single meter. */
44 	coin_counter_w(0,data & 0x02);
45 	coin_counter_w(1,data & 0x04);
46 }
47 
WRITE_HANDLER(kikcubic_coin_w)48 WRITE_HANDLER( kikcubic_coin_w )
49 {
50 	/* bits 0 is flip screen */
51 
52 	/* bit 1 is used but unknown */
53 
54 	/* bits 4/5 are coin counters */
55 	coin_counter_w(0,data & 0x10);
56 	coin_counter_w(1,data & 0x20);
57 }
58 
59 
60 
MEMORY_READ_START(vigilant_readmem)61 static MEMORY_READ_START( vigilant_readmem )
62 	{ 0x0000, 0x7fff, MRA_ROM },
63 	{ 0x8000, 0xbfff, MRA_BANK1 },
64 	{ 0xc020, 0xc0df, MRA_RAM },
65 	{ 0xc800, 0xcfff, MRA_RAM },
66 	{ 0xd000, 0xdfff, videoram_r },
67 	{ 0xe000, 0xefff, MRA_RAM },
68 MEMORY_END
69 
70 static MEMORY_WRITE_START( vigilant_writemem )
71 	{ 0x0000, 0xbfff, MWA_ROM },
72 	{ 0xc020, 0xc0df, MWA_RAM, &spriteram, &spriteram_size },
73 	{ 0xc800, 0xcfff, vigilant_paletteram_w, &paletteram },
74 	{ 0xd000, 0xdfff, videoram_w, &videoram, &videoram_size },
75 	{ 0xe000, 0xefff, MWA_RAM },
76 MEMORY_END
77 
78 static PORT_READ_START( vigilant_readport )
79 	{ 0x00, 0x00, input_port_0_r },
80 	{ 0x01, 0x01, input_port_1_r },
81 	{ 0x02, 0x02, input_port_2_r },
82 	{ 0x03, 0x03, input_port_3_r },
83 	{ 0x04, 0x04, input_port_4_r },
84 PORT_END
85 
86 static PORT_WRITE_START( vigilant_writeport )
87 	{ 0x00, 0x00, m72_sound_command_w },  /* SD */
88 	{ 0x01, 0x01, vigilant_out2_w }, /* OUT2 */
89 	{ 0x04, 0x04, vigilant_bank_select_w }, /* PBANK */
90 	{ 0x80, 0x81, vigilant_horiz_scroll_w }, /* HSPL, HSPH */
91 	{ 0x82, 0x83, vigilant_rear_horiz_scroll_w }, /* RHSPL, RHSPH */
92 	{ 0x84, 0x84, vigilant_rear_color_w }, /* RCOD */
93 PORT_END
94 
95 static MEMORY_READ_START( kikcubic_readmem )
96 	{ 0x0000, 0x7fff, MRA_ROM },
97 	{ 0x8000, 0xbfff, MRA_BANK1 },
98 	{ 0xc000, 0xc0ff, MRA_RAM },
99 	{ 0xc800, 0xcaff, MRA_RAM },
100 	{ 0xd000, 0xdfff, videoram_r },
101 	{ 0xe000, 0xffff, MRA_RAM },
102 MEMORY_END
103 
104 static MEMORY_WRITE_START( kikcubic_writemem )
105 	{ 0x0000, 0xbfff, MWA_ROM },
106 	{ 0xc000, 0xc0ff, MWA_RAM, &spriteram, &spriteram_size },
107 	{ 0xc800, 0xcaff, vigilant_paletteram_w, &paletteram },
108 	{ 0xd000, 0xdfff, videoram_w, &videoram, &videoram_size },
109 	{ 0xe000, 0xffff, MWA_RAM },
110 MEMORY_END
111 
112 static PORT_READ_START( kikcubic_readport )
113 	{ 0x00, 0x00, input_port_3_r },
114 	{ 0x01, 0x01, input_port_4_r },
115 	{ 0x02, 0x02, input_port_0_r },
116 	{ 0x03, 0x03, input_port_1_r },
117 	{ 0x04, 0x04, input_port_2_r },
118 PORT_END
119 
120 static PORT_WRITE_START( kikcubic_writeport )
121 	{ 0x00, 0x00, kikcubic_coin_w },	/* also flip screen, and...? */
122 	{ 0x04, 0x04, vigilant_bank_select_w },
123 	{ 0x06, 0x06, m72_sound_command_w },
124 //	{ 0x07, 0x07, IOWP_NOP },	/* ?? */
125 PORT_END
126 
127 static MEMORY_READ_START( sound_readmem )
128 	{ 0x0000, 0xbfff, MRA_ROM },
129 	{ 0xf000, 0xffff, MRA_RAM },
130 MEMORY_END
131 
132 static MEMORY_WRITE_START( sound_writemem )
133 	{ 0x0000, 0xbfff, MWA_ROM },
134 	{ 0xf000, 0xffff, MWA_RAM },
135 MEMORY_END
136 
137 static PORT_READ_START( sound_readport )
138 	{ 0x01, 0x01, YM2151_status_port_0_r },
139 	{ 0x80, 0x80, soundlatch_r },	/* SDRE */
140 	{ 0x84, 0x84, m72_sample_r },	/* S ROM C */
141 PORT_END
142 
143 static PORT_WRITE_START( sound_writeport )
144 	{ 0x00, 0x00, YM2151_register_port_0_w },
145 	{ 0x01, 0x01, YM2151_data_port_0_w },
146 	{ 0x80, 0x81, vigilant_sample_addr_w },	/* STL / STH */
147 	{ 0x82, 0x82, m72_sample_w },			/* COUNT UP */
148 	{ 0x83, 0x83, m72_sound_irq_ack_w },	/* IRQ clear */
149 PORT_END
150 
151 
152 INPUT_PORTS_START( vigilant )
153 	PORT_START
154 	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START1 )
155 	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_START2 )
156 	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_COIN3 )
157 	PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_COIN1 )
158 	PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNKNOWN )
159 
160 	PORT_START
161 	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
162 	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
163 	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
164 	PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
165 	PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
166 	PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
167 	PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
168 	PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
169 
170 	PORT_START
171 	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_COCKTAIL )
172 	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_COCKTAIL )
173 	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_COCKTAIL )
174 	PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_COCKTAIL )
175 	PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN2 )
176 	PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
177 	PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
178 	PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
179 
180 	PORT_START
181 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
182 	PORT_DIPSETTING(	0x02, "2" )
183 	PORT_DIPSETTING(	0x03, "3" )
184 	PORT_DIPSETTING(	0x01, "4" )
185 	PORT_DIPSETTING(	0x00, "5" )
186 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Difficulty ) )
187 	PORT_DIPSETTING(	0x04, "Normal" )
188 	PORT_DIPSETTING(	0x00, "Hard" )
189 	PORT_DIPNAME( 0x08, 0x08, "Decrease of Energy" )
190 	PORT_DIPSETTING(	0x08, "Slow" )
191 	PORT_DIPSETTING(	0x00, "Fast" )
192 	/* TODO: support the different settings which happen in Coin Mode 2 */
193 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
194 	PORT_DIPSETTING(	0xa0, DEF_STR( 6C_1C ) )
195 	PORT_DIPSETTING(	0xb0, DEF_STR( 5C_1C ) )
196 	PORT_DIPSETTING(	0xc0, DEF_STR( 4C_1C ) )
197 	PORT_DIPSETTING(	0xd0, DEF_STR( 3C_1C ) )
198 	PORT_DIPSETTING(	0x10, DEF_STR( 8C_3C ) )
199 	PORT_DIPSETTING(	0xe0, DEF_STR( 2C_1C ) )
200 	PORT_DIPSETTING(	0x20, DEF_STR( 5C_3C ) )
201 	PORT_DIPSETTING(	0x30, DEF_STR( 3C_2C ) )
202 	PORT_DIPSETTING(	0xf0, DEF_STR( 1C_1C ) )
203 	PORT_DIPSETTING(	0x40, DEF_STR( 2C_3C ) )
204 	PORT_DIPSETTING(	0x90, DEF_STR( 1C_2C ) )
205 	PORT_DIPSETTING(	0x80, DEF_STR( 1C_3C ) )
206 	PORT_DIPSETTING(	0x70, DEF_STR( 1C_4C ) )
207 	PORT_DIPSETTING(	0x60, DEF_STR( 1C_5C ) )
208 	PORT_DIPSETTING(	0x50, DEF_STR( 1C_6C ) )
209 	PORT_DIPSETTING(	0x00, DEF_STR( Free_Play ) )
210 
211 	PORT_START
212 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
213 	PORT_DIPSETTING(	0x01, DEF_STR( Off ) )
214 	PORT_DIPSETTING(	0x00, DEF_STR( On ) )
215 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
216 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
217 	PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
218 /* This activates a different coin mode. Look at the dip switch setting schematic */
219 	PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
220 	PORT_DIPSETTING(	0x04, "Mode 1" )
221 	PORT_DIPSETTING(	0x00, "Mode 2" )
222 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
223 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
224 	PORT_DIPSETTING(	0x08, DEF_STR( On ) )
225 	PORT_DIPNAME( 0x10, 0x10, "Allow Continue" )
226 	PORT_DIPSETTING(	0x00, DEF_STR( No ) )
227 	PORT_DIPSETTING(	0x10, DEF_STR( Yes ) )
228 	/* In stop mode, press 2 to stop and 1 to restart */
229 	PORT_BITX   ( 0x20, 0x20, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Stop Mode", IP_KEY_NONE, IP_JOY_NONE )
230 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
231 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
232 	PORT_BITX(    0x40, 0x40, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
233 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
234 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
235 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
236 	PORT_DIPSETTING(	0x80, DEF_STR( Off ) )
237 	PORT_DIPSETTING(	0x00, DEF_STR( On ) )
238 INPUT_PORTS_END
239 
240 INPUT_PORTS_START( kikcubic )
241 	PORT_START
242 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
243 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
244 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
245 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
246 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
247 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
248 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
249 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
250 
251 	PORT_START
252 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
253 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
254 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
255 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
256 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
257 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
258 	PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN3, 19 )
259 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
260 
261 	PORT_START
262 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
263 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
264 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
265 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
266 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
267 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
268 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
269 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
270 
271 	PORT_START
272 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
273 	PORT_DIPSETTING(    0x02, "Easy" )
274 	PORT_DIPSETTING(    0x03, "Medium" )
275 	PORT_DIPSETTING(    0x01, "Hard" )
276 	PORT_DIPSETTING(    0x00, "Hardest" )
277 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
278 	PORT_DIPSETTING(    0x08, "1" )
279 	PORT_DIPSETTING(    0x04, "2" )
280 	PORT_DIPSETTING(    0x0c, "3" )
281 	PORT_DIPSETTING(    0x00, "4" )
282 	/* TODO: support the different settings which happen in Coin Mode 2 */
283 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
284 	PORT_DIPSETTING(	0xa0, DEF_STR( 6C_1C ) )
285 	PORT_DIPSETTING(	0xb0, DEF_STR( 5C_1C ) )
286 	PORT_DIPSETTING(	0xc0, DEF_STR( 4C_1C ) )
287 	PORT_DIPSETTING(	0xd0, DEF_STR( 3C_1C ) )
288 	PORT_DIPSETTING(	0xe0, DEF_STR( 2C_1C ) )
289 	PORT_DIPSETTING(	0xf0, DEF_STR( 1C_1C ) )
290 	PORT_DIPSETTING(	0x70, DEF_STR( 1C_2C ) )
291 	PORT_DIPSETTING(	0x60, DEF_STR( 1C_3C ) )
292 	PORT_DIPSETTING(	0x50, DEF_STR( 1C_4C ) )
293 	PORT_DIPSETTING(	0x40, DEF_STR( 1C_5C ) )
294 	PORT_DIPSETTING(	0x30, DEF_STR( 1C_6C ) )
295 	PORT_DIPSETTING(	0x00, DEF_STR( Free_Play ) )
296 //	PORT_DIPSETTING(	0x10, "Undefined" )
297 //	PORT_DIPSETTING(	0x20, "Undefined" )
298 //	PORT_DIPSETTING(	0x80, "Undefined" )
299 //	PORT_DIPSETTING(	0x90, "Undefined" )
300 
301 	PORT_START
302 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
303 	PORT_DIPSETTING(	0x01, DEF_STR( Off ) )
304 	PORT_DIPSETTING(	0x00, DEF_STR( On ) )
305 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
306 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
307 	PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
308 /* This activates a different coin mode. Look at the dip switch setting schematic */
309 	PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
310 	PORT_DIPSETTING(	0x04, "Mode 1" )
311 	PORT_DIPSETTING(	0x00, "Mode 2" )
312 	PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
313 	PORT_DIPSETTING(	0x08, DEF_STR( Off ) )
314 	PORT_DIPSETTING(	0x00, DEF_STR( On ) )
315 	PORT_BITX(    0x10, 0x10, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
316 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
317 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
318 	PORT_DIPNAME( 0x20, 0x00, "Level Select" )
319 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
320 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
321 	PORT_DIPNAME( 0x40, 0x40, "Player Adding" )
322 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
323 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
324 	PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
325 INPUT_PORTS_END
326 
327 
328 
329 static struct GfxLayout text_layout =
330 {
331 	8,8, /* tile size */
332 	4096, /* number of tiles */
333 	4, /* bits per pixel */
334 	{64*1024*8,64*1024*8+4,0,4}, /* plane offsets */
335 	{ 0,1,2,3, 64+0,64+1,64+2,64+3 }, /* x offsets */
336 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, /* y offsets */
337 	128
338 };
339 
340 static struct GfxLayout sprite_layout =
341 {
342 	16,16,	/* tile size */
343 	4096,	/* number of sprites ($1000) */
344 	4,		/* bits per pixel */
345 	{0x40000*8,0x40000*8+4,0,4}, /* plane offsets */
346 	{ /* x offsets */
347 		0x00*8+0,0x00*8+1,0x00*8+2,0x00*8+3,
348 		0x10*8+0,0x10*8+1,0x10*8+2,0x10*8+3,
349 		0x20*8+0,0x20*8+1,0x20*8+2,0x20*8+3,
350 		0x30*8+0,0x30*8+1,0x30*8+2,0x30*8+3
351 	},
352 	{ /* y offsets */
353 		0x00*8, 0x01*8, 0x02*8, 0x03*8,
354 		0x04*8, 0x05*8, 0x06*8, 0x07*8,
355 		0x08*8, 0x09*8, 0x0A*8, 0x0B*8,
356 		0x0C*8, 0x0D*8, 0x0E*8, 0x0F*8
357 	},
358 	0x40*8
359 };
360 
361 static struct GfxLayout back_layout =
362 {
363 	32,1, /* tile size */
364 	3*512*8, /* number of tiles */
365 	4, /* bits per pixel */
366 	{0,2,4,6}, /* plane offsets */
367 	{ 0*8+1, 0*8,  1*8+1, 1*8, 2*8+1, 2*8, 3*8+1, 3*8, 4*8+1, 4*8, 5*8+1, 5*8,
368 	6*8+1, 6*8, 7*8+1, 7*8, 8*8+1, 8*8, 9*8+1, 9*8, 10*8+1, 10*8, 11*8+1, 11*8,
369 	12*8+1, 12*8, 13*8+1, 13*8, 14*8+1, 14*8, 15*8+1, 15*8 }, /* x offsets */
370 	{ 0 }, /* y offsets */
371 	16*8
372 };
373 
374 static struct GfxDecodeInfo vigilant_gfxdecodeinfo[] =
375 {
376 	{ REGION_GFX1, 0, &text_layout,   256, 16 },	/* colors 256-511 */
377 	{ REGION_GFX2, 0, &sprite_layout,   0, 16 },	/* colors   0-255 */
378 	{ REGION_GFX3, 0, &back_layout,   512,  2 },	/* actually the background uses colors */
379 													/* 256-511, but giving it exclusive */
380 													/* pens we can handle it more easily. */
381 	{ -1 } /* end of array */
382 };
383 
384 static struct GfxDecodeInfo kikcubic_gfxdecodeinfo[] =
385 {
386 	{ REGION_GFX1, 0, &text_layout,   0, 16 },
387 	{ REGION_GFX2, 0, &sprite_layout, 0, 16 },
388 	{ -1 } /* end of array */
389 };
390 
391 
392 
393 static struct YM2151interface ym2151_interface =
394 {
395 	1,			/* 1 chip */
396 	3579645,	/* 3.579645 MHz */
397 	{ YM3012_VOL(55,MIXER_PAN_LEFT,55,MIXER_PAN_RIGHT) },
398 	{ m72_ym2151_irq_handler },
399 	{ 0 }
400 };
401 
402 static struct DACinterface dac_interface =
403 {
404 	1,
405 	{ 100 }
406 };
407 
408 
409 
410 static MACHINE_DRIVER_START( vigilant )
411 
412 	/* basic machine hardware */
413 	MDRV_CPU_ADD(Z80, 3579645)		   /* 3.579645 MHz */
414 	MDRV_CPU_MEMORY(vigilant_readmem,vigilant_writemem)
415 	MDRV_CPU_PORTS(vigilant_readport,vigilant_writeport)
416 	MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
417 
418 	MDRV_CPU_ADD(Z80, 3579645)
419 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)		   /* 3.579645 MHz */
420 	MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
421 	MDRV_CPU_PORTS(sound_readport,sound_writeport)
422 	MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)	/* clocked by V1 */
423 								/* IRQs are generated by main Z80 and YM2151 */
424 	MDRV_FRAMES_PER_SECOND(55)
425 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
426 	MDRV_MACHINE_INIT(m72_sound)
427 
428 	/* video hardware */
429 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
430 	MDRV_SCREEN_SIZE(64*8, 32*8)
431 	MDRV_VISIBLE_AREA(16*8, (64-16)*8-1, 0*8, 32*8-1 )
432 	MDRV_GFXDECODE(vigilant_gfxdecodeinfo)
433 	MDRV_PALETTE_LENGTH(512+32)	/* 512 real palette, 32 virtual palette */
434 
435 	MDRV_VIDEO_START(vigilant)
436 	MDRV_VIDEO_UPDATE(vigilant)
437 
438 	/* sound hardware */
439 	MDRV_SOUND_ATTRIBUTES(SOUND_SUPPORTS_STEREO)
440 	MDRV_SOUND_ADD(YM2151, ym2151_interface)
441 	MDRV_SOUND_ADD(DAC, dac_interface)
442 MACHINE_DRIVER_END
443 
444 
445 static MACHINE_DRIVER_START( kikcubic )
446 
447 	/* basic machine hardware */
448 	MDRV_CPU_ADD(Z80, 3579645)		   /* 3.579645 MHz */
449 	MDRV_CPU_MEMORY(kikcubic_readmem,kikcubic_writemem)
450 	MDRV_CPU_PORTS(kikcubic_readport,kikcubic_writeport)
451 	MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
452 
453 	MDRV_CPU_ADD(Z80, 3579645)
454 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)		   /* 3.579645 MHz */
455 	MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
456 	MDRV_CPU_PORTS(sound_readport,sound_writeport)
457 	MDRV_CPU_VBLANK_INT(nmi_line_pulse,128)	/* clocked by V1 */
458 								/* IRQs are generated by main Z80 and YM2151 */
459 	MDRV_FRAMES_PER_SECOND(55)
460 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
461 	MDRV_MACHINE_INIT(m72_sound)
462 
463 	/* video hardware */
464 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
465 	MDRV_SCREEN_SIZE(64*8, 32*8)
466 	MDRV_VISIBLE_AREA(8*8, (64-8)*8-1, 0*8, 32*8-1 )
467 	MDRV_GFXDECODE(kikcubic_gfxdecodeinfo)
468 	MDRV_PALETTE_LENGTH(256)
469 
470 	MDRV_VIDEO_START(vigilant)
471 	MDRV_VIDEO_UPDATE(kikcubic)
472 
473 	/* sound hardware */
474 	MDRV_SOUND_ATTRIBUTES(SOUND_SUPPORTS_STEREO)
475 	MDRV_SOUND_ADD(YM2151, ym2151_interface)
476 	MDRV_SOUND_ADD(DAC, dac_interface)
477 MACHINE_DRIVER_END
478 
479 
480 
481 /***************************************************************************
482 
483   Game ROMs
484 
485 ***************************************************************************/
486 
487 ROM_START( vigilant )
488 	ROM_REGION( 0x30000, REGION_CPU1, 0 ) /* 64k for code + 128k for bankswitching */
489 	ROM_LOAD( "g07_c03.bin",  0x00000, 0x08000, CRC(9dcca081) SHA1(6d086b70e6bf1fbafa746ef5c82334645f199be9) )
490 	ROM_LOAD( "j07_c04.bin",  0x10000, 0x10000, CRC(e0159105) SHA1(da6d74ec075863c67c0ce21b07a54029d138f688) )
491 	/* 0x20000-0x2ffff empty */
492 
493 	ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for sound */
494 	ROM_LOAD( "g05_c02.bin",  0x00000, 0x10000, CRC(10582b2d) SHA1(6e7e5f07c49b347b427572efeb180c89f49bf2c7) )
495 
496 	ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
497 	ROM_LOAD( "f05_c08.bin",  0x00000, 0x10000, CRC(01579d20) SHA1(e58d8ca0ea0ac9d77225bf55faa499d1565924f9) )
498 	ROM_LOAD( "h05_c09.bin",  0x10000, 0x10000, CRC(4f5872f0) SHA1(6af21ba1c94097eecce30585983b4b07528c8635) )
499 
500 	ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )
501 	ROM_LOAD( "n07_c12.bin",  0x00000, 0x10000, CRC(10af8eb2) SHA1(664b178b248babc43a9af0fe140fe57bc7367762) )
502 	ROM_LOAD( "k07_c10.bin",  0x10000, 0x10000, CRC(9576f304) SHA1(0ec2a7d3d82208e2a9a4ef9ab2824e6fe26ebbe5) )
503 	ROM_LOAD( "o07_c13.bin",  0x20000, 0x10000, CRC(b1d9d4dc) SHA1(1aacf6b0ff8d102880d3dce3b55cd1488edb90cf) )
504 	ROM_LOAD( "l07_c11.bin",  0x30000, 0x10000, CRC(4598be4a) SHA1(6b68ec94bdee0e58133a8d3891054ef44a8ff0e5) )
505 	ROM_LOAD( "t07_c16.bin",  0x40000, 0x10000, CRC(f5425e42) SHA1(c401263b6a266d3e9cd23133f1d823fb4b095e3d) )
506 	ROM_LOAD( "p07_c14.bin",  0x50000, 0x10000, CRC(cb50a17c) SHA1(eb15704f715b6475ae7096f8d82f1b20f8277c71) )
507 	ROM_LOAD( "v07_c17.bin",  0x60000, 0x10000, CRC(959ba3c7) SHA1(dcd2a885ae7b61210cbd55a38ccbe91c73d071b0) )
508 	ROM_LOAD( "s07_c15.bin",  0x70000, 0x10000, CRC(7f2e91c5) SHA1(27dcc9b696834897c36c0b7a1c6202d93f41ad8d) )
509 
510 	ROM_REGION( 0x30000, REGION_GFX3, ROMREGION_DISPOSE )
511 	ROM_LOAD( "d01_c05.bin",  0x00000, 0x10000, CRC(81b1ee5c) SHA1(2014165ec71f089fecb5a3e60b939cc0f565d7f1) )
512 	ROM_LOAD( "e01_c06.bin",  0x10000, 0x10000, CRC(d0d33673) SHA1(39761d97a71deaf7f17233d5bd5a55dbb1e6b30e) )
513 	ROM_LOAD( "f01_c07.bin",  0x20000, 0x10000, CRC(aae81695) SHA1(ca8e136eca3543b27f3a61b105d4a280711cd6ea) )
514 
515 	ROM_REGION( 0x10000, REGION_SOUND1, 0 ) /* samples */
516 	ROM_LOAD( "d04_c01.bin",  0x00000, 0x10000, CRC(9b85101d) SHA1(6b8a0f33b9b66bb968f7b61e49d19a6afad8db95) )
517 ROM_END
518 
519 ROM_START( vigilntu )
520 	ROM_REGION( 0x30000, REGION_CPU1, 0 ) /* 64k for code + 128k for bankswitching */
521 	ROM_LOAD( "a-8h",  0x00000, 0x08000, CRC(8d15109e) SHA1(9ef57047a0b53cd0143a260193b33e3d5680ca71) )
522 	ROM_LOAD( "a-8l",  0x10000, 0x10000, CRC(7f95799b) SHA1(a371671c3c26976314aaac4e410bff0f13a8a085) )
523 	/* 0x20000-0x2ffff empty */
524 
525 	ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for sound */
526 	ROM_LOAD( "g05_c02.bin",  0x00000, 0x10000, CRC(10582b2d) SHA1(6e7e5f07c49b347b427572efeb180c89f49bf2c7) )
527 
528 	ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
529 	ROM_LOAD( "f05_c08.bin",  0x00000, 0x10000, CRC(01579d20) SHA1(e58d8ca0ea0ac9d77225bf55faa499d1565924f9) )
530 	ROM_LOAD( "h05_c09.bin",  0x10000, 0x10000, CRC(4f5872f0) SHA1(6af21ba1c94097eecce30585983b4b07528c8635) )
531 
532 	ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )
533 	ROM_LOAD( "n07_c12.bin",  0x00000, 0x10000, CRC(10af8eb2) SHA1(664b178b248babc43a9af0fe140fe57bc7367762) )
534 	ROM_LOAD( "k07_c10.bin",  0x10000, 0x10000, CRC(9576f304) SHA1(0ec2a7d3d82208e2a9a4ef9ab2824e6fe26ebbe5) )
535 	ROM_LOAD( "o07_c13.bin",  0x20000, 0x10000, CRC(b1d9d4dc) SHA1(1aacf6b0ff8d102880d3dce3b55cd1488edb90cf) )
536 	ROM_LOAD( "l07_c11.bin",  0x30000, 0x10000, CRC(4598be4a) SHA1(6b68ec94bdee0e58133a8d3891054ef44a8ff0e5) )
537 	ROM_LOAD( "t07_c16.bin",  0x40000, 0x10000, CRC(f5425e42) SHA1(c401263b6a266d3e9cd23133f1d823fb4b095e3d) )
538 	ROM_LOAD( "p07_c14.bin",  0x50000, 0x10000, CRC(cb50a17c) SHA1(eb15704f715b6475ae7096f8d82f1b20f8277c71) )
539 	ROM_LOAD( "v07_c17.bin",  0x60000, 0x10000, CRC(959ba3c7) SHA1(dcd2a885ae7b61210cbd55a38ccbe91c73d071b0) )
540 	ROM_LOAD( "s07_c15.bin",  0x70000, 0x10000, CRC(7f2e91c5) SHA1(27dcc9b696834897c36c0b7a1c6202d93f41ad8d) )
541 
542 	ROM_REGION( 0x30000, REGION_GFX3, ROMREGION_DISPOSE )
543 	ROM_LOAD( "d01_c05.bin",  0x00000, 0x10000, CRC(81b1ee5c) SHA1(2014165ec71f089fecb5a3e60b939cc0f565d7f1) )
544 	ROM_LOAD( "e01_c06.bin",  0x10000, 0x10000, CRC(d0d33673) SHA1(39761d97a71deaf7f17233d5bd5a55dbb1e6b30e) )
545 	ROM_LOAD( "f01_c07.bin",  0x20000, 0x10000, CRC(aae81695) SHA1(ca8e136eca3543b27f3a61b105d4a280711cd6ea) )
546 
547 	ROM_REGION( 0x10000, REGION_SOUND1, 0 ) /* samples */
548 	ROM_LOAD( "d04_c01.bin",  0x00000, 0x10000, CRC(9b85101d) SHA1(6b8a0f33b9b66bb968f7b61e49d19a6afad8db95) )
549 ROM_END
550 
551 ROM_START( vigilntj )
552 	ROM_REGION( 0x30000, REGION_CPU1, 0 ) /* 64k for code + 128k for bankswitching */
553 	ROM_LOAD( "vg_a-8h.rom",  0x00000, 0x08000, CRC(ba848713) SHA1(b357cbf404fb1874d555797ed9fb37f946cc4340) )
554 	ROM_LOAD( "vg_a-8l.rom",  0x10000, 0x10000, CRC(3b12b1d8) SHA1(2f9207f8d8ec41ea1b8f5bf3c69a97d1d09f6c3f) )
555 	/* 0x20000-0x2ffff empty */
556 
557 	ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for sound */
558 	ROM_LOAD( "g05_c02.bin",  0x00000, 0x10000, CRC(10582b2d) SHA1(6e7e5f07c49b347b427572efeb180c89f49bf2c7) )
559 
560 	ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
561 	ROM_LOAD( "f05_c08.bin",  0x00000, 0x10000, CRC(01579d20) SHA1(e58d8ca0ea0ac9d77225bf55faa499d1565924f9) )
562 	ROM_LOAD( "h05_c09.bin",  0x10000, 0x10000, CRC(4f5872f0) SHA1(6af21ba1c94097eecce30585983b4b07528c8635) )
563 
564 	ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )
565 	ROM_LOAD( "n07_c12.bin",  0x00000, 0x10000, CRC(10af8eb2) SHA1(664b178b248babc43a9af0fe140fe57bc7367762) )
566 	ROM_LOAD( "k07_c10.bin",  0x10000, 0x10000, CRC(9576f304) SHA1(0ec2a7d3d82208e2a9a4ef9ab2824e6fe26ebbe5) )
567 	ROM_LOAD( "o07_c13.bin",  0x20000, 0x10000, CRC(b1d9d4dc) SHA1(1aacf6b0ff8d102880d3dce3b55cd1488edb90cf) )
568 	ROM_LOAD( "l07_c11.bin",  0x30000, 0x10000, CRC(4598be4a) SHA1(6b68ec94bdee0e58133a8d3891054ef44a8ff0e5) )
569 	ROM_LOAD( "t07_c16.bin",  0x40000, 0x10000, CRC(f5425e42) SHA1(c401263b6a266d3e9cd23133f1d823fb4b095e3d) )
570 	ROM_LOAD( "p07_c14.bin",  0x50000, 0x10000, CRC(cb50a17c) SHA1(eb15704f715b6475ae7096f8d82f1b20f8277c71) )
571 	ROM_LOAD( "v07_c17.bin",  0x60000, 0x10000, CRC(959ba3c7) SHA1(dcd2a885ae7b61210cbd55a38ccbe91c73d071b0) )
572 	ROM_LOAD( "s07_c15.bin",  0x70000, 0x10000, CRC(7f2e91c5) SHA1(27dcc9b696834897c36c0b7a1c6202d93f41ad8d) )
573 
574 	ROM_REGION( 0x30000, REGION_GFX3, ROMREGION_DISPOSE )
575 	ROM_LOAD( "d01_c05.bin",  0x00000, 0x10000, CRC(81b1ee5c) SHA1(2014165ec71f089fecb5a3e60b939cc0f565d7f1) )
576 	ROM_LOAD( "e01_c06.bin",  0x10000, 0x10000, CRC(d0d33673) SHA1(39761d97a71deaf7f17233d5bd5a55dbb1e6b30e) )
577 	ROM_LOAD( "f01_c07.bin",  0x20000, 0x10000, CRC(aae81695) SHA1(ca8e136eca3543b27f3a61b105d4a280711cd6ea) )
578 
579 	ROM_REGION( 0x10000, REGION_SOUND1, 0 ) /* samples */
580 	ROM_LOAD( "d04_c01.bin",  0x00000, 0x10000, CRC(9b85101d) SHA1(6b8a0f33b9b66bb968f7b61e49d19a6afad8db95) )
581 ROM_END
582 
583 ROM_START( kikcubic )
584 	ROM_REGION( 0x30000, REGION_CPU1, 0 ) /* 64k for code + 128k for bankswitching */
585 	ROM_LOAD( "mqj-p0",       0x00000, 0x08000, CRC(9cef394a) SHA1(be9cc78420b4c35f8f9523b529bd56315749762c) )
586 	ROM_LOAD( "mqj-b0",       0x10000, 0x10000, CRC(d9bcf4cd) SHA1(f1f1cb8609343dae8637f115e5c96fd88a00f5eb) )
587 	ROM_LOAD( "mqj-b1",       0x20000, 0x10000, CRC(54a0abe1) SHA1(0fb1d050c1e299394609214c903bcf4cf11329ff) )
588 
589 	ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for sound */
590 	ROM_LOAD( "mqj-sp",       0x00000, 0x10000, CRC(bbcf3582) SHA1(4a5b9d4161b26e3ca400573fa78268893e42d5db) )
591 
592 	ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
593 	ROM_LOAD( "mqj-c0",       0x00000, 0x10000, CRC(975585c5) SHA1(eb8245e458a5d4880add5b4a305a4468fa8f6491) )
594 	ROM_LOAD( "mqj-c1",       0x10000, 0x10000, CRC(49d9936d) SHA1(c4169ddd481c19e8e24457e2fe011db1b34db6d3) )
595 
596 	ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )
597 	ROM_LOAD( "mqj-00",       0x00000, 0x40000, CRC(7fb0c58f) SHA1(f70ff39e2d648606686c87cf1a7a3ffb46c2656a) )
598 	ROM_LOAD( "mqj-10",       0x40000, 0x40000, CRC(3a189205) SHA1(063d664d4cf709931b5e3a5b6eb7c75bcd57b518) )
599 
600 	ROM_REGION( 0x10000, REGION_SOUND1, 0 ) /* samples */
601 	ROM_LOAD( "mqj-v0",       0x00000, 0x10000, CRC(54762956) SHA1(f08e983af28b16d27505d465ca64e7c7a93373a4) )
602 
603 	ROM_REGION( 0x0140, REGION_PROMS, 0 )
604 	ROM_LOAD( "8d",           0x0000, 0x0100, CRC(7379bb12) SHA1(cf0c4e27911505f937004ea5eac1154956ec5d3b) )	/* unknown (timing?) */
605 	ROM_LOAD( "6h",           0x0100, 0x0020, CRC(face0cbb) SHA1(c56aea3b7aaabbd4ff1b4546fcad94f51b473cde) )	/* unknown (bad read?) */
606 	ROM_LOAD( "7s",           0x0120, 0x0020, CRC(face0cbb) SHA1(c56aea3b7aaabbd4ff1b4546fcad94f51b473cde) )	/* unknown (bad read?) */
607 ROM_END
608 
609 
610 
611 GAMEX( 1988, vigilant, 0,        vigilant, vigilant, 0, ROT0, "Irem", "Vigilante (World)", GAME_NO_COCKTAIL )
612 GAMEX( 1988, vigilntu, vigilant, vigilant, vigilant, 0, ROT0, "Irem (Data East USA license)", "Vigilante (US)", GAME_NO_COCKTAIL )
613 GAMEX( 1988, vigilntj, vigilant, vigilant, vigilant, 0, ROT0, "Irem", "Vigilante (Japan)", GAME_NO_COCKTAIL )
614 GAMEX( 1988, kikcubic, 0,        kikcubic, kikcubic, 0, ROT0, "Irem", "Meikyu Jima (Japan)", GAME_NO_COCKTAIL )	/* English title is Kickle Cubicle */
615