1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 /* Final Crash & other CPS1 bootlegs */
4 
5 
6 /*
7     A note regarding other bootlegs:
8     In order to keep the cps source in some sort of order, the idea is to group similar bootleg hardware into seperate
9     derived classes and source files.
10 
11     Rom swaps, hacks etc.  (on original Capcom hardware)  ->  cps1.cpp
12     Sound: Z80, 2x YM2203, 2x m5205 ("Final Crash" h/w)   ->  fcrash.cpp
13     Sound: Z80, 1x YM2151, 2x m5205                       ->  cps1bl_5205.cpp
14     Sound: PIC, 1x M6295            *1                    ->  cps1bl_pic.cpp
15     Sound: Z80, 1x YM2151, 1x M6295 *2                    ->  fcrash.cpp      (for now...)
16 
17     *1 these seem to be only CPS1.5/Q sound games?
18     *2 this is original configuration, but non-Capcom (usually single-board) hardware.
19 
20     As per the above, this file now only contains games in second and last catergories.
21     Eventually only Final Crash, other Final Fight bootlegs and Carrier Air Wing bootlegs will remain here.
22 */
23 
24 /*
25 
26 Final Crash is a bootleg of Final Fight
27 
28 Final Fight is by Capcom and runs on CPS1 hardware
29 The bootleg was manufactured by Playmark of Italy
30 
31 this driver depends heavily on cps1.cpp, but has been
32 kept apart in an attempt to keep cps1.cpp clutter free
33 
34 Sound is very different from CPS1.
35 
36 ---
37 
38 Final Crash (bootleg of final fight)
39 
40 1x 68k
41 1x z80
42 2x ym2203
43 2x oki5205
44 1x osc 10mhz
45 1x osc 24mhz
46 
47 EPROMs:
48 1.bin sound EPROM
49 from 2.bin to 9.bin program EPROMs
50 10.bin to 25.bin graphics EPROMs
51 
52 ---
53 
54 kodb has various graphical issues, mainly with old info not being cleared away.
55 Also, it should be using a vblank irq value of 4. This triggers the following bootleg read/writes;
56  - IN1 is read at 0x992000
57  - IN0 is read of 0x992008
58  - dips continue to be read at 0x80001a
59  - sound command is wrote at 0x992006
60  - scroll 1Y is wrote at 0x980000
61  - scroll 1X is wrote at 0x980002
62  - scroll 2Y is wrote at 0x980004
63  - scroll 2X is wrote at 0x980006
64  - scroll 3Y is wrote at 0x980008
65  - scroll 3X is wrote at 0x98000a
66  - the layer enable and layer mask writes continue at 0x98000c and 0x980020-2
67 
68 These read/writes are identical to those used by a Knights of the Round bootleg which uses the all sf2mdt sound
69 hardware. This set is currently non-working.
70 
71 This also prevents the game from toggling the sprite address at m_cps_a_regs[0], similar to other bootlegs.
72 Currently the game is working somewhat, but only using the code left over from the original. If anyone wants to
73 do any development work on the set, (eg, find the sprite clearing issue), then this should be changed as the game
74 likely won't write any sprite clearing values otherwise.
75 
76 None of this is hooked up currently due to issues with row scroll on the scroll2 layer.
77 
78 
79 Status of each game:
80 --------------------
81 cawingb2, cawingbl: OK.
82 fcrash, kodb:       Old sprites show on next screen. Patch used.
83 sf2m1:              Crowd is missing. Plane's tail comes off a bit. Patch used.
84 wofabl:             Old sprites left behind - doesn't seem to write end-of-table marker when sprite table is empty.
85                     Priority problems - doesn't seem to write the layer mask values anywhere.
86                     Incorrect layer ordering during attract - writes invalid layer order values to layer control reg (bits 6-13).
87                     Glitched level 1 trees - bad data in gfx rom 12 but dump is confirmed correct.  https://youtu.be/RWKhBzwH0Gk
88 sgyxz:              Priority problems - doesn't seem to write the layer mask values anywhere. Patch used.
89                     Missing foreground trees on level 1.
90 wofr1bl:            Priority problems - doesn't seem to write the layer mask values anywhere.
91 
92 brightness circuity present on pcb?
93     sgyxz       no
94     wofabl      no
95     wofr1bl     no
96     others      tbc...   assume yes for now
97 */
98 
99 #include "emu.h"
100 #include "includes/fcrash.h"
101 
102 #include "cpu/z80/z80.h"
103 #include "cpu/m68000/m68000.h"
104 #include "sound/2203intf.h"
105 #include "sound/msm5205.h"
106 #include "sound/ym2151.h"
107 #include "sound/okim6295.h"
108 #include "machine/eepromser.h"
109 #include "speaker.h"
110 
111 
112 #define CPS1_ROWSCROLL_OFFS  (0x20/2)    /* base of row scroll offsets in other RAM */
113 #define CODE_SIZE            0x400000
114 
115 
fcrash_soundlatch_w(offs_t offset,uint16_t data,uint16_t mem_mask)116 void fcrash_state::fcrash_soundlatch_w(offs_t offset, uint16_t data, uint16_t mem_mask)
117 {
118 	if (ACCESSING_BITS_0_7)
119 	{
120 		m_soundlatch->write(data & 0xff);
121 		m_audiocpu->set_input_line(0, HOLD_LINE);
122 	}
123 }
124 
fcrash_snd_bankswitch_w(uint8_t data)125 void fcrash_state::fcrash_snd_bankswitch_w(uint8_t data)
126 {
127 	m_msm_1->set_output_gain(0, (data & 0x08) ? 0.0 : 1.0);
128 	m_msm_2->set_output_gain(0, (data & 0x10) ? 0.0 : 1.0);
129 
130 	membank("bank1")->set_entry(data & 0x07);
131 }
132 
WRITE_LINE_MEMBER(fcrash_state::m5205_int1)133 WRITE_LINE_MEMBER(fcrash_state::m5205_int1)
134 {
135 	m_msm_1->data_w(m_sample_buffer1 & 0x0f);
136 	m_sample_buffer1 >>= 4;
137 	m_sample_select1 ^= 1;
138 	if (m_sample_select1 == 0)
139 		m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
140 }
141 
WRITE_LINE_MEMBER(fcrash_state::m5205_int2)142 WRITE_LINE_MEMBER(fcrash_state::m5205_int2)
143 {
144 	m_msm_2->data_w(m_sample_buffer2 & 0x0f);
145 	m_sample_buffer2 >>= 4;
146 	m_sample_select2 ^= 1;
147 }
148 
fcrash_msm5205_0_data_w(uint8_t data)149 void fcrash_state::fcrash_msm5205_0_data_w(uint8_t data)
150 {
151 	m_sample_buffer1 = data;
152 }
153 
fcrash_msm5205_1_data_w(uint8_t data)154 void fcrash_state::fcrash_msm5205_1_data_w(uint8_t data)
155 {
156 	m_sample_buffer2 = data;
157 }
158 
cawingbl_soundlatch_w(offs_t offset,uint16_t data,uint16_t mem_mask)159 void fcrash_state::cawingbl_soundlatch_w(offs_t offset, uint16_t data, uint16_t mem_mask)
160 {
161 	if (ACCESSING_BITS_8_15)
162 	{
163 		m_soundlatch->write(data >> 8);
164 		m_audiocpu->set_input_line(0, HOLD_LINE);
165 		machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); /* boost the interleave or some voices get dropped */
166 	}
167 }
168 
kodb_layer_w(offs_t offset,uint16_t data)169 void fcrash_state::kodb_layer_w(offs_t offset, uint16_t data)
170 {
171 	/* layer enable and mask 1&2 registers are written here - passing them to m_cps_b_regs for now for drawing routines */
172 	if (offset == 0x06)
173 		m_cps_b_regs[m_layer_enable_reg / 2] = data;
174 	else
175 	if (offset == 0x10)
176 		m_cps_b_regs[m_layer_mask_reg[1] / 2] = data;
177 	else
178 	if (offset == 0x11)
179 		m_cps_b_regs[m_layer_mask_reg[2] / 2] = data;
180 }
181 
mtwinsb_layer_w(offs_t offset,uint16_t data)182 void fcrash_state::mtwinsb_layer_w(offs_t offset, uint16_t data)
183 {
184 	m_cps_a_regs[0x06 / 2] = 0x9100; // bit of a hack - the game never writes this, but does need it
185 
186 	switch (offset)
187 	{
188 	case 0x00:
189 		m_cps_a_regs[0x0e / 2] = data;
190 		break;
191 	case 0x01:
192 		m_cps_a_regs[0x0c / 2] = data - 0x3e;
193 		break;
194 	case 0x02:
195 		m_cps_a_regs[0x12 / 2] = data;
196 		m_cps_a_regs[CPS1_ROWSCROLL_OFFS] = data; /* row scroll start */
197 		break;
198 	case 0x03:
199 		m_cps_a_regs[0x10 / 2] = data - 0x3c;
200 		break;
201 	case 0x04:
202 		m_cps_a_regs[0x16 / 2] = data;
203 		break;
204 	case 0x05:
205 		m_cps_a_regs[0x14 / 2] = data - 0x40;
206 		break;
207 	default:
208 		logerror("%s: Unknown layer cmd %X %X\n",machine().describe_context(),offset<<1,data);
209 
210 	}
211 }
212 
sf2m1_layer_w(offs_t offset,uint16_t data)213 void fcrash_state::sf2m1_layer_w(offs_t offset, uint16_t data)
214 {
215 	switch (offset)
216 	{
217 	case 0x00:
218 		m_cps_a_regs[0x0e / 2] = data;
219 		break;
220 	case 0x01:
221 		m_cps_a_regs[0x0c / 2] = data;
222 		break;
223 	case 0x02:
224 		m_cps_a_regs[0x12 / 2] = data;
225 		m_cps_a_regs[CPS1_ROWSCROLL_OFFS] = data; /* row scroll start */
226 		break;
227 	case 0x03:
228 		m_cps_a_regs[0x10 / 2] = data;
229 		break;
230 	case 0x04:
231 		m_cps_a_regs[0x16 / 2] = data;
232 		break;
233 	case 0x05:
234 		m_cps_a_regs[0x14 / 2] = data;
235 		break;
236 	case 0x06:
237 			switch (data)
238 			{
239 			case 0:
240 				data = 0x078e;
241 				break;
242 			case 1:
243 				data = 0x12c0;
244 				break;
245 			case 2:
246 				data = 0x06ce;
247 				break;
248 			case 3:
249 				data = 0x09ce;
250 				break;
251 			case 4:
252 				data = 0x12ce;
253 				break;
254 			case 5:
255 				data = 0x0b4e;
256 				break;
257 			}
258 	case 0xb3:
259 			m_cps_b_regs[m_layer_enable_reg / 2] = data;
260 			break;
261 	case 0x0b:
262 	case 0x1b:
263 		m_cps_a_regs[0x06 / 2] = data;
264 		break;
265 	default:
266 		logerror("%s: Unknown layer cmd %X %X\n",machine().describe_context(),offset<<1,data);
267 
268 	}
269 }
270 
varthb_layer_w(offs_t offset,uint16_t data)271 void fcrash_state::varthb_layer_w(offs_t offset, uint16_t data)
272 {
273 	switch (offset)
274 	{
275 	case 0x00:
276 		m_cps_a_regs[0x0e / 2] = data;
277 		break;
278 	case 0x01:
279 		m_cps_a_regs[0x0c / 2] = data;
280 		break;
281 	case 0x02:
282 		m_cps_a_regs[0x12 / 2] = data;
283 		m_cps_a_regs[CPS1_ROWSCROLL_OFFS] = data; /* row scroll start */
284 		break;
285 	case 0x03:
286 		m_cps_a_regs[0x10 / 2] = data;
287 		break;
288 	case 0x04:
289 		m_cps_a_regs[0x16 / 2] = data;
290 		break;
291 	case 0x05:
292 		m_cps_a_regs[0x14 / 2] = data;
293 		break;
294 	default:
295 		logerror("%s: Unknown layer cmd %X %X\n",machine().describe_context(),offset<<1,data);
296 	}
297 }
298 
varthb_layer2_w(uint16_t data)299 void fcrash_state::varthb_layer2_w(uint16_t data)
300 {
301 	if (data > 0x9000)
302 		m_cps_a_regs[0x06 / 2] = data;
303 }
304 
sgyxz_dsw_r(offs_t offset)305 uint16_t fcrash_state::sgyxz_dsw_r(offs_t offset)
306 {
307 	int in = m_sgyxz_dsw[offset]->read();
308 	return (in << 8) | 0xff;
309 }
310 
wofr1bl_layer_w(offs_t offset,uint16_t data)311 void fcrash_state::wofr1bl_layer_w(offs_t offset, uint16_t data)
312 {
313 	switch (offset)
314 	{
315 	case 0x00:
316 		m_cps_a_regs[0x0e / 2] = data;
317 		break;
318 	case 0x01:
319 		m_cps_a_regs[0x0c / 2] = data;
320 		break;
321 	case 0x02:
322 		m_cps_a_regs[0x12 / 2] = data;
323 		m_cps_a_regs[CPS1_ROWSCROLL_OFFS] = data; /* row scroll start */
324 		break;
325 	case 0x03:
326 		m_cps_a_regs[0x10 / 2] = data;
327 		break;
328 	case 0x04:
329 		m_cps_a_regs[0x16 / 2] = data;
330 		break;
331 	case 0x05:
332 		m_cps_a_regs[0x14 / 2] = data;
333 		break;
334 	case 0x06:
335 		{
336 			// see bootleggers routines starting at $101000
337 			// writes values 0-f to 98000c
338 			// how does this relate to layer control reg value?
339 
340 			// original game values:
341 			// m_cps_b_regs[m_layer_enable_reg / 2] = m_mainram[0x6398 / 2];
342 			// m_cps_b_regs[m_layer_mask_reg[1] / 2] = m_mainram[0x639a / 2];
343 			// m_cps_b_regs[m_layer_mask_reg[2] / 2] = m_mainram[0x639c / 2];
344 			// m_cps_b_regs[m_layer_mask_reg[3] / 2] = m_mainram[0x639e / 2];
345 
346 			m_cps_b_regs[0x3e / 2] = data;
347 
348 			switch (data)
349 			{
350 			case 0:    // 12ce
351 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x12ce;  // attract lvl 1
352 				m_cps_b_regs[m_layer_mask_reg[1] / 2] = 0x1f;
353 				m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0x1ff;
354 				m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0x7fff;
355 				break;
356 			case 1:    // 12c2, 12c6, 270a, 138e, 18ce
357 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x138e;  // attract lvl 4
358 				m_cps_b_regs[m_layer_mask_reg[1] / 2] = 0x3f;
359 				m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0x1ff;
360 				m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0x7fff;
361 				break;
362 			case 2:
363 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x12ce; // ?
364 				m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0x780;
365 				m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0;
366 				break;
367 			case 3:    // 1c8e, 1c82, 1c86, 270a
368 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x1c8e;  // attract lvl 2
369 				m_cps_b_regs[m_layer_mask_reg[1] / 2] = 0x7ff;
370 				m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0x780;
371 				m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0;
372 				break;
373 			case 4:
374 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x12ce; // ?
375 				m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0;
376 				m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0x7fff;
377 				break;
378 			case 5:
379 				break;
380 			case 6:
381 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x12ce; // ?
382 				m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0x781;
383 				m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0x1f;
384 				break;
385 			case 7:
386 				break;
387 			case 8:
388 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x12ce; // ?
389 				m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0;
390 				m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0x1f;
391 				break;
392 			case 9:
393 				break;
394 			case 10:
395 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x12ce; // ?
396 				m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0x40ff;
397 				m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0x7fff;
398 				break;
399 			case 11:
400 				break;
401 			case 14:    // 12ce, 1b0e
402 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x12ce;
403 				break;
404 			case 15:    // 270a, 1e0e, 138e, 270e
405 				m_cps_b_regs[m_layer_enable_reg / 2] = 0x138e;  // attract lvl 3
406 				m_cps_b_regs[m_layer_mask_reg[1] / 2] = 0x7fff;
407 				m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0x7fff;
408 				m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0x7fff;
409 				break;
410 			}
411 		}
412 		break;
413 	default:
414 		logerror("%s: Unknown layer cmd %X %X\n",machine().describe_context(),offset<<1,data);
415 	}
416 }
417 
wofr1bl_layer2_w(uint16_t data)418 void fcrash_state::wofr1bl_layer2_w(uint16_t data)
419 {
420 	m_cps_a_regs[0x06 / 2] = data;
421 }
422 
wofr1bl_spr_base_w(uint16_t data)423 void fcrash_state::wofr1bl_spr_base_w(uint16_t data)
424 {
425 	m_sprite_base = data ? 0x3000 : 0x1000;
426 }
427 
428 
fcrash(machine_config & config)429 void fcrash_state::fcrash(machine_config &config)
430 {
431 	/* basic machine hardware */
432 	M68000(config, m_maincpu, 10000000);
433 	m_maincpu->set_addrmap(AS_PROGRAM, &fcrash_state::fcrash_map);
434 	m_maincpu->set_vblank_int("screen", FUNC(fcrash_state::cps1_interrupt));
435 	m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, &fcrash_state::cpu_space_map);
436 
437 	Z80(config, m_audiocpu, 24000000/6); /* ? */
438 	m_audiocpu->set_addrmap(AS_PROGRAM, &fcrash_state::fcrash_sound_map);
439 
440 	MCFG_MACHINE_START_OVERRIDE(fcrash_state, fcrash)
441 	MCFG_MACHINE_RESET_OVERRIDE(fcrash_state, fcrash)
442 
443 	/* video hardware */
444 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
445 	m_screen->set_refresh_hz(60);
446 	m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
447 	m_screen->set_size(64*8, 32*8);
448 	m_screen->set_visarea(8*8, (64-8)*8-1, 2*8, 30*8-1 );
449 	m_screen->set_screen_update(FUNC(fcrash_state::screen_update_fcrash));
450 	m_screen->screen_vblank().set(FUNC(fcrash_state::screen_vblank_cps1));
451 	m_screen->set_palette(m_palette);
452 
453 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_cps1);
454 	PALETTE(config, m_palette, palette_device::BLACK).set_entries(4096);
455 
456 	// sound hardware
457 	SPEAKER(config, "mono").front_center();
458 
459 	GENERIC_LATCH_8(config, m_soundlatch);
460 
461 	ym2203_device &ym1(YM2203(config, "ym1", 24000000/6));   /* ? */
462 	ym1.add_route(0, "mono", 0.10);
463 	ym1.add_route(1, "mono", 0.10);
464 	ym1.add_route(2, "mono", 0.10);
465 	ym1.add_route(3, "mono", 1.0);
466 
467 	ym2203_device &ym2(YM2203(config, "ym2", 24000000/6));   /* ? */
468 	ym2.add_route(0, "mono", 0.10);
469 	ym2.add_route(1, "mono", 0.10);
470 	ym2.add_route(2, "mono", 0.10);
471 	ym2.add_route(3, "mono", 1.0);
472 
473 	MSM5205(config, m_msm_1, 24000000/64);  /* ? */
474 	m_msm_1->vck_legacy_callback().set(FUNC(fcrash_state::m5205_int1)); /* interrupt function */
475 	m_msm_1->set_prescaler_selector(msm5205_device::S96_4B);    /* 4KHz 4-bit */
476 	m_msm_1->add_route(ALL_OUTPUTS, "mono", 0.25);
477 
478 	MSM5205(config, m_msm_2, 24000000/64);  /* ? */
479 	m_msm_2->vck_legacy_callback().set(FUNC(fcrash_state::m5205_int2)); /* interrupt function */
480 	m_msm_2->set_prescaler_selector(msm5205_device::S96_4B);    /* 4KHz 4-bit */
481 	m_msm_2->add_route(ALL_OUTPUTS, "mono", 0.25);
482 }
483 
ffightblb(machine_config & config)484 void fcrash_state::ffightblb(machine_config &config)
485 {
486 		/* basic machine hardware */
487 	M68000(config, m_maincpu, 10000000);
488 	m_maincpu->set_addrmap(AS_PROGRAM, &fcrash_state::fcrash_map);
489 	m_maincpu->set_vblank_int("screen", FUNC(fcrash_state::cps1_interrupt));
490 	m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, &fcrash_state::cpu_space_map);
491 
492 	Z80(config, m_audiocpu, 24000000/6); /* ? */
493 	m_audiocpu->set_addrmap(AS_PROGRAM, &fcrash_state::ffightblb_sound_map);
494 
495 	MCFG_MACHINE_START_OVERRIDE(fcrash_state, ffightblb)
496 	MCFG_MACHINE_RESET_OVERRIDE(fcrash_state, fcrash)
497 
498 	/* video hardware */
499 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
500 	m_screen->set_refresh_hz(60);
501 	m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
502 	m_screen->set_size(64*8, 32*8);
503 	m_screen->set_visarea(8*8, (64-8)*8-1, 2*8, 30*8-1 );
504 	m_screen->set_screen_update(FUNC(fcrash_state::screen_update_fcrash));
505 	m_screen->screen_vblank().set(FUNC(fcrash_state::screen_vblank_cps1));
506 	m_screen->set_palette(m_palette);
507 
508 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_cps1);
509 	PALETTE(config, m_palette, palette_device::BLACK).set_entries(4096);
510 
511 	// sound hardware
512 	SPEAKER(config, "mono").front_center();
513 
514 	GENERIC_LATCH_8(config, m_soundlatch);
515 
516 	OKIM6295(config, m_oki, 1000000 , okim6295_device::PIN7_HIGH);
517 	m_oki->set_addrmap(0, &fcrash_state::ffightblb_oki_map);
518 	m_oki->add_route(ALL_OUTPUTS, "mono", 0.30);
519 }
520 
cawingbl(machine_config & config)521 void fcrash_state::cawingbl(machine_config &config)
522 {
523 	fcrash(config);
524 	/* basic machine hardware */
525 	m_maincpu->set_vblank_int("screen", FUNC(fcrash_state::irq6_line_hold)); /* needed to write to scroll values */
526 
527 	MCFG_MACHINE_START_OVERRIDE(fcrash_state, cawingbl)
528 }
529 
kodb(machine_config & config)530 void fcrash_state::kodb(machine_config &config)
531 {
532 	/* basic machine hardware */
533 	M68000(config, m_maincpu, 10000000);
534 	m_maincpu->set_addrmap(AS_PROGRAM, &fcrash_state::fcrash_map);
535 	m_maincpu->set_vblank_int("screen", FUNC(fcrash_state::cps1_interrupt));
536 	m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, &fcrash_state::cpu_space_map);
537 
538 	Z80(config, m_audiocpu, 3579545);
539 	m_audiocpu->set_addrmap(AS_PROGRAM, &fcrash_state::kodb_sound_map);
540 
541 	MCFG_MACHINE_START_OVERRIDE(fcrash_state, kodb)
542 
543 	/* video hardware */
544 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
545 	m_screen->set_refresh_hz(60);
546 	m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
547 	m_screen->set_size(64*8, 32*8);
548 	m_screen->set_visarea(8*8, (64-8)*8-1, 2*8, 30*8-1);
549 	m_screen->set_screen_update(FUNC(fcrash_state::screen_update_fcrash));
550 	m_screen->screen_vblank().set(FUNC(fcrash_state::screen_vblank_cps1));
551 	m_screen->set_palette(m_palette);
552 
553 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_cps1);
554 	PALETTE(config, m_palette, palette_device::BLACK).set_entries(0xc00);
555 
556 	/* sound hardware */
557 	SPEAKER(config, "mono").front_center();
558 
559 	GENERIC_LATCH_8(config, m_soundlatch);
560 
561 	ym2151_device &ym2151(YM2151(config, "2151", XTAL(3'579'545)));  /* verified on pcb */
562 	ym2151.irq_handler().set_inputline(m_audiocpu, 0);
563 	ym2151.add_route(0, "mono", 0.35);
564 	ym2151.add_route(1, "mono", 0.35);
565 
566 	/* CPS PPU is fed by a 16mhz clock,pin 117 outputs a 4mhz clock which is divided by 4 using 2 74ls74 */
567 	OKIM6295(config, m_oki, XTAL(16'000'000)/4/4, okim6295_device::PIN7_HIGH); // pin 7 can be changed by the game code, see f006 on z80
568 	m_oki->add_route(ALL_OUTPUTS, "mono", 0.30);
569 }
570 
mtwinsb(machine_config & config)571 void fcrash_state::mtwinsb(machine_config &config)
572 {
573 	/* basic machine hardware */
574 	M68000(config, m_maincpu, 10000000);
575 	m_maincpu->set_addrmap(AS_PROGRAM, &fcrash_state::mtwinsb_map);
576 	m_maincpu->set_vblank_int("screen", FUNC(fcrash_state::cps1_interrupt));
577 	m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, &fcrash_state::cpu_space_map);
578 
579 	Z80(config, m_audiocpu, 3579545);
580 	m_audiocpu->set_addrmap(AS_PROGRAM, &fcrash_state::sgyxz_sound_map);
581 
582 	MCFG_MACHINE_START_OVERRIDE(fcrash_state, mtwinsb)
583 
584 	/* video hardware */
585 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
586 	m_screen->set_refresh_hz(60);
587 	m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
588 	m_screen->set_size(64*8, 32*8);
589 	m_screen->set_visarea(8*8, (64-8)*8-1, 2*8, 30*8-1);
590 	m_screen->set_screen_update(FUNC(fcrash_state::screen_update_fcrash));
591 	m_screen->screen_vblank().set(FUNC(fcrash_state::screen_vblank_cps1));
592 	m_screen->set_palette(m_palette);
593 
594 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_cps1);
595 	PALETTE(config, m_palette, palette_device::BLACK).set_entries(0xc00);
596 
597 	/* sound hardware */
598 	SPEAKER(config, "mono").front_center();
599 
600 	GENERIC_LATCH_8(config, m_soundlatch);
601 	GENERIC_LATCH_8(config, m_soundlatch2);
602 
603 	ym2151_device &ym2151(YM2151(config, "2151", XTAL(3'579'545)));
604 	ym2151.irq_handler().set_inputline(m_audiocpu, 0);
605 	ym2151.add_route(0, "mono", 0.35);
606 	ym2151.add_route(1, "mono", 0.35);
607 
608 	OKIM6295(config, m_oki, XTAL(16'000'000)/4/4, okim6295_device::PIN7_HIGH);
609 	m_oki->add_route(ALL_OUTPUTS, "mono", 0.30);
610 }
611 
sf2m1(machine_config & config)612 void fcrash_state::sf2m1(machine_config &config)
613 {
614 	/* basic machine hardware */
615 	M68000(config, m_maincpu, XTAL(12'000'000));
616 	m_maincpu->set_addrmap(AS_PROGRAM, &fcrash_state::sf2m1_map);
617 	m_maincpu->set_vblank_int("screen", FUNC(fcrash_state::cps1_interrupt));
618 	m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, &fcrash_state::cpu_space_map);
619 
620 	Z80(config, m_audiocpu, XTAL(3'579'545));
621 	m_audiocpu->set_addrmap(AS_PROGRAM, &fcrash_state::sgyxz_sound_map);
622 
623 	MCFG_MACHINE_START_OVERRIDE(fcrash_state, sf2m1)
624 
625 	/* video hardware */
626 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
627 	m_screen->set_raw(CPS_PIXEL_CLOCK, CPS_HTOTAL, CPS_HBEND, CPS_HBSTART, CPS_VTOTAL, CPS_VBEND, CPS_VBSTART);
628 	m_screen->set_screen_update(FUNC(fcrash_state::screen_update_fcrash));
629 	m_screen->screen_vblank().set(FUNC(fcrash_state::screen_vblank_cps1));
630 	m_screen->set_palette(m_palette);
631 
632 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_cps1);
633 	PALETTE(config, m_palette, palette_device::BLACK).set_entries(0xc00);
634 
635 	/* sound hardware */
636 	SPEAKER(config, "mono").front_center();
637 	GENERIC_LATCH_8(config, m_soundlatch);
638 	GENERIC_LATCH_8(config, m_soundlatch2);
639 	ym2151_device &ym2151(YM2151(config, "2151", XTAL(3'579'545)));
640 	ym2151.irq_handler().set_inputline(m_audiocpu, 0);
641 	ym2151.add_route(0, "mono", 0.35);
642 	ym2151.add_route(1, "mono", 0.35);
643 	OKIM6295(config, m_oki, XTAL(16'000'000)/4/4, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.30);
644 }
645 
sgyxz(machine_config & config)646 void fcrash_state::sgyxz(machine_config &config)
647 {
648 	/* basic machine hardware */
649 	M68000(config, m_maincpu, 12000000);
650 	m_maincpu->set_addrmap(AS_PROGRAM, &fcrash_state::sgyxz_map);
651 	m_maincpu->set_vblank_int("screen", FUNC(fcrash_state::cps1_interrupt));
652 	m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, &fcrash_state::cpu_space_map);
653 
654 	Z80(config, m_audiocpu, 3579545);
655 	m_audiocpu->set_addrmap(AS_PROGRAM, &fcrash_state::sgyxz_sound_map);
656 
657 	MCFG_MACHINE_START_OVERRIDE(fcrash_state, sgyxz)
658 	MCFG_MACHINE_RESET_OVERRIDE(fcrash_state, sgyxz)
659 
660 	/* video hardware */
661 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
662 	m_screen->set_refresh_hz(60);
663 	m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
664 	m_screen->set_size(64*8, 32*8);
665 	m_screen->set_visarea(8*8, (64-8)*8-1, 2*8, 30*8-1 );
666 	m_screen->set_screen_update(FUNC(fcrash_state::screen_update_fcrash));
667 	m_screen->screen_vblank().set(FUNC(fcrash_state::screen_vblank_cps1));
668 	m_screen->set_palette(m_palette);
669 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_cps1);
670 	PALETTE(config, m_palette, palette_device::BLACK).set_entries(0xc00);
671 
672 	/* sound hardware */
673 	SPEAKER(config, "mono").front_center();
674 
675 	GENERIC_LATCH_8(config, m_soundlatch);
676 	GENERIC_LATCH_8(config, m_soundlatch2);
677 
678 	ym2151_device &ym2151(YM2151(config, "2151", XTAL(3'579'545)));  /* verified on pcb */
679 	ym2151.irq_handler().set_inputline(m_audiocpu, 0);
680 	ym2151.add_route(0, "mono", 0.35);
681 	ym2151.add_route(1, "mono", 0.35);
682 
683 	/* CPS PPU is fed by a 16mhz clock,pin 117 outputs a 4mhz clock which is divided by 4 using 2 74ls74 */
684 	OKIM6295(config, m_oki, XTAL(16'000'000)/4/4, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.30); // pin 7 can be changed by the game code, see f006 on z80
685 }
686 
wofabl(machine_config & config)687 void fcrash_state::wofabl(machine_config &config)
688 {
689 	sgyxz(config);
690 	m_maincpu->set_addrmap(AS_PROGRAM, &fcrash_state::wofabl_map);
691 }
692 
wofr1bl(machine_config & config)693 void fcrash_state::wofr1bl(machine_config &config)
694 {
695 	sgyxz(config);
696 	m_maincpu->set_addrmap(AS_PROGRAM, &fcrash_state::wofr1bl_map);
697 	EEPROM_93C46_8BIT(config, "eeprom");
698 	MCFG_MACHINE_START_OVERRIDE(fcrash_state, wofr1bl)
699 	MCFG_MACHINE_RESET_REMOVE()
700 }
701 
varthb(machine_config & config)702 void fcrash_state::varthb(machine_config &config)
703 {
704 	/* basic machine hardware */
705 	M68000(config, m_maincpu, 12000000);
706 	m_maincpu->set_addrmap(AS_PROGRAM, &fcrash_state::varthb_map);
707 	m_maincpu->set_vblank_int("screen", FUNC(fcrash_state::cps1_interrupt));
708 	m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, &fcrash_state::cpu_space_map);
709 
710 	Z80(config, m_audiocpu, 3579545);
711 	m_audiocpu->set_addrmap(AS_PROGRAM, &fcrash_state::sgyxz_sound_map);
712 
713 	MCFG_MACHINE_START_OVERRIDE(fcrash_state, cps1)
714 
715 	/* video hardware */
716 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
717 	m_screen->set_refresh_hz(60);
718 	m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
719 	m_screen->set_size(64*8, 32*8);
720 	m_screen->set_visarea(8*8, (64-8)*8-1, 2*8, 30*8-1 );
721 	m_screen->set_screen_update(FUNC(fcrash_state::screen_update_cps1));
722 	m_screen->screen_vblank().set(FUNC(fcrash_state::screen_vblank_cps1));
723 	m_screen->set_palette(m_palette);
724 
725 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_cps1);
726 	PALETTE(config, m_palette, palette_device::BLACK).set_entries(0xc00);
727 
728 	/* sound hardware */
729 	SPEAKER(config, "mono").front_center();
730 
731 	GENERIC_LATCH_8(config, m_soundlatch);
732 	GENERIC_LATCH_8(config, m_soundlatch2);
733 
734 	ym2151_device &ym2151(YM2151(config, "2151", XTAL(3'579'545)));
735 	ym2151.irq_handler().set_inputline(m_audiocpu, 0);
736 	ym2151.add_route(0, "mono", 0.35);
737 	ym2151.add_route(1, "mono", 0.35);
738 
739 	OKIM6295(config, m_oki, XTAL(16'000'000)/4/4, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.30);
740 }
741 
742 
fcrash_map(address_map & map)743 void fcrash_state::fcrash_map(address_map &map)
744 {
745 	map(0x000000, 0x3fffff).rom();
746 	map(0x800030, 0x800031).w(FUNC(fcrash_state::cps1_coinctrl_w));
747 	map(0x800100, 0x80013f).ram().share("cps_a_regs");  /* CPS-A custom */
748 	map(0x800140, 0x80017f).ram().share("cps_b_regs");  /* CPS-B custom */
749 	map(0x880000, 0x880001).portr("IN1");                /* Player input ports */
750 	map(0x880006, 0x880007).w(FUNC(fcrash_state::fcrash_soundlatch_w));       /* Sound command */
751 	map(0x880008, 0x88000f).r(FUNC(fcrash_state::cps1_dsw_r));                /* System input ports / Dip Switches */
752 	map(0x890000, 0x890001).nopw();    // palette related?
753 	map(0x900000, 0x92ffff).ram().w(FUNC(fcrash_state::cps1_gfxram_w)).share("gfxram");
754 	map(0xff0000, 0xffffff).ram().share("mainram");
755 }
756 
mtwinsb_map(address_map & map)757 void fcrash_state::mtwinsb_map(address_map &map)
758 {
759 	map(0x000000, 0x3fffff).rom();
760 	map(0x800000, 0x800001).portr("IN1");
761 	map(0x800006, 0x800007).w(FUNC(fcrash_state::cps1_soundlatch_w));
762 	map(0x800018, 0x80001f).r(FUNC(fcrash_state::cps1_dsw_r));
763 	map(0x800030, 0x800037).w(FUNC(fcrash_state::cps1_coinctrl_w));
764 	map(0x800100, 0x80013f).w(FUNC(fcrash_state::cps1_cps_a_w)).share("cps_a_regs");
765 	map(0x800140, 0x80017f).rw(FUNC(fcrash_state::cps1_cps_b_r), FUNC(fcrash_state::cps1_cps_b_w)).share("cps_b_regs");
766 	map(0x980000, 0x98000b).w(FUNC(fcrash_state::mtwinsb_layer_w));
767 	map(0x900000, 0x92ffff).ram().w(FUNC(fcrash_state::cps1_gfxram_w)).share("gfxram");
768 	map(0xff0000, 0xffffff).ram().share("mainram");
769 }
770 
sf2m1_map(address_map & map)771 void fcrash_state::sf2m1_map(address_map &map)
772 {
773 	map(0x000000, 0x3fffff).rom();
774 	map(0x800000, 0x800007).portr("IN1");            /* Player input ports */
775 	map(0x800006, 0x800007).w(FUNC(fcrash_state::cps1_soundlatch_w));    /* Sound command */
776 	map(0x800012, 0x800013).r(FUNC(fcrash_state::cps1_in2_r));            /* Buttons 4,5,6 for both players */
777 	map(0x800018, 0x80001f).r(FUNC(fcrash_state::cps1_dsw_r));            /* System input ports / Dip Switches */
778 	map(0x800100, 0x80013f).w(FUNC(fcrash_state::cps1_cps_a_w)).share("cps_a_regs");  /* CPS-A custom */
779 	map(0x800140, 0x80017f).rw(FUNC(fcrash_state::cps1_cps_b_r), FUNC(fcrash_state::cps1_cps_b_w)).share("cps_b_regs");
780 	map(0x800180, 0x800181).nopw(); // only once at boot, for 80010c
781 	map(0x800188, 0x80018f).w(FUNC(fcrash_state::cps1_soundlatch2_w));   /* Sound timer fade */
782 	map(0x880000, 0x880001).nopw(); // unknown
783 	map(0x900000, 0x93ffff).ram().w(FUNC(fcrash_state::cps1_gfxram_w)).share("gfxram");
784 	map(0x980000, 0x9801ff).w(FUNC(fcrash_state::sf2m1_layer_w));
785 	map(0x990000, 0x990001).nopw(); // same as 880000
786 	map(0xff0000, 0xffffff).ram().share("mainram");
787 }
788 
sgyxz_map(address_map & map)789 void fcrash_state::sgyxz_map(address_map &map)
790 {
791 	map(0x000000, 0x3fffff).rom();
792 	map(0x800030, 0x800031).w(FUNC(fcrash_state::cps1_coinctrl_w));
793 	map(0x800100, 0x80013f).ram().share("cps_a_regs");  /* CPS-A custom */
794 	map(0x800140, 0x80017f).ram().share("cps_b_regs");  /* CPS-B custom */
795 	map(0x880000, 0x880001).portr("IN1");            /* Player input ports */
796 	map(0x880006, 0x880007).portr("IN0");                                   /* System input ports + Player 3 controls */
797 	map(0x880008, 0x88000d).r(FUNC(fcrash_state::sgyxz_dsw_r));            /* Dip Switches */
798 	map(0x88000e, 0x88000f).w(FUNC(fcrash_state::cps1_soundlatch_w));
799 	map(0x880e78, 0x880e79).nopr();  // reads just once at start, bug?
800 	map(0x890000, 0x890001).w(FUNC(fcrash_state::cps1_soundlatch2_w));
801 	map(0x900000, 0x92ffff).ram().w(FUNC(fcrash_state::cps1_gfxram_w)).share("gfxram");
802 	map(0xf1c004, 0xf1c005).w(FUNC(fcrash_state::cpsq_coinctrl2_w));     /* Coin control2 (later games) */
803 	map(0xf1c006, 0xf1c007).noprw();  // doesn't have an eeprom
804 	map(0xff0000, 0xffffff).ram().share("mainram");
805 }
806 
wofabl_map(address_map & map)807 void fcrash_state::wofabl_map(address_map &map)
808 {
809 	map(0x000000, 0x1fffff).rom();
810 	map(0x800030, 0x800031).w(FUNC(fcrash_state::cps1_coinctrl_w));
811 	map(0x800100, 0x80013f).ram().share("cps_a_regs");  /* CPS-A custom */
812 	map(0x800140, 0x80017f).ram().share("cps_b_regs");  /* CPS-B custom */
813 	map(0x880000, 0x880001).portr("IN1");            /* Player input ports */
814 	map(0x880006, 0x880007).w(FUNC(fcrash_state::cps1_soundlatch_w));
815 	map(0x880008, 0x880009).portr("IN0");                                   /* System input ports + Player 3 controls */
816 	map(0x88000a, 0x88000f).r(FUNC(fcrash_state::sgyxz_dsw_r));            /* Dip Switches */
817 	map(0x890000, 0x890001).w(FUNC(fcrash_state::cps1_soundlatch2_w));
818 	map(0x900000, 0x92ffff).ram().w(FUNC(fcrash_state::cps1_gfxram_w)).share("gfxram");
819 	map(0xf1c004, 0xf1c005).w(FUNC(fcrash_state::cpsq_coinctrl2_w));     /* Coin control2 (later games) */
820 	map(0xf1c006, 0xf1c007).noprw();  // doesn't have an eeprom
821 	map(0xff0000, 0xffffff).ram().share("mainram");
822 }
823 
wofr1bl_map(address_map & map)824 void fcrash_state::wofr1bl_map(address_map &map)
825 {
826 	map(0x000000, 0x3fffff).rom();
827 	map(0x800000, 0x800007).portr("IN1");            /* Player input ports */
828 	map(0x800006, 0x800007).w(FUNC(fcrash_state::cps1_soundlatch_w));    /* Sound command */
829 	map(0x800008, 0x800009).w(FUNC(fcrash_state::wofr1bl_layer2_w));
830 	map(0x800018, 0x80001f).r(FUNC(fcrash_state::cps1_dsw_r));            /* System input ports / Dip Switches */
831 	map(0x800030, 0x800037).w(FUNC(fcrash_state::cps1_coinctrl_w));
832 	map(0x800100, 0x80013f).w(FUNC(fcrash_state::cps1_cps_a_w)).share("cps_a_regs");  /* CPS-A custom */
833 	map(0x800140, 0x80017f).rw(FUNC(fcrash_state::cps1_cps_b_r), FUNC(fcrash_state::cps1_cps_b_w)).share("cps_b_regs");  /* Only writes here at boot */
834 	map(0x880000, 0x880001).nopw(); // ?
835 	map(0x900000, 0x92ffff).ram().w(FUNC(fcrash_state::cps1_gfxram_w)).share("gfxram");
836 	map(0x980000, 0x98000d).w(FUNC(fcrash_state::wofr1bl_layer_w));
837 	map(0xf18000, 0xf19fff).nopw(); // few q-sound leftovers
838 	map(0xf1c000, 0xf1c001).portr("IN2");            /* Player 3 controls (later games) */
839 	map(0xf1c004, 0xf1c005).w(FUNC(fcrash_state::cpsq_coinctrl2_w));     /* Coin control2 (later games) */
840 	map(0xf1c006, 0xf1c007).portr("EEPROMIN").portw("EEPROMOUT");
841 	map(0xff0000, 0xffffff).ram().share("mainram");
842 }
843 
varthb_map(address_map & map)844 void fcrash_state::varthb_map(address_map &map)
845 {
846 	map(0x000000, 0x1fffff).rom();
847 	map(0x800000, 0x800001).portr("IN1");
848 	map(0x800006, 0x800007).w(FUNC(fcrash_state::cps1_soundlatch_w));
849 	map(0x800018, 0x80001f).r(FUNC(fcrash_state::cps1_dsw_r));
850 	map(0x800030, 0x800037).w(FUNC(fcrash_state::cps1_coinctrl_w));
851 	map(0x800100, 0x80013f).w(FUNC(fcrash_state::cps1_cps_a_w)).share("cps_a_regs");
852 	map(0x800140, 0x80017f).rw(FUNC(fcrash_state::cps1_cps_b_r), FUNC(fcrash_state::cps1_cps_b_w)).share("cps_b_regs");
853 	map(0x800188, 0x800189).w(FUNC(fcrash_state::varthb_layer2_w));
854 	map(0x980000, 0x98000b).w(FUNC(fcrash_state::varthb_layer_w));
855 	map(0x900000, 0x92ffff).ram().w(FUNC(fcrash_state::cps1_gfxram_w)).share("gfxram");
856 	map(0xff0000, 0xffffff).ram().share("mainram");
857 }
858 
fcrash_sound_map(address_map & map)859 void fcrash_state::fcrash_sound_map(address_map &map)
860 {
861 	map(0x0000, 0x7fff).rom();
862 	map(0x8000, 0xbfff).bankr("bank1");
863 	map(0xd000, 0xd7ff).ram();
864 	map(0xd800, 0xd801).rw("ym1", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
865 	map(0xdc00, 0xdc01).rw("ym2", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
866 	map(0xe000, 0xe000).w(FUNC(fcrash_state::fcrash_snd_bankswitch_w));
867 	map(0xe400, 0xe400).r(m_soundlatch, FUNC(generic_latch_8_device::read));
868 	map(0xe800, 0xe800).w(FUNC(fcrash_state::fcrash_msm5205_0_data_w));
869 	map(0xec00, 0xec00).w(FUNC(fcrash_state::fcrash_msm5205_1_data_w));
870 }
871 
kodb_sound_map(address_map & map)872 void fcrash_state::kodb_sound_map(address_map &map)
873 {
874 	map(0x0000, 0x7fff).rom();
875 	map(0x8000, 0xbfff).bankr("bank1");
876 	map(0xd000, 0xd7ff).ram();
877 	map(0xe000, 0xe001).rw("2151", FUNC(ym2151_device::read), FUNC(ym2151_device::write));
878 	map(0xe400, 0xe400).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write));
879 	map(0xe800, 0xe800).r(m_soundlatch, FUNC(generic_latch_8_device::read));
880 }
881 
sgyxz_sound_map(address_map & map)882 void fcrash_state::sgyxz_sound_map(address_map &map)
883 {
884 	map(0x0000, 0x7fff).rom();
885 	map(0x8000, 0xbfff).bankr("bank1");
886 	map(0xd000, 0xd7ff).ram();
887 	map(0xf000, 0xf001).rw("2151", FUNC(ym2151_device::read), FUNC(ym2151_device::write));
888 	map(0xf002, 0xf002).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write));
889 	map(0xf004, 0xf004).w(FUNC(fcrash_state::cps1_snd_bankswitch_w));
890 	map(0xf006, 0xf006).w(FUNC(fcrash_state::cps1_oki_pin7_w)); /* controls pin 7 of OKI chip */
891 	map(0xf008, 0xf008).r(m_soundlatch, FUNC(generic_latch_8_device::read)); /* Sound command */
892 	map(0xf00a, 0xf00a).r(m_soundlatch2, FUNC(generic_latch_8_device::read)); /* Sound timer fade */
893 }
894 
ffightblb_sound_map(address_map & map)895 void fcrash_state::ffightblb_sound_map(address_map &map) // TODO: verify
896 {
897 	map(0x0000, 0x7fff).rom();
898 	map(0x8000, 0x87ff).ram();
899 	map(0x9000, 0x9000).lw8(NAME([this] (u8 data) { m_okibank->set_entry(data & 0x03); }));
900 	map(0x9800, 0x9800).rw(m_oki, FUNC(okim6295_device::read), FUNC(okim6295_device::write));
901 	map(0xa000, 0xa000).r(m_soundlatch, FUNC(generic_latch_8_device::read));
902 }
903 
ffightblb_oki_map(address_map & map)904 void fcrash_state::ffightblb_oki_map(address_map &map)
905 {
906 	map(0x00000, 0x1ffff).rom();
907 	map(0x20000, 0x3ffff).bankr(m_okibank);
908 }
909 
910 
MACHINE_START_MEMBER(fcrash_state,fcrash)911 MACHINE_START_MEMBER(fcrash_state, fcrash)
912 {
913 	uint8_t *ROM = memregion("audiocpu")->base();
914 
915 	membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
916 
917 	m_layer_enable_reg = 0x20;
918 	m_layer_mask_reg[0] = 0x26;
919 	m_layer_mask_reg[1] = 0x30;
920 	m_layer_mask_reg[2] = 0x28;
921 	m_layer_mask_reg[3] = 0x32;
922 	m_layer_scroll1x_offset = 62;
923 	m_layer_scroll2x_offset = 60;
924 	m_layer_scroll3x_offset = 64;
925 	m_sprite_base = 0x50c8;
926 	m_sprite_list_end_marker = 0x8000;
927 	m_sprite_x_offset = 0;
928 
929 	save_item(NAME(m_sample_buffer1));
930 	save_item(NAME(m_sample_buffer2));
931 	save_item(NAME(m_sample_select1));
932 	save_item(NAME(m_sample_select2));
933 }
934 
MACHINE_RESET_MEMBER(fcrash_state,fcrash)935 MACHINE_RESET_MEMBER(fcrash_state, fcrash)
936 {
937 	m_sample_buffer1 = 0;
938 	m_sample_buffer2 = 0;
939 	m_sample_select1 = 0;
940 	m_sample_select2 = 0;
941 }
942 
MACHINE_START_MEMBER(fcrash_state,cawingbl)943 MACHINE_START_MEMBER(fcrash_state, cawingbl)
944 {
945 	MACHINE_START_CALL_MEMBER(fcrash);
946 
947 	m_layer_enable_reg = 0x0c;
948 	m_layer_mask_reg[0] = 0x0a;
949 	m_layer_mask_reg[1] = 0x08;
950 	m_layer_mask_reg[2] = 0x06;
951 	m_layer_mask_reg[3] = 0x04;
952 	m_layer_scroll1x_offset = 63;
953 	m_layer_scroll2x_offset = 62;
954 	m_layer_scroll3x_offset = 65;
955 	m_sprite_base = 0x1000;
956 }
957 
MACHINE_START_MEMBER(fcrash_state,kodb)958 MACHINE_START_MEMBER(fcrash_state, kodb)
959 {
960 	m_layer_enable_reg = 0x20;
961 	m_layer_mask_reg[0] = 0x2e;
962 	m_layer_mask_reg[1] = 0x2c;
963 	m_layer_mask_reg[2] = 0x2a;
964 	m_layer_mask_reg[3] = 0x28;
965 	m_layer_scroll1x_offset = 0;
966 	m_layer_scroll2x_offset = 0;
967 	m_layer_scroll3x_offset = 0;
968 	m_sprite_base = 0x1000;
969 	m_sprite_list_end_marker = 0xffff;
970 	m_sprite_x_offset = 0;
971 }
972 
MACHINE_START_MEMBER(fcrash_state,mtwinsb)973 MACHINE_START_MEMBER(fcrash_state, mtwinsb)
974 {
975 	m_layer_enable_reg = 0x12;
976 	m_layer_mask_reg[0] = 0x14;
977 	m_layer_mask_reg[1] = 0x16;
978 	m_layer_mask_reg[2] = 0x18;
979 	m_layer_mask_reg[3] = 0x1a;
980 	m_layer_scroll1x_offset = 0x00;
981 	m_layer_scroll2x_offset = 0x00;
982 	m_layer_scroll3x_offset = 0x00;
983 	m_sprite_base = 0x1000;
984 	m_sprite_list_end_marker = 0x8000;
985 	m_sprite_x_offset = 0;
986 }
987 
MACHINE_START_MEMBER(fcrash_state,sf2m1)988 MACHINE_START_MEMBER(fcrash_state, sf2m1)
989 {
990 	uint8_t *ROM = memregion("audiocpu")->base();
991 
992 	membank("bank1")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
993 
994 	m_layer_enable_reg = 0x26;
995 	m_layer_mask_reg[0] = 0x28;
996 	m_layer_mask_reg[1] = 0x2a;
997 	m_layer_mask_reg[2] = 0x2c;
998 	m_layer_mask_reg[3] = 0x2e;
999 	m_layer_scroll1x_offset = 0x3e;
1000 	m_layer_scroll2x_offset = 0x3c;
1001 	m_layer_scroll3x_offset = 0x40;
1002 	m_sprite_base = 0x1000;
1003 	m_sprite_list_end_marker = 0x8000;
1004 	m_sprite_x_offset = 0;
1005 }
1006 
MACHINE_START_MEMBER(fcrash_state,sgyxz)1007 MACHINE_START_MEMBER(fcrash_state, sgyxz)
1008 {
1009 	m_layer_enable_reg = 0x20;
1010 	// palette_control  = 0x2a
1011 
1012 	// layer priority masks:
1013 	// clears 0x28, 0x2c, 0x2e at boot, then never writes any layer mask values anywhere outside main ram.
1014 	// (bootleggers have nop'd the original code)
1015 	// assume the bootleg h/w just uses some fixed values (set in machine_reset), just use any locations the game doesn't overwrite:
1016 	m_layer_mask_reg[0] = 0x38;
1017 	m_layer_mask_reg[1] = 0x3a;
1018 	m_layer_mask_reg[2] = 0x3c;
1019 	m_layer_mask_reg[3] = 0x3e;
1020 
1021 	m_layer_scroll1x_offset = 0x40;
1022 	m_layer_scroll2x_offset = 0x40;
1023 	m_layer_scroll3x_offset = 0x40;
1024 	m_sprite_base = 0x1000;
1025 	m_sprite_list_end_marker = 0x8000;
1026 	m_sprite_x_offset = 0;
1027 
1028 	membank("bank1")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x10000, 0x4000);
1029 }
1030 
MACHINE_RESET_MEMBER(fcrash_state,sgyxz)1031 MACHINE_RESET_MEMBER(fcrash_state, sgyxz)
1032 {
1033 	// assume some fixed values for layer masks (game never writes any outside main ram)
1034 	m_cps_b_regs[m_layer_mask_reg[2] / 2] = 0x1ff;
1035 	m_cps_b_regs[m_layer_mask_reg[3] / 2] = 0x1ff;
1036 }
1037 
MACHINE_START_MEMBER(fcrash_state,wofr1bl)1038 MACHINE_START_MEMBER(fcrash_state, wofr1bl)
1039 {
1040 	m_layer_enable_reg = 0x26;
1041 	m_layer_mask_reg[0] = 0x28;
1042 	m_layer_mask_reg[1] = 0x2a;
1043 	m_layer_mask_reg[2] = 0x2c;
1044 	m_layer_mask_reg[3] = 0x2e;
1045 	m_layer_scroll1x_offset = 0x40;
1046 	m_layer_scroll2x_offset = 0x40;
1047 	m_layer_scroll3x_offset = 0x40;
1048 	m_sprite_base = 0x1000;
1049 	m_sprite_list_end_marker = 0x8000;
1050 	m_sprite_x_offset = 2;
1051 	membank("bank1")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x10000, 0x4000);
1052 }
1053 
MACHINE_START_MEMBER(fcrash_state,ffightblb)1054 MACHINE_START_MEMBER(fcrash_state, ffightblb)
1055 {
1056 	m_layer_enable_reg = 0x20;
1057 	m_layer_mask_reg[0] = 0x26;
1058 	m_layer_mask_reg[1] = 0x30;
1059 	m_layer_mask_reg[2] = 0x28;
1060 	m_layer_mask_reg[3] = 0x32;
1061 	m_layer_scroll1x_offset = 0x00;
1062 	m_layer_scroll2x_offset = 0x08;
1063 	m_layer_scroll3x_offset = 0x04;
1064 	m_sprite_base = 0x5008; // check this
1065 	m_sprite_list_end_marker = 0x8000;
1066 	m_sprite_x_offset = -0x38;
1067 
1068 	m_okibank->configure_entries(0, 4, memregion("oki")->base() + 0x20000, 0x20000);
1069 }
1070 
1071 
init_cawingbl()1072 void fcrash_state::init_cawingbl()
1073 {
1074 	m_maincpu->space(AS_PROGRAM).install_read_port(0x882000, 0x882001, "IN1");
1075 	m_maincpu->space(AS_PROGRAM).install_write_handler(0x882006, 0x882007, write16s_delegate(*this, FUNC(fcrash_state::cawingbl_soundlatch_w)));
1076 	m_maincpu->space(AS_PROGRAM).install_read_handler(0x882008, 0x88200f, read16sm_delegate(*this, FUNC(fcrash_state::cps1_dsw_r)));
1077 
1078 	init_cps1();
1079 }
1080 
init_kodb()1081 void fcrash_state::init_kodb()
1082 {
1083 	m_maincpu->space(AS_PROGRAM).install_read_port(0x800000, 0x800007, "IN1");
1084 	m_maincpu->space(AS_PROGRAM).install_read_handler(0x800018, 0x80001f, read16sm_delegate(*this, FUNC(fcrash_state::cps1_dsw_r)));
1085 	m_maincpu->space(AS_PROGRAM).install_write_handler(0x800180, 0x800187, write16s_delegate(*this, FUNC(fcrash_state::cps1_soundlatch_w)));
1086 	m_maincpu->space(AS_PROGRAM).install_write_handler(0x980000, 0x98002f, write16sm_delegate(*this, FUNC(fcrash_state::kodb_layer_w)));
1087 
1088 	/* the original game alternates between 2 sprite ram areas to achieve flashing sprites - the bootleg doesn't do the write to the register to achieve this
1089 	mapping both sprite ram areas to the same bootleg sprite ram - similar to how sf2mdt works */
1090 	m_bootleg_sprite_ram = std::make_unique<uint16_t[]>(0x2000);
1091 	m_maincpu->space(AS_PROGRAM).install_ram(0x900000, 0x903fff, m_bootleg_sprite_ram.get());
1092 	m_maincpu->space(AS_PROGRAM).install_ram(0x904000, 0x907fff, m_bootleg_sprite_ram.get()); /* both of these need to be mapped */
1093 
1094 	init_cps1();
1095 }
1096 
init_mtwinsb()1097 void fcrash_state::init_mtwinsb()
1098 {
1099 	m_bootleg_sprite_ram = std::make_unique<uint16_t[]>(0x2000);
1100 	m_maincpu->space(AS_PROGRAM).install_ram(0x990000, 0x993fff, m_bootleg_sprite_ram.get());
1101 	init_cps1();
1102 }
1103 
init_sf2m1()1104 void fcrash_state::init_sf2m1()
1105 {
1106 	uint16_t *mem16 = (uint16_t *)memregion("maincpu")->base();
1107 	mem16[0x64E/2] = 0x6046; // fix priorities
1108 
1109 	init_mtwinsb();
1110 }
1111 
init_wofr1bl()1112 void fcrash_state::init_wofr1bl()
1113 {
1114 	m_bootleg_sprite_ram = std::make_unique<uint16_t[]>(0x2000);
1115 	m_maincpu->space(AS_PROGRAM).install_ram(0x990000, 0x993fff, m_bootleg_sprite_ram.get());
1116 	m_maincpu->space(AS_PROGRAM).install_write_handler(0x990000, 0x990001, write16smo_delegate(*this, FUNC(fcrash_state::wofr1bl_spr_base_w)));
1117 	init_cps1();
1118 }
1119 
1120 
1121 #define CPS1_COINAGE_1 \
1122 	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) \
1123 	PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
1124 	PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) ) \
1125 	PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) ) \
1126 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) ) \
1127 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) ) \
1128 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) ) \
1129 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) ) \
1130 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_6C ) ) \
1131 	PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) \
1132 	PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
1133 	PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) ) \
1134 	PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
1135 	PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) ) \
1136 	PORT_DIPSETTING(    0x30, DEF_STR( 1C_2C ) ) \
1137 	PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) ) \
1138 	PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) ) \
1139 	PORT_DIPSETTING(    0x18, DEF_STR( 1C_6C ) )
1140 
1141 #define CPS1_COINAGE_2(diploc) \
1142 	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION(diploc ":1,2,3") \
1143 	PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
1144 	PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) ) \
1145 	PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) ) \
1146 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) ) \
1147 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) ) \
1148 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) ) \
1149 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) ) \
1150 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_6C ) )
1151 
1152 #define CPS1_DIFFICULTY_1(diploc) \
1153 	PORT_DIPNAME( 0x07, 0x04, DEF_STR( Difficulty ) ) PORT_DIPLOCATION(diploc ":1,2,3") \
1154 	PORT_DIPSETTING(    0x07, "1 (Easiest)" ) \
1155 	PORT_DIPSETTING(    0x06, "2" ) \
1156 	PORT_DIPSETTING(    0x05, "3" ) \
1157 	PORT_DIPSETTING(    0x04, "4 (Normal)" ) \
1158 	PORT_DIPSETTING(    0x03, "5" ) \
1159 	PORT_DIPSETTING(    0x02, "6" ) \
1160 	PORT_DIPSETTING(    0x01, "7" ) \
1161 	PORT_DIPSETTING(    0x00, "8 (Hardest)" )
1162 
1163 static INPUT_PORTS_START( fcrash )
1164 	PORT_START("IN0")
1165 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1166 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1167 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
1168 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1169 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
1170 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
1171 	PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
1172 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1173 
1174 	PORT_START("DSWA")
1175 	CPS1_COINAGE_1
1176 	PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" )
DEF_STR(Off)1177 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1178 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1179 	PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
1180 
1181 	PORT_START("DSWB")
1182 	PORT_DIPNAME( 0x07, 0x04, "Difficulty Level 1" )
1183 	PORT_DIPSETTING(    0x07, DEF_STR( Easiest ) )   // "01"
1184 	PORT_DIPSETTING(    0x06, DEF_STR( Easier ) )    // "02"
1185 	PORT_DIPSETTING(    0x05, DEF_STR( Easy ) )      // "03"
1186 	PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )    // "04"
1187 	PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )    // "05"
1188 	PORT_DIPSETTING(    0x02, DEF_STR( Hard ) )      // "06"
1189 	PORT_DIPSETTING(    0x01, DEF_STR( Harder ) )    // "07"
1190 	PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )   // "08"
1191 	PORT_DIPNAME( 0x18, 0x10, "Difficulty Level 2" )
1192 	PORT_DIPSETTING(    0x18, DEF_STR( Easy ) )      // "01"
1193 	PORT_DIPSETTING(    0x10, DEF_STR( Normal ) )    // "02"
1194 	PORT_DIPSETTING(    0x08, DEF_STR( Hard ) )      // "03"
1195 	PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )   // "04"
1196 	PORT_DIPNAME( 0x60, 0x60, DEF_STR( Bonus_Life ) )
1197 	PORT_DIPSETTING(    0x60, "100k" )
1198 	PORT_DIPSETTING(    0x40, "200k" )
1199 	PORT_DIPSETTING(    0x20, "100k and every 200k" )
1200 	PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1201 	PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
1202 
1203 	PORT_START("DSWC")
1204 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
1205 	PORT_DIPSETTING(    0x00, "1" )
1206 	PORT_DIPSETTING(    0x03, "2" )
1207 	PORT_DIPSETTING(    0x02, "3" )
1208 	PORT_DIPSETTING(    0x01, "4" )
1209 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) )
1210 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1211 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1212 	PORT_DIPNAME( 0x08, 0x08, "Freeze" )
1213 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1214 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1215 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) )
1216 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1217 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1218 	PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) )
1219 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1220 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1221 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) )
1222 	PORT_DIPSETTING(    0x40, DEF_STR( No ) )
1223 	PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
1224 	PORT_DIPNAME( 0x80, 0x80, "Game Mode")
1225 	PORT_DIPSETTING(    0x80, "Game" )
1226 	PORT_DIPSETTING(    0x00, DEF_STR( Test ) )
1227 
1228 	PORT_START("IN1")
1229 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1230 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1231 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1232 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1233 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1234 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1235 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME ("P1 Button 3 (Cheat)")
1236 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1237 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1238 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1239 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1240 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1241 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1242 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1243 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME ("P2 Button 3 (Cheat)")
1244 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1245 INPUT_PORTS_END
1246 
1247 static INPUT_PORTS_START( cawingbl )
1248 	PORT_START("IN0")
1249 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1250 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1251 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
1252 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1253 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
1254 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
1255 	PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW )
1256 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1257 
1258 	PORT_START("IN1")
1259 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1260 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1261 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1262 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1263 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1264 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1265 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1266 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1267 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1268 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1269 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1270 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1271 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1272 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1273 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1274 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1275 
1276 	PORT_START("DSWA")
1277 	CPS1_COINAGE_1
1278 	PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" )
1279 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )  // Overrides all other coinage settings
1280 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )   // according to manual
1281 	PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )       // This switch is not documented
1282 
1283 	PORT_START("DSWB")
1284 	PORT_DIPNAME( 0x07, 0x04, "Difficulty Level (Enemy's Strength)" ) PORT_DIPLOCATION("SW(B):1,2,3")
1285 	PORT_DIPSETTING(    0x07, "1 (Easiest)" )
1286 	PORT_DIPSETTING(    0x06, "2" )
1287 	PORT_DIPSETTING(    0x05, "3" )
1288 	PORT_DIPSETTING(    0x04, "4 (Normal)" )
1289 	PORT_DIPSETTING(    0x03, "5" )
1290 	PORT_DIPSETTING(    0x02, "6" )
1291 	PORT_DIPSETTING(    0x01, "7" )
1292 	PORT_DIPSETTING(    0x00, "8 (Hardest)" )
1293 	PORT_DIPNAME( 0x18, 0x18, "Difficulty Level (Player's Strength)" ) PORT_DIPLOCATION("SW(B):4,5")
1294 	PORT_DIPSETTING(    0x10, DEF_STR( Easy ) )
1295 	PORT_DIPSETTING(    0x18, DEF_STR( Normal ) )
1296 	PORT_DIPSETTING(    0x08, DEF_STR( Hard ) )
1297 	PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1298 	PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(B):6" )  // This switch is not documented
1299 	PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW(B):7" )  // This switch is not documented
1300 	PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(B):8" )  // This switch is not documented
1301 
1302 	PORT_START("DSWC")
1303 	PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" )  // This switch is not documented
1304 	PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" )  // This switch is not documented
1305 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3")
1306 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1307 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1308 	PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4")
1309 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1310 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1311 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5")
1312 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1313 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1314 	PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6")
1315 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1316 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1317 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7")
1318 	PORT_DIPSETTING(    0x40, DEF_STR( No ) )
1319 	PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
1320 	PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8")
1321 	PORT_DIPSETTING(    0x80, "Game" )
1322 	PORT_DIPSETTING(    0x00, DEF_STR( Test ) )
1323 INPUT_PORTS_END
1324 
1325 static INPUT_PORTS_START( kodb )
1326 	PORT_START("IN0")
1327 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1328 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1329 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
1330 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1331 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
1332 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
1333 	PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW )
1334 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1335 
1336 	PORT_START("DSWA")
1337 	CPS1_COINAGE_2( "SW(A)" )
1338 	PORT_DIPNAME( 0x08, 0x08, "Coin Slots" ) PORT_DIPLOCATION("SW(A):4")
1339 	PORT_DIPSETTING(    0x00, "1" )
1340 	PORT_DIPSETTING(    0x08, "3" )
1341 	PORT_DIPNAME( 0x10, 0x10, "Play Mode" ) PORT_DIPLOCATION("SW(A):5")
1342 	PORT_DIPSETTING(    0x00, "2 Players" )
1343 	PORT_DIPSETTING(    0x10, "3 Players" )
1344 	PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(A):6" )
1345 	PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" ) PORT_DIPLOCATION("SW(A):7")
1346 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1347 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1348 	PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" )
1349 
1350 	PORT_START("DSWB")
1351 	CPS1_DIFFICULTY_1( "SW(B)" )
1352 	PORT_DIPNAME( 0x38, 0x38, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW(B):4,5,6")
1353 	PORT_DIPSETTING(    0x30, "1" )
1354 	PORT_DIPSETTING(    0x38, "2" )
1355 	PORT_DIPSETTING(    0x28, "3" )
1356 	PORT_DIPSETTING(    0x20, "4" )
1357 	PORT_DIPSETTING(    0x18, "5" )
1358 	PORT_DIPSETTING(    0x10, "6" )
1359 	PORT_DIPSETTING(    0x08, "7" )
1360 	PORT_DIPSETTING(    0x00, "8" )
1361 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) )  PORT_DIPLOCATION("SW(B):7,8")
1362 	PORT_DIPSETTING(    0x80, "80k and every 400k" )
1363 	PORT_DIPSETTING(    0xc0, "100k and every 450k" )
1364 	PORT_DIPSETTING(    0x40, "160k and every 450k" )
1365 	PORT_DIPSETTING(    0x00, DEF_STR( None ) )
1366 
1367 	PORT_START("DSWC")
1368 	PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" )
1369 	PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" )
1370 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW(C):3")
1371 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1372 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1373 	PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW(C):4")
1374 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1375 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1376 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW(C):5")
1377 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1378 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1379 	PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW(C):6")
1380 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1381 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1382 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW(C):7")
1383 	PORT_DIPSETTING(    0x40, DEF_STR( No ) )
1384 	PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
1385 	PORT_DIPNAME( 0x80, 0x80, "Game Mode") PORT_DIPLOCATION("SW(C):8")
1386 	PORT_DIPSETTING(    0x80, "Game" )
1387 	PORT_DIPSETTING(    0x00, DEF_STR( Test ) )
1388 
1389 	PORT_START("IN1")
1390 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1391 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1392 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1393 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1394 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1395 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1396 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1397 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1398 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1399 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1400 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1401 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1402 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1403 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1404 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1405 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1406 
1407 	PORT_START("IN2")
1408 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
1409 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
1410 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
1411 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
1412 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1413 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1414 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
1415 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
1416 INPUT_PORTS_END
1417 
1418 static INPUT_PORTS_START( sgyxz )
1419 	PORT_START("IN0")
1420 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
1421 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
1422 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
1423 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
1424 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1425 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1426 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
1427 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 )
1428 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
1429 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
1430 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SERVICE1 )
1431 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
1432 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START1 )
1433 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_START2 )
1434 	PORT_SERVICE_NO_TOGGLE( 0x4000, IP_ACTIVE_LOW )  // test mode doesn't work
1435 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1436 
1437 	// No COIN3, must use SERVICE1 to credit 3P in "3 Players, 3 Chutes" mode
1438 	// STARTx changes character during gameplay
1439 
1440 	PORT_START ("IN1")
1441 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1442 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1443 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1444 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1445 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1446 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1447 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)  // special move added by bootlegger
1448 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1449 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1450 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1451 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1452 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1453 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1454 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1455 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)  // special move added by bootlegger
1456 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1457 
1458 	PORT_START("DSWA")
1459 	PORT_DIPNAME( 0x03, 0x02, "Cabinet" ) PORT_DIPLOCATION("SW(A):1,2")
1460 	PORT_DIPSETTING( 0x03, "3 Players, 3 Chutes" )
1461 	PORT_DIPSETTING( 0x02, "3 Players, 1 Chute" )
1462 	PORT_DIPSETTING( 0x01, "2 Players, 1 Chute" )
1463 	//PORT_DIPSETTING( 0x00, "2 Players, 1 Chute" )
1464 	PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW(A):3" )
1465 	PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(A):4" )
1466 	PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(A):5" )
1467 	PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(A):6" )
1468 	PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW(A):7" )
1469 	PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW(A):8" )
1470 
1471 	PORT_START("DSWB")
1472 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW(B):1,2")
1473 	PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
1474 	PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
1475 	PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) )
1476 	PORT_DIPSETTING( 0x00, DEF_STR( 1C_4C ) )
1477 	PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW(B):3" )
1478 	PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(B):4" )
1479 	PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(B):5" )
1480 	PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(B):6" )
1481 	PORT_DIPNAME( 0xc0, 0xc0, "Number of Special Moves" ) PORT_DIPLOCATION("SW(B):7,8")
1482 	PORT_DIPSETTING( 0xc0, "3" )
1483 	PORT_DIPSETTING( 0x80, "2" )
1484 	PORT_DIPSETTING( 0x40, "1" )
1485 	PORT_DIPSETTING( 0x00, "0" )
1486 
1487 	PORT_START("DSWC")
1488 	PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW(C):1" )
1489 	PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW(C):2" )
1490 	PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW(C):3" )
1491 	PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(C):4" )
1492 	PORT_DIPNAME( 0x70, 0x60, "Number of Players" ) PORT_DIPLOCATION("SW(C):5,6,7")
1493 	PORT_DIPSETTING( 0x70, "Start 1, Continue 1" )
1494 	PORT_DIPSETTING( 0x60, "Start 2, Continue 2" )
1495 	PORT_DIPSETTING( 0x50, "Start 3, Continue 3" )
1496 	PORT_DIPSETTING( 0x40, "Start 4, Continue 4" )
1497 	PORT_DIPSETTING( 0x30, "Start 1, Continue 2" )
1498 	PORT_DIPSETTING( 0x20, "Start 2, Continue 3" )
1499 	PORT_DIPSETTING( 0x10, "Start 3, Continue 4" )
1500 	PORT_DIPSETTING( 0x00, "Start 4, Continue 5" )
1501 	PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW(C):8" )
1502 INPUT_PORTS_END
1503 
1504 static INPUT_PORTS_START( wofabl )
1505 	PORT_START("IN0")
1506 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
1507 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
1508 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
1509 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
1510 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1511 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1512 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN3 )
1513 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START3 )
1514 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
1515 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
1516 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SERVICE1 )
1517 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
1518 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START1 )
1519 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_START2 )
1520 	PORT_SERVICE_NO_TOGGLE( 0x4000, IP_ACTIVE_LOW )
1521 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1522 
1523 	PORT_START ("IN1")
1524 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1525 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1526 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1527 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1528 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1529 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1530 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
1531 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
1532 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1533 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1534 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1535 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1536 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1537 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1538 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1539 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
1540 
1541 	PORT_START("DSWA")
1542 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW(A):1,2,3,4")
1543 	PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
1544 	PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
1545 	PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
1546 	PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) )
1547 	PORT_DIPSETTING( 0x0b, DEF_STR( 1C_6C ) )
1548 	PORT_DIPSETTING( 0x0a, DEF_STR( 2C_1C ) )
1549 	PORT_DIPSETTING( 0x09, DEF_STR( 3C_1C ) )
1550 	PORT_DIPSETTING( 0x08, DEF_STR( 4C_1C ) )
1551 	PORT_DIPSETTING( 0x07, "2 Coins Start, 1 Coin Continue" )
1552 	PORT_DIPSETTING( 0x06, DEF_STR( Free_Play ) )
1553 	/* setting any of these crashes the test mode config menu */
1554 	PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW(A):5" )  // free play?
1555 	PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW(A):6" )  // 1c 8c?
1556 	PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW(A):7" )  // 2 coins start?
1557 	PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW(A):8" )  // 1c 7c?
1558 
1559 	PORT_START("DSWB")
1560 	PORT_DIPNAME( 0x07, 0x04, "Game Difficulty" ) PORT_DIPLOCATION("SW(B):1,2,3")
1561 	PORT_DIPSETTING( 0x07, "0 (Extra Easy)" )
1562 	PORT_DIPSETTING( 0x06, "1 (Very Easy)" )
1563 	PORT_DIPSETTING( 0x05, "2 (Easy)" )
1564 	PORT_DIPSETTING( 0x04, "3 (Normal)" )
1565 	PORT_DIPSETTING( 0x03, "4 (Hard)" )
1566 	PORT_DIPSETTING( 0x02, "5 (Very Hard)" )
1567 	PORT_DIPSETTING( 0x01, "6 (Extra Hard)" )
1568 	PORT_DIPSETTING( 0x00, "7 (Hardest)" )
1569 	PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(B):4" )
1570 	PORT_DIPNAME( 0x70, 0x60, "Number of Players" ) PORT_DIPLOCATION("SW(B):5,6,7")
1571 	PORT_DIPSETTING( 0x70, "Start 1, Continue 1" )
1572 	PORT_DIPSETTING( 0x60, "Start 2, Continue 2" )
1573 	PORT_DIPSETTING( 0x50, "Start 3, Continue 3" )
1574 	PORT_DIPSETTING( 0x40, "Start 4, Continue 4" )
1575 	PORT_DIPSETTING( 0x30, "Start 1, Continue 2" )
1576 	PORT_DIPSETTING( 0x20, "Start 2, Continue 3" )
1577 	PORT_DIPSETTING( 0x10, "Start 3, Continue 4" )
1578 	PORT_DIPSETTING( 0x00, "Start 4, Continue 5" )
1579 	PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW(B):8" )
1580 
1581 	PORT_START("DSWC")
1582 	PORT_DIPNAME( 0x03, 0x03, "Cabinet" ) PORT_DIPLOCATION("SW(C):1,2")
1583 	PORT_DIPSETTING( 0x03, "3 Players, 3 Chutes" )
1584 	PORT_DIPSETTING( 0x02, "3 Players, 1 Chute" )
1585 	PORT_DIPSETTING( 0x01, "2 Players, 1 Chute" )
1586 	PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW(C):3" )
1587 	PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW(C):4" )
1588 	PORT_DIPNAME( 0x30, 0x10, "Extend" ) PORT_DIPLOCATION("SW(C):5,6")
1589 	PORT_DIPSETTING( 0x30, "No Extend" )
1590 	PORT_DIPSETTING( 0x20, "100000 pts." )
1591 	PORT_DIPSETTING( 0x10, "300000 pts." )
1592 	PORT_DIPSETTING( 0x00, "100000, 300000, 500000, 1000000 pts." )
1593 	PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW(C):7" )
1594 	PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW(C):8" )  // crashes the test mode config menu if set
1595 INPUT_PORTS_END
1596 
1597 
1598 void fcrash_state::fcrash_update_transmasks()
1599 {
1600 	int i;
1601 
1602 	for (i = 0; i < 4; i++)
1603 	{
1604 		int mask;
1605 
1606 		/* Get transparency registers */
1607 		if (m_layer_mask_reg[i])
1608 			mask = m_cps_b_regs[m_layer_mask_reg[i] / 2] ^ 0xffff;
1609 		else
1610 			mask = 0xffff;  /* completely transparent if priority masks not defined (mercs, qad) */
1611 
1612 		m_bg_tilemap[0]->set_transmask(i, mask, 0x8000);
1613 		m_bg_tilemap[1]->set_transmask(i, mask, 0x8000);
1614 		m_bg_tilemap[2]->set_transmask(i, mask, 0x8000);
1615 	}
1616 }
1617 
bootleg_render_sprites(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)1618 void fcrash_state::bootleg_render_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
1619 {
1620 	int pos;
1621 	int base = m_sprite_base / 2;
1622 	int num_sprites = m_gfxdecode->gfx(2)->elements();
1623 	int last_sprite_offset = 0x1ffc;
1624 	uint16_t *sprite_ram = m_gfxram;
1625 	uint16_t tileno,colour,xpos,ypos;
1626 	bool flipx, flipy;
1627 
1628 	/* if we have separate sprite ram, use it */
1629 	if (m_bootleg_sprite_ram) sprite_ram = m_bootleg_sprite_ram.get();
1630 
1631 	/* get end of sprite list marker */
1632 	for (pos = 0x1ffc - base; pos >= 0x0000; pos -= 4)
1633 		if (sprite_ram[base + pos - 1] == m_sprite_list_end_marker) last_sprite_offset = pos;
1634 
1635 	/* If we are using bootleg sprite ram, the index must be less than 0x2000 */
1636 	if (((base + last_sprite_offset) < 0x2000) || (!m_bootleg_sprite_ram))
1637 	{
1638 		for (pos = last_sprite_offset; pos >= 0x0000; pos -= 4)
1639 		{
1640 			tileno = sprite_ram[base + pos];
1641 			if (tileno >= num_sprites) continue; /* don't render anything outside our tiles */
1642 			xpos   = sprite_ram[base + pos + 2] & 0x1ff;
1643 			ypos   = sprite_ram[base + pos - 1] & 0x1ff;
1644 			flipx  = BIT(sprite_ram[base + pos + 1], 5);
1645 			flipy  = BIT(sprite_ram[base + pos + 1], 6);
1646 			colour = sprite_ram[base + pos + 1] & 0x1f;
1647 			ypos   = 256 - ypos - 16;
1648 			xpos   = xpos + m_sprite_x_offset + 49;
1649 
1650 			if (flip_screen())
1651 				m_gfxdecode->gfx(2)->prio_transpen(bitmap, cliprect, tileno, colour, !flipx, !flipy, 512-16-xpos, 256-16-ypos, screen.priority(), 2, 15);
1652 			else
1653 				m_gfxdecode->gfx(2)->prio_transpen(bitmap, cliprect, tileno, colour, flipx, flipy, xpos, ypos, screen.priority(), 2, 15);
1654 		}
1655 	}
1656 }
1657 
fcrash_render_layer(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect,int layer,int primask)1658 void fcrash_state::fcrash_render_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int primask )
1659 {
1660 	switch (layer)
1661 	{
1662 		case 0:
1663 			bootleg_render_sprites(screen, bitmap, cliprect);
1664 			break;
1665 		case 1:
1666 		case 2:
1667 		case 3:
1668 			m_bg_tilemap[layer - 1]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, primask);
1669 			break;
1670 	}
1671 }
1672 
fcrash_render_high_layer(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect,int layer)1673 void fcrash_state::fcrash_render_high_layer( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer )
1674 {
1675 	switch (layer)
1676 	{
1677 		case 0:
1678 			/* there are no high priority sprites */
1679 			break;
1680 		case 1:
1681 		case 2:
1682 		case 3:
1683 			m_bg_tilemap[layer - 1]->draw(screen, m_dummy_bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
1684 			break;
1685 	}
1686 }
1687 
fcrash_build_palette()1688 void fcrash_state::fcrash_build_palette()
1689 {
1690 	int offset;
1691 
1692 	// all the bootlegs seem to write the palette offset as usual
1693 	int palettebase = (m_cps_a_regs[0x0a / 2] << 8) & 0x1ffff;
1694 
1695 	for (offset = 0; offset < 32 * 6 * 16; offset++)
1696 	{
1697 		int palette = m_gfxram[palettebase / 2 + offset];
1698 		int r, g, b, bright;
1699 
1700 		// from my understanding of the schematics, when the 'brightness'
1701 		// component is set to 0 it should reduce brightness to 1/3
1702 
1703 		bright = 0x0f + ((palette >> 12) << 1);
1704 
1705 		r = ((palette >> 8) & 0x0f) * 0x11 * bright / 0x2d;
1706 		g = ((palette >> 4) & 0x0f) * 0x11 * bright / 0x2d;
1707 		b = ((palette >> 0) & 0x0f) * 0x11 * bright / 0x2d;
1708 
1709 		m_palette->set_pen_color(offset, rgb_t(r, g, b));
1710 	}
1711 }
1712 
fcrash_build_palette()1713 void cps1bl_no_brgt::fcrash_build_palette()
1714 {
1715 	// some bootlegs don't have the brightness hardware, the 2x 74ls07 and 2x extra resistor arrays
1716 	// are either unpopulated or simply don't exist in the bootleg design.
1717 	// this is a problem as some games (wofabl, jurassic99) use erroneous brightness values
1718 	// which have no effect on the bootleg pcb, but cause issues in mame (as they would on genuine hardware).
1719 
1720 	int offset;
1721 
1722 	// all the bootlegs seem to write the palette offset as usual
1723 	int palettebase = (m_cps_a_regs[0x0a / 2] << 8) & 0x1ffff;
1724 
1725 	for (offset = 0; offset < 32 * 6 * 16; offset++)
1726 	{
1727 		int palette = m_gfxram[palettebase / 2 + offset];
1728 		int r, g, b;
1729 
1730 		r = ((palette >> 8) & 0x0f) * 0x11;
1731 		g = ((palette >> 4) & 0x0f) * 0x11;
1732 		b = ((palette >> 0) & 0x0f) * 0x11;
1733 
1734 		m_palette->set_pen_color(offset, rgb_t(r, g, b));
1735 	}
1736 }
1737 
screen_update_fcrash(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)1738 uint32_t fcrash_state::screen_update_fcrash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
1739 {
1740 	int layercontrol, l0, l1, l2, l3;
1741 	int videocontrol = m_cps_a_regs[0x22 / 2];
1742 
1743 	flip_screen_set(videocontrol & 0x8000);
1744 
1745 	layercontrol = m_cps_b_regs[m_layer_enable_reg / 2];
1746 
1747 	/* Get video memory base registers */
1748 	cps1_get_video_base();
1749 
1750 	/* Build palette */
1751 	fcrash_build_palette();
1752 
1753 	fcrash_update_transmasks();
1754 
1755 	m_bg_tilemap[0]->set_scrollx(0, m_scroll1x - m_layer_scroll1x_offset);
1756 	m_bg_tilemap[0]->set_scrolly(0, m_scroll1y);
1757 
1758 	if (videocontrol & 0x01)    /* linescroll enable */
1759 	{
1760 		int scrly = -m_scroll2y;
1761 		int i;
1762 		int otheroffs;
1763 
1764 		m_bg_tilemap[1]->set_scroll_rows(1024);
1765 
1766 		otheroffs = m_cps_a_regs[CPS1_ROWSCROLL_OFFS];
1767 
1768 		for (i = 0; i < 256; i++)
1769 			m_bg_tilemap[1]->set_scrollx((i - scrly) & 0x3ff, m_scroll2x + m_other[(i + otheroffs) & 0x3ff]);
1770 	}
1771 	else
1772 	{
1773 		m_bg_tilemap[1]->set_scroll_rows(1);
1774 		m_bg_tilemap[1]->set_scrollx(0, m_scroll2x - m_layer_scroll2x_offset);
1775 	}
1776 	m_bg_tilemap[1]->set_scrolly(0, m_scroll2y);
1777 	m_bg_tilemap[2]->set_scrollx(0, m_scroll3x - m_layer_scroll3x_offset);
1778 	m_bg_tilemap[2]->set_scrolly(0, m_scroll3y);
1779 
1780 
1781 	/* turn all tilemaps on regardless of settings in get_video_base() */
1782 	/* write a custom get_video_base for this bootleg hardware? */
1783 	m_bg_tilemap[0]->enable(1);
1784 	m_bg_tilemap[1]->enable(1);
1785 	m_bg_tilemap[2]->enable(1);
1786 
1787 	/* Blank screen */
1788 	bitmap.fill(0xbff, cliprect);
1789 
1790 	screen.priority().fill(0, cliprect);
1791 	l0 = (layercontrol >> 0x06) & 03;
1792 	l1 = (layercontrol >> 0x08) & 03;
1793 	l2 = (layercontrol >> 0x0a) & 03;
1794 	l3 = (layercontrol >> 0x0c) & 03;
1795 
1796 	fcrash_render_layer(screen, bitmap, cliprect, l0, 0);
1797 
1798 	if (l1 == 0)
1799 		fcrash_render_high_layer(screen, bitmap, cliprect, l0);
1800 
1801 	fcrash_render_layer(screen, bitmap, cliprect, l1, 0);
1802 
1803 	if (l2 == 0)
1804 		fcrash_render_high_layer(screen, bitmap, cliprect, l1);
1805 
1806 	fcrash_render_layer(screen, bitmap, cliprect, l2, 0);
1807 
1808 	if (l3 == 0)
1809 		fcrash_render_high_layer(screen, bitmap, cliprect, l2);
1810 
1811 	fcrash_render_layer(screen, bitmap, cliprect, l3, 0);
1812 
1813 	return 0;
1814 }
1815 
1816 
1817 // ************************************************************************* FCRASH
1818 
1819 ROM_START( fcrash )
1820 	ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
1821 	ROM_LOAD16_BYTE( "9.bin", 0x00000, 0x20000, CRC(c6854c91) SHA1(29f01cc65be5eaa3f86e99eebdd284104623abb0) )
1822 	ROM_LOAD16_BYTE( "5.bin", 0x00001, 0x20000, CRC(77f7c2b3) SHA1(feea48d9555824a2e5bf5e99ce159edc015f0792) )
1823 	ROM_LOAD16_BYTE( "8.bin", 0x40000, 0x20000, CRC(1895b3df) SHA1(415a26050c50ed79a7ee5ddd1b8d61593b1ce876) )
1824 	ROM_LOAD16_BYTE( "4.bin", 0x40001, 0x20000, CRC(bbd411ee) SHA1(85d50ca72ec46d627f9c88ff0809aa30e164821a) )
1825 	ROM_LOAD16_BYTE( "7.bin", 0x80000, 0x20000, CRC(5b23ebf2) SHA1(8c28c21a72a28ad249170026891c6bb865943f84) )
1826 	ROM_LOAD16_BYTE( "3.bin", 0x80001, 0x20000, CRC(aba2aebe) SHA1(294109b5929ed63859a55bef16643e3ade7da16f) )
1827 	ROM_LOAD16_BYTE( "6.bin", 0xc0000, 0x20000, CRC(d4bf37f6) SHA1(f47e1cc9aa3b3019ee57f59715e3a611acf9fe3e) )
1828 	ROM_LOAD16_BYTE( "2.bin", 0xc0001, 0x20000, CRC(07ac8f43) SHA1(7a41b003c76adaabd3f94929cc163461b70e0ed9) )
1829 	//ROM_FILL(0x2610, 1, 7)  // temporary patch to fix transitions
1830 
1831 	ROM_REGION( 0x30000, "audiocpu", 0 ) /* Audio CPU + Sample Data */
1832 	ROM_LOAD( "1.bin", 0x00000, 0x20000, CRC(5b276c14) SHA1(73e53c077d4e3c1b919eee28b29e34176ee204f8) )
1833 	ROM_RELOAD(        0x10000, 0x20000 )
1834 
1835 	ROM_REGION( 0x200000, "gfx", 0 )
1836 	ROM_LOAD32_BYTE( "18.bin", 0x000000, 0x20000, CRC(f1eee6d9) SHA1(bee95efbff49c582cff1cc6d9bb5ef4ea5c4a074) )
1837 	ROM_LOAD32_BYTE( "20.bin", 0x000001, 0x20000, CRC(675f4537) SHA1(acc68822da3aafbb62f76cbffa5f3389fcc91447) )
1838 	ROM_LOAD32_BYTE( "22.bin", 0x000002, 0x20000, CRC(db8a32ac) SHA1(b95f73dff291acee239e22e5fd7efe15d0de23be) )
1839 	ROM_LOAD32_BYTE( "24.bin", 0x000003, 0x20000, CRC(f4113e57) SHA1(ff1f443c13494a169b9be24abc361d27a6d01c09) )
1840 	ROM_LOAD32_BYTE( "10.bin", 0x080000, 0x20000, CRC(d478853e) SHA1(91fcf8eb022ccea66d291bec84ace557181cf861) )
1841 	ROM_LOAD32_BYTE( "12.bin", 0x080001, 0x20000, CRC(25055642) SHA1(578cf6a436489cc1f2d1acdb0cba6c1cbee2e21f) )
1842 	ROM_LOAD32_BYTE( "14.bin", 0x080002, 0x20000, CRC(b77d0328) SHA1(42eb1ebfda301f2b09f3add5932e8331f4790706) )
1843 	ROM_LOAD32_BYTE( "16.bin", 0x080003, 0x20000, CRC(ea111a79) SHA1(1b86aa984d2d6c527e96b61274a82263f34d0d89) )
1844 	ROM_LOAD32_BYTE( "19.bin", 0x100000, 0x20000, CRC(b3aa1f48) SHA1(411f3855739992f5967e915f2a5255afcedeac2e) ) // only these 4 differ from ffightbla (new title logo)
1845 	ROM_LOAD32_BYTE( "21.bin", 0x100001, 0x20000, CRC(04d175c9) SHA1(33e6e3fefae4e3977c8c954fbd7feff36e92d723) ) // ^
1846 	ROM_LOAD32_BYTE( "23.bin", 0x100002, 0x20000, CRC(e592ba4f) SHA1(62559481e0da3954a90da0ab0fb51f87f1b3dd9d) ) // ^
1847 	ROM_LOAD32_BYTE( "25.bin", 0x100003, 0x20000, CRC(b89a740f) SHA1(516d73c772e0a904dfb0bd84874919d78bbbd200) ) // ^
1848 	ROM_LOAD32_BYTE( "11.bin", 0x180000, 0x20000, CRC(d4457a60) SHA1(9e956efafa81a81aca92837df03968f5670ffc15) )
1849 	ROM_LOAD32_BYTE( "13.bin", 0x180001, 0x20000, CRC(3b26a37d) SHA1(58d8d0cdef81c938fb1a5595f2d02b228865893b) )
1850 	ROM_LOAD32_BYTE( "15.bin", 0x180002, 0x20000, CRC(6d837e09) SHA1(b4a133ab96c35b689ee692bfcc04981791099b6f) )
1851 	ROM_LOAD32_BYTE( "17.bin", 0x180003, 0x20000, CRC(c59a4d6c) SHA1(59e49c7d24dd333007de4bb621050011a5392bcc) )
1852 
1853 	ROM_REGION( 0x8000, "gfx2", 0 )
1854 	ROM_COPY( "gfx", 0x000000, 0x000000, 0x8000 )   /* stars */
1855 ROM_END
1856 
1857 ROM_START( ffightbl )
1858 	ROM_REGION( 0x400000, "maincpu", 0 )      /* 68000 code */
1859 	ROM_LOAD16_BYTE( "fg-e.bin", 0x00000, 0x80000, CRC(f8ccf27e) SHA1(08ff445d946da81e7dc0cc021f686b5968fa34ab) )
1860 	ROM_LOAD16_BYTE( "fg-f.bin", 0x00001, 0x80000, CRC(d96c76b2) SHA1(3f9ca4625491cab07cf4a1bf001f1325dc3652a3) )
1861 
1862 	ROM_REGION( 0x30000, "audiocpu", 0 ) /* Audio CPU + Sample Data */
1863 	ROM_LOAD( "ff1.bin", 0x00000, 0x20000, CRC(5b276c14) SHA1(73e53c077d4e3c1b919eee28b29e34176ee204f8) )
1864 	ROM_RELOAD(          0x10000, 0x20000 )
1865 
1866 	ROM_REGION( 0x200000, "gfx", 0 )
1867 	ROM_LOAD32_BYTE( "fg-d.bin", 0x000000, 0x80000, CRC(4303f863) SHA1(72a3246e14f9c4d1fb4712bd67d087db42d722d9) )
1868 	ROM_LOAD32_BYTE( "fg-c.bin", 0x000001, 0x80000, CRC(d1dfcd2d) SHA1(8796db70459e1e6232a75f5c3f4bf8b227b16f46) )
1869 	ROM_LOAD32_BYTE( "fg-b.bin", 0x000002, 0x80000, CRC(22f2c097) SHA1(bbf2d30d31c5a7802b7f7f164dd51a4584511936) )
1870 	ROM_LOAD32_BYTE( "fg-a.bin", 0x000003, 0x80000, CRC(16a89b2c) SHA1(4d0e1ec6ae9a2bd31fa77140532bbce64d3874e9) )
1871 
1872 	ROM_REGION( 0x8000, "gfx2", 0 )
1873 	ROM_COPY( "gfx", 0x000000, 0x000000, 0x8000 )   /* stars */
1874 ROM_END
1875 
1876 /*
1877     this is identical to the Final Crash bootleg but without the modified gfx.
1878     it's less common than Final Crash, but is either the original bootleg, or the bootleggers wanted to restore the
1879     original title.
1880 */
1881 ROM_START( ffightbla )
1882 	ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
1883 	ROM_LOAD16_BYTE( "9.bin", 0x00000, 0x20000, CRC(c6854c91) SHA1(29f01cc65be5eaa3f86e99eebdd284104623abb0) )
1884 	ROM_LOAD16_BYTE( "5.bin", 0x00001, 0x20000, CRC(77f7c2b3) SHA1(feea48d9555824a2e5bf5e99ce159edc015f0792) )
1885 	ROM_LOAD16_BYTE( "8.bin", 0x40000, 0x20000, CRC(1895b3df) SHA1(415a26050c50ed79a7ee5ddd1b8d61593b1ce876) )
1886 	ROM_LOAD16_BYTE( "4.bin", 0x40001, 0x20000, CRC(bbd411ee) SHA1(85d50ca72ec46d627f9c88ff0809aa30e164821a) )
1887 	ROM_LOAD16_BYTE( "7.bin", 0x80000, 0x20000, CRC(5b23ebf2) SHA1(8c28c21a72a28ad249170026891c6bb865943f84) )
1888 	ROM_LOAD16_BYTE( "3.bin", 0x80001, 0x20000, CRC(aba2aebe) SHA1(294109b5929ed63859a55bef16643e3ade7da16f) )
1889 	ROM_LOAD16_BYTE( "6.bin", 0xc0000, 0x20000, CRC(d4bf37f6) SHA1(f47e1cc9aa3b3019ee57f59715e3a611acf9fe3e) )
1890 	ROM_LOAD16_BYTE( "2.bin", 0xc0001, 0x20000, CRC(07ac8f43) SHA1(7a41b003c76adaabd3f94929cc163461b70e0ed9) )
1891 	//ROM_FILL(0x2610, 1, 7)  // temporary patch to fix transitions
1892 
1893 	ROM_REGION( 0x30000, "audiocpu", 0 ) /* Audio CPU + Sample Data */
1894 	ROM_LOAD( "1.bin", 0x00000, 0x20000, CRC(5b276c14) SHA1(73e53c077d4e3c1b919eee28b29e34176ee204f8) )
1895 	ROM_RELOAD(        0x10000, 0x20000 )
1896 
1897 	ROM_REGION( 0x200000, "gfx", 0 )
1898 	ROM_LOAD32_BYTE( "18.bin",    0x000000, 0x20000, CRC(f1eee6d9) SHA1(bee95efbff49c582cff1cc6d9bb5ef4ea5c4a074) )
1899 	ROM_LOAD32_BYTE( "20.bin",    0x000001, 0x20000, CRC(675f4537) SHA1(acc68822da3aafbb62f76cbffa5f3389fcc91447) )
1900 	ROM_LOAD32_BYTE( "22.bin",    0x000002, 0x20000, CRC(db8a32ac) SHA1(b95f73dff291acee239e22e5fd7efe15d0de23be) )
1901 	ROM_LOAD32_BYTE( "24.bin",    0x000003, 0x20000, CRC(f4113e57) SHA1(ff1f443c13494a169b9be24abc361d27a6d01c09) )
1902 	ROM_LOAD32_BYTE( "10.bin",    0x080000, 0x20000, CRC(d478853e) SHA1(91fcf8eb022ccea66d291bec84ace557181cf861) )
1903 	ROM_LOAD32_BYTE( "12.bin",    0x080001, 0x20000, CRC(25055642) SHA1(578cf6a436489cc1f2d1acdb0cba6c1cbee2e21f) )
1904 	ROM_LOAD32_BYTE( "14.bin",    0x080002, 0x20000, CRC(b77d0328) SHA1(42eb1ebfda301f2b09f3add5932e8331f4790706) )
1905 	ROM_LOAD32_BYTE( "16.bin",    0x080003, 0x20000, CRC(ea111a79) SHA1(1b86aa984d2d6c527e96b61274a82263f34d0d89) )
1906 	ROM_LOAD32_BYTE( "ff-19.bin", 0x100000, 0x20000, CRC(7bc03747) SHA1(6964e5c562d6af5b4327ff828f3d0522c34911bc) ) // only these 4 differ from fcrash
1907 	ROM_LOAD32_BYTE( "ff-21.bin", 0x100001, 0x20000, CRC(0c248e2b) SHA1(28731fe25a8eb39c1e0822cf9074a7a32c6b2978) ) // ^
1908 	ROM_LOAD32_BYTE( "ff-23.bin", 0x100002, 0x20000, CRC(53949d0e) SHA1(1b11134005a47c323917b9892fe44819c36c6ee2) ) // ^
1909 	ROM_LOAD32_BYTE( "ff-25.bin", 0x100003, 0x20000, CRC(8d34a67d) SHA1(69e9f52efb73952313848a6d54dbdc17a2275c59) ) // ^
1910 	ROM_LOAD32_BYTE( "11.bin",    0x180000, 0x20000, CRC(d4457a60) SHA1(9e956efafa81a81aca92837df03968f5670ffc15) )
1911 	ROM_LOAD32_BYTE( "13.bin",    0x180001, 0x20000, CRC(3b26a37d) SHA1(58d8d0cdef81c938fb1a5595f2d02b228865893b) )
1912 	ROM_LOAD32_BYTE( "15.bin",    0x180002, 0x20000, CRC(6d837e09) SHA1(b4a133ab96c35b689ee692bfcc04981791099b6f) )
1913 	ROM_LOAD32_BYTE( "17.bin",    0x180003, 0x20000, CRC(c59a4d6c) SHA1(59e49c7d24dd333007de4bb621050011a5392bcc) )
1914 
1915 	ROM_REGION( 0x8000, "gfx2", 0 )
1916 	ROM_COPY( "gfx", 0x000000, 0x000000, 0x8000 )   /* stars */
1917 ROM_END
1918 
1919 // the following bootleg is very peculiar: the program ROMs are identical to those of ffightbl but is uses smaller ROMs for patching
1920 // there is a full set of GFX ROMs matching ffightbl, additional ROMs matching 0x100000-0x1fffff of ffightbla and some smaller ROMs for overlaying
1921 // for now the loading is the full set, overlayed by the 0x100000-0x1fffff, overlayed by the smaller ROMs. Should be checked though
1922 // the sound system comprises a Z80 with bare bones sound code and a single OKI-M6295
1923 ROM_START( ffightblb )
1924 	ROM_REGION( 0x10000, "patch", 0 )
1925 	ROM_LOAD16_BYTE( "pgm0h.4", 0x00000, 0x08000, CRC(b800c1be) SHA1(dc5c748e49c751c155d970d8a7e6c0fb20767d04) ) // these seem to patch some addresses (see below)
1926 	ROM_LOAD16_BYTE( "pgm0l.3", 0x00001, 0x08000, CRC(a39f50d2) SHA1(a7b822f92a8eb412855bfb87a3083aa9082542ae) ) // they are empty after 0x5000 (interleaved)
1927 
1928 	ROM_REGION( 0x400000, "maincpu", 0 )
1929 	ROM_LOAD16_BYTE( "soonhwa_f-fightpgm.8h", 0x00000, 0x80000, CRC(f8ccf27e) SHA1(08ff445d946da81e7dc0cc021f686b5968fa34ab) )
1930 	ROM_LOAD16_BYTE( "soonhwa_f-fightpgm.8l", 0x00001, 0x80000, CRC(d96c76b2) SHA1(3f9ca4625491cab07cf4a1bf001f1325dc3652a3) )
1931 	ROM_COPY( "patch", 0x00000, 0x002000, 0x1000 )
1932 	ROM_COPY( "patch", 0x01000, 0x016000, 0x1000 )
1933 	ROM_COPY( "patch", 0x02000, 0x01f000, 0x1000 )
1934 	ROM_COPY( "patch", 0x03000, 0x05e000, 0x1000 )
1935 	ROM_COPY( "patch", 0x04000, 0x078000, 0x1000 )
1936 
1937 	ROM_REGION( 0x8000, "audiocpu", 0 )
1938 	ROM_LOAD( "sro.1", 0x00000, 0x8000, CRC(2b1c4c16) SHA1(8da39809df20a3fe4371573596285ea3297996e3) )
1939 
1940 	ROM_REGION( 0x200000, "gfx", 0 )
1941 	ROM_LOAD32_BYTE( "soonhwa_f-fight03.0r03",  0x000000, 0x80000, CRC(2126bec0) SHA1(c523e7e52c18177e2e967091a6acb231d52a3525) )
1942 	ROM_IGNORE(0x80000) // 1ST AND 2ND HALF IDENTICAL
1943 	ROM_LOAD32_BYTE( "soonhwa_f-fight02.0r02",  0x000001, 0x80000, CRC(fe326d39) SHA1(10e1e9b26a3ed2277f2016d040ce5b205a62096d) )
1944 	ROM_IGNORE(0x80000) // 1ST AND 2ND HALF IDENTICAL
1945 	ROM_LOAD32_BYTE( "soonhwa_f-fight01.0r01",  0x000002, 0x80000, CRC(09c47cae) SHA1(995546a72667fa25d7b3fd29643217acb6ff4fd5) )
1946 	ROM_IGNORE(0x80000) // 1ST AND 2ND HALF IDENTICAL
1947 	ROM_LOAD32_BYTE( "soonhwa_f-fight00.0r00",  0x000003, 0x80000, CRC(4b4390de) SHA1(30b38842116fc45c0d284f3b72c67fef33215ad7) )
1948 	ROM_IGNORE(0x80000) // 1ST AND 2ND HALF IDENTICAL
1949 	ROM_LOAD32_WORD_SWAP( "soonhwa_f-fight.9",  0x100000, 0x40000, CRC(11a7c515) SHA1(b4f32e1627fb2af15ec6a3d7cfd88ea6fa9ad15a) ) // here starts the first overlay of GFX ROMs
1950 	ROM_IGNORE(0x40000) // 1ST AND 2ND HALF IDENTICAL
1951 	ROM_LOAD32_WORD_SWAP( "soonhwa_f-fight.8",  0x100002, 0x40000, CRC(f1e18158) SHA1(2a4195002be4bcb1eda84fd876666f58c837e58e) )
1952 	ROM_IGNORE(0x40000) // 1ST AND 2ND HALF IDENTICAL
1953 	ROM_LOAD32_WORD_SWAP( "soonhwa_f-fight.11", 0x180000, 0x40000, CRC(52879243) SHA1(97fb84376334abb0cb0590e7b4d49adeeb17373d) )
1954 	ROM_IGNORE(0x40000) // 1ST AND 2ND HALF IDENTICAL
1955 	ROM_LOAD32_WORD_SWAP( "soonhwa_f-fight.10", 0x180002, 0x40000, CRC(7cce0ff5) SHA1(0048ddf8ac26b0cbd4b017634d308f0d6b631abc) )
1956 	ROM_IGNORE(0x40000) // 1ST AND 2ND HALF IDENTICAL
1957 	ROM_LOAD32_BYTE( "cr.00", 0x100000, 0x10000, CRC(e6bbd39b) SHA1(7c7c9fad7608f231172f011dd930399e6b72e57a) ) // here starts the second overlay of GFX ROMs
1958 	ROM_LOAD32_BYTE( "cr.01", 0x100001, 0x10000, CRC(6c794ef4) SHA1(e7835ac5c52153ca333be154cd16f2162e936364) )
1959 	ROM_LOAD32_BYTE( "cr.02", 0x100002, 0x10000, CRC(4d1d389d) SHA1(12c65c2f8027d4944f25d89d98a440be5422cb98) )
1960 	ROM_LOAD32_BYTE( "cr.03", 0x100003, 0x10000, CRC(5282be3c) SHA1(ff32a501ee2d3f7476ff814aea302b1d780c35b7) )
1961 
1962 	ROM_REGION( 0x8000, "gfx2", 0 )
1963 	ROM_COPY( "gfx", 0x000000, 0x000000, 0x8000 )   /* stars */
1964 
1965 	ROM_REGION( 0xa0000, "oki", ROMREGION_ERASE00 )
1966 	ROM_LOAD( "vco.2",              0x00000, 0x20000, CRC(de0f0ef5) SHA1(18cb33f7990d7715d11d61e6db446ce935e799eb) )
1967 	ROM_LOAD( "soonhwa_f-fight.14", 0x20000, 0x80000, CRC(319fbc2f) SHA1(263fc6b59cef6d110da35b36dde250a2e326dcbe) )
1968 ROM_END
1969 
1970 // ************************************************************************* KODB
1971 
1972 /*
1973     CPU
1974     1x TS68000CP12 (main)
1975     1x TPC1020AFN-084C
1976     1x Z8400BB1-Z80CPU (sound)
1977     1x YM2151 (sound)
1978     1x YM3012A (sound)
1979     1x OKI-M6295 (sound)
1980     2x LM324N (sound)
1981     1x TDA2003 (sound)
1982     1x oscillator 10.0 MHz
1983     1x oscillator 22.1184 MHz
1984 
1985     ROMs
1986     1x AM27C512 (1)(sound)
1987     1x AM27C020 (2)(sound)
1988     2x AM27C040 (3,4)(main)
1989     1x Am27C040 (bp)(gfx)
1990     7x mask ROM (ai,bi,ci,di,ap,cp,dp)(gfx)
1991     1x GAL20V8A (not dumped)
1992     3x GAL16V8A (not dumped)
1993     1x PALCE20V8H (not dumped)
1994     1x GAL20V8S (not dumped)
1995 
1996     Note
1997     1x JAMMA edge connector
1998     1x trimmer (volume)
1999     3x 8 switches dip
2000 */
2001 ROM_START( kodb )
2002 	ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
2003 	ROM_LOAD16_BYTE( "3.ic172", 0x00000, 0x080000, CRC(036dd74c) SHA1(489344e56863429e86b4c362b82d89819c1d6afb) )
2004 	ROM_LOAD16_BYTE( "4.ic171", 0x00001, 0x080000, CRC(3e4b7295) SHA1(3245640bae7d141238051dfe5c7683d05c6d3848) )
2005 	//ROM_FILL( 0x952, 1, 7)  // temporary patch to fix transitions
2006 
2007 	ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
2008 	ROM_LOAD( "1.ic28", 0x00000, 0x08000, CRC(01cae60c) SHA1(b2cdd883fd859f0b701230831aca1f1a74ad6087) )
2009 	ROM_CONTINUE(       0x10000, 0x08000 )
2010 
2011 	ROM_REGION( 0x400000, "gfx", 0 )
2012 	ROM_LOAD64_BYTE( "cp.ic90", 0x000000, 0x80000, CRC(e3b8589e) SHA1(775f97e43cb995b93da40063a1f1e4d73b34437c) )
2013 	ROM_LOAD64_BYTE( "dp.ic89", 0x000001, 0x80000, CRC(3eec9580) SHA1(3d8d0cfbeae077544e514a5eb96cc83f716e494f) )
2014 	ROM_LOAD64_BYTE( "ap.ic88", 0x000002, 0x80000, CRC(fdf5f163) SHA1(271ee96886c958accaca9a82484ab80fe32bd38e) )
2015 	ROM_LOAD64_BYTE( "bp.ic87", 0x000003, 0x80000, CRC(4e1c52b7) SHA1(74570e7d577c999c62203c97b3d449e3b61a678a) )
2016 	ROM_LOAD64_BYTE( "ci.ic91", 0x000004, 0x80000, CRC(22228bc5) SHA1(d48a09ee284d9e4b986f5c3c1c865930f76986e2) )
2017 	ROM_LOAD64_BYTE( "di.ic92", 0x000005, 0x80000, CRC(ab031763) SHA1(5bcd89b1debf029b779aa1bb73b3a572d27154ec) )
2018 	ROM_LOAD64_BYTE( "ai.ic93", 0x000006, 0x80000, CRC(cffbf4be) SHA1(f805bafc855d4a656c055a76eaeb26e36835541e) )
2019 	ROM_LOAD64_BYTE( "bi.ic94", 0x000007, 0x80000, CRC(4a1b43fe) SHA1(7957f45b2862825c9509043c63c7da7108bd251b) )
2020 
2021 	ROM_REGION( 0x8000, "gfx2", 0 )
2022 	ROM_COPY( "gfx", 0x000000, 0x000000, 0x8000 )   /* stars */
2023 
2024 	ROM_REGION( 0x40000, "oki", 0 ) /* Samples */
2025 	ROM_LOAD( "2.ic19", 0x00000, 0x40000, CRC(a2db1575) SHA1(1a4a29e4b045af50700adf1665697feab12cc234) )
2026 ROM_END
2027 
2028 
2029 // ************************************************************************* CAWINGBL, CAWINGB2
2030 
2031 ROM_START( cawingbl )
2032 	ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
2033 	ROM_LOAD16_BYTE( "caw2.bin", 0x00000, 0x80000, CRC(8125d3f0) SHA1(a0e48c326c6164ca189c9372f5c38a7c103772c1) )
2034 	ROM_LOAD16_BYTE( "caw1.bin", 0x00001, 0x80000, CRC(b19b10ce) SHA1(3c71f1dc830d1e8b8ba26d8a71e12f477659480c) )
2035 
2036 	ROM_REGION( 0x200000, "gfx", 0 )
2037 	ROM_LOAD32_BYTE( "caw7.bin", 0x000000, 0x80000, CRC(a045c689) SHA1(8946c55635121282ea03586a278e50de20d92633) )
2038 	ROM_LOAD32_BYTE( "caw6.bin", 0x000001, 0x80000, CRC(61192f7c) SHA1(86643c62653a62a5c7541d50cfdecae9b607440d) )
2039 	ROM_LOAD32_BYTE( "caw5.bin", 0x000002, 0x80000, CRC(30dd78db) SHA1(e0295001d6f5fb4a9276c432f971e88f73c5e39a) )
2040 	ROM_LOAD32_BYTE( "caw4.bin", 0x000003, 0x80000, CRC(4937fc41) SHA1(dac179715be483a521df8e515afc1fb7a2cd8f13) )
2041 
2042 	ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
2043 	ROM_LOAD( "caw3.bin", 0x00000, 0x20000, CRC(ffe16cdc) SHA1(8069ea69f0b89d61c35995c8040a4989d7be9c1f) )
2044 	ROM_RELOAD(           0x10000, 0x20000 )
2045 ROM_END
2046 
2047 ROM_START( cawingb2 )
2048 	ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
2049 	ROM_LOAD16_BYTE( "8.8", 0x00000, 0x20000, CRC(f655708c) SHA1(9962a1c96ea08bc71b25d4f58e5d1fb1beebf0dc) )
2050 	ROM_LOAD16_BYTE( "4.4", 0x00001, 0x20000, CRC(a02fb5aa) SHA1(c9c064a83899c48f681ac803cfc5886503b9d992) )
2051 	ROM_LOAD16_BYTE( "7.7", 0x40000, 0x20000, CRC(8c6c7430) SHA1(3ed5713caf774b050b41a6adea026e1307b570df) )
2052 	ROM_LOAD16_BYTE( "3.3", 0x40001, 0x20000, CRC(f585bf2c) SHA1(3a3169791f8deace8d9bee1adb08f19fbcd309c6) )
2053 	ROM_LOAD16_BYTE( "6.6", 0x80000, 0x20000, CRC(5fda906e) SHA1(7b3ef17d494a2f92e58ab7e34a3beaad8c149fca) )
2054 	ROM_LOAD16_BYTE( "2.2", 0x80001, 0x20000, CRC(736c1835) SHA1(a91f479fab30603a111304adc0478d430faa80fc) )
2055 	ROM_LOAD16_BYTE( "5.5", 0xc0000, 0x20000, CRC(76458083) SHA1(cbb4ef5f7615c834b2ee1ad3c86e7262f2f62c01) )
2056 	ROM_LOAD16_BYTE( "1.1", 0xc0001, 0x20000, CRC(d3523f34) SHA1(005ea378c2b78782f85ecc591946c027ca2ca023) )
2057 
2058 	ROM_REGION( 0x200000, "gfx", 0 )
2059 	ROM_LOAD32_BYTE( "17.17", 0x000000, 0x20000, CRC(0b538062) SHA1(ac6e5dc82efdca311adfe6e6cdda160ad4a0d04d) )
2060 	ROM_LOAD32_BYTE( "19.19", 0x000001, 0x20000, CRC(3ad62311) SHA1(1c132696b55191d16af30ebd36d2320d979eab36) )
2061 	ROM_LOAD32_BYTE( "21.21", 0x000002, 0x20000, CRC(1b872a98) SHA1(7a3f72c6d384dfa8e224f93604997a7b6e5c8926) )
2062 	ROM_LOAD32_BYTE( "23.23", 0x000003, 0x20000, CRC(ad49eecd) SHA1(39909996765391ed734a02c74f683e1bd9ce1561) )
2063 	ROM_LOAD32_BYTE( "9.9",   0x080000, 0x20000, CRC(8cd4df5b) SHA1(771b6d6a6baa95a669335fe64e2219fe7226e140) )
2064 	ROM_LOAD32_BYTE( "11.11", 0x080001, 0x20000, CRC(bf14418a) SHA1(7a0e1c65b8825a252338d6c1db59a88966ec6cfb) )
2065 	ROM_LOAD32_BYTE( "13.13", 0x080002, 0x20000, CRC(cef1aab8) SHA1(677a889b939ff00e95737a4a53053744bb6744c0) )
2066 	ROM_LOAD32_BYTE( "15.15", 0x080003, 0x20000, CRC(397725dc) SHA1(9450362bbf2f91b4225a088d6e283d7b16407b74) )
2067 	ROM_LOAD32_BYTE( "18.18", 0x100000, 0x20000, CRC(9b14f7ed) SHA1(72b6e1174d4faab487261aa6739de842d2423e1a) )
2068 	ROM_LOAD32_BYTE( "20.20", 0x100001, 0x20000, CRC(59bcc1bb) SHA1(c725060e068294dea1d962c54a9018050fa70297) )
2069 	ROM_LOAD32_BYTE( "22.22", 0x100002, 0x20000, CRC(23dc647a) SHA1(2d8d4c4c7b2d0616430360d1639b07216dd731d6) )
2070 	ROM_LOAD32_BYTE( "24.24", 0x100003, 0x20000, CRC(eda9fa6b) SHA1(4a3510ce71b015a1ea568fd0bbe61c5c093a2fbf) )
2071 	ROM_LOAD32_BYTE( "10.10", 0x180000, 0x20000, CRC(17174249) SHA1(71c6424ab4629065dd6af8bb47b18f5b5d0fbe49) )
2072 	ROM_LOAD32_BYTE( "12.12", 0x180001, 0x20000, CRC(490440b2) SHA1(2597bf16340308f84b32cfa048c426db571b4a35) )
2073 	ROM_LOAD32_BYTE( "14.14", 0x180002, 0x20000, CRC(344a8270) SHA1(fdb588a7ba60783225e3b5c72446f79625de4f9c) )
2074 	ROM_LOAD32_BYTE( "16.16", 0x180003, 0x20000, CRC(b991ad91) SHA1(5c59131ddf068cb54d23f8836293360fbc967d58) )
2075 
2076 	ROM_REGION( 0x30000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
2077 	ROM_LOAD( "5.a", 0x00000, 0x20000, CRC(ffe16cdc) SHA1(8069ea69f0b89d61c35995c8040a4989d7be9c1f) )
2078 	ROM_RELOAD(      0x10000, 0x20000 )
2079 ROM_END
2080 
2081 
2082 // ************************************************************************* MTWINSB
2083 
2084 /* board marked MGT-026 */
2085 ROM_START( mtwinsb )
2086 	ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
2087 	ROM_LOAD16_BYTE( "1-prg-27c4001.bin", 0x00001, 0x80000, CRC(8938a029) SHA1(50104d2afaec8d69d317780c071a4f2248e23e62) )
2088 	ROM_LOAD16_BYTE( "2-prg-27c4001.bin", 0x00000, 0x80000, CRC(7d5b8a97) SHA1(d3e456061a569765d400fc7c9b43e4fdacf17951) )
2089 
2090 	ROM_REGION( 0x200000, "gfx", 0 ) // identical to the original, but differently arranged
2091 	ROM_LOAD64_BYTE( "g4.bin",  0x000004, 0x40000, CRC(11493e55) SHA1(0e45f53b034d66ce8d029346d4d88e46021df1a7) )
2092 	ROM_CONTINUE(               0x000000, 0x40000)
2093 	ROM_LOAD64_BYTE( "g3.bin",  0x000005, 0x40000, CRC(feda0f8b) SHA1(59c740478791ce95bf06feeda5173cc283a1eaea) )
2094 	ROM_CONTINUE(               0x000001, 0x40000)
2095 	ROM_LOAD64_BYTE( "g2.bin",  0x000006, 0x40000, CRC(745f0eba) SHA1(1cb07be5df7cc43b5aa236f114d303bf92436c74) )
2096 	ROM_CONTINUE(               0x000002, 0x40000)
2097 	ROM_LOAD64_BYTE( "g1.bin",  0x000007, 0x40000, CRC(8069026f) SHA1(3d5e9b36a349328bcd93d83d8d2fe3cd40e68a3b) )
2098 	ROM_CONTINUE(               0x000003, 0x40000)
2099 
2100 	ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
2101 	ROM_LOAD( "4-snd-z80-27c512.bin", 0x00000, 0x08000, CRC(4d4255b7) SHA1(81a76b58043af7252a854b7efc4109957ef0e679) ) // identical to the original
2102 	ROM_CONTINUE(                     0x10000, 0x08000 )
2103 
2104 	ROM_REGION( 0x40000, "oki", 0 ) /* Samples */
2105 	ROM_LOAD( "3-snd-27c208.bin", 0x00000, 0x40000, CRC(a0c3de92) SHA1(5135cd982564f898f799ff1bc2bb2a75154be0cd) ) // identical to the original, but one single bigger ROM
2106 ROM_END
2107 
2108 
2109 // ************************************************************************* SGYXZ
2110 
2111 /*
2112     24mhz crystal (maincpu), 28.322 crystal (video), 3.579545 crystal (sound)
2113     sound cpu is (239 V 249521 VC5006 KABUKI DL-030P-110V) - recycled Kabuki Z80 from genuine Capcom HW?
2114     3x8 dsws
2115 
2116     bootlegger hacks:
2117     2 extra playable characters (7 total)
2118     can swap character during gameplay (press start to cycle)
2119     new special move (button 3)
2120     level order is changed
2121     attract sequence shortened
2122 */
2123 ROM_START( sgyxz )
2124 	ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 Code */
2125 	ROM_LOAD16_BYTE( "sgyxz_prg1.bin", 0x000001, 0x20000, CRC(d8511929) SHA1(4de9263778f327693f4d1e21b48e43806f673487) )
2126 	ROM_CONTINUE( 0x80001, 0x20000 )
2127 	ROM_CONTINUE( 0x40001, 0x20000 )
2128 	ROM_CONTINUE( 0xc0001, 0x20000 )
2129 	ROM_LOAD16_BYTE( "sgyxz_prg2.bin", 0x000000, 0x20000, CRC(95429c83) SHA1(e981624d018132e5625a66113b6ac4fc44e55cf7) )
2130 	ROM_CONTINUE( 0x80000, 0x20000 )
2131 	ROM_CONTINUE( 0x40000, 0x20000 )
2132 	ROM_CONTINUE( 0xc0000, 0x20000 )
2133 	ROM_FILL(0x708da, 4, 0xff) // patch out protections
2134 	ROM_FILL(0xf11ea, 1, 0x60)
2135 	ROM_FILL(0x00007, 1, 0xa2) // start address
2136 	ROM_FILL(0x02448, 1, 0x07) // transitions
2137 
2138 	ROM_REGION( 0x400000, "gfx", 0 )
2139 	ROM_LOAD64_WORD("sgyxz_gfx1.bin", 0x000000, 0x80000, CRC(a60be9f6) SHA1(2298a4b6a2c83b76dc106a1efa19606b298d378a) ) // 'picture 1'
2140 	ROM_CONTINUE(                     0x000004, 0x80000 )
2141 	ROM_CONTINUE(                     0x200000, 0x80000 )
2142 	ROM_CONTINUE(                     0x200004, 0x80000 )
2143 	ROM_LOAD64_WORD("sgyxz_gfx2.bin", 0x000002, 0x80000, CRC(6ad9d048) SHA1(d47212d28d0a1ce349e4c59e5d0d99c541b3458e) ) // 'picture 2'
2144 	ROM_CONTINUE(                     0x000006, 0x80000 )
2145 	ROM_CONTINUE(                     0x200002, 0x80000 )
2146 	ROM_CONTINUE(                     0x200006, 0x80000 )
2147 
2148 	ROM_REGION( 0x20000, "audiocpu", 0 ) /* Z80 code */
2149 	ROM_LOAD( "sgyxz_snd2.bin", 0x00000, 0x10000, CRC(210c376f) SHA1(0d937c86078d0a106f5636b7daf5fc0266c2c2ec) )
2150 	ROM_RELOAD(                 0x08000, 0x10000 )
2151 
2152 	ROM_REGION( 0x040000, "oki", 0 ) /* Samples */
2153 	ROM_LOAD( "sgyxz_snd1.bin", 0x00000, 0x40000, CRC(c15ac0f2) SHA1(8d9e5519d9820e4ac4f70555088c80e64d052c9d) )
2154 ROM_END
2155 
2156 
2157 // ************************************************************************* WOFABL, WOFR1BL
2158 
2159 ROM_START( wofabl )
2160 	ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 Code */
2161 	ROM_LOAD16_BYTE( "5.prg.040", 0x000000, 0x80000, CRC(4d9d2327) SHA1(b8029b117083a1c31546455fa53d9ee83a4ff7ad) )
2162 	ROM_LOAD16_BYTE( "3.prg.040", 0x000001, 0x80000, CRC(ef25fe49) SHA1(d45d3c94cb57187b2f6ac248e9c3c9989be38f99) )
2163 	ROM_LOAD16_BYTE( "6.prg.010", 0x100000, 0x20000, CRC(93eeb161) SHA1(0b8efb7ace59791ffb8a3f7826f0ea74620d7a0f) ) // x111111xxxxxxxxxx = 0xFF
2164 	ROM_LOAD16_BYTE( "4.prg.010", 0x100001, 0x20000, CRC(a0751944) SHA1(84f092992f0f94acffbbb43168fbcee2c45da789) ) // x111111xxxxxxxxxx = 0xFF
2165 
2166 	ROM_REGION( 0x400000, "gfx", 0 )
2167 	ROM_LOAD32_BYTE( "gfx13.040", 0x000000, 0x80000, CRC(8e8db215) SHA1(cc85e576bf09c3edab9afc1b5fa0a152f4140c06) )
2168 	ROM_LOAD32_BYTE( "gfx14.040", 0x000001, 0x80000, CRC(f34a7f9d) SHA1(6d67623c93147a779f07ef103188f3e2cb6d6d6e) )
2169 	ROM_LOAD32_BYTE( "gfx15.040", 0x000002, 0x80000, CRC(a5e4f449) SHA1(9956f82818ccc685367b5fe5e4bc8b59b65c31c1) )
2170 	ROM_LOAD32_BYTE( "gfx16.040", 0x000003, 0x80000, CRC(49a3dfc7) SHA1(c14ea91745fd72be936b6db9981d12d958326757) )
2171 	ROM_LOAD32_BYTE( "gfx9.040",  0x200000, 0x80000, CRC(f8f33a0e) SHA1(33f172b79499d4a76b53c070c0007bd1604a71bd) )
2172 	ROM_LOAD32_BYTE( "gfx10.040", 0x200001, 0x80000, CRC(6a060c6c) SHA1(49e4da9373272e5889caa79a86c39ee34087c480) )
2173 	ROM_LOAD32_BYTE( "gfx11.040", 0x200002, 0x80000, CRC(13324965) SHA1(979754ebd15a2989f92b5b7fc5bae99eb83c3593) )
2174 	ROM_LOAD32_BYTE( "gfx12.040", 0x200003, 0x80000, CRC(c29f7b70) SHA1(95d22dcd9e2a48ddea7573d0be75225e0aae798f) )
2175 
2176 	ROM_REGION( 0x20000, "audiocpu", 0 ) /* Z80 code */
2177 	ROM_LOAD( "sound.512", 0x00000, 0x10000,  CRC(210c376f) SHA1(0d937c86078d0a106f5636b7daf5fc0266c2c2ec) ) // identical to sgyxz
2178 	ROM_RELOAD(            0x08000, 0x10000 )
2179 
2180 	ROM_REGION( 0x040000, "oki", 0 ) /* Samples */
2181 	ROM_LOAD( "sound.020", 0x00000, 0x40000,  CRC(672dcb46) SHA1(e76c1ce81689a55b573fb6e5c9a860cb756cd876) ) // almost identical to sgyxz
2182 ROM_END
2183 
2184 // very similar to wofpic but has the proper z80/ym/oki sound h/w instead of pic.
2185 ROM_START( wofr1bl )
2186 	ROM_REGION( CODE_SIZE, "maincpu", 0 ) /* 68000 Code */
2187 	ROM_LOAD16_BYTE( "3-f2ab.040", 0x000000, 0x80000, CRC(61fd0a01) SHA1(a7b5bdddd7b31645e33314c1d3649e1506cecfea) )  // == wofpic
2188 	ROM_LOAD16_BYTE( "1-9207.040", 0x000001, 0x80000, CRC(7f59e24c) SHA1(34c294328d00c65086622bd15e17210f07f37237) )  // != wofpic, 1 byte diff 4ea57
2189 	ROM_LOAD16_BYTE( "4-d4d2.010", 0x100000, 0x20000, CRC(fe5eee87) SHA1(be1230f64c1e59ae3ff3e58593070613966ac79d) )  // == wofpic
2190 	ROM_LOAD16_BYTE( "2-6c41.010", 0x100001, 0x20000, CRC(739379be) SHA1(897f61527213902fda04bc28339f1f4278bf5ae9) )  // == wofpic
2191 
2192 	ROM_REGION( 0x400000, "gfx", 0 )
2193 	ROM_LOAD64_BYTE( "5-caf3.040",  0x000000, 0x40000, CRC(c8dcaa95) SHA1(bcaeaefd40ffa1b32e80457cffcc1ceab461af1d) )
2194 	ROM_CONTINUE(                   0x000004, 0x40000)
2195 	ROM_LOAD64_BYTE( "6-034f.040",  0x000001, 0x40000, CRC(1ab0000c) SHA1(0d0004cc1725c38d140ecb8dc9666361b2d3e607) )
2196 	ROM_CONTINUE(                   0x000005, 0x40000)
2197 	ROM_LOAD64_BYTE( "7-b0fa.040",  0x000002, 0x40000, CRC(8425ff6b) SHA1(9a051089c2a492b8c63484582f95c578704b6820) )
2198 	ROM_CONTINUE(                   0x000006, 0x40000)
2199 	ROM_LOAD64_BYTE( "8-a6b7.040",  0x000003, 0x40000, CRC(24ce197b) SHA1(0ccdbd6f6a30e6d1479f8702c3e8561b16303550) )
2200 	ROM_CONTINUE(                   0x000007, 0x40000)
2201 	ROM_LOAD64_BYTE( "9-8a2c.040",  0x200000, 0x40000, CRC(9d20ef9b) SHA1(cbf3cb6bd7a73312e5061082554f2e17aae08621) )
2202 	ROM_CONTINUE(                   0x200004, 0x40000)
2203 	ROM_LOAD64_BYTE( "10-7d24.040", 0x200001, 0x40000, CRC(90c93dd2) SHA1(d3d2b0bcbcbb21a41f986eb752ab114697eb9402) )
2204 	ROM_CONTINUE(                   0x200005, 0x40000)
2205 	ROM_LOAD64_BYTE( "11-4171.040", 0x200002, 0x40000, CRC(219fd7e2) SHA1(af765eb7b275ed541c08e243b22b5c9f54c1a8ec) )
2206 	ROM_CONTINUE(                   0x200006, 0x40000)
2207 	ROM_LOAD64_BYTE( "12-f56b.040", 0x200003, 0x40000, CRC(efc17c9a) SHA1(26429a9039bb249e17945508c16645c82f7f412a) )
2208 	ROM_CONTINUE(                   0x200007, 0x40000)
2209 
2210 	ROM_REGION( 0x20000, "audiocpu", 0 ) /* Z80 code */
2211 	ROM_LOAD( "3js_09.rom", 0x00000, 0x10000, CRC(21ce044c) SHA1(425fd8d33d54f35ef90d68a7530db7a0eafb600d) )
2212 	ROM_RELOAD(             0x08000, 0x10000 )
2213 
2214 	ROM_REGION( 0x40000, "oki", 0 ) /* Samples */
2215 	ROM_LOAD( "3js_18.rom", 0x00000, 0x20000, CRC(ac6e307d) SHA1(b490ce625bb7ce0904b0fd121fbfbd5252790f7a) )
2216 	ROM_LOAD( "3js_19.rom", 0x20000, 0x20000, CRC(068741db) SHA1(ab48aff639a7ac218b7d5304145e10e92d61fd9f) )
2217 ROM_END
2218 
2219 
2220 // ************************************************************************* SF2M1, SF2M9
2221 
2222 ROM_START( sf2m1 )
2223 	ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
2224 	ROM_LOAD16_BYTE( "222e",             0x000000, 0x80000, CRC(1e20d0a3) SHA1(5e05b52fd938aff5190bca7e178705d7236aef66) )
2225 	ROM_LOAD16_BYTE( "196e",             0x000001, 0x80000, CRC(88cc38a3) SHA1(6049962f943bd37748a9531cc3254e8b59326eac) )
2226 	ROM_LOAD16_WORD_SWAP( "s92_21a.bin", 0x100000, 0x80000, CRC(925a7877) SHA1(1960dca35f0ca6f2b399a9fccfbc0132ac6425d1) )
2227 
2228 	ROM_REGION( 0x600000, "gfx", 0 )
2229 	ROM_LOAD64_WORD( "s92_01.bin", 0x000000, 0x80000, CRC(03b0d852) SHA1(f370f25c96ad2b94f8c53d6b7139100285a25bef) )
2230 	ROM_LOAD64_WORD( "s92_02.bin", 0x000002, 0x80000, CRC(840289ec) SHA1(2fb42a242f60ba7e74009b5a90eb26e035ba1e82) )
2231 	ROM_LOAD64_WORD( "s92_03.bin", 0x000004, 0x80000, CRC(cdb5f027) SHA1(4c7d944fef200fdfcaf57758b901b5511188ed2e) )
2232 	ROM_LOAD64_WORD( "s92_04.bin", 0x000006, 0x80000, CRC(e2799472) SHA1(27d3796429338d82a8de246a0ea06dd487a87768) )
2233 	ROM_LOAD64_WORD( "s92_05.bin", 0x200000, 0x80000, CRC(ba8a2761) SHA1(4b696d66c51611e43522bed752654314e76d33b6) )
2234 	ROM_LOAD64_WORD( "s92_06.bin", 0x200002, 0x80000, CRC(e584bfb5) SHA1(ebdf1f5e2638eed3a65dda82b1ed9151a355f4c9) )
2235 	ROM_LOAD64_WORD( "s92_07.bin", 0x200004, 0x80000, CRC(21e3f87d) SHA1(4a4961bb68c3a1ce15f9d393d9c03ecb2466cc29) )
2236 	ROM_LOAD64_WORD( "s92_08.bin", 0x200006, 0x80000, CRC(befc47df) SHA1(520390420da3a0271ba90b0a933e65143265e5cf) )
2237 	ROM_LOAD64_WORD( "s92_10.bin", 0x400000, 0x80000, CRC(960687d5) SHA1(2868c31121b1c7564e9767b9a19cdbf655c7ed1d) )
2238 	ROM_LOAD64_WORD( "s92_11.bin", 0x400002, 0x80000, CRC(978ecd18) SHA1(648a59706b93c84b4206a968ecbdc3e834c476f6) )
2239 	ROM_LOAD64_WORD( "s92_12.bin", 0x400004, 0x80000, CRC(d6ec9a0a) SHA1(ed6143f8737013b6ef1684e37c05e037e7a80dae) )
2240 	ROM_LOAD64_WORD( "s92_13.bin", 0x400006, 0x80000, CRC(ed2c67f6) SHA1(0083c0ffaf6fe7659ff0cf822be4346cd6e61329) )
2241 
2242 	ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
2243 	ROM_LOAD( "s92_09.bin", 0x00000, 0x08000, CRC(08f6b60e) SHA1(8258fcaca4ac419312531eec67079b97f471179c) )
2244 	ROM_CONTINUE(           0x10000, 0x08000 )
2245 
2246 	ROM_REGION( 0x40000, "oki", 0 ) /* Samples */
2247 	ROM_LOAD( "s92_18.bin", 0x00000, 0x20000, CRC(7f162009) SHA1(346bf42992b4c36c593e21901e22c87ae4a7d86d) )
2248 	ROM_LOAD( "s92_19.bin", 0x20000, 0x20000, CRC(beade53f) SHA1(277c397dc12752719ec6b47d2224750bd1c07f79) )
2249 ROM_END
2250 
2251 ROM_START( sf2m9 )
2252 	ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
2253 	ROM_LOAD16_BYTE( "27040.6", 0x000000, 0x80000, CRC(16c6372e) SHA1(5d5a49392f2fb806e66e0ac137df00425ca52e7f) )
2254 	ROM_LOAD16_BYTE( "27040.5", 0x000001, 0x80000, CRC(137d5f2e) SHA1(835e9b767e6499f161c5c4fd9a31a9f54b3ee68f) )
2255 	ROM_LOAD16_BYTE( "27010.4", 0x100000, 0x20000, CRC(8226c11c) SHA1(9588bd64e338901394805aca8a234f880674dc60) )
2256 	ROM_LOAD16_BYTE( "27010.3", 0x100001, 0x20000, CRC(924c6ce2) SHA1(676a912652bd75da5087f0c7eae047b7681a993c) )
2257 
2258 	ROM_REGION( 0x600000, "gfx", 0 )
2259 	ROM_LOAD64_BYTE( "tat-01.bin", 0x000000, 0x40000, CRC(a887f7d4) SHA1(d7e0c46b3ab1c6352f45033cb9e610d9c34d51fb) )
2260 	ROM_CONTINUE(                  0x000004, 0x40000)
2261 	ROM_LOAD64_BYTE( "tat-05.bin", 0x000001, 0x40000, CRC(9390ff23) SHA1(b234169615aa952e3b15c7b0dfb495e499ba49ef) )
2262 	ROM_CONTINUE(                  0x000005, 0x40000)
2263 	ROM_LOAD64_BYTE( "tat-02.bin", 0x000002, 0x40000, CRC(afb3b589) SHA1(9721fa705d62814e416c38a6c3e698efb9385a98) )
2264 	ROM_CONTINUE(                  0x000006, 0x40000)
2265 	ROM_LOAD64_BYTE( "tat-06.bin", 0x000003, 0x40000, CRC(90f2053e) SHA1(a78710421e702b410650c45c3dec21bf16799fb4) )
2266 	ROM_CONTINUE(                  0x000007, 0x40000)
2267 
2268 	ROM_LOAD64_BYTE( "tat-03.bin", 0x200000, 0x40000, CRC(79fa8bf0) SHA1(9f8f7b8dc54a75226beb017b9ca9fd62a9e42f6b) )
2269 	ROM_CONTINUE(                  0x200004, 0x40000)
2270 	ROM_LOAD64_BYTE( "tat-07.bin", 0x200001, 0x40000, CRC(6a5f153c) SHA1(f3d82ad01e2e4bdb2039815747fa14399c69753a) )
2271 	ROM_CONTINUE(                  0x200005, 0x40000)
2272 	ROM_LOAD64_BYTE( "tat-04.bin", 0x200002, 0x40000, CRC(32518120) SHA1(56ffa5fffb714cff8be8be5a3675b8a5fa29b2bc) )
2273 	ROM_CONTINUE(                  0x200006, 0x40000)
2274 	ROM_LOAD64_BYTE( "tat-08.bin", 0x200003, 0x40000, CRC(c16579ae) SHA1(42c9d6df9f3b015f5d1ad4fa2b34ea90bb37bcae) )
2275 	ROM_CONTINUE(                  0x200007, 0x40000)
2276 
2277 	ROM_LOAD64_BYTE( "tat-09.bin", 0x400000, 0x40000, CRC(169d85a6) SHA1(dd98c8807e80465858b2eac10825e598c37e1a93) )
2278 	ROM_CONTINUE(                  0x400004, 0x40000)
2279 	ROM_LOAD64_BYTE( "tat-11.bin", 0x400001, 0x40000, CRC(32a3a841) SHA1(6f9a13b8828998d194dd3933b032c75efed9cab3) )
2280 	ROM_CONTINUE(                  0x400005, 0x40000)
2281 	ROM_LOAD64_BYTE( "tat-10.bin", 0x400002, 0x40000, CRC(0c638630) SHA1(709d183d181a0509c7ed839c59214851468d2bb8) )
2282 	ROM_CONTINUE(                  0x400006, 0x40000)
2283 	ROM_LOAD64_BYTE( "tat-12.bin", 0x400003, 0x40000, CRC(6ee19b94) SHA1(c45119d04879b6ca23a3f7749175c56b381b43f2) )
2284 	ROM_CONTINUE(                  0x400007, 0x40000)
2285 
2286 	ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
2287 	ROM_LOAD( "27512.1", 0x00000, 0x08000, CRC(08f6b60e) SHA1(8258fcaca4ac419312531eec67079b97f471179c) )
2288 	ROM_CONTINUE(        0x10000, 0x08000 )
2289 
2290 	ROM_REGION( 0x40000, "oki", 0 ) /* Samples */
2291 	ROM_LOAD( "27020.2", 0x00000, 0x40000, CRC(6cfffb11) SHA1(995526183ffd35f92e9096500a3fe6237faaa2dd) )
2292 
2293 	ROM_REGION( 0x00c8d, "pld", 0 ) /* pal/gal */
2294 	ROM_LOAD( "gal20v8.68kadd", 0x00000, 0x00c8d, CRC(27cdd376) SHA1(9fb5844b33002bec80fb92d3e5d1bbc779087300) )  //68k address decoder
2295 ROM_END
2296 
2297 
2298 // ************************************************************************* VARTHB
2299 
2300 ROM_START( varthb )
2301 	ROM_REGION( CODE_SIZE, "maincpu", 0 )      /* 68000 code */
2302 	ROM_LOAD16_BYTE( "2", 0x000000, 0x80000, CRC(2f010023) SHA1(bf4b6c0cd82cf1b86e17d6ea2670110c06e6eabe) )
2303 	ROM_LOAD16_BYTE( "1", 0x000001, 0x80000, CRC(0861dff3) SHA1(bf6dfe18ecaeaa1bbea09267014891c4a4a07943) )
2304 	ROM_LOAD16_BYTE( "4", 0x100000, 0x10000, CRC(aa51e43b) SHA1(46b9dab844c55b50a47d048e5bb114911773699c) )
2305 	ROM_LOAD16_BYTE( "3", 0x100001, 0x10000, CRC(f7e4f2f0) SHA1(2ce4eadb2d6a0e0d5745323eff2c899950ad4d3b) )
2306 
2307 	ROM_REGION( 0x200000, "gfx", 0 )
2308 	ROM_LOAD64_BYTE( "14", 0x000000, 0x40000, CRC(7ca73780) SHA1(26909db32f84157cd05719e5d1e715e76636d292)  )
2309 	ROM_LOAD64_BYTE( "13", 0x000001, 0x40000, CRC(9fb11869) SHA1(a434fb0b588f934aaa68139495e1212a63ccf162)  )
2310 	ROM_LOAD64_BYTE( "12", 0x000002, 0x40000, CRC(afeba416) SHA1(e722c65ea2e2bac3251c32208899484aa5ef6ad2)  )
2311 	ROM_LOAD64_BYTE( "11", 0x000003, 0x40000, CRC(9eef3507) SHA1(ae03064ca5681fbdc43a34c54aaac11c8467428b)  )
2312 	ROM_LOAD64_BYTE( "10", 0x000004, 0x40000, CRC(eeec6183) SHA1(40dc9c86e90d7c1a2ad600c195fe387180d95fd4)  )
2313 	ROM_LOAD64_BYTE( "9",  0x000005, 0x40000, CRC(0e94f718) SHA1(249534f2323abcdb24099d0abc24c229c699ba94)  )
2314 	ROM_LOAD64_BYTE( "8",  0x000006, 0x40000, CRC(c4ddc5b4) SHA1(79c2a42a664e387932b7804e7a80f5753338c3b0)  )
2315 	ROM_LOAD64_BYTE( "7",  0x000007, 0x40000, CRC(8941ca12) SHA1(5ad5d47b8614c2899d05c65dc3b74947d4bac561)  )
2316 
2317 	ROM_REGION( 0x18000, "audiocpu", 0 ) /* 64k for the audio CPU (+banks) */
2318 	ROM_LOAD( "6", 0x00000, 0x08000, CRC(7a99446e) SHA1(ca027f41e3e58be5abc33ad7380746658cb5380a) )
2319 	ROM_CONTINUE(  0x10000, 0x08000 )
2320 
2321 	ROM_REGION( 0x40000, "oki", 0 ) /* Samples */
2322 	ROM_LOAD( "5", 0x00000, 0x40000, CRC(1547e595) SHA1(27f47b1afd9700afd9e8167d7e4e2888be34a9e5) )
2323 
2324 	ROM_REGION( 0x1000, "pals", 0 )
2325 	ROM_LOAD_OPTIONAL( "varth1.bin", 0x00000, 0x157, CRC(4c6a0d99) SHA1(081a307ef38675de178dd6221e6c4e55a5bfbd87) )
2326 	ROM_LOAD_OPTIONAL( "varth2.bin", 0x00200, 0x157, NO_DUMP ) // Registered
2327 	ROM_LOAD_OPTIONAL( "varth3.bin", 0x00400, 0x157, NO_DUMP ) // Registered
2328 	ROM_LOAD_OPTIONAL( "varth4.bin", 0x00600, 0x117, CRC(53317bf6) SHA1(f7b8f8b2c40429a517e3be63e5aed9573972ddfb) )
2329 	ROM_LOAD_OPTIONAL( "varth5.bin", 0x00800, 0x157, NO_DUMP ) // Registered
2330 	ROM_LOAD_OPTIONAL( "varth6.bin", 0x00a00, 0x157, NO_DUMP ) // Registered
2331 ROM_END
2332 
2333 
2334 // ************************************************************************* DRIVER MACROS
2335 
2336 GAME( 1990, cawingbl,   cawing,  cawingbl,  cawingbl,  fcrash_state,   init_cawingbl,  ROT0,    "bootleg",  "Carrier Air Wing (bootleg with 2xYM2203 + 2xMSM5205, set 1)",  MACHINE_SUPPORTS_SAVE ) // 901012 ETC
2337 GAME( 1990, cawingb2,   cawing,  cawingbl,  cawingbl,  fcrash_state,   init_cawingbl,  ROT0,    "bootleg",  "Carrier Air Wing (bootleg with 2xYM2203 + 2xMSM5205, set 2)",  MACHINE_SUPPORTS_SAVE ) // 901012 ETC
2338 
2339 GAME( 1990, fcrash,     ffight,  fcrash,    fcrash,    fcrash_state,   init_cps1,      ROT0,    "bootleg (Playmark)",  "Final Crash (bootleg of Final Fight)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
2340 GAME( 1990, ffightbl,   ffight,  fcrash,    fcrash,    fcrash_state,   init_cps1,      ROT0,    "bootleg",  "Final Fight (bootleg)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
2341 GAME( 1990, ffightbla,  ffight,  fcrash,    fcrash,    fcrash_state,   init_cps1,      ROT0,    "bootleg",  "Final Fight (bootleg on Final Crash PCB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // same as Final Crash without the modified graphics
2342 GAME( 1990, ffightblb,  ffight,  ffightblb, fcrash,    fcrash_state,   init_cps1,      ROT0,    "bootleg (Soon Hwa)",  "Final Fight (bootleg with single OKI)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // priority glitches
2343 
2344 GAME( 1991, kodb,       kod,     kodb,      kodb,      fcrash_state,   init_kodb,      ROT0,    "bootleg (Playmark)",  "The King of Dragons (bootleg)",  MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 910731  "ETC"
2345 
2346 GAME( 1993, mtwinsb,    mtwins,  mtwinsb,   mtwins,    fcrash_state,   init_mtwinsb,   ROT0,    "David Inc. (bootleg)",  "Twins (Mega Twins bootleg)",  MACHINE_SUPPORTS_SAVE ) // based on World version
2347 
2348 GAME( 1992, sf2m1,      sf2ce,   sf2m1,     sf2,       fcrash_state,   init_sf2m1,     ROT0,    "bootleg",  "Street Fighter II': Champion Edition (M1, bootleg)",  MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC
2349 GAME( 1992, sf2m9,      sf2ce,   sf2m1,     sf2,       fcrash_state,   init_sf2m1,     ROT0,    "bootleg",  "Street Fighter II': Champion Edition (M9, bootleg)",  MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 920313 ETC
2350 
2351 GAME( 1999, sgyxz,      wof,     sgyxz,     sgyxz,     cps1bl_no_brgt, init_cps1,      ROT0,    "bootleg (All-In Electronic)",  "Warriors of Fate ('sgyxz' bootleg)",  MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )   // 921005 - Sangokushi 2
2352 GAME( 1992, wofabl,     wof,     wofabl,    wofabl,    cps1bl_no_brgt, init_cps1,      ROT0,    "bootleg",  "Sangokushi II (bootleg)",  MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )   // 921005 - Sangokushi 2
2353 GAME( 1992, wofr1bl,    wof,     wofr1bl,   wof,       cps1bl_no_brgt, init_wofr1bl,   ROT0,    "bootleg",  "Warriors of Fate (bootleg)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )   // 921002 ETC
2354 
2355 GAME( 1992, varthb,     varth,   varthb,    varth,     fcrash_state,   init_mtwinsb,   ROT270,  "bootleg",  "Varth: Operation Thunderstorm (bootleg, set 1)",  MACHINE_SUPPORTS_SAVE )
2356