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