1 // FB Alpha Taito Under Fire / Chase Bombers
2 // Based on MAME driver by Bryan McPhail and David Graves
3 
4 // do-to:
5 // cbombers priority mess :(
6 
7 #include "tiles_generic.h"
8 #include "m68000_intf.h"
9 #include "taito.h"
10 #include "taito_ic.h"
11 #include "taitof3_snd.h"
12 #include "eeprom.h"
13 #include "watchdog.h"
14 #include "burn_shift.h"
15 #include "burn_gun.h"
16 
17 static INT32 subcpu_in_reset;
18 static INT32 interrupt5_timer;
19 
20 static UINT8 ReloadGun[2] = { 0, 0 };
21 
22 static INT32 has_subcpu = 0;
23 static UINT8 DrvRecalc;
24 
25 #define A(a, b, c, d) {a, b, (UINT8*)(c), d}
26 static struct BurnInputInfo UndrfireInputList[] = {
27 	{"Coin 1",			BIT_DIGITAL,	TaitoInputPort3 + 2,	"p1 coin"	},
28 	{"Coin 2",			BIT_DIGITAL,	TaitoInputPort3 + 3,	"p2 coin"	},
29 
30 	{"P1 Start",		BIT_DIGITAL,	TaitoInputPort2 + 4,	"p1 start"	},
31 	{"P1 Button 1",		BIT_DIGITAL,	TaitoInputPort1 + 4,	"p1 fire 1"	},
32 	{"P1 Button 2",		BIT_DIGITAL,	TaitoInputPort1 + 5,	"p1 fire 2"	},
33 	{"P1 Button 3",		BIT_DIGITAL,	ReloadGun + 0,          "p1 fire 3"	},
34 	A("P1 Gun X",       BIT_ANALOG_REL, &TaitoAnalogPort0,      "mouse x-axis"),
35 	A("P1 Gun Y",       BIT_ANALOG_REL, &TaitoAnalogPort1,      "mouse y-axis"),
36 
37 	{"P2 Start",		BIT_DIGITAL,	TaitoInputPort2 + 5,	"p2 start"	},
38 	{"P2 Button 1",		BIT_DIGITAL,	TaitoInputPort1 + 6,	"p2 fire 1"	},
39 	{"P2 Button 2",		BIT_DIGITAL,	TaitoInputPort1 + 7,	"p2 fire 2"	},
40 	{"P2 Button 3",		BIT_DIGITAL,	ReloadGun + 1,          "p2 fire 3"	},
41 	A("P2 Gun X",       BIT_ANALOG_REL, &TaitoAnalogPort2,      "p2 x-axis"),
42 	A("P2 Gun Y",       BIT_ANALOG_REL, &TaitoAnalogPort3,      "p2 y-axis"),
43 
44 	{"Reset",			BIT_DIGITAL,	&TaitoReset,			"reset"		},
45 	{"Service",			BIT_DIGITAL,	TaitoInputPort3 + 1,	"service"	},
46 	{"Service Mode",	BIT_DIGITAL,	TaitoInputPort3 + 0,	"diag"	    },
47 };
48 
49 STDINPUTINFO(Undrfire)
50 
51 static struct BurnInputInfo CbombersInputList[] = {
52 	{"P1 Coin",			BIT_DIGITAL,	TaitoInputPort3 + 2,	"p1 coin"	},
53 	{"P1 Start",		BIT_DIGITAL,	TaitoInputPort2 + 4,    "p1 start"	},
54 
55 	{"P1 Accelerator",	BIT_DIGITAL,	TaitoInputPort0 + 2,    "p1 fire 1"	},
56 	{"P1 Brake",	    BIT_DIGITAL,	TaitoInputPort0 + 3,    "p1 fire 2"	},
57 	{"P1 Nitro",		BIT_DIGITAL,	TaitoInputPort0 + 1,    "p1 fire 3"	},
58 	{"P1 Gear Shift",	BIT_DIGITAL,	TaitoInputPort0 + 0,    "p1 fire 4"	},
59 
60 	A("P1 Steering",	BIT_ANALOG_REL, &TaitoAnalogPort0,		"p1 x-axis" ),
61 
62 	{"P2 Coin",			BIT_DIGITAL,	TaitoInputPort3 + 3,	"p2 coin"	},
63 	{"P2 Start",		BIT_DIGITAL,	TaitoInputPort2 + 4,    "p2 start"	},
64 
65 	{"Freeze",			BIT_DIGITAL,	TaitoInputPort1 + 3,	"p1 fire 5"	},
66 	{"Reset",			BIT_DIGITAL,	&TaitoReset,			"reset"		},
67 	{"Service",			BIT_DIGITAL,	TaitoInputPort3 + 1,	"service"	},
68 	{"Service Mode",	BIT_DIGITAL,	TaitoInputPort3 + 0,	"diag"	    },
69 };
70 
STDINPUTINFO(Cbombers)71 STDINPUTINFO(Cbombers)
72 #undef A
73 
74 
75 static void __fastcall undrfire_main_write_long(UINT32 a, UINT32 d)
76 {
77 	TC0100SCN0LongWrite_Map(0x900000, 0x90ffff)
78 
79 	switch (a)
80 	{
81 		case 0x400000:
82 		{
83 			if (!has_subcpu) return; // for chase bomber
84 
85 			INT32 previous = subcpu_in_reset;
86 			subcpu_in_reset = (~d >> 12) & 1;
87 			if (!subcpu_in_reset && previous) {
88 				SekClose();
89 				SekOpen(2);
90 				SekReset();
91 				SekClose();
92 				SekOpen(0);
93 			}
94 		}
95 		return;
96 
97 		case 0x304000:
98 		case 0x304400:
99 		return; // ??
100 	}
101 
102 	bprintf (0, _T("WL: %5.5x, %8.8x\n"), a, d);
103 }
104 
undrfire_main_write_word(UINT32 a,UINT16 d)105 static void __fastcall undrfire_main_write_word(UINT32 a, UINT16 d)
106 {
107 	TC0100SCN0WordWrite_Map(0x900000, 0x90ffff)
108 	TC0480SCPCtrlWordWrite_Map(0x830000)
109 	TC0100SCN0CtrlWordWrite_Map(0x920000)
110 
111 	switch (a)
112 	{
113 		case 0xd00000:
114 		case 0xd00002:
115 		return;
116 	}
117 
118 	bprintf (0, _T("WW: %5.5x, %4.4x\n"), a, d);
119 }
120 
undrfire_main_write_byte(UINT32 a,UINT8 d)121 static void __fastcall undrfire_main_write_byte(UINT32 a, UINT8 d)
122 {
123 	TC0100SCN0ByteWrite_Map(0x900000, 0x90ffff)
124 
125 	switch (a)
126 	{
127 		case 0x400000:
128 		case 0x400001:
129 		case 0x400002:
130 		case 0x400003:
131 		{
132 			// leds
133 			bprintf (0, _T("WB: %5.5x, %2.2x\n"), a, d);
134 		}
135 		return;
136 
137 		case 0x500000:
138 			BurnWatchdogWrite();
139 		return;
140 
141 		case 0x500001:
142 		case 0x500002:
143 		return;
144 
145 		case 0x500003:
146 			EEPROMSetCSLine((~d & 0x10) ? EEPROM_ASSERT_LINE : EEPROM_CLEAR_LINE);
147 			EEPROMSetClockLine((d & 0x20) ? EEPROM_ASSERT_LINE : EEPROM_CLEAR_LINE);
148 			EEPROMWriteBit((d >> 6) & 1);
149 		return;
150 
151 		case 0x500004:
152 			// coin counter / lockout
153 		return;
154 
155 		case 0x500005:
156 		case 0x500006:
157 		case 0x500007:
158 		return;
159 
160 		case 0x600000:
161 		case 0x600001:
162 		case 0x600002:
163 		case 0x600003:
164 		case 0x600004:
165 		case 0x600005:
166 		case 0x600006:
167 		case 0x600007:
168 			if (has_subcpu) {
169 				interrupt5_timer = 10;
170 			}
171 		return;
172 
173 		case 0xc00000:
174 		case 0xc00001:
175 		case 0xc00002:
176 		case 0xc00003:
177 		case 0xc00004:
178 		case 0xc00005:
179 		case 0xc00006:
180 		case 0xc00007:
181 		return;
182 
183 		case 0xd00000:
184 		case 0xd00001:
185 		case 0xd00002:
186 		case 0xd00003:
187 			// rotate_control_w
188 		return;
189 	}
190 	if (a != 0x500000) bprintf (0, _T("WB: %5.5x, %2.2x\n"), a, d);
191 }
192 
undrfire_main_read_long(UINT32 address)193 static UINT32 __fastcall undrfire_main_read_long(UINT32 address)
194 {
195 	bprintf (0, _T("RL: %5.5x\n"), address);
196 
197 	return 0;
198 }
199 
undrfire_main_read_word(UINT32 address)200 static UINT16 __fastcall undrfire_main_read_word(UINT32 address)
201 {
202 	if ((address & 0xffffc0) == 0x830000) {
203 		return TC0480SCPCtrl[(address / 2) & 0x1f];
204 	}
205 
206 	if ((address & 0xfffff0) == 0x920000) {
207 		return TC0100SCNCtrl[0][(address / 2) & 7];
208 	}
209 
210 	bprintf (0, _T("RW: %5.5x\n"), address);
211 
212 	return 0;
213 }
214 
undrfire_main_read_byte(UINT32 address)215 static UINT8 __fastcall undrfire_main_read_byte(UINT32 address)
216 {
217 	switch (address)
218 	{
219 		case 0x500000:
220 			return TaitoInput[0]; // inputs0
221 
222 		case 0x500001:
223 			return TaitoInput[1]; // inputs1
224 
225 		case 0x500002:
226 			return TaitoInput[2]; // inputs2
227 
228 		case 0x500003:
229 			return (EEPROMRead() ? 0x80 : 0) | (nCurrentFrame & 1) | 0x7e;
230 
231 		case 0x500004:
232 			return 0xff;
233 
234 		case 0x500005:
235 			return 0xff;
236 
237 		case 0x500006:
238 			return 0xff;
239 
240 		case 0x500007:
241 			return TaitoInput[3]; // system
242 
243 		case 0x600000:
244 				return (has_subcpu) ? ProcessAnalog(TaitoAnalogPort0, 1, INPUT_DEADZONE, 0x00, 0xff) : 0;
245 		case 0x600001:
246 		case 0x600002:
247 		case 0x600003:
248 		case 0x600004:
249 		case 0x600005:
250 		case 0x600006:
251 		case 0x600007: // cbombers steering (unused bytes)
252 			return 0;
253 
254 		case 0xc00000:
255 		case 0xc00001:
256 		case 0xc00002:
257 		case 0xc00003:
258 		case 0xc00004:
259 		case 0xc00005:
260 		case 0xc00006:
261 		case 0xc00007: // nop
262 			return 0;
263 	}
264 
265 	if ((address & 0xfffff8) == 0xf00000) {
266 		if (has_subcpu) return 0;
267 
268 		INT32 x = (ReloadGun[(address & 7) >> 2]) ? 0xff : 0xff - BurnGunReturnX((address & 7) >> 2);
269 		INT32 y = (ReloadGun[(address & 7) >> 2]) ? 0x00 : BurnGunReturnY((address & 7) >> 2);
270 		UINT32 res = ((x << 30) & 0xff000000) | ((x << 14) & 0xff0000) | ((y << 14) & 0xff00) | ((y >> 2) & 0xff);
271 
272 		return res >> (8 * (~address & 0x3));
273 	}
274 
275 	bprintf (0, _T("RB: %5.5x\n"), address);
276 	return 0;
277 }
278 
DrvDoReset(INT32 clear_mem)279 static INT32 DrvDoReset(INT32 clear_mem)
280 {
281 	if (clear_mem) {
282 		memset (TaitoRamStart, 0, TaitoRamEnd - TaitoRamStart);
283 	}
284 
285 	SekOpen(0);
286 	SekReset();
287 	SekClose();
288 
289 	SekOpen(2);
290 	SekReset();
291 	SekClose();
292 
293 	TaitoICReset();
294 	TaitoF3SoundReset();
295 
296 	BurnWatchdogReset();
297 
298 	BurnShiftReset();
299 
300 	EEPROMReset();
301 	if (EEPROMAvailable() == 0) {
302 		EEPROMFill(TaitoDefaultEEProm, 0, 0x80);
303 	}
304 
305 	subcpu_in_reset = 0;
306 	interrupt5_timer = -1;
307 
308 	return 0;
309 }
310 
MemIndex()311 static INT32 MemIndex()
312 {
313 	UINT8 *Next; Next = TaitoMem;
314 
315 	Taito68KRom1		= Next; Next += 0x200000;
316 
317 	Taito68KRom2		= Next;
318 	TaitoF3SoundRom		= Next; Next += 0x100000;
319 
320 	Taito68KRom3		= Next; Next += 0x040000;
321 
322 	TaitoSpritesA		= Next; Next += 0x2000000;
323 	TaitoChars			= Next; Next += 0x800000;
324 	TaitoCharsPivot		= Next; Next += 0x800000;
325 
326 	TaitoSpriteMapRom	= Next; Next += 0x100000;
327 
328 	TaitoDefaultEEProm	= Next; Next += 0x000080;
329 
330 	TaitoES5505Rom		= Next;
331 	TaitoF3ES5506Rom	= Next; Next += 0x1000000;
332 
333 	TaitoPalette		= (UINT32*)Next; Next += 0x4000 * sizeof(UINT32);
334 
335 	TaitoF2SpriteList	= (TaitoF2SpriteEntry*)Next; Next += 0x4000 * sizeof(TaitoF2SpriteEntry);
336 
337 	TaitoRamStart		= Next;
338 
339 	TaitoSharedRam		= Next; Next += 0x010000;
340 	TaitoSpriteRam		= Next; Next += 0x004000;
341 	TaitoSpriteRam2		= Next; Next += 0x000400;
342 	Taito68KRam1		= Next; Next += 0x020000;
343 	Taito68KRam3		= Next; Next += 0x010000;
344 	TaitoPaletteRam		= Next; Next += 0x010000;
345 
346 //	TC0100SCNRam[0]		= Next; Next += 0x010000; // allocated in init
347 //	TC0480SCPRam		= Next; Next += 0x010000; // allocated in init
348 
349 	TaitoF3SoundRam		= Next; Next += 0x010000;	// 64 KB
350 	TaitoF3SharedRam	= Next; Next += 0x000800;	// 2 KB
351 	TaitoES5510DSPRam	= Next; Next += 0x000200;	// 512 Bytes
352 	TaitoES5510GPR		= (UINT32 *)Next; Next += 0x000300;	// 192x4 Bytes
353 	TaitoES5510DRAM		= (UINT16 *)Next; Next += 0x400000;	// 4 MB
354 
355 	TaitoRamEnd		= Next;
356 
357 	TaitoMemEnd		= Next;
358 
359 	return 0;
360 }
361 
DrvGfxDecode(INT32 sprite_size)362 static INT32 DrvGfxDecode(INT32 sprite_size)
363 {
364 	INT32 Plane0[4]  = { STEP4(0,1) };
365 	INT32 XOffs0[16] = { 1*4, 0*4, 5*4, 4*4, 3*4, 2*4, 7*4, 6*4, 9*4, 8*4, 13*4, 12*4, 11*4, 10*4, 15*4, 14*4 };
366 	INT32 YOffs0[16] = { STEP16(0,64) };
367 
368 	INT32 Plane1[5]  = { (sprite_size/2)*8, STEP4(0,8) };
369 	INT32 XOffs1[16] = { STEP8(32,1), STEP8(0,1) };
370 	INT32 YOffs1[16] = { STEP16(0,64) };
371 
372 	INT32 Plane2[6] = { 0x200000*8, 0x200000*8+1, STEP4(0,1) };
373 	INT32 XOffs2[8] = { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 };
374 	INT32 YOffs2[8] = { STEP8(0,32) };
375 
376 	UINT8 *tmp = (UINT8*)BurnMalloc(sprite_size);
377 	if (tmp == NULL) {
378 		return 1;
379 	}
380 
381 	memcpy (tmp, TaitoChars, 0x400000);
382 
383 	GfxDecode(0x08000, 4, 16, 16, Plane0, XOffs0, YOffs0, 0x400, tmp, TaitoChars);
384 
385 	memcpy (tmp, TaitoSpritesA, sprite_size);
386 
387 	GfxDecode(sprite_size / (16*16), 5, 16, 16, Plane1, XOffs1, YOffs1, 0x400, tmp, TaitoSpritesA);
388 
389 	memcpy (tmp, TaitoCharsPivot, 0x400000);
390 
391 	GfxDecode(0x10000, 6,  8,  8, Plane2, XOffs2, YOffs2, 0x100, tmp, TaitoCharsPivot);
392 
393 	BurnFree(tmp);
394 
395 	return 0;
396 }
397 
DrvGfxReorder(INT32 size)398 static void DrvGfxReorder(INT32 size)
399 {
400 	UINT32 offset = size/2;
401 
402 	for (INT32 i = size/2+size/4; i < size; i++)
403 	{
404 		INT32 data = TaitoCharsPivot[i];
405 		INT32 d1 = (data >> 0) & 3;
406 		INT32 d2 = (data >> 2) & 3;
407 		INT32 d3 = (data >> 4) & 3;
408 		INT32 d4 = (data >> 6) & 3;
409 
410 		TaitoCharsPivot[offset] = (d1<<2) | (d2<<6);
411 		offset++;
412 
413 		TaitoCharsPivot[offset] = (d3<<2) | (d4<<6);
414 		offset++;
415 	}
416 }
417 
CommonInit(INT32 game_select)418 static INT32 CommonInit(INT32 game_select)
419 {
420 	TaitoMem = NULL;
421 	MemIndex();
422 	INT32 nLen = TaitoMemEnd - (UINT8 *)0;
423 	if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
424 	memset(TaitoMem, 0, nLen);
425 	MemIndex();
426 
427 	if (game_select == 0) // under fire
428 	{
429 		INT32 k = 0;
430 		if (BurnLoadRom(Taito68KRom1 + 0x000001, k++, 4)) return 1;
431 		if (BurnLoadRom(Taito68KRom1 + 0x000000, k++, 4)) return 1;
432 		if (BurnLoadRom(Taito68KRom1 + 0x000003, k++, 4)) return 1;
433 		if (BurnLoadRom(Taito68KRom1 + 0x000002, k++, 4)) return 1;
434 
435 		if (BurnLoadRom(TaitoF3SoundRom + 0x000001, k++, 2)) return 1;
436 		if (BurnLoadRom(TaitoF3SoundRom + 0x000000, k++, 2)) return 1;
437 
438 		if (BurnLoadRom(TaitoChars + 0x000000, k++, 2)) return 1;
439 		if (BurnLoadRom(TaitoChars + 0x000001, k++, 2)) return 1;
440 
441 		if (BurnLoadRom(TaitoSpritesA + 0x000003, k++, 4)) return 1;
442 		if (BurnLoadRom(TaitoSpritesA + 0x000002, k++, 4)) return 1;
443 		if (BurnLoadRom(TaitoSpritesA + 0x000001, k++, 4)) return 1;
444 		if (BurnLoadRom(TaitoSpritesA + 0x000000, k++, 4)) return 1;
445 		if (BurnLoadRom(TaitoSpritesA + 0x800000, k++, 4)) return 1;
446 
447 		if (BurnLoadRom(TaitoCharsPivot + 0x000000, k++, 2)) return 1;
448 		if (BurnLoadRom(TaitoCharsPivot + 0x000001, k++, 2)) return 1;
449 		if (BurnLoadRom(TaitoCharsPivot + 0x300000, k++, 1)) return 1;
450 
451 		if (BurnLoadRom(TaitoSpriteMapRom + 0x000000, k++, 1)) return 1;
452 
453 		if (BurnLoadRom(TaitoF3ES5506Rom + 0x000001, k++, 2)) return 1;
454 		if (BurnLoadRom(TaitoF3ES5506Rom + 0xc00001, k++, 2)) return 1;
455 
456 		if (BurnLoadRom(TaitoDefaultEEProm  + 0x000000, k++, 1)) return 1;
457 
458 		DrvGfxReorder(0x400000);
459 		DrvGfxDecode(0x1000000);
460 	}
461 	else if (game_select == 1) // chase bomber
462 	{
463 		INT32 k = 0;
464 		if (BurnLoadRom(Taito68KRom1 + 0x000001, k++, 4)) return 1;
465 		if (BurnLoadRom(Taito68KRom1 + 0x000000, k++, 4)) return 1;
466 		if (BurnLoadRom(Taito68KRom1 + 0x000003, k++, 4)) return 1;
467 		if (BurnLoadRom(Taito68KRom1 + 0x000002, k++, 4)) return 1;
468 
469 		if (BurnLoadRom(TaitoF3SoundRom + 0x000001, k++, 2)) return 1;
470 		if (BurnLoadRom(TaitoF3SoundRom + 0x000000, k++, 2)) return 1;
471 
472 		if (BurnLoadRom(Taito68KRom3 + 0x000000, k++, 2)) return 1;
473 		if (BurnLoadRom(Taito68KRom3 + 0x000001, k++, 2)) return 1;
474 
475 		if (BurnLoadRom(TaitoChars + 0x000000, k++, 2)) return 1;
476 		if (BurnLoadRom(TaitoChars + 0x000001, k++, 2)) return 1;
477 
478 		if (BurnLoadRom(TaitoSpritesA + 0x000003, k++, 4)) return 1;
479 		if (BurnLoadRom(TaitoSpritesA + 0x000002, k++, 4)) return 1;
480 		if (BurnLoadRom(TaitoSpritesA + 0x000001, k++, 4)) return 1;
481 		if (BurnLoadRom(TaitoSpritesA + 0x000000, k++, 4)) return 1;
482 		if (BurnLoadRom(TaitoSpritesA + 0x800003, k++, 4)) return 1;
483 		if (BurnLoadRom(TaitoSpritesA + 0x800002, k++, 4)) return 1;
484 		if (BurnLoadRom(TaitoSpritesA + 0x800001, k++, 4)) return 1;
485 		if (BurnLoadRom(TaitoSpritesA + 0x800000, k++, 4)) return 1;
486 		if (BurnLoadRom(TaitoSpritesA + 0xc00000, k++, 4)) return 1;
487 		if (BurnLoadRom(TaitoSpritesA + 0x1400000, k++, 4)) return 1;
488 
489 		if (BurnLoadRom(TaitoCharsPivot + 0x000000, k++, 2)) return 1;
490 		if (BurnLoadRom(TaitoCharsPivot + 0x000001, k++, 2)) return 1;
491 		if (BurnLoadRom(TaitoCharsPivot + 0x300000, k++, 1)) return 1;
492 
493 		if (BurnLoadRom(TaitoSpriteMapRom + 0x000001, k++, 2)) return 1;
494 		if (BurnLoadRom(TaitoSpriteMapRom + 0x000000, k++, 2)) return 1;
495 		if (BurnLoadRom(TaitoSpriteMapRom + 0x080000, k++, 1)) return 1;
496 
497 		if (BurnLoadRom(TaitoF3ES5506Rom + 0xc00001, k++, 2)) return 1;
498 		if (BurnLoadRom(TaitoF3ES5506Rom + 0x000001, k,   2)) return 1;
499 		if (BurnLoadRom(TaitoF3ES5506Rom + 0x400001, k++, 2)) return 1; // reload
500 		if (BurnLoadRom(TaitoF3ES5506Rom + 0x800001, k++, 2)) return 1;
501 
502 		if (BurnLoadRom(TaitoDefaultEEProm  + 0x000000, k++, 1)) return 1;
503 
504 		DrvGfxReorder(0x400000);
505 		DrvGfxDecode(0x1800000);
506 	}
507 	else if (game_select == 2) // chase bomber prototype
508 	{
509 		INT32 k = 0;
510 		if (BurnLoadRom(Taito68KRom1 + 0x000001, k++, 4)) return 1;
511 		if (BurnLoadRom(Taito68KRom1 + 0x000000, k++, 4)) return 1;
512 		if (BurnLoadRom(Taito68KRom1 + 0x000003, k++, 4)) return 1;
513 		if (BurnLoadRom(Taito68KRom1 + 0x000002, k++, 4)) return 1;
514 
515 		if (BurnLoadRom(TaitoF3SoundRom + 0x000001, k++, 2)) return 1;
516 		if (BurnLoadRom(TaitoF3SoundRom + 0x000000, k++, 2)) return 1;
517 
518 		if (BurnLoadRom(Taito68KRom3 + 0x000001, k++, 2)) return 1;
519 		if (BurnLoadRom(Taito68KRom3 + 0x000000, k++, 2)) return 1;
520 
521 		if (BurnLoadRom(TaitoChars + 0x000000, k++, 4)) return 1;
522 		if (BurnLoadRom(TaitoChars + 0x000001, k++, 4)) return 1;
523 		if (BurnLoadRom(TaitoChars + 0x000002, k++, 4)) return 1;
524 		if (BurnLoadRom(TaitoChars + 0x000003, k++, 4)) return 1;
525 		if (BurnLoadRom(TaitoChars + 0x200000, k++, 4)) return 1;
526 		if (BurnLoadRom(TaitoChars + 0x200001, k++, 4)) return 1;
527 		if (BurnLoadRom(TaitoChars + 0x200002, k++, 4)) return 1;
528 		if (BurnLoadRom(TaitoChars + 0x200003, k++, 4)) return 1;
529 
530 		if (BurnLoadRom(TaitoSpritesA + 0x000003, k++, 8)) return 1;
531 		if (BurnLoadRom(TaitoSpritesA + 0x000002, k++, 8)) return 1;
532 		if (BurnLoadRom(TaitoSpritesA + 0x000001, k++, 8)) return 1;
533 		if (BurnLoadRom(TaitoSpritesA + 0x000000, k++, 8)) return 1;
534 		if (BurnLoadRom(TaitoSpritesA + 0x000007, k++, 8)) return 1;
535 		if (BurnLoadRom(TaitoSpritesA + 0x000006, k++, 8)) return 1;
536 		if (BurnLoadRom(TaitoSpritesA + 0x000005, k++, 8)) return 1;
537 		if (BurnLoadRom(TaitoSpritesA + 0x000004, k++, 8)) return 1;
538 
539 		if (BurnLoadRom(TaitoSpritesA + 0xc00000, k++, 8)) return 1;
540 		if (BurnLoadRom(TaitoSpritesA + 0xc00004, k++, 8)) return 1;
541 		if (BurnLoadRom(TaitoSpritesA + 0x400003, k++, 8)) return 1;
542 		if (BurnLoadRom(TaitoSpritesA + 0x400002, k++, 8)) return 1;
543 		if (BurnLoadRom(TaitoSpritesA + 0x400001, k++, 8)) return 1;
544 		if (BurnLoadRom(TaitoSpritesA + 0x400000, k++, 8)) return 1;
545 		if (BurnLoadRom(TaitoSpritesA + 0x400007, k++, 8)) return 1;
546 		if (BurnLoadRom(TaitoSpritesA + 0x400006, k++, 8)) return 1;
547 		if (BurnLoadRom(TaitoSpritesA + 0x400005, k++, 8)) return 1;
548 		if (BurnLoadRom(TaitoSpritesA + 0x400004, k++, 8)) return 1;
549 		if (BurnLoadRom(TaitoSpritesA + 0x1000000, k++, 8)) return 1;
550 		if (BurnLoadRom(TaitoSpritesA + 0x1000004, k++, 8)) return 1;
551 		if (BurnLoadRom(TaitoSpritesA + 0x800003, k++, 8)) return 1;
552 		if (BurnLoadRom(TaitoSpritesA + 0x800002, k++, 8)) return 1;
553 		if (BurnLoadRom(TaitoSpritesA + 0x800001, k++, 8)) return 1;
554 		if (BurnLoadRom(TaitoSpritesA + 0x800000, k++, 8)) return 1;
555 		if (BurnLoadRom(TaitoSpritesA + 0x800007, k++, 8)) return 1;
556 		if (BurnLoadRom(TaitoSpritesA + 0x800006, k++, 8)) return 1;
557 		if (BurnLoadRom(TaitoSpritesA + 0x800005, k++, 8)) return 1;
558 		if (BurnLoadRom(TaitoSpritesA + 0x800004, k++, 8)) return 1;
559 		if (BurnLoadRom(TaitoSpritesA + 0x1400000, k++, 8)) return 1;
560 		if (BurnLoadRom(TaitoSpritesA + 0x1400004, k++, 8)) return 1;
561 
562 		if (BurnLoadRom(TaitoCharsPivot + 0x000001, k++, 2)) return 1;
563 		if (BurnLoadRom(TaitoCharsPivot + 0x000000, k++, 2)) return 1;
564 		if (BurnLoadRom(TaitoCharsPivot + 0x300000, k++, 1)) return 1;
565 		if (BurnLoadRom(TaitoCharsPivot + 0x100001, k++, 2)) return 1;
566 		if (BurnLoadRom(TaitoCharsPivot + 0x100000, k++, 2)) return 1;
567 		if (BurnLoadRom(TaitoCharsPivot + 0x380000, k++, 1)) return 1;
568 
569 		if (BurnLoadRom(TaitoSpriteMapRom + 0x000001, k++, 2)) return 1;
570 		if (BurnLoadRom(TaitoSpriteMapRom + 0x000000, k++, 2)) return 1;
571 		if (BurnLoadRom(TaitoSpriteMapRom + 0x080000, k++, 1)) return 1;
572 
573 		if (BurnLoadRom(TaitoF3ES5506Rom + 0x000001, k++, 2)) return 1;
574 		if (BurnLoadRom(TaitoF3ES5506Rom + 0x100001, k++, 2)) return 1;
575 		if (BurnLoadRom(TaitoF3ES5506Rom + 0x200001, k++, 2)) return 1;
576 		if (BurnLoadRom(TaitoF3ES5506Rom + 0x300001, k++, 2)) return 1;
577 		if (BurnLoadRom(TaitoF3ES5506Rom + 0x400001, k++, 2)) return 1;
578 		if (BurnLoadRom(TaitoF3ES5506Rom + 0xe00001, k++, 2)) return 1;
579 		if (BurnLoadRom(TaitoF3ES5506Rom + 0xf00001, k++, 2)) return 1;
580 
581 		DrvGfxReorder(0x400000);
582 		DrvGfxDecode(0x1800000);
583 	}
584 
585 	GenericTilesInit();
586 	TC0100SCNInit(0, 0x10000, 50, 24, 0, NULL);
587 	TC0100SCNSetColourDepth(0, 6);
588 	TC0480SCPInit(0x8000, 0, 36, 0, -1, 0, 24);
589 	TC0480SCPSetColourBase(game_select ? (0x1000 >> 4) : 0);
590 	TC0480SCPSetPriMap(pPrioDraw);
591 
592 	SekInit(0, 0x68ec020);
593 	SekOpen(0);
594 	SekMapMemory(Taito68KRom1,			0x000000, 0x1fffff, MAP_ROM);
595 	SekMapMemory(Taito68KRam1,			0x200000, 0x21ffff, MAP_RAM);
596 	SekMapMemory(TaitoSpriteRam,		0x300000, 0x303fff, MAP_RAM);
597 	SekMapMemory(TaitoF3SharedRam,		0x700000, 0x7007ff, MAP_RAM);
598 	SekMapMemory(TC0480SCPRam,			0x800000, 0x80ffff, MAP_RAM);
599 	SekMapMemory(TC0100SCNRam[0],		0x900000, 0x90ffff, MAP_READ);
600 	SekMapMemory(TaitoPaletteRam,		0xa00000, 0xa0ffff, MAP_RAM);
601 	SekMapMemory(TaitoSpriteRam2,		0xb00000, 0xb003ff, MAP_RAM); // Unknown
602 	SekMapMemory(TaitoSharedRam,		0xe00000, 0xe0ffff, MAP_RAM); // not on undrfire
603 	SekSetWriteLongHandler(0,			undrfire_main_write_long);
604 	SekSetWriteWordHandler(0,			undrfire_main_write_word);
605 	SekSetWriteByteHandler(0,			undrfire_main_write_byte);
606 	SekSetReadLongHandler(0,			undrfire_main_read_long);
607 	SekSetReadWordHandler(0,			undrfire_main_read_word);
608 	SekSetReadByteHandler(0,			undrfire_main_read_byte);
609 	SekClose();
610 
611 	TaitoF3ES5506RomSize = 0x1000000;
612 	TaitoF3SoundInit(1); // 68k #1 initialized here
613 	TaitoF3SoundIRQConfig(1);
614 
615 	has_subcpu = (game_select == 0) ? 0 : 1;
616 
617 	SekInit(2, 0x68000);
618 	SekOpen(2);
619 	SekMapMemory(Taito68KRom3,			0x000000, 0x03ffff, MAP_ROM);
620 	SekMapMemory(Taito68KRam3,			0x400000, 0x40ffff, MAP_RAM);
621 	SekMapMemory(TaitoSharedRam,		0x800000, 0x80ffff, MAP_RAM); // not on undrfire
622 	SekClose();
623 
624 	BurnWatchdogInit(DrvDoReset, 180);
625 
626 	EEPROMInit(&eeprom_interface_93C46);
627 	EEPROMIgnoreErrMessage(1); // chase bombers!
628 
629 	BurnShiftInit(SHIFT_POSITION_BOTTOM_RIGHT, SHIFT_COLOR_GREEN, 80); // cbombers
630 	BurnGunInit(2, true); // undrfire
631 
632 	DrvDoReset(1);
633 
634 	return 0;
635 }
636 
DrvExit()637 static INT32 DrvExit()
638 {
639 	GenericTilesExit();
640 
641 	SekExit();
642 	EEPROMExit();
643 
644 	TaitoF3SoundExit();
645 	TaitoICExit();
646 
647 	BurnShiftExit();
648 	BurnGunExit();
649 
650 	BurnFree(TaitoMem);
651 
652 	return 0;
653 }
654 
DrvPaletteUpdate()655 static void DrvPaletteUpdate()
656 {
657 	UINT32 *pal = (UINT32*)TaitoPaletteRam;
658 
659 	for (INT32 i = 0; i < 0x10000/4; i++)
660 	{
661 		UINT32 color = pal[i];
662 		color = (color << 16) | (color >> 16);
663 
664 		INT32 r = color >> 16;
665 		INT32 g = color >> 8;
666 		INT32 b = color;
667 
668 		TaitoPalette[i] = BurnHighCol(r,g,b,0);
669 	}
670 }
671 
draw_sprites(INT32 * primasks,INT32 x_offs,INT32 y_offs)672 static void draw_sprites(INT32 *primasks,INT32 x_offs,INT32 y_offs)
673 {
674 	UINT32 *spriteram32 = (UINT32*)TaitoSpriteRam;
675 	UINT16 *spritemap = (UINT16*)TaitoSpriteMapRom;
676 	INT32 offs, tilenum, color, flipx, flipy;
677 	INT32 x, y, priority, dblsize, curx, cury;
678 	INT32 sprites_flipscreen = 0;
679 	INT32 zoomx, zoomy, zx, zy;
680 	INT32 sprite_chunk,map_offset,code,j,k,px,py;
681 	INT32 dimension,total_chunks;
682 
683 	struct TaitoF2SpriteEntry *sprite_ptr = &TaitoF2SpriteList[0];
684 
685 	for (offs = (0x4000/4-4);offs >= 0;offs -= 4)
686 	{
687 		UINT32 data = spriteram32[offs+0];
688 		data = (data << 16) | (data >> 16);
689 		flipx =    (data & 0x00800000) >> 23;
690 		zoomx =    (data & 0x007f0000) >> 16;
691 		tilenum =  (data & 0x00007fff);
692 
693 		data = spriteram32[offs+2];
694 		data = (data << 16) | (data >> 16);
695 		priority = (data & 0x000c0000) >> 18;
696 		color =    (data & 0x0003fc00) >> 10;
697 		x =        (data & 0x000003ff);
698 
699 		data = spriteram32[offs+3];
700 		data = (data << 16) | (data >> 16);
701 		dblsize =  (data & 0x00040000) >> 18;
702 		flipy =    (data & 0x00020000) >> 17;
703 		zoomy =    (data & 0x0001fc00) >> 10;
704 		y =        (data & 0x000003ff);
705 
706 		color |= (0x100 + (priority << 6));     /* priority bits select color bank */
707 		color /= 2;     /* as sprites are 5bpp */
708 		flipy = !flipy;
709 		y = (-y &0x3ff);
710 
711 		if (!tilenum) continue;
712 
713 		flipy = !flipy;
714 		zoomx += 1;
715 		zoomy += 1;
716 
717 		y += y_offs;
718 
719 		if (x>0x340) x -= 0x400;
720 		if (y>0x340) y -= 0x400;
721 
722 		x -= x_offs;
723 
724 		dimension = ((dblsize*2) + 2);  // 2 or 4
725 		total_chunks = ((dblsize*3) + 1) << 2;  // 4 or 16
726 		map_offset = tilenum << 2;
727 
728 		{
729 			for (sprite_chunk=0;sprite_chunk<total_chunks;sprite_chunk++)
730 			{
731 				j = sprite_chunk / dimension;   /* rows */
732 				k = sprite_chunk % dimension;   /* chunks per row */
733 
734 				px = k;
735 				py = j;
736 				/* pick tiles back to front for x and y flips */
737 				if (flipx)  px = dimension-1-k;
738 				if (flipy)  py = dimension-1-j;
739 
740 				code = spritemap[map_offset + px + (py<<(dblsize+1))];
741 
742 				if (code==0xffff)
743 				{
744 					continue;
745 				}
746 
747 				curx = x + ((k*zoomx)/dimension);
748 				cury = y + ((j*zoomy)/dimension);
749 
750 				zx= x + (((k+1)*zoomx)/dimension) - curx;
751 				zy= y + (((j+1)*zoomy)/dimension) - cury;
752 
753 				if (sprites_flipscreen)
754 				{
755 					curx = 320 - curx - zx;
756 					cury = 256 - cury - zy;
757 					flipx = !flipx;
758 					flipy = !flipy;
759 				}
760 
761 				sprite_ptr->Code = code;
762 				sprite_ptr->Colour = color << 5;
763 				sprite_ptr->xFlip = !flipx;
764 				sprite_ptr->yFlip = flipy;
765 				sprite_ptr->x = curx;
766 				sprite_ptr->y = cury - 0;
767 				sprite_ptr->xZoom = zx << 12;
768 				sprite_ptr->yZoom = zy << 12;
769 				sprite_ptr->Priority = priority;
770 				sprite_ptr++;
771 			}
772 		}
773 	}
774 
775 	while (sprite_ptr != &TaitoF2SpriteList[0])
776 	{
777 		sprite_ptr--;
778 
779 		RenderZoomedPrioSprite(pTransDraw, TaitoSpritesA,
780 			sprite_ptr->Code,
781 			sprite_ptr->Colour, 0,
782 			sprite_ptr->x, sprite_ptr->y-24,
783 			sprite_ptr->xFlip,sprite_ptr->yFlip,
784 			16, 16,
785 			sprite_ptr->xZoom,sprite_ptr->yZoom, primasks[sprite_ptr->Priority]);
786 	}
787 }
788 
draw_sprites_cbombers(const INT32 * primasks,INT32 x_offs,INT32 y_offs)789 static void draw_sprites_cbombers(const INT32 *primasks,INT32 x_offs,INT32 y_offs)
790 {
791 	UINT32 *spriteram32 = (UINT32*)TaitoSpriteRam;
792 	UINT16 *spritemap = (UINT16*)TaitoSpriteMapRom;
793 	UINT8 *spritemapHibit = TaitoSpriteMapRom + 0x80000;
794 
795 	INT32 offs, tilenum, color, flipx, flipy;
796 	INT32 x, y, priority, dblsize, curx, cury;
797 	INT32 sprites_flipscreen = 0;
798 	INT32 zoomx, zoomy, zx, zy;
799 	INT32 sprite_chunk,map_offset,code,j,k,px,py;
800 	INT32 dimension,total_chunks;
801 
802 	struct TaitoF2SpriteEntry *sprite_ptr = &TaitoF2SpriteList[0];
803 
804 	for (offs = (0x4000/4-4);offs >= 0;offs -= 4)
805 	{
806 		UINT32 data = spriteram32[offs+0];
807 		data = (data << 16) | (data >> 16);
808 		flipx =    (data & 0x00800000) >> 23;
809 		zoomx =    (data & 0x007f0000) >> 16;
810 		tilenum =  (data & 0x0000ffff);
811 
812 		data = spriteram32[offs+2];
813 		data = (data << 16) | (data >> 16);
814 		priority = (data & 0x000c0000) >> 18;
815 		color =    (data & 0x0003fc00) >> 10;
816 		x =        (data & 0x000003ff);
817 
818 		data = spriteram32[offs+3];
819 		data = (data << 16) | (data >> 16);
820 		dblsize =  (data & 0x00040000) >> 18;
821 		flipy =    (data & 0x00020000) >> 17;
822 		zoomy =    (data & 0x0001fc00) >> 10;
823 		y =        (data & 0x000003ff);
824 
825 		color |= (/*0x100 +*/ (priority << 6));     /* priority bits select color bank */
826 
827 		color /= 2;     /* as sprites are 5bpp */
828 		flipy = !flipy;
829 
830 		if (!tilenum) continue;
831 
832 		zoomx += 1;
833 		zoomy += 1;
834 
835 		y += y_offs;
836 
837 		/* treat coords as signed */
838 		if (x>0x340) x -= 0x400;
839 		if (y>0x340) y -= 0x400;
840 
841 		x -= x_offs;
842 
843 		dimension = ((dblsize*2) + 2);  // 2 or 4
844 		total_chunks = ((dblsize*3) + 1) << 2;  // 4 or 16
845 		map_offset = tilenum << 2;
846 
847 		for (sprite_chunk = 0; sprite_chunk < total_chunks; sprite_chunk++)
848 		{
849 			INT32 map_addr;
850 
851 			j = sprite_chunk / dimension;   /* rows */
852 			k = sprite_chunk % dimension;   /* chunks per row */
853 
854 			px = k;
855 			py = j;
856 			/* pick tiles back to front for x and y flips */
857 			if (flipx)  px = dimension-1-k;
858 			if (flipy)  py = dimension-1-j;
859 
860 			map_addr = map_offset + px + (py << (dblsize + 1));
861 			code =  (spritemapHibit[map_addr] << 16) | spritemap[map_addr];
862 
863 			curx = x + ((k*zoomx)/dimension);
864 			cury = y + ((j*zoomy)/dimension);
865 
866 			zx= x + (((k+1)*zoomx)/dimension) - curx;
867 			zy= y + (((j+1)*zoomy)/dimension) - cury;
868 
869 			if (sprites_flipscreen)
870 			{
871 				curx = 320 - curx - zx;
872 				cury = 256 - cury - zy;
873 				flipx = !flipx;
874 				flipy = !flipy;
875 			}
876 
877 			sprite_ptr->Code = code;
878 			sprite_ptr->Colour = color;
879 			sprite_ptr->xFlip = !flipx;
880 			sprite_ptr->yFlip = flipy;
881 			sprite_ptr->x = curx;
882 			sprite_ptr->y = cury;
883 			sprite_ptr->xZoom = zx << 12;
884 			sprite_ptr->yZoom = zy << 12;
885 			sprite_ptr->Priority = priority;
886 			sprite_ptr++;
887 		}
888 	}
889 
890 	while (sprite_ptr != &TaitoF2SpriteList[0])
891 	{
892 		sprite_ptr--;
893 
894 		RenderZoomedPrioSprite(pTransDraw, TaitoSpritesA,
895 			sprite_ptr->Code & 0x1ffff,
896 			sprite_ptr->Colour << 5, 0,
897 			sprite_ptr->x, sprite_ptr->y-24,
898 			sprite_ptr->xFlip,sprite_ptr->yFlip,
899 			16, 16,
900 			sprite_ptr->xZoom,sprite_ptr->yZoom, primasks[sprite_ptr->Priority]);
901 	}
902 }
903 
UndrfireDraw()904 static INT32 UndrfireDraw()
905 {
906 //	if (DrvRecalc) {
907 		DrvPaletteUpdate();
908 		DrvRecalc = 0;
909 //	}
910 
911 	UINT8 layer[5];
912 	UINT16 priority = TC0480SCPGetBgPriority();
913 
914 	layer[0] = (priority & 0xf000) >> 12;
915 	layer[1] = (priority & 0x0f00) >>  8;
916 	layer[2] = (priority & 0x00f0) >>  4;
917 	layer[3] = (priority & 0x000f) >>  0;
918 	layer[4] = 4;
919 
920 	BurnTransferClear();
921 
922 	INT32 Disable = TC0100SCNCtrl[0][6] & 0x3;
923 	if (TC0100SCNBottomLayer(0)) {
924 		if (nSpriteEnable & 8) if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 1, TaitoCharsPivot);
925 		if (nSpriteEnable & 4) if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 0, TaitoCharsPivot);
926 	} else {
927 		if (nSpriteEnable & 4) if (!(Disable & 0x01)) TC0100SCNRenderBgLayer(0, 1, TaitoCharsPivot);
928 		if (nSpriteEnable & 8) if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoCharsPivot);
929 	}
930 
931 	if (nBurnLayer & 1) TC0480SCPTilemapRenderPrio(layer[0], 0, 1, TaitoChars);
932 	if (nBurnLayer & 2) TC0480SCPTilemapRenderPrio(layer[1], 0, 2, TaitoChars);
933 	if (nBurnLayer & 4) TC0480SCPTilemapRenderPrio(layer[2], 0, 4, TaitoChars);
934 	if (nBurnLayer & 8) TC0480SCPTilemapRenderPrio(layer[3], 0, 8, TaitoChars);
935 
936 	if ((TC0480SCPCtrl[0xf] & 0x3) == 3) // priority control
937 	{
938 		INT32 primasks[4] = {0xfff0, 0xff00, 0x0000, 0x0};
939 
940 		if (nSpriteEnable & 16) draw_sprites(primasks, 44, -574);
941 	}
942 	else
943 	{
944 		INT32 primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
945 
946 		if (nSpriteEnable & 16) draw_sprites(primasks, 44, -574);
947 	}
948 
949 	if (nSpriteEnable & 4) TC0100SCNRenderCharLayer(0);
950 	if (nSpriteEnable & 8) TC0480SCPRenderCharLayer();
951 
952 	BurnTransferCopy(TaitoPalette);
953 	BurnGunDrawTargets();
954 	return 0;
955 }
956 
CbombersDraw()957 static INT32 CbombersDraw()
958 {
959 //	if (DrvRecalc) {
960 		DrvPaletteUpdate();
961 		DrvRecalc = 0;
962 //	}
963 
964 
965 	UINT8 layer[5];
966 	UINT16 priority = TC0480SCPGetBgPriority();
967 
968 	layer[0] = (priority & 0xf000) >> 12;
969 	layer[1] = (priority & 0x0f00) >>  8;
970 	layer[2] = (priority & 0x00f0) >>  4;
971 	layer[3] = (priority & 0x000f) >>  0;
972 	layer[4] = 4;
973 
974 	BurnTransferClear();
975 
976 	if (TC0100SCNBottomLayer(0)) {
977 		if (nSpriteEnable & 2) TC0100SCNRenderFgLayer(0, 1, TaitoCharsPivot);
978 		if (nSpriteEnable & 1) TC0100SCNRenderBgLayer(0, 0, TaitoCharsPivot);
979 	} else {
980 		if (nSpriteEnable & 1) TC0100SCNRenderBgLayer(0, 1, TaitoCharsPivot);
981 		if (nSpriteEnable & 2) TC0100SCNRenderFgLayer(0, 0, TaitoCharsPivot);
982 	}
983 
984 	if (nBurnLayer & 1) TC0480SCPTilemapRenderPrio(layer[0], 0, 1, TaitoChars);
985 	if (nBurnLayer & 2) TC0480SCPTilemapRenderPrio(layer[1], 0, 2, TaitoChars);
986 	if (nBurnLayer & 4) TC0480SCPTilemapRenderPrio(layer[2], 0, 4, TaitoChars);
987 	if (nBurnLayer & 8) TC0480SCPTilemapRenderPrio(layer[3], 0, 8, TaitoChars);
988 
989 	if ((TC0480SCPCtrl[0xf] & 0x3) == 3) // priority control
990 	{
991 		INT32 primasks[4] = {0xfff0, 0xff00, 0x0, 0x0};
992 		if (nSpriteEnable & 16) draw_sprites_cbombers(primasks, 80, -208);
993 	}
994 	else
995 	{
996 		INT32 primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
997 		if (nSpriteEnable & 16) draw_sprites_cbombers(primasks, 80, -208);
998 	}
999 
1000 	if (nSpriteEnable & 4) TC0100SCNRenderCharLayer(0);
1001 	if (nSpriteEnable & 8) TC0480SCPRenderCharLayer();
1002 
1003 	BurnTransferCopy(TaitoPalette);
1004 
1005 	//BurnShiftRender(); (game has its own shift indicator)
1006 
1007 	return 0;
1008 }
1009 
DrvFrame()1010 static INT32 DrvFrame()
1011 {
1012 	BurnWatchdogUpdate();
1013 
1014 //	SekNewFrame();
1015 
1016 	if (TaitoReset) {
1017 		DrvDoReset(1);
1018 	}
1019 
1020 	{
1021 		TaitoInput[0] = 0xff;
1022 		TaitoInput[1] = 0xf7;
1023 		TaitoInput[2] = 0xff;
1024 		TaitoInput[3] = 0xff;
1025 
1026 		if (ReloadGun[0]) {
1027 			TaitoInputPort1[4] = 1;
1028 		}
1029 		if (ReloadGun[1]) {
1030 			TaitoInputPort1[6] = 1;
1031 		}
1032 
1033 		for (INT32 i = 0; i < 8; i++) {
1034 			TaitoInput[0] ^= (TaitoInputPort0[i] & 1) << i;
1035 			TaitoInput[1] ^= (TaitoInputPort1[i] & 1) << i;
1036 			TaitoInput[2] ^= (TaitoInputPort2[i] & 1) << i;
1037 			TaitoInput[3] ^= (TaitoInputPort3[i] & 1) << i;
1038 		}
1039 
1040 		{
1041 			if (has_subcpu) {
1042 				// gear shifter stuff (cbombers)
1043 				BurnShiftInputCheckToggle(TaitoInputPort0[0]);
1044 
1045 				TaitoInput[0] &= ~1;
1046 				TaitoInput[0] |= !bBurnShiftStatus;
1047 			} else {
1048 				// lightgun stuff (undrfire)
1049 				BurnGunMakeInputs(0, TaitoAnalogPort0, TaitoAnalogPort1);
1050 				BurnGunMakeInputs(1, TaitoAnalogPort2, TaitoAnalogPort3);
1051 			}
1052 		}
1053 	}
1054 
1055 	INT32 nInterleave = 256;
1056 	INT32 nCyclesTotal[2] = { 20000000 / 60, 16000000 / 60 };
1057 	INT32 nCyclesDone[2] = { 0, 0 };
1058 
1059 	for (INT32 i = 0; i < nInterleave; i++)
1060 	{
1061 		SekOpen(0);
1062 		nCyclesDone[0] += SekRun(((i + 1) * nCyclesTotal[0] / nInterleave) - nCyclesDone[0]);
1063 
1064 		if (i == (nInterleave - 1))
1065 		{
1066 			SekSetIRQLine(4, CPU_IRQSTATUS_AUTO);
1067 		}
1068 		else if (interrupt5_timer >= 0)
1069 		{
1070 			if (interrupt5_timer == 0)
1071 			{
1072 				SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
1073 			}
1074 
1075 			interrupt5_timer--;
1076 		}
1077 
1078 		SekClose();
1079 
1080 		TaitoF3CpuUpdate(nInterleave, i);
1081 
1082 		if (has_subcpu) { // cbombers only
1083 			SekOpen(2);
1084 
1085 			if (subcpu_in_reset == 0)
1086 			{
1087 				nCyclesDone[1] += SekRun(((i + 1) * nCyclesTotal[1] / nInterleave) - nCyclesDone[1]);
1088 
1089 				if (i == (nInterleave - 1))
1090 				{
1091 					SekSetIRQLine(4, CPU_IRQSTATUS_AUTO);
1092 				}
1093 			}
1094 			else
1095 			{
1096 				SekIdle(nCyclesTotal[1] / nInterleave);
1097 			}
1098 
1099 			SekClose();
1100 		}
1101 	}
1102 
1103 	if (pBurnSoundOut) {
1104 		TaitoF3SoundUpdate(pBurnSoundOut, nBurnSoundLen);
1105 	}
1106 
1107 	if (pBurnDraw) {
1108 		BurnDrvRedraw();
1109 	}
1110 
1111 	return 0;
1112 }
1113 
DrvScan(INT32 nAction,INT32 * pnMin)1114 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
1115 {
1116 	struct BurnArea ba;
1117 
1118 	if (pnMin) {
1119 		*pnMin = 0x029702;
1120 	}
1121 
1122 	if (nAction & ACB_VOLATILE) {
1123 		memset(&ba, 0, sizeof(ba));
1124 
1125 		ba.Data	  = TaitoRamStart;
1126 		ba.nLen	  = TaitoRamEnd - TaitoRamStart;
1127 		ba.szName = "All Ram";
1128 		BurnAcb(&ba);
1129 
1130 		SekScan(nAction);
1131 		TaitoICScan(nAction);
1132 		TaitoF3SoundScan(nAction, pnMin);
1133 		EEPROMScan(nAction, pnMin);
1134 		BurnWatchdogScan(nAction);
1135 		BurnShiftScan(nAction);
1136 		BurnGunScan();
1137 
1138 		SCAN_VAR(subcpu_in_reset);
1139 		SCAN_VAR(interrupt5_timer);
1140 	}
1141 
1142 	return 0;
1143 }
1144 
1145 
1146 // Under Fire (World)
1147 
1148 static struct BurnRomInfo undrfireRomDesc[] = {
1149 	{ "d67-19",					0x080000, 0x1d88fa5a, TAITO_68KROM1_BYTESWAP32 },	//  0 M68EC020 Code
1150 	{ "d67-18",					0x080000, 0xf41ae7fd, TAITO_68KROM1_BYTESWAP32 },	//  1
1151 	{ "d67-17",					0x080000, 0x34e030b7, TAITO_68KROM1_BYTESWAP32 },	//  2
1152 	{ "d67-23",					0x080000, 0x28e84e0a, TAITO_68KROM1_BYTESWAP32 },	//  3
1153 
1154 	{ "d67-20",					0x020000, 0x974ebf69, TAITO_68KROM2_BYTESWAP },		//  4 Sound 68K Code
1155 	{ "d67-21",					0x020000, 0x8fc6046f, TAITO_68KROM2_BYTESWAP },		//  5
1156 
1157 	{ "d67-08",					0x200000, 0x56730d44, TAITO_CHARS_BYTESWAP },		//  6 Background Tiles
1158 	{ "d67-09",					0x200000, 0x3c19f9e3, TAITO_CHARS_BYTESWAP },		//  7
1159 
1160 	{ "d67-03",					0x200000, 0x3b6e99a9, TAITO_SPRITESA_BYTESWAP32 },	//  8 Sprites
1161 	{ "d67-04",					0x200000, 0x8f2934c9, TAITO_SPRITESA_BYTESWAP32 },	//  9
1162 	{ "d67-05",					0x200000, 0xe2e7dcf3, TAITO_SPRITESA_BYTESWAP32 },	// 10
1163 	{ "d67-06",					0x200000, 0xa2a63488, TAITO_SPRITESA_BYTESWAP32 },	// 11
1164 	{ "d67-07",					0x200000, 0x189c0ee5, TAITO_SPRITESA },				// 12
1165 
1166 	{ "d67-10",					0x100000, 0xd79e6ce9, TAITO_CHARS_PIVOT },			// 13 PIV Tiles
1167 	{ "d67-11",					0x100000, 0x7a401bb3, TAITO_CHARS_PIVOT },			// 14
1168 	{ "d67-12",					0x100000, 0x67b16fec, TAITO_CHARS_PIVOT },			// 15
1169 
1170 	{ "d67-13",					0x080000, 0x42e7690d, TAITO_SPRITEMAP },			// 16 Sprite Map
1171 
1172 	{ "d67-01",					0x200000, 0xa2f18122, TAITO_ES5505_BYTESWAP },		// 17 Ensoniq Samples/Data
1173 	{ "d67-02",					0x200000, 0xfceb715e, TAITO_ES5505_BYTESWAP },		// 18
1174 
1175 	{ "eeprom-undrfire.bin",	0x000080, 0x9f7368f4, TAITO_DEFAULT_EEPROM },		// 19 Default EEPROM
1176 };
1177 
1178 STD_ROM_PICK(undrfire)
STD_ROM_FN(undrfire)1179 STD_ROM_FN(undrfire)
1180 
1181 static INT32 UndrfireInit()
1182 {
1183 	return CommonInit(0);
1184 }
1185 
1186 struct BurnDriver BurnDrvUndrfire = {
1187 	"undrfire", NULL, NULL, NULL, "1993",
1188 	"Under Fire (World)\0", NULL, "Taito Corporation Japan", "K1100744A",
1189 	NULL, NULL, NULL, NULL,
1190 	BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0,
1191 	NULL, undrfireRomInfo, undrfireRomName, NULL, NULL, NULL, NULL, UndrfireInputInfo, NULL,
1192 	UndrfireInit, DrvExit, DrvFrame, UndrfireDraw, DrvScan, &DrvRecalc, 0x4000,
1193 	320, 232, 4, 3
1194 };
1195 
1196 
1197 // Under Fire (Japan)
1198 
1199 static struct BurnRomInfo undrfirejRomDesc[] = {
1200 	{ "d67-19",					0x080000, 0x1d88fa5a, TAITO_68KROM1_BYTESWAP32 },	//  0 M68EC020 Code
1201 	{ "d67-18",					0x080000, 0xf41ae7fd, TAITO_68KROM1_BYTESWAP32 },	//  1
1202 	{ "d67-17",					0x080000, 0x34e030b7, TAITO_68KROM1_BYTESWAP32 },	//  2
1203 	{ "d67-16",					0x080000, 0xc6e62f26, TAITO_68KROM1_BYTESWAP32 },	//  3
1204 
1205 	{ "d67-20",					0x020000, 0x974ebf69, TAITO_68KROM2_BYTESWAP },		//  4 Sound 68K Code
1206 	{ "d67-21",					0x020000, 0x8fc6046f, TAITO_68KROM2_BYTESWAP },		//  5
1207 
1208 	{ "d67-08",					0x200000, 0x56730d44, TAITO_CHARS_BYTESWAP },		//  6 Background Tiles
1209 	{ "d67-09",					0x200000, 0x3c19f9e3, TAITO_CHARS_BYTESWAP },		//  7
1210 
1211 	{ "d67-03",					0x200000, 0x3b6e99a9, TAITO_SPRITESA_BYTESWAP32 },	//  8 Sprites
1212 	{ "d67-04",					0x200000, 0x8f2934c9, TAITO_SPRITESA_BYTESWAP32 },	//  9
1213 	{ "d67-05",					0x200000, 0xe2e7dcf3, TAITO_SPRITESA_BYTESWAP32 },	// 10
1214 	{ "d67-06",					0x200000, 0xa2a63488, TAITO_SPRITESA_BYTESWAP32 },	// 11
1215 	{ "d67-07",					0x200000, 0x189c0ee5, TAITO_SPRITESA },				// 12
1216 
1217 	{ "d67-10",					0x100000, 0xd79e6ce9, TAITO_CHARS_PIVOT },			// 13 PIV Tiles
1218 	{ "d67-11",					0x100000, 0x7a401bb3, TAITO_CHARS_PIVOT },			// 14
1219 	{ "d67-12",					0x100000, 0x67b16fec, TAITO_CHARS_PIVOT },			// 15
1220 
1221 	{ "d67-13",					0x080000, 0x42e7690d, TAITO_SPRITEMAP },			// 16 Sprite Map
1222 
1223 	{ "d67-01",					0x200000, 0xa2f18122, TAITO_ES5505_BYTESWAP },		// 17 Ensoniq Samples/Data
1224 	{ "d67-02",					0x200000, 0xfceb715e, TAITO_ES5505_BYTESWAP },		// 18
1225 
1226 	{ "eeprom-undrfire.bin",	0x000080, 0x9f7368f4, TAITO_DEFAULT_EEPROM },		// 19 Default EEPROM
1227 };
1228 
1229 STD_ROM_PICK(undrfirej)
1230 STD_ROM_FN(undrfirej)
1231 
1232 struct BurnDriver BurnDrvUndrfirej = {
1233 	"undrfirej", "undrfire", NULL, NULL, "1993",
1234 	"Under Fire (Japan)\0", NULL, "Taito Corporation", "K1100744A",
1235 	NULL, NULL, NULL, NULL,
1236 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0,
1237 	NULL, undrfirejRomInfo, undrfirejRomName, NULL, NULL, NULL, NULL, UndrfireInputInfo, NULL,
1238 	UndrfireInit, DrvExit, DrvFrame, UndrfireDraw, DrvScan, &DrvRecalc, 0x4000,
1239 	320, 232, 4, 3
1240 };
1241 
1242 
1243 // Chase Bombers (World)
1244 
1245 static struct BurnRomInfo cbombersRomDesc[] = {
1246 	{ "d83_39.ic17",			0x080000, 0xb9f48284, TAITO_68KROM1_BYTESWAP32 },	//  0 M68EC020 Code
1247 	{ "d83_41.ic4",				0x080000, 0xa2f4c8be, TAITO_68KROM1_BYTESWAP32 },	//  1
1248 	{ "d83_40.ic3",				0x080000, 0xb05f59ea, TAITO_68KROM1_BYTESWAP32 },	//  2
1249 	{ "d83_38.ic16",			0x080000, 0x0a10616c, TAITO_68KROM1_BYTESWAP32 },	//  3
1250 
1251 	{ "d83_26.ic37",			0x020000, 0x4f49b484, TAITO_68KROM2_BYTESWAP },		//  4 Sound 68K Code
1252 	{ "d83_27.ic38",			0x020000, 0x2aa1a237, TAITO_68KROM2_BYTESWAP },		//  5
1253 
1254 	{ "d83_28.ic26",			0x020000, 0x06328ef7, TAITO_68KROM3_BYTESWAP },		//  6 Sub 68k Code
1255 	{ "d83_29.ic27",			0x020000, 0x771b4080, TAITO_68KROM3_BYTESWAP },		//  7
1256 
1257 	{ "d83_04.ic8",				0x200000, 0x79f36cce, TAITO_CHARS_BYTESWAP },		//  8 Background Tiles
1258 	{ "d83_05.ic7",				0x200000, 0x7787e495, TAITO_CHARS_BYTESWAP },		//  9
1259 
1260 	{ "d83_06.ic28",			0x200000, 0x4b71944e, TAITO_SPRITESA_BYTESWAP32 },	// 10 Sprites
1261 	{ "d83_07.ic30",			0x200000, 0x29861b61, TAITO_SPRITESA_BYTESWAP32 },	// 11
1262 	{ "d83_08.ic32",			0x200000, 0xa0e81e01, TAITO_SPRITESA_BYTESWAP32 },	// 12
1263 	{ "d83_09.ic45",			0x200000, 0x7e4dec50, TAITO_SPRITESA_BYTESWAP32 },	// 13
1264 	{ "d83_11.ic41",			0x100000, 0xa790e490, TAITO_SPRITESA_BYTESWAP32 },	// 14
1265 	{ "d83_12.ic29",			0x100000, 0x2f237b0d, TAITO_SPRITESA_BYTESWAP32 },	// 15
1266 	{ "d83_13.ic31",			0x100000, 0xc2cceeb6, TAITO_SPRITESA_BYTESWAP32 },	// 16
1267 	{ "d83_14.ic44",			0x100000, 0x8b6f4f12, TAITO_SPRITESA_BYTESWAP32 },	// 17
1268 	{ "d83_10.ic43",			0x200000, 0x36c440a0, TAITO_SPRITESA },				// 18
1269 	{ "d83_15.ic42",			0x100000, 0x1b71175e, TAITO_SPRITESA },				// 19
1270 
1271 	{ "d83_16.ic19",			0x100000, 0xd364cf1e, TAITO_CHARS_PIVOT },			// 20 PIV Tiles
1272 	{ "d83_17.ic5",				0x100000, 0x0ffe737c, TAITO_CHARS_PIVOT },			// 21
1273 	{ "d83_18.ic6",				0x100000, 0x87979155, TAITO_CHARS_PIVOT },			// 22
1274 
1275 	{ "d83_31.ic10",			0x040000, 0x85c37961, TAITO_SPRITEMAP },			// 23 Sprite Map
1276 	{ "d83_32.ic11",			0x040000, 0xb0db2559, TAITO_SPRITEMAP },			// 24
1277 	{ "d83_30.ic9",				0x040000, 0xeb86dc67, TAITO_SPRITEMAP },			// 25
1278 
1279 	{ "d83_01.ic40",			0x200000, 0x912799f4, TAITO_ES5505_BYTESWAP },		// 26 Ensoniq Samples/Data
1280 	{ "d83_02.ic39",			0x200000, 0x2abca020, TAITO_ES5505_BYTESWAP },		// 27
1281 	{ "d83_03.ic18",			0x200000, 0x1b2d9ec3, TAITO_ES5505_BYTESWAP },		// 28
1282 
1283 	{ "eeprom-cbombers.bin",	0x000080, 0x9f7368f4, TAITO_DEFAULT_EEPROM },		// 29 Defaults
1284 };
1285 
1286 STD_ROM_PICK(cbombers)
STD_ROM_FN(cbombers)1287 STD_ROM_FN(cbombers)
1288 
1289 static INT32 CbombersInit()
1290 {
1291 	return CommonInit(1);
1292 }
1293 
1294 struct BurnDriver BurnDrvCbombers = {
1295 	"cbombers", NULL, NULL, NULL, "1994",
1296 	"Chase Bombers (World)\0", "With graphics issues", "Taito Corporation Japan", "K1100809A",
1297 	NULL, NULL, NULL, NULL,
1298 	BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0,
1299 	NULL, cbombersRomInfo, cbombersRomName, NULL, NULL, NULL, NULL, CbombersInputInfo, NULL,
1300 	CbombersInit, DrvExit, DrvFrame, CbombersDraw, DrvScan, &DrvRecalc, 0x4000,
1301 	320, 232, 4, 3
1302 };
1303 
1304 
1305 // Chase Bombers (Japan)
1306 
1307 static struct BurnRomInfo cbombersjRomDesc[] = {
1308 	{ "d83_34.ic17",			0x080000, 0x78e85cb1, TAITO_68KROM1_BYTESWAP32 },	//  0 M68EC020 Code
1309 	{ "d83_36.ic4",				0x080000, 0xfdc936cf, TAITO_68KROM1_BYTESWAP32 },	//  1
1310 	{ "d83_35.ic3",				0x080000, 0xb0379b1e, TAITO_68KROM1_BYTESWAP32 },	//  2
1311 	{ "d83_33.ic16",			0x080000, 0x72fb42a7, TAITO_68KROM1_BYTESWAP32 },	//  3
1312 
1313 	{ "d83_26.ic37",			0x020000, 0x4f49b484, TAITO_68KROM2_BYTESWAP },		//  4 Sound 68K Code
1314 	{ "d83_27.ic38",			0x020000, 0x2aa1a237, TAITO_68KROM2_BYTESWAP },		//  5
1315 
1316 	{ "d83_28.ic26",			0x020000, 0x06328ef7, TAITO_68KROM3_BYTESWAP },		//  6 Sub 68k Code
1317 	{ "d83_29.ic27",			0x020000, 0x771b4080, TAITO_68KROM3_BYTESWAP },		//  7
1318 
1319 	{ "d83_04.ic8",				0x200000, 0x79f36cce, TAITO_CHARS_BYTESWAP },		//  8 Background Tiles
1320 	{ "d83_05.ic7",				0x200000, 0x7787e495, TAITO_CHARS_BYTESWAP },		//  9
1321 
1322 	{ "d83_06.ic28",			0x200000, 0x4b71944e, TAITO_SPRITESA_BYTESWAP32 },	// 10 Sprites
1323 	{ "d83_07.ic30",			0x200000, 0x29861b61, TAITO_SPRITESA_BYTESWAP32 },	// 11
1324 	{ "d83_08.ic32",			0x200000, 0xa0e81e01, TAITO_SPRITESA_BYTESWAP32 },	// 12
1325 	{ "d83_09.ic45",			0x200000, 0x7e4dec50, TAITO_SPRITESA_BYTESWAP32 },	// 13
1326 	{ "d83_11.ic41",			0x100000, 0xa790e490, TAITO_SPRITESA_BYTESWAP32 },	// 14
1327 	{ "d83_12.ic29",			0x100000, 0x2f237b0d, TAITO_SPRITESA_BYTESWAP32 },	// 15
1328 	{ "d83_13.ic31",			0x100000, 0xc2cceeb6, TAITO_SPRITESA_BYTESWAP32 },	// 16
1329 	{ "d83_14.ic44",			0x100000, 0x8b6f4f12, TAITO_SPRITESA_BYTESWAP32 },	// 17
1330 	{ "d83_10.ic43",			0x200000, 0x36c440a0, TAITO_SPRITESA },				// 18
1331 	{ "d83_15.ic42",			0x100000, 0x1b71175e, TAITO_SPRITESA },				// 19
1332 
1333 	{ "d83_16.ic19",			0x100000, 0xd364cf1e, TAITO_CHARS_PIVOT },			// 20 PIV Tiles
1334 	{ "d83_17.ic5",				0x100000, 0x0ffe737c, TAITO_CHARS_PIVOT },			// 21
1335 	{ "d83_18.ic6",				0x100000, 0x87979155, TAITO_CHARS_PIVOT },			// 22
1336 
1337 	{ "d83_31.ic10",			0x040000, 0x85c37961, TAITO_SPRITEMAP },			// 23 Sprite Map
1338 	{ "d83_32.ic11",			0x040000, 0xb0db2559, TAITO_SPRITEMAP },			// 24
1339 	{ "d83_30.ic9",				0x040000, 0xeb86dc67, TAITO_SPRITEMAP },			// 25
1340 
1341 	{ "d83_01.ic40",			0x200000, 0x912799f4, TAITO_ES5505_BYTESWAP },		// 26 Ensoniq Samples/Data
1342 	{ "d83_02.ic39",			0x200000, 0x2abca020, TAITO_ES5505_BYTESWAP },		// 27
1343 	{ "d83_03.ic18",			0x200000, 0x1b2d9ec3, TAITO_ES5505_BYTESWAP },		// 28
1344 
1345 	{ "eeprom-cbombers.bin",	0x000080, 0x9f7368f4, TAITO_DEFAULT_EEPROM },		// 29 Defaults
1346 };
1347 
1348 STD_ROM_PICK(cbombersj)
1349 STD_ROM_FN(cbombersj)
1350 
1351 struct BurnDriver BurnDrvCbombersj = {
1352 	"cbombersj", "cbombers", NULL, NULL, "1994",
1353 	"Chase Bombers (Japan)\0", "With graphics issues", "Taito Corporation", "K1100809A",
1354 	NULL, NULL, NULL, NULL,
1355 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0,
1356 	NULL, cbombersjRomInfo, cbombersjRomName, NULL, NULL, NULL, NULL, CbombersInputInfo, NULL,
1357 	CbombersInit, DrvExit, DrvFrame, CbombersDraw, DrvScan, &DrvRecalc, 0x4000,
1358 	320, 232, 4, 3
1359 };
1360 
1361 
1362 // Chase Bombers (Japan Prototype)
1363 
1364 static struct BurnRomInfo cbomberspRomDesc[] = {
1365 	{ "hh.bin",					0x080000, 0x8ee7b6c2, TAITO_68KROM1_BYTESWAP32 },	//  0 M68EC020 Code
1366 	{ "hl.bin",					0x080000, 0x63683ed8, TAITO_68KROM1_BYTESWAP32 },	//  1
1367 	{ "lh.bin",					0x080000, 0x77ad9acb, TAITO_68KROM1_BYTESWAP32 },	//  2
1368 	{ "ll.bin",					0x080000, 0x54c060a5, TAITO_68KROM1_BYTESWAP32 },	//  3
1369 
1370 	{ "ic47_eprg_h_up_c5c5.bin",0x020000, 0xcb0d11b1, TAITO_68KROM2_BYTESWAP },		//  4 Sound 68K Code
1371 	{ "ic46_eprg_l_low_d5e.bin",0x020000, 0x567ae215, TAITO_68KROM2_BYTESWAP },		//  5
1372 
1373 	{ "5-l.bin",				0x020000, 0xaed4c3c0, TAITO_68KROM3_BYTESWAP },		//  6 Sub 68k Code
1374 	{ "5-h.bin",				0x020000, 0xc6ec60e4, TAITO_68KROM3_BYTESWAP },		//  7
1375 
1376 	{ "scp0ll_ic7.bin",			0x080000, 0xb1af439d, TAITO_CHARS_BYTESWAP },		//  8 Background Tiles
1377 	{ "scp0hl_ic9.bin",			0x080000, 0x5b6e413e, TAITO_CHARS_BYTESWAP },		//  9
1378 	{ "scp0lh_ic22.bin",		0x080000, 0xd5109bca, TAITO_CHARS_BYTESWAP },		// 10
1379 	{ "scp0aa_2b04_ic35.bin",	0x080000, 0xb8ec56bd, TAITO_CHARS_BYTESWAP },		// 11
1380 	{ "scp1ll_ic8.bin",			0x080000, 0xeaa5839a, TAITO_CHARS_BYTESWAP },		// 12
1381 	{ "scp1hl_ic24.bin",		0x080000, 0x46d198ba, TAITO_CHARS_BYTESWAP },		// 13
1382 	{ "scp1lh_ic23.bin",		0x080000, 0x7c9f0035, TAITO_CHARS_BYTESWAP },		// 14
1383 	{ "scp1hh_ic36.bin",		0x080000, 0x24f545d8, TAITO_CHARS_BYTESWAP },		// 15
1384 
1385 	{ "obj0l_ic29.bin",			0x080000, 0x4b954950, TAITO_SPRITESA },				// 16 Sprites
1386 	{ "obj16l_ic20.bin",		0x080000, 0xb53932c0, TAITO_SPRITESA },				// 17
1387 	{ "obj32l_ic51.bin",		0x080000, 0xf23f7253, TAITO_SPRITESA },				// 18
1388 	{ "obj48l_ic53.bin",		0x080000, 0x85bb6b75, TAITO_SPRITESA },				// 19
1389 	{ "obj8l_ic4.bin",			0x080000, 0xd26140bb, TAITO_SPRITESA },				// 20
1390 	{ "obj24l_ic50.bin",		0x080000, 0x27c76f27, TAITO_SPRITESA },				// 21
1391 	{ "obj40l_ic52.bin",		0x080000, 0x09aaf6c5, TAITO_SPRITESA },				// 22
1392 	{ "obj56l_ic54.bin",		0x080000, 0x8b6bacdf, TAITO_SPRITESA },				// 23
1393 	{ "obj64l_ic55.bin",		0x080000, 0x18c976f1, TAITO_SPRITESA },				// 24
1394 	{ "obj72l_ic56.bin",		0x080000, 0x6a1b5ebc, TAITO_SPRITESA },				// 25
1395 	{ "obj0h_ic30.bin",			0x080000, 0x4c436ad2, TAITO_SPRITESA },				// 26
1396 	{ "obj16h_ic21.bin",		0x080000, 0x5406b71e, TAITO_SPRITESA },				// 27
1397 	{ "ic65_4b57.bin",			0x080000, 0x6a1a8054, TAITO_SPRITESA },				// 28
1398 	{ "ic67_0956.bin",			0x080000, 0xabe445dd, TAITO_SPRITESA },				// 29
1399 	{ "obj8l_ic5.bin",			0x080000, 0x46b028eb, TAITO_SPRITESA },				// 30
1400 	{ "ic64_5aba.bin",			0x080000, 0x0912b766, TAITO_SPRITESA },				// 31
1401 	{ "ic66_4ae9.bin",			0x080000, 0x77aafe1a, TAITO_SPRITESA },				// 32
1402 	{ "ic68_1429.bin",			0x080000, 0x2e5857e5, TAITO_SPRITESA },				// 33
1403 	{ "ic69_43b4.bin",			0x080000, 0xd08643be, TAITO_SPRITESA },				// 34
1404 	{ "ic70_4504.bin",			0x080000, 0x3cf5d9d7, TAITO_SPRITESA },				// 35
1405 	{ "obj0l_ic31.bin",			0x080000, 0x9a20d601, TAITO_SPRITESA },				// 36
1406 	{ "obj16l_ic33.bin",		0x080000, 0xea9df360, TAITO_SPRITESA },				// 37
1407 	{ "ic77_36ac.bin",			0x080000, 0x75628014, TAITO_SPRITESA },				// 38
1408 	{ "ic79_ef40.bin",			0x080000, 0x6af34bbf, TAITO_SPRITESA },				// 39
1409 	{ "obj8l_ic6.bin",			0x080000, 0x2037aad5, TAITO_SPRITESA },				// 40
1410 	{ "ic76_443a.bin",			0x080000, 0xe5820610, TAITO_SPRITESA },				// 41
1411 	{ "ic78_989c.bin",			0x080000, 0x23ec2896, TAITO_SPRITESA },				// 42
1412 	{ "ic80_d511.bin",			0x080000, 0x37da5baf, TAITO_SPRITESA },				// 43
1413 	{ "ic81_e150.bin",			0x080000, 0x48dbc4fb, TAITO_SPRITESA },				// 44
1414 	{ "ic82_3d3d.bin",			0x080000, 0x3e62970e, TAITO_SPRITESA },				// 45
1415 
1416 	{ "ic44_scc1.bin",			0x080000, 0x868d0d3d, TAITO_CHARS_PIVOT },			// 46 PIV Tiles
1417 	{ "ic43_scc4.bin",			0x080000, 0x2f170ee4, TAITO_CHARS_PIVOT },			// 47
1418 	{ "ic45_5cc2.bin",			0x080000, 0x7ae48d63, TAITO_CHARS_PIVOT },			// 48
1419 	{ "ic58_f357.bin",			0x080000, 0x16486967, TAITO_CHARS_PIVOT },			// 49
1420 	{ "ic57_1a62.bin",			0x080000, 0xafd45e35, TAITO_CHARS_PIVOT },			// 50
1421 	{ "ic59_7cce.bin",			0x080000, 0xee762199, TAITO_CHARS_PIVOT },			// 51
1422 
1423 	{ "st8_ic2.bin",			0x040000, 0xd74254d8, TAITO_SPRITEMAP },			// 52 Sprite Map
1424 	{ "st0_ic1.bin",			0x040000, 0xc414c479, TAITO_SPRITEMAP },			// 53
1425 	{ "st16_ic3.bin",			0x040000, 0xc4ff6b2f, TAITO_SPRITEMAP },			// 54
1426 
1427 	{ "ic84_0816_wave0.bin",	0x080000, 0xc30c71fd, TAITO_ES5505_BYTESWAP },		// 55 Ensoniq Samples/Data
1428 	{ "ic85_8058_wave1.bin",	0x080000, 0xfe37d544, TAITO_ES5505_BYTESWAP },		// 56
1429 	{ "ic86_9e88_wave2.bin",	0x080000, 0xd6dcb45d, TAITO_ES5505_BYTESWAP },		// 57
1430 	{ "ic87_42e7_wave3.bin",	0x080000, 0xfe52856b, TAITO_ES5505_BYTESWAP },		// 58
1431 	{ "ic88_2704_wave4.bin",	0x080000, 0xcba55d36, TAITO_ES5505_BYTESWAP },		// 59
1432 	{ "ic107_3a9c_wave14.bin",	0x080000, 0x26312451, TAITO_ES5505_BYTESWAP },		// 60
1433 	{ "ic108_a148_wave15.bin",	0x080000, 0x2edaa9dc, TAITO_ES5505_BYTESWAP },		// 61
1434 };
1435 
1436 STD_ROM_PICK(cbombersp)
STD_ROM_FN(cbombersp)1437 STD_ROM_FN(cbombersp)
1438 
1439 static INT32 CbomberspInit()
1440 {
1441 	return CommonInit(2);
1442 }
1443 
1444 struct BurnDriver BurnDrvCbombersp = {
1445 	"cbombersp", "cbombers", NULL, NULL, "1994",
1446 	"Chase Bombers (Japan Prototype)\0", "With graphics issues", "Taito Corporation", "Miscellaneous",
1447 	NULL, NULL, NULL, NULL,
1448 	BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0,
1449 	NULL, cbomberspRomInfo, cbomberspRomName, NULL, NULL, NULL, NULL, CbombersInputInfo, NULL,
1450 	CbomberspInit, DrvExit, DrvFrame, CbombersDraw, DrvScan, &DrvRecalc, 0x4000,
1451 	320, 232, 4, 3
1452 };
1453