1 // FB Alpha Boogie Wing / Great Ragtime Show driver module
2 // Based on MAME driver by Bryan McPhail and David Haywood
3 
4 #include "tiles_generic.h"
5 #include "m68000_intf.h"
6 #include "h6280_intf.h"
7 #include "deco16ic.h"
8 #include "deco146.h"
9 #include "msm6295.h"
10 #include "burn_ym2151.h"
11 
12 static UINT8 *AllMem;
13 static UINT8 *MemEnd;
14 static UINT8 *AllRam;
15 static UINT8 *RamEnd;
16 static UINT8 *Drv68KROM;
17 static UINT8 *Drv68KCode;
18 static UINT8 *DrvHucROM;
19 static UINT8 *DrvGfxROM0;
20 static UINT8 *DrvGfxROM1;
21 static UINT8 *DrvGfxROM2;
22 static UINT8 *DrvGfxROM3;
23 static UINT8 *DrvGfxROM4;
24 static UINT8 *DrvGfxROM5;
25 static UINT8 *DrvSndROM0;
26 static UINT8 *DrvSndROM1;
27 static UINT8 *Drv68KRAM;
28 static UINT8 *DrvHucRAM;
29 static UINT8 *DrvPalRAM;
30 static UINT8 *DrvSprRAM;
31 static UINT8 *DrvSprRAM1;
32 static UINT8 *DrvPalBuf;
33 static UINT8 *DrvSprBuf;
34 static UINT8 *DrvSprBuf1;
35 
36 static UINT32 *DrvPalette;
37 static UINT8 DrvRecalc;
38 
39 static UINT8 *flipscreen;
40 
41 static UINT8 DrvJoy1[16];
42 static UINT8 DrvJoy2[16];
43 static UINT8 DrvDips[2];
44 static UINT8 DrvReset;
45 static UINT16 DrvInputs[2];
46 
47 static UINT16 *tempdraw[2];
48 
49 static INT32 DrvOkiBank;
50 
51 static struct BurnInputInfo BoogwingInputList[] = {
52 	{"P1 Coin",		BIT_DIGITAL,	DrvJoy2 + 0,	"p1 coin"	},
53 	{"P1 Start",		BIT_DIGITAL,	DrvJoy1 + 7,	"p1 start"	},
54 	{"P1 Up",		BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
55 	{"P1 Down",		BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
56 	{"P1 Left",		BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
57 	{"P1 Right",		BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
58 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
59 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy1 + 5,	"p1 fire 2"	},
60 	{"P1 Button 3",		BIT_DIGITAL,	DrvJoy1 + 6,	"p1 fire 3"	},
61 
62 	{"P2 Coin",		BIT_DIGITAL,	DrvJoy2 + 1,	"p2 coin"	},
63 	{"P2 Start",		BIT_DIGITAL,	DrvJoy1 + 15,	"p2 start"	},
64 	{"P2 Up",		BIT_DIGITAL,	DrvJoy1 + 8,	"p2 up"		},
65 	{"P2 Down",		BIT_DIGITAL,	DrvJoy1 + 9,	"p2 down"	},
66 	{"P2 Left",		BIT_DIGITAL,	DrvJoy1 + 10,	"p2 left"	},
67 	{"P2 Right",		BIT_DIGITAL,	DrvJoy1 + 11,	"p2 right"	},
68 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy1 + 12,	"p2 fire 1"	},
69 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy1 + 13,	"p2 fire 2"	},
70 	{"P2 Button 3",		BIT_DIGITAL,	DrvJoy1 + 14,	"p2 fire 3"	},
71 
72 	{"Reset",		BIT_DIGITAL,	&DrvReset,	"reset"		},
73 	{"Service",		BIT_DIGITAL,	DrvJoy2 + 2,	"service"	},
74 	{"Dip A",		BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
75 	{"Dip B",		BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
76 };
77 
78 STDINPUTINFO(Boogwing)
79 
80 static struct BurnDIPInfo BoogwingDIPList[]=
81 {
82 	{0x14, 0xff, 0xff, 0xff, NULL			},
83 	{0x15, 0xff, 0xff, 0x7f, NULL			},
84 
85 	{0   , 0xfe, 0   ,    8, "Coin A"		},
86 	{0x14, 0x01, 0x07, 0x00, "3 Coins 1 Credits"	},
87 	{0x14, 0x01, 0x07, 0x01, "2 Coins 1 Credits"	},
88 	{0x14, 0x01, 0x07, 0x07, "1 Coin  1 Credits"	},
89 	{0x14, 0x01, 0x07, 0x06, "1 Coin  2 Credits"	},
90 	{0x14, 0x01, 0x07, 0x05, "1 Coin  3 Credits"	},
91 	{0x14, 0x01, 0x07, 0x04, "1 Coin  4 Credits"	},
92 	{0x14, 0x01, 0x07, 0x03, "1 Coin  5 Credits"	},
93 	{0x14, 0x01, 0x07, 0x02, "1 Coin  6 Credits"	},
94 
95 	{0   , 0xfe, 0   ,    8, "Coin B"		},
96 	{0x14, 0x01, 0x38, 0x00, "3 Coins 1 Credits"	},
97 	{0x14, 0x01, 0x38, 0x08, "2 Coins 1 Credits"	},
98 	{0x14, 0x01, 0x38, 0x38, "1 Coin  1 Credits"	},
99 	{0x14, 0x01, 0x38, 0x30, "1 Coin  2 Credits"	},
100 	{0x14, 0x01, 0x38, 0x28, "1 Coin  3 Credits"	},
101 	{0x14, 0x01, 0x38, 0x20, "1 Coin  4 Credits"	},
102 	{0x14, 0x01, 0x38, 0x18, "1 Coin  5 Credits"	},
103 	{0x14, 0x01, 0x38, 0x10, "1 Coin  6 Credits"	},
104 
105 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
106 	{0x14, 0x01, 0x40, 0x40, "Off"			},
107 	{0x14, 0x01, 0x40, 0x00, "On"			},
108 
109 	{0   , 0xfe, 0   ,    2, "Continue Coin"	},
110 	{0x14, 0x01, 0x80, 0x80, "Normal Coin Credit"	},
111 	{0x14, 0x01, 0x80, 0x00, "2 Start/1 Continue"	},
112 
113 	{0   , 0xfe, 0   ,    4, "Lives"		},
114 	{0x15, 0x01, 0x03, 0x01, "1"			},
115 	{0x15, 0x01, 0x03, 0x03, "2"			},
116 	{0x15, 0x01, 0x03, 0x02, "3"			},
117 	{0x15, 0x01, 0x03, 0x00, "4"			},
118 
119 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
120 	{0x15, 0x01, 0x0c, 0x08, "Easy"			},
121 	{0x15, 0x01, 0x0c, 0x0c, "Normal"		},
122 	{0x15, 0x01, 0x0c, 0x04, "Hard"			},
123 	{0x15, 0x01, 0x0c, 0x00, "Hardest"		},
124 
125 	{0   , 0xfe, 0   ,    2, "Coin Slots"		},
126 	{0x15, 0x01, 0x10, 0x10, "Common"		},
127 	{0x15, 0x01, 0x10, 0x00, "Individual"		},
128 
129 	{0   , 0xfe, 0   ,    2, "Stage Reset"		},
130 	{0x15, 0x01, 0x20, 0x20, "Point of Termination"	},
131 	{0x15, 0x01, 0x20, 0x00, "Beginning of Stage"	},
132 
133 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
134 	{0x15, 0x01, 0x80, 0x80, "Off"			},
135 	{0x15, 0x01, 0x80, 0x00, "On"			},
136 };
137 
STDDIPINFO(Boogwing)138 STDDIPINFO(Boogwing)
139 
140 static void __fastcall boogwing_main_write_byte(UINT32 address, UINT8 data)
141 {
142 	switch (address)
143 	{
144 		case 0x220000:
145 		case 0x220001:
146 			deco16_priority = data;
147 		return;
148 
149 		case 0x240000:
150 		case 0x240001:
151 			memcpy (DrvSprBuf , DrvSprRAM , 0x800);
152 		return;
153 
154 		case 0x244000:
155 		case 0x244001:
156 			memcpy (DrvSprBuf1, DrvSprRAM1, 0x800);
157 		return;
158 
159 		case 0x282008:
160 		case 0x282009:
161 			memcpy (DrvPalBuf, DrvPalRAM, 0x2000);
162 		return;
163 	}
164 
165 	if (address >= 0x24e000 && address <= 0x24efff) {
166 		deco146_104_prot_wb(0, address & 0xfff, data);
167 	}
168 }
169 
boogwing_main_write_word(UINT32 address,UINT16 data)170 static void __fastcall boogwing_main_write_word(UINT32 address, UINT16 data)
171 {
172 	deco16_write_control_word(0, address, 0x260000, data)
173 	deco16_write_control_word(1, address, 0x270000, data)
174 
175 	switch (address)
176 	{
177 		case 0x220000:
178 			deco16_priority = data;
179 		return;
180 
181 		case 0x240000:
182 			memcpy (DrvSprBuf , DrvSprRAM , 0x800);
183 		return;
184 
185 		case 0x244000:
186 			memcpy (DrvSprBuf1, DrvSprRAM1, 0x800);
187 		return;
188 
189 		case 0x282008:
190 			memcpy (DrvPalBuf, DrvPalRAM, 0x2000);
191 		return;
192 	}
193 
194 	if (address >= 0x24e000 && address <= 0x24efff) {
195 		deco146_104_prot_ww(0, address & 0xfff, data);
196 	}
197 }
198 
boogwing_main_read_byte(UINT32 address)199 static UINT8 __fastcall boogwing_main_read_byte(UINT32 address)
200 {
201 	if (address >= 0x24e000 && address <= 0x24efff) {
202 		return deco146_104_prot_rb(0, address & 0xfff);
203 	}
204 
205 	return 0;
206 }
207 
boogwing_main_read_word(UINT32 address)208 static UINT16 __fastcall boogwing_main_read_word(UINT32 address)
209 {
210 	if (address >= 0x24e000 && address <= 0x24efff) {
211 		return deco146_104_prot_rw(0, address & 0xfff);
212 	}
213 
214 	return 0;
215 }
216 
boogwing_bank_callback(const INT32 bank)217 static INT32 boogwing_bank_callback( const INT32 bank )
218 {
219 	return ((bank >> 4) & 0x7) * 0x1000;
220 }
221 
boogwing_bank_callback2(const INT32 bank)222 static INT32 boogwing_bank_callback2( const INT32 bank )
223 {
224 	INT32 offset = ((bank >> 4) & 0x7) * 0x1000;
225 	if ((bank & 0xf) == 0xa) offset += 0x800;
226 
227 	return offset;
228 }
229 
DrvYM2151WritePort(UINT32,UINT32 data)230 static void DrvYM2151WritePort(UINT32, UINT32 data)
231 {
232 	MSM6295SetBank(1, DrvSndROM1 + ((data & 0x02) >> 1) * 0x40000, 0, 0x3ffff);
233 	MSM6295SetBank(0, DrvSndROM0 + (data & 1) * 0x40000, 0, 0x3ffff);
234 	DrvOkiBank = data;
235 }
236 
inputs_read()237 static UINT16 inputs_read()
238 {
239 	return DrvInputs[0];
240 }
241 
system_read()242 static UINT16 system_read()
243 {
244 	return (DrvInputs[1] & 7) | deco16_vblank;
245 }
246 
dips_read()247 static UINT16 dips_read()
248 {
249 	return (DrvDips[1] << 8) | (DrvDips[0] << 0);
250 }
251 
soundlatch_write(UINT16 data)252 static void soundlatch_write(UINT16 data)
253 {
254 	deco16_soundlatch = data & 0xff;
255 	h6280SetIRQLine(0, CPU_IRQSTATUS_ACK);
256 }
257 
DrvDoReset()258 static INT32 DrvDoReset()
259 {
260 	memset (AllRam, 0, RamEnd - AllRam);
261 
262 	SekOpen(0);
263 	SekReset();
264 	SekClose();
265 
266 	deco16SoundReset();
267 	DrvYM2151WritePort(0, 0);
268 
269 	deco16Reset();
270 
271 	return 0;
272 }
273 
MemIndex()274 static INT32 MemIndex()
275 {
276 	UINT8 *Next; Next = AllMem;
277 
278 	Drv68KROM	= Next; Next += 0x100000;
279 	Drv68KCode	= Next; Next += 0x100000;
280 	DrvHucROM	= Next; Next += 0x010000;
281 
282 	DrvGfxROM0	= Next; Next += 0x040000;
283 	DrvGfxROM1	= Next; Next += 0x400000;
284 	DrvGfxROM5	= Next; Next += 0x100000;
285 	DrvGfxROM2	= Next; Next += 0x400000;
286 	DrvGfxROM3	= Next; Next += 0x800000;
287 	DrvGfxROM4	= Next; Next += 0x800000;
288 
289 	DrvSndROM0	= Next; Next += 0x080000;
290 	DrvSndROM1	= Next; Next += 0x080000;
291 
292 	DrvPalette	= (UINT32*)Next; Next += 0x0800 * sizeof(UINT32);
293 
294 	tempdraw[0]	= (UINT16*)Next; Next += 320 * 240 * sizeof(UINT16);
295 	tempdraw[1]	= (UINT16*)Next; Next += 320 * 240 * sizeof(UINT16);
296 
297 	AllRam		= Next;
298 
299 	Drv68KRAM	= Next; Next += 0x010000;
300 	DrvHucRAM	= Next; Next += 0x002000;
301 	DrvSprRAM	= Next; Next += 0x000800;
302 	DrvSprRAM1	= Next; Next += 0x000800;
303 	DrvSprBuf	= Next; Next += 0x000800;
304 	DrvSprBuf1	= Next; Next += 0x000800;
305 	DrvPalRAM	= Next; Next += 0x002000;
306 	DrvPalBuf	= Next; Next += 0x002000;
307 
308 	flipscreen	= Next; Next += 0x000001;
309 
310 	RamEnd		= Next;
311 
312 	MemEnd		= Next;
313 
314 	return 0;
315 }
316 
317 
DrvGfxDecode5bpp()318 static INT32 DrvGfxDecode5bpp()
319 {
320 	// actually 5 bits / pixel, but fba doesn't seem to like that...
321 	INT32 Plane[6] = { 0x1800000, 0x1000000, 0x800008, 0x800000, 0x000008, 0x000000 };
322 	INT32 XOffs[16] = { 32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7, 0, 1, 2, 3, 4, 5, 6, 7 };
323 	INT32 YOffs[16] = { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 };
324 
325 	UINT8 *tmp = (UINT8*)BurnMalloc(0x400000);
326 	if (tmp == NULL) {
327 		return 1;
328 	}
329 
330 	memcpy (tmp + 0x000000, DrvGfxROM1, 0x200000);
331 	memset (tmp + 0x200000, 0,          0x200000);
332 	memcpy (tmp + 0x200000, DrvGfxROM5, 0x100000);
333 
334 	GfxDecode(0x4000, 6, 16, 16, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM1);
335 
336 	for (INT32 i = 0; i < 0x400000; i++) DrvGfxROM1[i] &= 0x1f;
337 
338 	BurnFree (tmp);
339 
340 	return 0;
341 }
342 
DrvInit()343 static INT32 DrvInit()
344 {
345 	BurnSetRefreshRate(58.00);
346 
347 	AllMem = NULL;
348 	MemIndex();
349 	INT32 nLen = MemEnd - (UINT8 *)0;
350 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
351 	memset(AllMem, 0, nLen);
352 	MemIndex();
353 
354 	{
355 		if (BurnLoadRom(Drv68KROM  + 0x000001,  0, 2)) return 1;
356 		if (BurnLoadRom(Drv68KROM  + 0x000000,  1, 2)) return 1;
357 		if (BurnLoadRom(Drv68KROM  + 0x080001,  2, 2)) return 1;
358 		if (BurnLoadRom(Drv68KROM  + 0x080000,  3, 2)) return 1;
359 
360 		if (BurnLoadRom(DrvHucROM  + 0x000000,  4, 1)) return 1;
361 
362 		if (BurnLoadRom(DrvGfxROM0 + 0x000000,  5, 2)) return 1;
363 		if (BurnLoadRom(DrvGfxROM0 + 0x000001,  6, 2)) return 1;
364 
365 		if (BurnLoadRom(DrvGfxROM1 + 0x000000,  7, 1)) return 1;
366 		if (BurnLoadRom(DrvGfxROM1 + 0x100000,  8, 1)) return 1;
367 
368 		if (BurnLoadRom(DrvGfxROM5 + 0x000000,  9, 2)) return 1; // skip a byte!
369 
370 		if (BurnLoadRom(DrvGfxROM2 + 0x000000, 10, 1)) return 1;
371 		if (BurnLoadRom(DrvGfxROM2 + 0x100000, 11, 1)) return 1;
372 
373 		if (BurnLoadRom(DrvGfxROM3 + 0x000001, 12, 2)) return 1;
374 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 2)) return 1;
375 
376 		if (BurnLoadRom(DrvGfxROM4 + 0x000001, 14, 2)) return 1;
377 		if (BurnLoadRom(DrvGfxROM4 + 0x000000, 15, 2)) return 1;
378 
379 		if (BurnLoadRom(DrvSndROM0 + 0x000000, 16, 1)) return 1;
380 
381 		if (BurnLoadRom(DrvSndROM1 + 0x000000, 17, 1)) return 1;
382 
383 		deco56_decrypt_gfx(DrvGfxROM0, 0x020000);
384 		deco56_decrypt_gfx(DrvGfxROM1, 0x300000);
385 		deco56_decrypt_gfx(DrvGfxROM2, 0x200000);
386 		deco56_remap_gfx(DrvGfxROM5, 0x100000);
387 		deco102_decrypt_cpu(Drv68KROM, Drv68KCode, 0x100000, 0x42ba, 0x00, 0x18);
388 
389 		deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1);
390 		deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x200000, 0);
391 		deco16_sprite_decode(DrvGfxROM3, 0x400000);
392 		deco16_sprite_decode(DrvGfxROM4, 0x400000);
393 
394 		DrvGfxDecode5bpp();
395 	}
396 
397 	deco16Init(0, 0, 1);
398 	deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x200000 * 2, DrvGfxROM2, 0x200000 * 2);
399 	deco16_set_color_base(1, 0x100);
400 	deco16_set_color_base(2, 0x300);
401 	deco16_set_color_base(3, 0x400);
402 	deco16_set_global_offsets(0, 8);
403 	deco16_set_transparency_mask(1, 0x1f);
404 	deco16_set_color_mask(2, 0x1f);
405 	deco16_set_color_mask(3, 0x1f);
406 	deco16_set_bank_callback(1, boogwing_bank_callback);
407 	deco16_set_bank_callback(2, boogwing_bank_callback2);
408 	deco16_set_bank_callback(3, boogwing_bank_callback2);
409 
410 	// 146_104 prot
411 	deco_104_init();
412 	deco_146_104_set_port_a_cb(inputs_read); // inputs
413 	deco_146_104_set_port_b_cb(system_read); // system
414 	deco_146_104_set_port_c_cb(dips_read); // dips
415 	deco_146_104_set_soundlatch_cb(soundlatch_write);
416 	deco_146_104_set_interface_scramble_reverse();
417 	deco_146_104_set_use_magic_read_address_xor(1);
418 
419 	SekInit(0, 0x68000);
420 	SekOpen(0);
421 	SekMapMemory(Drv68KROM,			0x000000, 0x0fffff, MAP_READ);
422 	SekMapMemory(Drv68KCode,		0x000000, 0x0fffff, MAP_FETCH);
423 	SekMapMemory(Drv68KRAM,			0x200000, 0x20ffff, MAP_RAM);
424 	SekMapMemory(DrvSprRAM,			0x242000, 0x2427ff, MAP_RAM);
425 	SekMapMemory(DrvSprRAM1,		0x246000, 0x2467ff, MAP_RAM);
426 	SekMapMemory(deco16_pf_ram[0],		0x264000, 0x265fff, MAP_RAM);
427 	SekMapMemory(deco16_pf_ram[1],		0x266000, 0x267fff, MAP_RAM);
428 	SekMapMemory(deco16_pf_rowscroll[0],	0x268000, 0x268fff, MAP_RAM);
429 	SekMapMemory(deco16_pf_rowscroll[1],	0x26a000, 0x26afff, MAP_RAM);
430 	SekMapMemory(deco16_pf_ram[2],		0x274000, 0x275fff, MAP_RAM);
431 	SekMapMemory(deco16_pf_ram[3],		0x276000, 0x277fff, MAP_RAM);
432 	SekMapMemory(deco16_pf_rowscroll[2],	0x278000, 0x278fff, MAP_RAM);
433 	SekMapMemory(deco16_pf_rowscroll[3],	0x27a000, 0x27afff, MAP_RAM);
434 	SekMapMemory(DrvPalRAM,			0x284000, 0x285fff, MAP_RAM);
435 	SekSetWriteWordHandler(0,		boogwing_main_write_word);
436 	SekSetWriteByteHandler(0,		boogwing_main_write_byte);
437 	SekSetReadWordHandler(0,		boogwing_main_read_word);
438 	SekSetReadByteHandler(0,		boogwing_main_read_byte);
439 	SekClose();
440 
441 	deco16SoundInit(DrvHucROM, DrvHucRAM, 8055000, 0, DrvYM2151WritePort, 0.80, 1006875, 0.75, 2013750, 0.30);
442 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.80, BURN_SND_ROUTE_LEFT);
443 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.80, BURN_SND_ROUTE_RIGHT);
444 
445 	GenericTilesInit();
446 
447 	DrvDoReset();
448 
449 	return 0;
450 }
451 
DrvExit()452 static INT32 DrvExit()
453 {
454 	GenericTilesExit();
455 	deco16Exit();
456 
457 	deco16SoundExit();
458 
459 	SekExit();
460 
461 	BurnFree (AllMem);
462 
463 	return 0;
464 }
465 
draw_sprites(UINT8 * ram,UINT8 * gfx,INT32 coloff,INT32 gfx_region,INT32 bpp)466 static void draw_sprites(UINT8 *ram, UINT8 *gfx, INT32 coloff, INT32 gfx_region, INT32 bpp)
467 {
468 	if (bpp != (nBurnBpp & 4)) return;
469 
470 	UINT16 *spriteram_base = (UINT16*)ram;
471 
472 	INT32 colmask = (gfx_region == 4) ? 0x0f : 0x1f;
473 
474 	INT32 sflipscreen = !*flipscreen;
475 	INT32 priority = deco16_priority;
476 
477 	for (INT32 offs = 0x400 - 4; offs >= 0; offs -= 4)
478 	{
479 		INT32 inc, mult, pri = 0, spri = 0, alpha = 0xff;
480 
481 		INT32 sprite = BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 1]);
482 
483 		if (!sprite) continue;
484 
485 		INT32 y = BURN_ENDIAN_SWAP_INT16(spriteram_base[offs]);
486 
487 		if ((y & 0x1000) && (nCurrentFrame & 1))
488 			continue;
489 
490 		INT32 x = BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]);
491 		INT32 colour = (x >> 9) & colmask;
492 
493 		INT32 fx = y & 0x2000;
494 		INT32 fy = y & 0x4000;
495 		INT32 multi = (1 << ((y & 0x0600) >> 9)) - 1;
496 
497 		if (gfx_region == 4)
498 		{
499 			if ((BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0xc000) == 0xc000)
500 				spri = 4;
501 			else if ((BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0xc000))
502 				spri = 16;
503 			else
504 				spri = 64;
505 
506 			if (BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0x2000)	alpha = 0x80;
507 
508 			if (priority == 0x2)
509 			{
510 				if (BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0x8000) alpha = 0x80;
511 
512 				if ((BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0xc000) == 0xc000)
513 					pri = 4;
514 				else if ((BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0xc000) == 0x8000)
515 					pri = 16;
516 				else
517 					pri = 64;
518 			}
519 			else
520 			{
521 				if ((BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0x8000) == 0x8000)
522 					pri = 16;
523 				else
524 					pri = 64;
525 			}
526 		}
527 		else
528 		{
529 			if (BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0x8000)
530 				spri = 8;
531 			else
532 				spri = 32;
533 
534 			if (priority == 0x1)
535 			{
536 				if ((BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0xc000))
537 					pri = 16;
538 				else
539 					pri = 64;
540 			}
541 			else
542 			{
543 				if ((BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0xc000) == 0xc000)
544 					pri = 4;
545 				else if ((BURN_ENDIAN_SWAP_INT16(spriteram_base[offs + 2]) & 0xc000) == 0x8000)
546 					pri = 16;
547 				else
548 					pri = 64;
549 			}
550 		}
551 
552 		x = x & 0x01ff;
553 		y = y & 0x01ff;
554 		if (x >= 320) x -= 512;
555 		if (y >= 256) y -= 512;
556 		y = 240 - y;
557 		x = 304 - x;
558 
559 		sprite &= ~multi;
560 		if (fy)
561 			inc = -1;
562 		else
563 		{
564 			sprite += multi;
565 			inc = 1;
566 		}
567 
568 		if (sflipscreen)
569 		{
570 			y = 240 - y;
571 			x = 304 - x;
572 			if (fx) fx = 0; else fx = 1;
573 			if (fy) fy = 0; else fy = 1;
574 			mult = 16;
575 		}
576 		else
577 			mult = -16;
578 
579 		while (multi >= 0)
580 		{
581 			if (!bpp) {
582 				deco16_draw_prio_sprite(pTransDraw, gfx, sprite - multi * inc, (colour << 4) + coloff, x, y + mult * multi, fx, fy, pri, spri);
583 			} else {
584 				deco16_draw_alphaprio_sprite(DrvPalette, gfx, sprite - multi * inc, (colour << 4) + coloff, x, y + mult * multi, fx, fy, pri, spri, alpha);
585 			}
586 
587 			multi--;
588 		}
589 	}
590 }
591 
draw_combined_playfield(INT32 color,INT32 priority)592 static void draw_combined_playfield(INT32 color, INT32 priority) // opaque
593 {
594 	UINT16 *src0 = tempdraw[0];
595 	UINT16 *src1 = tempdraw[1];
596 	UINT16 *dest = pTransDraw;
597 	UINT8 *prio = deco16_prio_map;
598 
599 	for (INT32 y = 0; y < nScreenHeight; y++) {
600 		for (INT32 x = 0; x < nScreenWidth; x++) {
601 			dest[x] = color | (src0[x] & 0x0f) | ((src1[x] & 0x0f) << 4);
602 			prio[x] = priority;
603 		}
604 		src0 += nScreenWidth;
605 		src1 += nScreenWidth;
606 		dest += nScreenWidth;
607 		prio += 512;
608 	}
609 }
610 
DrvDraw()611 static INT32 DrvDraw()
612 {
613 //	if (DrvRecalc) {
614 		deco16_palette_recalculate(DrvPalette, DrvPalBuf);
615 		DrvRecalc = 0;
616 //	}
617 
618 	deco16_pf12_update();
619 	deco16_pf34_update();
620 
621 	for (INT32 i = 0; i < nScreenWidth * nScreenHeight; i++) {
622 		pTransDraw[i] = 0x400;
623 	}
624 
625 	if ((deco16_priority & 0x07) == 0x05) {
626 		UINT8 *tptr = deco16_pf_rowscroll[3];
627 		deco16_pf_rowscroll[3] = deco16_pf_rowscroll[2];
628 
629 		deco16_draw_layer(2, tempdraw[0], 0x10000);
630 		deco16_draw_layer(3, tempdraw[1], 0x10000);
631 
632 		deco16_pf_rowscroll[3] = tptr;
633 	}
634 
635 	deco16_clear_prio_map();
636 
637 	INT32 bpp0 = (deco16_get_tilemap_size(0) == 1) ? DECO16_LAYER_5BITSPERPIXEL : DECO16_LAYER_4BITSPERPIXEL;
638 	INT32 bpp1 = (deco16_get_tilemap_size(1) == 1) ? DECO16_LAYER_5BITSPERPIXEL : DECO16_LAYER_4BITSPERPIXEL;
639 
640 	switch (deco16_priority & 0x07)
641 	{
642 		case 0x01:
643 		case 0x02:
644 			if (nSpriteEnable & 4) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x00) | DECO16_LAYER_OPAQUE);
645 			if (nSpriteEnable & 1) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x08) | bpp1);
646 			if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x20));
647 		break;
648 
649 		case 0x03:
650 			if (nSpriteEnable & 4) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x00) | DECO16_LAYER_OPAQUE);
651 			if (nSpriteEnable & 1) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x08) | bpp1);
652 			// should use pf2 to add shadows...
653 		break;
654 
655 		case 0x05:
656 			if (nSpriteEnable & 1) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x00) | DECO16_LAYER_OPAQUE);
657 			if (nSpriteEnable &16) draw_combined_playfield(0x300, DECO16_LAYER_PRIORITY(0x20));
658 		break;
659 
660 		case 0x00:
661 		case 0x04:
662 		case 0x06:
663 		case 0x07:
664 			if (nSpriteEnable & 4) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x00) | DECO16_LAYER_OPAQUE);
665 			if (nSpriteEnable & 2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x08));
666 			if (nSpriteEnable & 1) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x20) | bpp1);
667 		break;
668 	}
669 
670 	draw_sprites(DrvSprBuf , DrvGfxROM3, 0x500, 3, 0);
671 	draw_sprites(DrvSprBuf1, DrvGfxROM4, 0x700, 4, 0);
672 
673 	if (nSpriteEnable & 8) deco16_draw_layer(0, pTransDraw, DECO16_LAYER_PRIORITY(0xff) | bpp0);
674 
675 	BurnTransferCopy(DrvPalette);
676 
677 	draw_sprites(DrvSprBuf , DrvGfxROM3, 0x500, 3, 4);
678 	draw_sprites(DrvSprBuf1, DrvGfxROM4, 0x700, 4, 4);
679 
680 	return 0;
681 }
682 
DrvFrame()683 static INT32 DrvFrame()
684 {
685 	if (DrvReset) {
686 		DrvDoReset();
687 	}
688 
689 	{
690 		memset (DrvInputs, 0xff, 2 * sizeof(INT16));
691 		for (INT32 i = 0; i < 16; i++) {
692 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
693 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
694 		}
695 	}
696 
697 	INT32 nInterleave = 256;
698 	INT32 nSoundBufferPos = 0;
699 	INT32 nCyclesTotal[2] = { 14000000 / 58, 8055000 / 58 };
700 	INT32 nCyclesDone[2] = { 0, 0 };
701 
702 	SekOpen(0);
703 	h6280Open(0);
704 
705 	deco16_vblank = 0;
706 
707 	for (INT32 i = 0; i < nInterleave; i++)
708 	{
709 		nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave);
710 		nCyclesDone[1] += h6280Run(nCyclesTotal[1] / nInterleave);
711 
712 		if (i == 248) {
713 			SekSetIRQLine(6, CPU_IRQSTATUS_AUTO);
714 			deco16_vblank = 0x08;
715 		}
716 
717 		if (pBurnSoundOut && i%8 == 7) {
718 			INT32 nSegmentLength = nBurnSoundLen / (nInterleave / 8);
719 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
720 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
721 			nSoundBufferPos += nSegmentLength;
722 		}
723 	}
724 
725 	if (pBurnSoundOut) {
726 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
727 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
728 
729 		if (nSegmentLength) {
730 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
731 		}
732 	}
733 
734 	h6280Close();
735 	SekClose();
736 
737 	if (pBurnDraw) {
738 		DrvDraw();
739 	}
740 
741 	return 0;
742 }
743 
DrvScan(INT32 nAction,INT32 * pnMin)744 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
745 {
746 	struct BurnArea ba;
747 
748 	if (pnMin != NULL) {
749 		*pnMin = 0x029722;
750 	}
751 
752 	if (nAction & ACB_MEMORY_RAM) {
753 		memset(&ba, 0, sizeof(ba));
754 		ba.Data	  = AllRam;
755 		ba.nLen	  = RamEnd-AllRam;
756 		ba.szName = "All Ram";
757 		BurnAcb(&ba);
758 	}
759 
760 	if (nAction & ACB_DRIVER_DATA) {
761 		SekScan(nAction);
762 
763 		deco16SoundScan(nAction, pnMin);
764 
765 		deco16Scan();
766 
767 		SCAN_VAR(DrvOkiBank);
768 
769 		DrvYM2151WritePort(0, DrvOkiBank);
770 	}
771 
772 	return 0;
773 }
774 
775 
776 // Boogie Wings (Euro v1.5, 92.12.07)
777 
778 static struct BurnRomInfo boogwingRomDesc[] = {
779 	{ "kn_00-2.2b",		0x040000, 0xe38892b9,  1 | BRF_PRG | BRF_ESS }, //  0 68k Code
780 	{ "kn_02-2.2e",		0x040000, 0x8426efef,  1 | BRF_PRG | BRF_ESS }, //  1
781 	{ "kn_01-2.4b",		0x040000, 0x3ad4b54c,  1 | BRF_PRG | BRF_ESS }, //  2
782 	{ "kn_03-2.4e",		0x040000, 0x10b61f4a,  1 | BRF_PRG | BRF_ESS }, //  3
783 
784 	{ "km06.18p",		0x010000, 0x3e8bc4e1,  2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
785 
786 	{ "km05.9e",		0x010000, 0xd10aef95,  3 | BRF_GRA },           //  5 Characters
787 	{ "km04.8e",		0x010000, 0x329323a8,  3 | BRF_GRA },           //  6
788 
789 	{ "mbd-01.9b",		0x100000, 0xd7de4f4b,  4 | BRF_GRA },           //  7 Foreground Tiles
790 	{ "mbd-00.8b",		0x100000, 0xadb20ba9,  4 | BRF_GRA },           //  8
791 	{ "mbd-02.10e",		0x080000, 0xb25aa721,  8 | BRF_GRA },           //  9
792 
793 	{ "mbd-03.13b",		0x100000, 0xcf798f2c,  5 | BRF_GRA },           // 10 Background Tiles
794 	{ "mbd-04.14b",		0x100000, 0xd9764d0b,  5 | BRF_GRA },           // 11
795 
796 	{ "mbd-05.16b",		0x200000, 0x1768c66a,  6 | BRF_GRA },           // 12 Sprite Bank A
797 	{ "mbd-06.17b",		0x200000, 0x7750847a,  6 | BRF_GRA },           // 13
798 
799 	{ "mbd-07.18b",		0x200000, 0x241faac1,  7 | BRF_GRA },           // 14 Sprite Bank B
800 	{ "mbd-08.19b",		0x200000, 0xf13b1e56,  7 | BRF_GRA },           // 15
801 
802 	{ "mbd-10.17p",		0x080000, 0xf159f76a,  9 | BRF_SND },           // 16 OKI M6295 Samples 0
803 	{ "mbd-09.16p",		0x080000, 0xf44f2f87, 10 | BRF_SND },           // 17 OKI M6295 Samples 1
804 
805 	{ "kj-00.15n",		0x000400, 0xadd4d50b, 11 | BRF_OPT },           // 18 Unknown PROMs
806 };
807 
808 STD_ROM_PICK(boogwing)
809 STD_ROM_FN(boogwing)
810 
811 struct BurnDriver BurnDrvBoogwing = {
812 	"boogwing", NULL, NULL, NULL, "1992",
813 	"Boogie Wings (Euro v1.5, 92.12.07)\0", NULL, "Data East Corporation", "DECO IC16",
814 	NULL, NULL, NULL, NULL,
815 	BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_HORSHOOT, 0,
816 	NULL, boogwingRomInfo, boogwingRomName, NULL, NULL, NULL, NULL, BoogwingInputInfo, BoogwingDIPInfo,
817 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
818 	320, 240, 4, 3
819 };
820 
821 
822 // Boogie Wings (USA v1.7, 92.12.14)
823 
824 static struct BurnRomInfo boogwinguRomDesc[] = {
825 	{ "kl_00.2b",		0x040000, 0x4dc14798,  1 | BRF_PRG | BRF_ESS }, //  0 68k Code
826 	{ "kl_02.2e",		0x040000, 0x3bb3b0a0,  1 | BRF_PRG | BRF_ESS }, //  1
827 	{ "kl_01.4b",		0x040000, 0xd109ba13,  1 | BRF_PRG | BRF_ESS }, //  2
828 	{ "kl_03.4e",		0x040000, 0xfef2a176,  1 | BRF_PRG | BRF_ESS }, //  3
829 
830 	{ "kl06.18p",		0x010000, 0x3e8bc4e1,  2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
831 
832 	{ "kl05.9e",		0x010000, 0xd10aef95,  3 | BRF_GRA },           //  5 Characters
833 	{ "kl04.8e",		0x010000, 0x329323a8,  3 | BRF_GRA },           //  6
834 
835 	{ "mbd-01.9b",		0x100000, 0xd7de4f4b,  4 | BRF_GRA },           //  7 Foreground Tiles
836 	{ "mbd-00.8b",		0x100000, 0xadb20ba9,  4 | BRF_GRA },           //  8
837 	{ "mbd-02.10e",		0x080000, 0xb25aa721,  4 | BRF_GRA },           //  9
838 
839 	{ "mbd-03.13b",		0x100000, 0xcf798f2c,  5 | BRF_GRA },           // 10 Background Tiles
840 	{ "mbd-04.14b",		0x100000, 0xd9764d0b,  5 | BRF_GRA },           // 11
841 
842 	{ "mbd-05.16b",		0x200000, 0x1768c66a,  6 | BRF_GRA },           // 12 Sprite Bank A
843 	{ "mbd-06.17b",		0x200000, 0x7750847a,  6 | BRF_GRA },           // 13
844 
845 	{ "mbd-07.18b",		0x200000, 0x241faac1,  7 | BRF_GRA },           // 14 Sprite Bank B
846 	{ "mbd-08.19b",		0x200000, 0xf13b1e56,  7 | BRF_GRA },           // 15
847 
848 	{ "mbd-10.17p",		0x080000, 0xf159f76a,  8 | BRF_SND },           // 16 OKI M6295 Samples 0
849 	{ "mbd-09.16p",		0x080000, 0xf44f2f87,  9 | BRF_SND },           // 17 OKI M6295 Samples 1
850 
851 	{ "kj-00.15n",		0x000400, 0xadd4d50b, 10 | BRF_OPT },           // 18 Unknown PROMs
852 };
853 
854 STD_ROM_PICK(boogwingu)
855 STD_ROM_FN(boogwingu)
856 
857 struct BurnDriver BurnDrvBoogwingu = {
858 	"boogwingu", "boogwing", NULL, NULL, "1992",
859 	"Boogie Wings (USA v1.7, 92.12.14)\0", NULL, "Data East Corporation", "DECO IC16",
860 	NULL, NULL, NULL, NULL,
861 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_HORSHOOT, 0,
862 	NULL, boogwinguRomInfo, boogwinguRomName, NULL, NULL, NULL, NULL, BoogwingInputInfo, BoogwingDIPInfo,
863 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
864 	320, 240, 4, 3
865 };
866 
867 
868 // Boogie Wings (Asia v1.5, 92.12.07)
869 
870 static struct BurnRomInfo boogwingaRomDesc[] = {
871 	{ "km_00-2.2b",		0x040000, 0x71ab71c6,  1 | BRF_PRG | BRF_ESS }, //  0 68k Code
872 	{ "km_02-2.2e",		0x040000, 0xe90f07f9,  1 | BRF_PRG | BRF_ESS }, //  1
873 	{ "km_01-2.4b",		0x040000, 0x7fdce2d3,  1 | BRF_PRG | BRF_ESS }, //  2
874 	{ "km_03-2.4e",		0x040000, 0x0b582de3,  1 | BRF_PRG | BRF_ESS }, //  3
875 
876 	{ "km06.18p",		0x010000, 0x3e8bc4e1,  2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
877 
878 	{ "km05.9e",		0x010000, 0xd10aef95,  3 | BRF_GRA },           //  5 Characters
879 	{ "km04.8e",		0x010000, 0x329323a8,  3 | BRF_GRA },           //  6
880 
881 	{ "mbd-01.9b",		0x100000, 0xd7de4f4b,  4 | BRF_GRA },           //  7 Foreground Tiles
882 	{ "mbd-00.8b",		0x100000, 0xadb20ba9,  4 | BRF_GRA },           //  8
883 	{ "mbd-02.10e",		0x080000, 0xb25aa721,  4 | BRF_GRA },           //  9
884 
885 	{ "mbd-03.13b",		0x100000, 0xcf798f2c,  5 | BRF_GRA },           // 10 Background Tiles
886 	{ "mbd-04.14b",		0x100000, 0xd9764d0b,  5 | BRF_GRA },           // 11
887 
888 	{ "mbd-05.16b",		0x200000, 0x1768c66a,  6 | BRF_GRA },           // 12 Sprite Bank A
889 	{ "mbd-06.17b",		0x200000, 0x7750847a,  6 | BRF_GRA },           // 13
890 
891 	{ "mbd-07.18b",		0x200000, 0x241faac1,  7 | BRF_GRA },           // 14 Sprite Bank B
892 	{ "mbd-08.19b",		0x200000, 0xf13b1e56,  7 | BRF_GRA },           // 15
893 
894 	{ "mbd-10.17p",		0x080000, 0xf159f76a,  8 | BRF_SND },           // 16 OKI M6295 Samples 0
895 	{ "mbd-09.16p",		0x080000, 0xf44f2f87,  9 | BRF_SND },           // 17 OKI M6295 Samples 1
896 
897 	{ "kj-00.15n",		0x000400, 0xadd4d50b, 10 | BRF_OPT },           // 18 Unknown PROMs
898 };
899 
900 STD_ROM_PICK(boogwinga)
901 STD_ROM_FN(boogwinga)
902 
903 struct BurnDriver BurnDrvBoogwinga = {
904 	"boogwinga", "boogwing", NULL, NULL, "1992",
905 	"Boogie Wings (Asia v1.5, 92.12.07)\0", NULL, "Data East Corporation", "DECO IC16",
906 	NULL, NULL, NULL, NULL,
907 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_HORSHOOT, 0,
908 	NULL, boogwingaRomInfo, boogwingaRomName, NULL, NULL, NULL, NULL, BoogwingInputInfo, BoogwingDIPInfo,
909 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
910 	320, 240, 4, 3
911 };
912 
913 
914 // The Great Ragtime Show (Japan v1.5, 92.12.07)
915 
916 static struct BurnRomInfo ragtimeRomDesc[] = {
917 	{ "kh_00-2.2b",		0x040000, 0x553e179f,  1 | BRF_PRG | BRF_ESS }, //  0 68k Code
918 	{ "kh_02-2.2e",		0x040000, 0x6c759ec0,  1 | BRF_PRG | BRF_ESS }, //  1
919 	{ "kh_01-2.4b",		0x040000, 0x12dfee70,  1 | BRF_PRG | BRF_ESS }, //  2
920 	{ "kh_03-2.4e",		0x040000, 0x076fea18,  1 | BRF_PRG | BRF_ESS }, //  3
921 
922 	{ "km06.18p",		0x010000, 0x3e8bc4e1,  2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
923 
924 	{ "km05.9e",		0x010000, 0xd10aef95,  3 | BRF_GRA },           //  5 Characters
925 	{ "km04.8e",		0x010000, 0x329323a8,  3 | BRF_GRA },           //  6
926 
927 	{ "mbd-01.9b",		0x100000, 0xd7de4f4b,  4 | BRF_GRA },           //  7 Foreground Tiles
928 	{ "mbd-00.8b",		0x100000, 0xadb20ba9,  4 | BRF_GRA },           //  8
929 	{ "mbd-02.10e",		0x080000, 0xb25aa721,  8 | BRF_GRA },           //  9
930 
931 	{ "mbd-03.13b",		0x100000, 0xcf798f2c,  5 | BRF_GRA },           // 10 Background Tiles
932 	{ "mbd-04.14b",		0x100000, 0xd9764d0b,  5 | BRF_GRA },           // 11
933 
934 	{ "mbd-05.16b",		0x200000, 0x1768c66a,  6 | BRF_GRA },           // 12 Sprite Bank A
935 	{ "mbd-06.17b",		0x200000, 0x7750847a,  6 | BRF_GRA },           // 13
936 
937 	{ "mbd-07.18b",		0x200000, 0x241faac1,  7 | BRF_GRA },           // 14 Sprite Bank B
938 	{ "mbd-08.19b",		0x200000, 0xf13b1e56,  7 | BRF_GRA },           // 15
939 
940 	{ "mbd-10.17p",		0x080000, 0xf159f76a,  9 | BRF_SND },           // 16 OKI M6295 Samples 0
941 	{ "mbd-09.16p",		0x080000, 0xf44f2f87, 10 | BRF_SND },           // 17 OKI M6295 Samples 1
942 
943 	{ "kj-00.15n",		0x000400, 0xadd4d50b, 11 | BRF_OPT },           // 18 Unknown PROMs
944 };
945 
946 STD_ROM_PICK(ragtime)
947 STD_ROM_FN(ragtime)
948 
949 struct BurnDriver BurnDrvRagtime = {
950 	"ragtime", "boogwing", NULL, NULL, "1992",
951 	"The Great Ragtime Show (Japan v1.5, 92.12.07)\0", NULL, "Data East Corporation", "DECO IC16",
952 	NULL, NULL, NULL, NULL,
953 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_HORSHOOT, 0,
954 	NULL, ragtimeRomInfo, ragtimeRomName, NULL, NULL, NULL, NULL, BoogwingInputInfo, BoogwingDIPInfo,
955 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
956 	320, 240, 4, 3
957 };
958 
959 
960 // The Great Ragtime Show (Japan v1.3, 92.11.26)
961 
962 static struct BurnRomInfo ragtimeaRomDesc[] = {
963 	{ "kh_00-1.2b",		0x040000, 0x88f0155a,  1 | BRF_PRG | BRF_ESS }, //  0 68k Code
964 	{ "kh_02-1.2e",		0x040000, 0x8811b41b,  1 | BRF_PRG | BRF_ESS }, //  1
965 	{ "kh_01-1.4b",		0x040000, 0x4dab63ad,  1 | BRF_PRG | BRF_ESS }, //  2
966 	{ "kh_03-1.4e",		0x040000, 0x8a4cbb18,  1 | BRF_PRG | BRF_ESS }, //  3
967 
968 	{ "km06.18p",		0x010000, 0x3e8bc4e1,  2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
969 
970 	{ "km05.9e",		0x010000, 0xd10aef95,  3 | BRF_GRA },           //  5 Characters
971 	{ "km04.8e",		0x010000, 0x329323a8,  3 | BRF_GRA },           //  6
972 
973 	{ "mbd-01.9b",		0x100000, 0xd7de4f4b,  4 | BRF_GRA },           //  7 Foreground Tiles
974 	{ "mbd-00.8b",		0x100000, 0xadb20ba9,  4 | BRF_GRA },           //  8
975 	{ "mbd-02.10e",		0x080000, 0xb25aa721,  8 | BRF_GRA },           //  9
976 
977 	{ "mbd-03.13b",		0x100000, 0xcf798f2c,  5 | BRF_GRA },           // 10 Background Tiles
978 	{ "mbd-04.14b",		0x100000, 0xd9764d0b,  5 | BRF_GRA },           // 11
979 
980 	{ "mbd-05.16b",		0x200000, 0x1768c66a,  6 | BRF_GRA },           // 12 Sprite Bank A
981 	{ "mbd-06.17b",		0x200000, 0x7750847a,  6 | BRF_GRA },           // 13
982 
983 	{ "mbd-07.18b",		0x200000, 0x241faac1,  7 | BRF_GRA },           // 14 Sprite Bank B
984 	{ "mbd-08.19b",		0x200000, 0xf13b1e56,  7 | BRF_GRA },           // 15
985 
986 	{ "mbd-10.17p",		0x080000, 0xf159f76a,  9 | BRF_SND },           // 16 OKI M6295 Samples 0
987 	{ "mbd-09.16p",		0x080000, 0xf44f2f87, 10 | BRF_SND },           // 17 OKI M6295 Samples 1
988 
989 	{ "kj-00.15n",		0x000400, 0xadd4d50b, 11 | BRF_OPT },           // 18 Unknown PROMs
990 };
991 
992 STD_ROM_PICK(ragtimea)
993 STD_ROM_FN(ragtimea)
994 
995 struct BurnDriver BurnDrvRagtimea = {
996 	"ragtimea", "boogwing", NULL, NULL, "1992",
997 	"The Great Ragtime Show (Japan v1.3, 92.11.26)\0", NULL, "Data East Corporation", "DECO IC16",
998 	NULL, NULL, NULL, NULL,
999 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_HORSHOOT, 0,
1000 	NULL, ragtimeaRomInfo, ragtimeaRomName, NULL, NULL, NULL, NULL, BoogwingInputInfo, BoogwingDIPInfo,
1001 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
1002 	320, 240, 4, 3
1003 };
1004