1 // FB Alpha Best League (Big Striker bootleg) driver module
2 // Based on MAME driver by David Haywood & Angelo Salese
3 
4 #include "tiles_generic.h"
5 #include "m68000_intf.h"
6 #include "msm6295.h"
7 #include "burn_pal.h"
8 
9 static UINT8 *AllMem;
10 static UINT8 *MemEnd;
11 static UINT8 *AllRam;
12 static UINT8 *RamEnd;
13 static UINT8 *Drv68KROM;
14 static UINT8 *DrvGfxROM0;
15 static UINT8 *DrvGfxROM1;
16 static UINT8 *DrvGfxROM2;
17 static UINT8 *DrvSndROM;
18 static UINT8 *Drv68KRAM;
19 static UINT8 *DrvBgRAM;
20 static UINT8 *DrvFgRAM;
21 static UINT8 *DrvTxRAM;
22 static UINT8 *DrvSprRAM;
23 
24 static UINT8 DrvRecalc;
25 
26 static UINT8 okibank;
27 static UINT16 scroll[8];
28 
29 static UINT8 DrvJoy1[8];
30 static UINT8 DrvJoy2[8];
31 static UINT8 DrvJoy3[8];
32 static UINT8 DrvDips[2];
33 static UINT8 DrvInputs[3];
34 static UINT8 DrvReset;
35 
36 static struct BurnInputInfo BestleagInputList[] = {
37 	{"P1 Coin",		BIT_DIGITAL,	DrvJoy1 + 6,	"p1 coin"	},
38 	{"P1 Start",		BIT_DIGITAL,	DrvJoy1 + 0,	"p1 start"	},
39 	{"P1 Up",		BIT_DIGITAL,	DrvJoy2 + 3,	"p1 up"		},
40 	{"P1 Down",		BIT_DIGITAL,	DrvJoy2 + 2,	"p1 down"	},
41 	{"P1 Left",		BIT_DIGITAL,	DrvJoy2 + 1,	"p1 left"	},
42 	{"P1 Right",		BIT_DIGITAL,	DrvJoy2 + 0,	"p1 right"	},
43 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy2 + 4,	"p1 fire 1"	},
44 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy2 + 5,	"p1 fire 2"	},
45 	{"P1 Button 3",		BIT_DIGITAL,	DrvJoy2 + 6,	"p1 fire 3"	},
46 
47 	{"P2 Coin",		BIT_DIGITAL,	DrvJoy1 + 7,	"p2 coin"	},
48 	{"P2 Start",		BIT_DIGITAL,	DrvJoy1 + 1,	"p2 start"	},
49 	{"P2 Up",		BIT_DIGITAL,	DrvJoy3 + 3,	"p2 up"		},
50 	{"P2 Down",		BIT_DIGITAL,	DrvJoy3 + 2,	"p2 down"	},
51 	{"P2 Left",		BIT_DIGITAL,	DrvJoy3 + 1,	"p2 left"	},
52 	{"P2 Right",		BIT_DIGITAL,	DrvJoy3 + 0,	"p2 right"	},
53 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy3 + 4,	"p2 fire 1"	},
54 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy3 + 5,	"p2 fire 2"	},
55 	{"P2 Button 3",		BIT_DIGITAL,	DrvJoy3 + 6,	"p2 fire 3"	},
56 
57 	{"Reset",		BIT_DIGITAL,	&DrvReset,	"reset"		},
58 	{"Dip A",		BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
59 	{"Dip B",		BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
60 };
61 
62 STDINPUTINFO(Bestleag)
63 
64 static struct BurnDIPInfo BestleagDIPList[]=
65 {
66 	{0x13, 0xff, 0xff, 0xff, NULL			},
67 	{0x14, 0xff, 0xff, 0xff, NULL			},
68 
69 	{0   , 0xfe, 0   ,    11, "Coin A"		},
70 	{0x13, 0x01, 0x0f, 0x07, "4 Coins 1 Credits"	},
71 	{0x13, 0x01, 0x0f, 0x08, "3 Coins 1 Credits"	},
72 	{0x13, 0x01, 0x0f, 0x09, "2 Coins 1 Credits"	},
73 	{0x13, 0x01, 0x0f, 0x0f, "1 Coin  1 Credits"	},
74 	{0x13, 0x01, 0x0f, 0x06, "2 Coins 3 Credits"	},
75 	{0x13, 0x01, 0x0f, 0x0e, "1 Coin  2 Credits"	},
76 	{0x13, 0x01, 0x0f, 0x0d, "1 Coin  3 Credits"	},
77 	{0x13, 0x01, 0x0f, 0x0c, "1 Coin  4 Credits"	},
78 	{0x13, 0x01, 0x0f, 0x0b, "1 Coin  5 Credits"	},
79 	{0x13, 0x01, 0x0f, 0x0a, "1 Coin  6 Credits"	},
80 	{0x13, 0x01, 0x0f, 0x00, "Free Play"		},
81 
82 	{0   , 0xfe, 0   ,    11, "Coin B"		},
83 	{0x13, 0x01, 0xf0, 0x70, "4 Coins 1 Credits"	},
84 	{0x13, 0x01, 0xf0, 0x80, "3 Coins 1 Credits"	},
85 	{0x13, 0x01, 0xf0, 0x90, "2 Coins 1 Credits"	},
86 	{0x13, 0x01, 0xf0, 0xf0, "1 Coin  1 Credits"	},
87 	{0x13, 0x01, 0xf0, 0x60, "2 Coins 3 Credits"	},
88 	{0x13, 0x01, 0xf0, 0xe0, "1 Coin  2 Credits"	},
89 	{0x13, 0x01, 0xf0, 0xd0, "1 Coin  3 Credits"	},
90 	{0x13, 0x01, 0xf0, 0xc0, "1 Coin  4 Credits"	},
91 	{0x13, 0x01, 0xf0, 0xb0, "1 Coin  5 Credits"	},
92 	{0x13, 0x01, 0xf0, 0xa0, "1 Coin  6 Credits"	},
93 	{0x13, 0x01, 0xf0, 0x00, "Free Play"		},
94 
95 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
96 	{0x14, 0x01, 0x01, 0x01, "Off"			},
97 	{0x14, 0x01, 0x01, 0x00, "On"			},
98 
99 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
100 	{0x14, 0x01, 0x06, 0x02, "Easy"			},
101 	{0x14, 0x01, 0x06, 0x06, "Normal"		},
102 	{0x14, 0x01, 0x06, 0x04, "Hard"			},
103 	{0x14, 0x01, 0x06, 0x00, "Hardest"		},
104 
105 	{0   , 0xfe, 0   ,    4, "Timer Speed"		},
106 	{0x14, 0x01, 0x18, 0x08, "Slow"			},
107 	{0x14, 0x01, 0x18, 0x18, "Normal"		},
108 	{0x14, 0x01, 0x18, 0x10, "Fast"			},
109 	{0x14, 0x01, 0x18, 0x00, "Fastest"		},
110 
111 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
112 	{0x14, 0x01, 0x20, 0x00, "Off"			},
113 	{0x14, 0x01, 0x20, 0x20, "On"			},
114 
115 	{0   , 0xfe, 0   ,    2, "2 Players Game"	},
116 	{0x14, 0x01, 0x40, 0x40, "1 Credit"		},
117 	{0x14, 0x01, 0x40, 0x00, "2 Credits"		},
118 
119 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
120 	{0x14, 0x01, 0x80, 0x80, "Off"			},
121 	{0x14, 0x01, 0x80, 0x00, "On"			},
122 };
123 
STDDIPINFO(Bestleag)124 STDDIPINFO(Bestleag)
125 
126 static void oki_bankswitch(UINT32 data)
127 {
128 	data--;
129 
130 	if (data > 2) return;
131 
132 	okibank = data + 1;
133 
134 	MSM6295SetBank(0, MSM6295ROM + 0x20000 + (data * 0x20000), 0x20000, 0x3ffff);
135 }
136 
bestleag_write_word(UINT32 address,UINT16 data)137 static void __fastcall bestleag_write_word(UINT32 address, UINT16 data)
138 {
139 	switch (address)
140 	{
141 		case 0x0f8000:
142 		case 0x0f8002:
143 		case 0x0f8004:
144 		case 0x0f8006:
145 		case 0x0f8008:
146 		case 0x0f800a:
147 			scroll[(address / 2) & 7] = data;
148 		return;
149 	}
150 }
151 
bestleag_write_byte(UINT32 address,UINT8 data)152 static void __fastcall bestleag_write_byte(UINT32 address, UINT8 data)
153 {
154 	switch (address)
155 	{
156 		case 0x30001d:
157 			oki_bankswitch(data);
158 		return;
159 
160 		case 0x30001f:
161 			MSM6295Write(0, data);
162 		return;
163 
164 		case 0x304000:
165 		return; // nop
166 	}
167 }
168 
bestleag_read_word(UINT32 address)169 static UINT16 __fastcall bestleag_read_word(UINT32 address)
170 {
171 	switch (address)
172 	{
173 		case 0x300010:
174 			return DrvInputs[0];
175 
176 		case 0x300012:
177 			return DrvInputs[1];
178 
179 		case 0x300014:
180 			return DrvInputs[2];
181 
182 		case 0x300016:
183 			return DrvDips[0];
184 
185 		case 0x300018:
186 			return DrvDips[1];
187 	}
188 
189 	return 0;
190 }
191 
bestleag_read_byte(UINT32 address)192 static UINT8 __fastcall bestleag_read_byte(UINT32 address)
193 {
194 	switch (address)
195 	{
196 		case 0x30001f:
197 			return MSM6295Read(0);
198 	}
199 
200 	return 0;
201 }
202 
tilemap_scan(tilemap)203 static tilemap_scan( tilemap )
204 {
205 	int offset;
206 
207 	offset = ((col&0xf)*16) + (row&0xf);
208 	offset += (col >> 4) * 0x100;
209 	offset += (row >> 4) * 0x800;
210 
211 	return offset;
212 }
213 
tilemap_callback(text)214 static tilemap_callback( text )
215 {
216 	UINT16 *ram = (UINT16*)DrvTxRAM;
217 
218 	UINT16 code = ram[offs];
219 
220 	TILE_SET_INFO(0, code & 0xfff, code >> 12, 0);
221 }
222 
tilemap_callback(background)223 static tilemap_callback( background )
224 {
225 	UINT16 *ram = (UINT16*)DrvBgRAM;
226 
227 	UINT16 code = ram[offs];
228 
229 	TILE_SET_INFO(1, code & 0xfff, code >> 12, 0);
230 }
231 
tilemap_callback(foreground)232 static tilemap_callback( foreground )
233 {
234 	UINT16 *ram = (UINT16*)DrvFgRAM;
235 
236 	UINT16 code = ram[offs];
237 
238 	TILE_SET_INFO(2, code & 0xfff, code >> 12, 0);
239 }
240 
DrvDoReset()241 static INT32 DrvDoReset()
242 {
243 	memset (AllRam, 0, RamEnd - AllRam);
244 
245 	SekOpen(0);
246 	SekReset();
247 	SekClose();
248 
249 	MSM6295Reset(0);
250 	oki_bankswitch(0);
251 
252 	memset (scroll, 0, 8 * sizeof(INT16));
253 
254 	return 0;
255 }
256 
MemIndex()257 static INT32 MemIndex()
258 {
259 	UINT8 *Next; Next = AllMem;
260 
261 	Drv68KROM	= Next; Next += 0x040000;
262 
263 	DrvGfxROM0	= Next; Next += 0x040000;
264 	DrvGfxROM1	= Next; Next += 0x200000;
265 	DrvGfxROM2	= Next; Next += 0x100000;
266 
267 	MSM6295ROM	= Next;
268 	DrvSndROM	= Next; Next += 0x080000;
269 
270 	BurnPalette	= (UINT32*)Next; Next += 0x0400 * sizeof(UINT32);
271 
272 	AllRam		= Next;
273 
274 	Drv68KRAM	= Next; Next += 0x020000;
275 	BurnPalRAM	= Next; Next += 0x001000;
276 	DrvBgRAM	= Next; Next += 0x004000;
277 	DrvFgRAM	= Next; Next += 0x004000;
278 	DrvTxRAM	= Next; Next += 0x004000;
279 	DrvSprRAM	= Next; Next += 0x001000;
280 
281 	RamEnd		= Next;
282 
283 	MemEnd		= Next;
284 
285 	return 0;
286 }
287 
DrvGfxDecode()288 static INT32 DrvGfxDecode()
289 {
290 	INT32 Plane[4]  = { (0x40000 * 8) * 3, (0x40000 * 8) * 2, (0x40000 * 8) * 1, (0x40000 * 8) * 0 };
291 	INT32 XOffs[16] = { STEP8(0,1), STEP8(128,1) };
292 	INT32 YOffs[16] = { STEP16(0,8) };
293 	INT32 YOffs0[8] = { 0, 16, 32, 48, 8, 24, 40, 56 };
294 
295 	UINT8 *tmp = (UINT8*)BurnMalloc(0x200000);
296 	if (tmp == NULL) {
297 		return 1;
298 	}
299 
300 	memcpy (tmp + 0x000000, DrvGfxROM1 + 0x040000, 0x040000);
301 	memcpy (tmp + 0x040000, DrvGfxROM1 + 0x0c0000, 0x040000);
302 	memcpy (tmp + 0x080000, DrvGfxROM1 + 0x140000, 0x040000);
303 	memcpy (tmp + 0x0c0000, DrvGfxROM1 + 0x1c0000, 0x040000);
304 
305 	GfxDecode(0x1000, 4,  8,  8, Plane, XOffs, YOffs0, 0x040, tmp, DrvGfxROM0);
306 
307 	memcpy (tmp + 0x000000, DrvGfxROM1 + 0x000000, 0x040000);
308 	memcpy (tmp + 0x040000, DrvGfxROM1 + 0x080000, 0x040000);
309 	memcpy (tmp + 0x080000, DrvGfxROM1 + 0x100000, 0x040000);
310 	memcpy (tmp + 0x0c0000, DrvGfxROM1 + 0x180000, 0x040000);
311 
312 	GfxDecode(0x2000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM1);
313 
314 	memcpy (tmp, DrvGfxROM2, 0x100000);
315 
316 	GfxDecode(0x1000, 4, 16, 16, Plane, XOffs, YOffs, 0x100, tmp, DrvGfxROM2);
317 
318 	BurnFree (tmp);
319 
320 	return 0;
321 }
322 
DrvInit()323 static INT32 DrvInit()
324 {
325 	AllMem = NULL;
326 	MemIndex();
327 	INT32 nLen = MemEnd - (UINT8 *)0;
328 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
329 	memset(AllMem, 0, nLen);
330 	MemIndex();
331 
332 	{
333 		if (BurnLoadRom(Drv68KROM  + 0x000001,  0, 2)) return 1;
334 		if (BurnLoadRom(Drv68KROM  + 0x000000,  1, 2)) return 1;
335 
336 		if (BurnLoadRom(DrvGfxROM1 + 0x000000,  2, 1)) return 1;
337 		if (BurnLoadRom(DrvGfxROM1 + 0x080000,  3, 1)) return 1;
338 		if (BurnLoadRom(DrvGfxROM1 + 0x100000,  4, 1)) return 1;
339 		if (BurnLoadRom(DrvGfxROM1 + 0x180000,  5, 1)) return 1;
340 
341 		if (BurnLoadRom(DrvGfxROM2 + 0x000000,  6, 1)) return 1;
342 		if (BurnLoadRom(DrvGfxROM2 + 0x040000,  7, 1)) return 1;
343 		if (BurnLoadRom(DrvGfxROM2 + 0x080000,  8, 1)) return 1;
344 		if (BurnLoadRom(DrvGfxROM2 + 0x0c0000,  9, 1)) return 1;
345 
346 		if (BurnLoadRom(DrvSndROM  + 0x000000, 10, 1)) return 1;
347 
348 		DrvGfxDecode();
349 	}
350 
351 	SekInit(0, 0x68000);
352 	SekOpen(0);
353 	SekMapMemory(Drv68KROM,		0x000000, 0x03ffff, MAP_ROM);
354 	SekMapMemory(DrvBgRAM,		0x0e0000, 0x0e3fff, MAP_RAM);
355 	SekMapMemory(DrvFgRAM,		0x0e8000, 0x0ebfff, MAP_RAM);
356 	SekMapMemory(DrvTxRAM,		0x0f0000, 0x0f3fff, MAP_RAM);
357 	SekMapMemory(BurnPalRAM,	0x100000, 0x100fff, MAP_RAM);
358 	SekMapMemory(DrvSprRAM,		0x200000, 0x200fff, MAP_RAM);
359 	SekMapMemory(Drv68KRAM,		0xfe0000, 0xffffff, MAP_RAM);
360 	SekSetWriteWordHandler(0,	bestleag_write_word);
361 	SekSetWriteByteHandler(0,	bestleag_write_byte);
362 	SekSetReadWordHandler(0,	bestleag_read_word);
363 	SekSetReadByteHandler(0,	bestleag_read_byte);
364 	SekClose();
365 
366 	MSM6295Init(0, 1000000 / 132, 0);
367 	MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH);
368 
369 	GenericTilesInit();
370 	GenericTilemapInit(0, TILEMAP_SCAN_COLS, text_map_callback,        8,  8, 256, 32);
371 	GenericTilemapInit(1, tilemap_map_scan,  background_map_callback, 16, 16, 128, 64);
372 	GenericTilemapInit(2, tilemap_map_scan,  foreground_map_callback, 16, 16, 128, 64);
373 	GenericTilemapSetGfx(0, DrvGfxROM0 + 0x000000, 4,  8,  8, 0x040000, 0x200, 0xf);
374 	GenericTilemapSetGfx(1, DrvGfxROM1 + 0x000000, 4, 16, 16, 0x100000, 0x000, 0xf);
375 	GenericTilemapSetGfx(2, DrvGfxROM1 + 0x100000, 4, 16, 16, 0x100000, 0x100, 0xf);
376 	GenericTilemapSetOffsets(TMAP_GLOBAL, 0, -16);
377 	GenericTilemapSetTransparent(0, 0xf);
378 	GenericTilemapSetTransparent(2, 0xf);
379 
380 	DrvDoReset();
381 
382 	return 0;
383 }
384 
DrvExit()385 static INT32 DrvExit()
386 {
387 	GenericTilesExit();
388 
389 	MSM6295Exit(0);
390 	SekExit();
391 
392 	BurnFree (AllMem);
393 
394 	MSM6295ROM = NULL;
395 
396 	return 0;
397 }
398 
draw_single_sprite(INT32 code,INT32 color,INT32 sx,INT32 sy,INT32 flipx,INT32 flipy)399 static void draw_single_sprite(INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy)
400 {
401 	if (flipy) {
402 		if (flipx) {
403 			Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0xf, 0x300, DrvGfxROM2);
404 		} else {
405 			Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0xf, 0x300, DrvGfxROM2);
406 		}
407 	} else {
408 		if (flipx) {
409 			Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0xf, 0x300, DrvGfxROM2);
410 		} else {
411 			Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0xf, 0x300, DrvGfxROM2);
412 		}
413 	}
414 }
415 
draw_sprites()416 static void draw_sprites()
417 {
418 	UINT16 *ram = (UINT16*)DrvSprRAM;
419 
420 	INT32 color_mask = (scroll[0] & 0x1000) ? 0x7 : 0xf;
421 
422 	for (INT32 offs = 0x16/2;offs < 0x1000/2;offs += 4)
423 	{
424 		if (ram[offs] & 0x2000) break;
425 
426 		INT32 code  = (ram[offs+3] & 0xfff);
427 		INT32 color = (ram[offs+2] >> 12) & color_mask;
428 		INT32 sx    = (ram[offs+2] & 0x1ff) - 20;
429 		INT32 sy    = (0xff - (ram[offs] & 0xff)) - (15 + 16);
430 		INT32 flipx = (ram[offs] & 0x4000) >> 14;
431 
432 		draw_single_sprite(code+0, color, flipx ? (sx+16) : (sx), sy, flipx, 0);
433 		draw_single_sprite(code+1, color, flipx ? (sx) : (sx+16), sy, flipx, 0);
434 		draw_single_sprite(code+0, color, flipx ? (sx+16 - 512) : (sx - 512), sy, flipx, 0);
435 		draw_single_sprite(code+1, color, flipx ? (sx - 512) : (sx+16 - 512), sy, flipx, 0);
436 	}
437 }
438 
BestleagDraw()439 static INT32 BestleagDraw()
440 {
441 	if (DrvRecalc) {
442 		BurnPaletteUpdate_RRRRGGGGBBBBRGBx();
443 		DrvRecalc = 1;
444 	}
445 
446 	GenericTilemapSetScrollX(1, (scroll[0] & 0xfff) + ((scroll[4] & 7) - 3));
447 	GenericTilemapSetScrollY(1, scroll[1]);
448 	GenericTilemapSetScrollX(0, scroll[2]);
449 	GenericTilemapSetScrollY(0, scroll[3]);
450 	GenericTilemapSetScrollX(2, scroll[4] & 0xfff8);
451 	GenericTilemapSetScrollY(2, scroll[5]);
452 
453 	if ((nBurnLayer & 1) == 0) BurnTransferClear();
454 
455 	if (nBurnLayer & 1) GenericTilemapDraw(1, pTransDraw, 0);
456 	if (nBurnLayer & 2) GenericTilemapDraw(2, pTransDraw, 0);
457 	if (nBurnLayer & 4) draw_sprites();
458 	if (nBurnLayer & 8) GenericTilemapDraw(0, pTransDraw, 0);
459 
460 	BurnTransferCopy(BurnPalette);
461 
462 	return 0;
463 }
464 
BestleawDraw()465 static INT32 BestleawDraw()
466 {
467 	if (DrvRecalc) {
468 		BurnPaletteUpdate_RRRRGGGGBBBBRGBx();
469 		DrvRecalc = 1;
470 	}
471 
472 	GenericTilemapSetScrollX(1, scroll[4]);
473 	GenericTilemapSetScrollY(1, scroll[5]);
474 	GenericTilemapSetScrollX(0, scroll[0]);
475 	GenericTilemapSetScrollY(0, scroll[1]);
476 	GenericTilemapSetScrollX(2, scroll[2]);
477 	GenericTilemapSetScrollY(2, scroll[3]);
478 
479 	if ((nBurnLayer & 1) == 0) BurnTransferClear();
480 
481 	if (nBurnLayer & 1) GenericTilemapDraw(1, pTransDraw, 0);
482 	if (nBurnLayer & 2) GenericTilemapDraw(2, pTransDraw, 0);
483 	if (nBurnLayer & 4) draw_sprites();
484 	if (nBurnLayer & 8) GenericTilemapDraw(0, pTransDraw, 0);
485 
486 	BurnTransferCopy(BurnPalette);
487 
488 	return 0;
489 }
490 
DrvFrame()491 static INT32 DrvFrame()
492 {
493 	if (DrvReset) {
494 		DrvDoReset();
495 	}
496 
497 	{
498 		memset (DrvInputs, 0xff, 3);
499 
500 		for (INT32 i = 0; i < 8; i++)
501 		{
502 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
503 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
504 			DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
505 		}
506 	}
507 
508 	SekOpen(0);
509 	SekRun(12000000 / 60);
510 	SekSetIRQLine(6, CPU_IRQSTATUS_AUTO);
511 	SekClose();
512 
513 	if (pBurnSoundOut) {
514 		MSM6295Render(0, pBurnSoundOut, nBurnSoundLen);
515 	}
516 
517 	if (pBurnDraw) {
518 		BurnDrvRedraw();
519 	}
520 
521 	return 0;
522 }
523 
DrvScan(INT32 nAction,INT32 * pnMin)524 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
525 {
526 	struct BurnArea ba;
527 
528 	if (pnMin != NULL) {
529 		*pnMin = 0x029698;
530 	}
531 
532 	if (nAction & ACB_MEMORY_RAM) {
533 		memset(&ba, 0, sizeof(ba));
534 		ba.Data	  = AllRam;
535 		ba.nLen	  = RamEnd-AllRam;
536 		ba.szName = "All Ram";
537 		BurnAcb(&ba);
538 	}
539 
540 	if (nAction & ACB_DRIVER_DATA) {
541 		SekScan(nAction);
542 
543 		MSM6295Scan(nAction, pnMin);
544 
545 		SCAN_VAR(scroll);
546 		SCAN_VAR(okibank);
547 	}
548 
549 	if (nAction & ACB_WRITE) {
550 		oki_bankswitch(okibank);
551 	}
552 
553 	return 0;
554 }
555 
556 
557 // Best League (bootleg of Big Striker, Italian Serie A)
558 
559 static struct BurnRomInfo bestleagRomDesc[] = {
560 	{ "2.bin",			0x20000, 0xd2be3431, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
561 	{ "3.bin",			0x20000, 0xf29c613a, 1 | BRF_PRG | BRF_ESS }, //  1
562 
563 	{ "4.bin",			0x80000, 0x47f7c9bc, 2 | BRF_GRA },           //  2 Layer tiles
564 	{ "5.bin",			0x80000, 0x6a6f499d, 2 | BRF_GRA },           //  3
565 	{ "6.bin",			0x80000, 0x0c3d2609, 2 | BRF_GRA },           //  4
566 	{ "7.bin",			0x80000, 0xdcece871, 2 | BRF_GRA },           //  5
567 
568 	{ "27_27c010.u86",	0x20000, 0xa463422a, 3 | BRF_GRA },           //  6 Sprites
569 	{ "28_27c010.u85",	0x20000, 0xebec74ed, 3 | BRF_GRA },           //  7
570 	{ "29_27c010.u84",	0x20000, 0x7ea4e22d, 3 | BRF_GRA },           //  8
571 	{ "30_27c010.u83",	0x20000, 0x283d9ba6, 3 | BRF_GRA },           //  9
572 
573 	{ "20_27c040.u16",	0x80000, 0xe152138e, 4 | BRF_SND },           // 10 MSM6295 samples
574 };
575 
576 STD_ROM_PICK(bestleag)
577 STD_ROM_FN(bestleag)
578 
579 struct BurnDriver BurnDrvBestleag = {
580 	"bestleag", "bigstrik", NULL, NULL, "1993",
581 	"Best League (bootleg of Big Striker, Italian Serie A)\0", NULL, "bootleg", "Miscellaneous",
582 	NULL, NULL, NULL, NULL,
583 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_SPORTSFOOTBALL, 0,
584 	NULL, bestleagRomInfo, bestleagRomName, NULL, NULL, NULL, NULL, BestleagInputInfo, BestleagDIPInfo,
585 	DrvInit, DrvExit, DrvFrame, BestleagDraw, DrvScan, &DrvRecalc, 0x400,
586 	256, 224, 4, 3
587 };
588 
589 
590 // Best League (bootleg of Big Striker, World Cup)
591 
592 static struct BurnRomInfo bestleawRomDesc[] = {
593 	{ "21_27c101.u67",	0x20000, 0xab5abd37, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
594 	{ "22_27c010.u66",	0x20000, 0x4abc0580, 1 | BRF_PRG | BRF_ESS }, //  1
595 
596 	{ "23_27c040.u36",	0x80000, 0xdcd53a97, 2 | BRF_GRA },           //  2 Layer tiles
597 	{ "24_27c040.u42",	0x80000, 0x2984c1a0, 2 | BRF_GRA },           //  3
598 	{ "25_27c040.u38",	0x80000, 0x8bb5d73a, 2 | BRF_GRA },           //  4
599 	{ "26_27c4001.u45",	0x80000, 0xa82c905d, 2 | BRF_GRA },           //  5
600 
601 	{ "27_27c010.u86",	0x20000, 0xa463422a, 3 | BRF_GRA },           //  6 Sprites
602 	{ "28_27c010.u85",	0x20000, 0xebec74ed, 3 | BRF_GRA },           //  7
603 	{ "29_27c010.u84",	0x20000, 0x7ea4e22d, 3 | BRF_GRA },           //  8
604 	{ "30_27c010.u83",	0x20000, 0x283d9ba6, 3 | BRF_GRA },           //  9
605 
606 	{ "20_27c040.u16",	0x80000, 0xe152138e, 4 | BRF_SND },           // 10 MSM6295 samples
607 
608 	{ "85c060.bin",		0x0032f, 0x537100ac, 5 | BRF_OPT },           // 11 plds
609 	{ "gal16v8-25hb1.u182",	0x00117, 0x00000000, 5 | BRF_NODUMP | BRF_OPT },           // 12
610 	{ "gal16v8-25hb1.u183",	0x00117, 0x00000000, 5 | BRF_NODUMP | BRF_OPT },           // 13
611 	{ "gal16v8-25hb1.u58",	0x00117, 0x00000000, 5 | BRF_NODUMP | BRF_OPT },           // 14
612 	{ "palce20v8h-15pc-4.u38",0x157, 0x00000000, 5 | BRF_NODUMP | BRF_OPT },           // 15
613 };
614 
615 STD_ROM_PICK(bestleaw)
616 STD_ROM_FN(bestleaw)
617 
618 struct BurnDriver BurnDrvBestleaw = {
619 	"bestleaw", "bigstrik", NULL, NULL, "1993",
620 	"Best League (bootleg of Big Striker, World Cup)\0", NULL, "bootleg", "Miscellaneous",
621 	NULL, NULL, NULL, NULL,
622 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_POST90S, GBF_SPORTSFOOTBALL, 0,
623 	NULL, bestleawRomInfo, bestleawRomName, NULL, NULL, NULL, NULL, BestleagInputInfo, BestleagDIPInfo,
624 	DrvInit, DrvExit, DrvFrame, BestleawDraw, DrvScan, &DrvRecalc, 0x400,
625 	256, 224, 4, 3
626 };
627