1 // FB Alpha Toaplan driver module
2 // Based on MAME driver by Darren Olafson, Quench, and Stephane Humbert
3 
4 #include "tiles_generic.h"
5 #include "m68000_intf.h"
6 #include "z80_intf.h"
7 #include "burn_ym3812.h"
8 #include "tms32010.h"
9 
10 static UINT8 *AllMem;
11 static UINT8 *MemEnd;
12 static UINT8 *AllRam;
13 static UINT8 *RamEnd;
14 static UINT8 *Drv68KROM;
15 static UINT8 *DrvZ80ROM;
16 static UINT8 *DrvMCUROM;
17 static UINT8 *DrvGfxROM0;
18 static UINT8 *DrvGfxROM1;
19 static UINT8 *DrvPalRAM;
20 static UINT8 *DrvVidRAM;
21 static UINT8 *DrvShareRAM;
22 static UINT8 *DrvSprRAM;
23 static UINT8 *DrvSprSizeRAM;
24 static UINT8 *DrvSprBuf;
25 static UINT8 *DrvSprSizeBuf;
26 static UINT8 *Drv68KRAM;
27 static UINT8 *DrvZ80RAM;
28 static UINT8 *DrvMCURAM;
29 static UINT8 *DrvTransTable;
30 
31 static UINT16 *scroll;
32 
33 static UINT16 *pTempDraw;
34 
35 static UINT32 *DrvPalette;
36 static UINT8 DrvRecalc;
37 
38 static UINT16 sprite_flipscreen;
39 static UINT8 flipscreen;
40 static UINT8 interrupt_enable;
41 static UINT16 tiles_offsets_x;
42 static UINT16 tiles_offsets_y;
43 static UINT16 tileram_offs;
44 static UINT16 spriteram_offset;
45 static UINT8 soundlatch;
46 static UINT8 mcu_command;
47 
48 static INT32 m68k_halt;
49 static UINT32 main_ram_seg;
50 static UINT16 dsp_addr_w;
51 static INT32 dsp_execute;
52 static INT32 dsp_BIO;
53 static INT32 dsp_on;
54 
55 static INT32 tile_mask;
56 static INT32 sprite_mask;
57 static INT32 mainrom_size;
58 static INT32 sprite_y_adjust;
59 static INT32 vertical_lines;
60 static INT32 samesame = 0;
61 static INT32 vblank;
62 static INT32 has_dsp = 0;
63 
64 static UINT8 DrvJoy1[8];
65 static UINT8 DrvJoy2[8];
66 static UINT8 DrvJoy3[8];
67 static UINT8 DrvDips[4];
68 static UINT8 DrvInputs[3];
69 static UINT8 DrvReset;
70 
71 static struct BurnInputInfo Drv2bInputList[] = {
72 	{"P1 Coin",		BIT_DIGITAL,	DrvJoy3 + 3,	"p1 coin"	},
73 	{"P1 Start",		BIT_DIGITAL,	DrvJoy3 + 5,	"p1 start"	},
74 	{"P1 Up",		BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
75 	{"P1 Down",		BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
76 	{"P1 Left",		BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
77 	{"P1 Right",		BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
78 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
79 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy1 + 5,	"p1 fire 2"	},
80 
81 	{"P2 Coin",		BIT_DIGITAL,	DrvJoy3 + 4,	"p2 coin"	},
82 	{"P2 Start",		BIT_DIGITAL,	DrvJoy3 + 6,	"p2 start"	},
83 	{"P2 Up",		BIT_DIGITAL,	DrvJoy2 + 0,	"p2 up"		},
84 	{"P2 Down",		BIT_DIGITAL,	DrvJoy2 + 1,	"p2 down"	},
85 	{"P2 Left",		BIT_DIGITAL,	DrvJoy2 + 2,	"p2 left"	},
86 	{"P2 Right",		BIT_DIGITAL,	DrvJoy2 + 3,	"p2 right"	},
87 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy2 + 4,	"p2 fire 1"	},
88 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy2 + 5,	"p2 fire 2"	},
89 
90 	{"Reset",		BIT_DIGITAL,	&DrvReset,	"reset"		},
91 	{"Service",		BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
92 	{"Test SW",		BIT_DIGITAL,	DrvJoy3 + 2,	"diag"		},
93 	{"Tilt",		BIT_DIGITAL,	DrvJoy3 + 1,	"tilt"		},
94 	{"Dip A",		BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
95 	{"Dip B",		BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
96 	{"Dip C",		BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
97 };
98 
99 STDINPUTINFO(Drv2b)
100 
101 static struct BurnInputInfo Drv3bInputList[] = {
102 	{"P1 Coin",		BIT_DIGITAL,	DrvJoy3 + 3,	"p1 coin"	},
103 	{"P1 Start",		BIT_DIGITAL,	DrvJoy3 + 5,	"p1 start"	},
104 	{"P1 Up",		BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
105 	{"P1 Down",		BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
106 	{"P1 Left",		BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
107 	{"P1 Right",		BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
108 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
109 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy1 + 5,	"p1 fire 2"	},
110 	{"P1 Button 3",		BIT_DIGITAL,	DrvJoy1 + 6,	"p1 fire 3"	},
111 
112 	{"P2 Coin",		BIT_DIGITAL,	DrvJoy3 + 4,	"p2 coin"	},
113 	{"P2 Start",		BIT_DIGITAL,	DrvJoy3 + 6,	"p2 start"	},
114 	{"P2 Up",		BIT_DIGITAL,	DrvJoy2 + 0,	"p2 up"		},
115 	{"P2 Down",		BIT_DIGITAL,	DrvJoy2 + 1,	"p2 down"	},
116 	{"P2 Left",		BIT_DIGITAL,	DrvJoy2 + 2,	"p2 left"	},
117 	{"P2 Right",		BIT_DIGITAL,	DrvJoy2 + 3,	"p2 right"	},
118 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy2 + 4,	"p2 fire 1"	},
119 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy2 + 5,	"p2 fire 2"	},
120 	{"P2 Button 3",		BIT_DIGITAL,	DrvJoy2 + 6,	"p2 fire 3"	},
121 
122 	{"Reset",		BIT_DIGITAL,	&DrvReset,	"reset"		},
123 	{"Service",		BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
124 	{"Test SW",		BIT_DIGITAL,	DrvJoy3 + 2,	"diag"		},
125 	{"Tilt",		BIT_DIGITAL,	DrvJoy3 + 1,	"tilt"		},
126 	{"Dip A",		BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
127 	{"Dip B",		BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
128 	{"Dip C",		BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
129 };
130 
131 STDINPUTINFO(Drv3b)
132 
133 static struct BurnInputInfo FiresharkInputList[] = {
134 	{"P1 Coin",		BIT_DIGITAL,	DrvJoy3 + 3,	"p1 coin"	},
135 	{"P1 Start",		BIT_DIGITAL,	DrvJoy3 + 5,	"p1 start"	},
136 	{"P1 Up",		BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
137 	{"P1 Down",		BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
138 	{"P1 Left",		BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
139 	{"P1 Right",		BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
140 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
141 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy1 + 5,	"p1 fire 2"	},
142 
143 	{"P2 Coin",		BIT_DIGITAL,	DrvJoy3 + 4,	"p2 coin"	},
144 	{"P2 Start",		BIT_DIGITAL,	DrvJoy3 + 6,	"p2 start"	},
145 	{"P2 Up",		BIT_DIGITAL,	DrvJoy2 + 0,	"p2 up"		},
146 	{"P2 Down",		BIT_DIGITAL,	DrvJoy2 + 1,	"p2 down"	},
147 	{"P2 Left",		BIT_DIGITAL,	DrvJoy2 + 2,	"p2 left"	},
148 	{"P2 Right",		BIT_DIGITAL,	DrvJoy2 + 3,	"p2 right"	},
149 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy2 + 4,	"p2 fire 1"	},
150 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy2 + 5,	"p2 fire 2"	},
151 
152 	{"Reset",		BIT_DIGITAL,	&DrvReset,	"reset"		},
153 	{"Service",		BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
154 	{"Tilt",		BIT_DIGITAL,	DrvJoy3 + 1,	"tilt"		},
155 	{"Dip A",		BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
156 	{"Dip B",		BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
157 	{"Dip C",		BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
158 };
159 
160 STDINPUTINFO(Fireshark)
161 
162 static struct BurnDIPInfo RallybikDIPList[]=
163 {
164 	{0x14, 0xff, 0xff, 0x01, NULL			},
165 	{0x15, 0xff, 0xff, 0x20, NULL			},
166 	{0x16, 0xff, 0xff, 0x00, NULL			},
167 
168 	{0   , 0xfe, 0   ,    2, "Cabinet"		},
169 	{0x14, 0x01, 0x01, 0x01, "Upright"		},
170 	{0x14, 0x01, 0x01, 0x00, "Cocktail"		},
171 
172 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
173 	{0x14, 0x01, 0x02, 0x00, "Off"			},
174 	{0x14, 0x01, 0x02, 0x02, "On"			},
175 
176 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
177 	{0x14, 0x01, 0x04, 0x00, "Off"			},
178 	{0x14, 0x01, 0x04, 0x04, "On"			},
179 
180 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
181 	{0x14, 0x01, 0x08, 0x08, "Off"			},
182 	{0x14, 0x01, 0x08, 0x00, "On"			},
183 
184 	{0   , 0xfe, 0   ,    4, "Coin A"			},
185 	{0x14, 0x01, 0x30, 0x00, "1 Coin  1 Credit"		},  // a/b ok.
186 	{0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit"		},
187 	{0x14, 0x01, 0x30, 0x20, "3 Coins 1 Credit"		},
188 	{0x14, 0x01, 0x30, 0x30, "4 Coins 1 Credit"		},
189 
190 	{0   , 0xfe, 0   ,    4, "Coin B"			},
191 	{0x14, 0x01, 0xc0, 0x00, "1 Coin  2 Credits"		},
192 	{0x14, 0x01, 0xc0, 0x40, "1 Coin  3 Credits"		},
193 	{0x14, 0x01, 0xc0, 0x80, "1 Coin  4 Credits"		},
194 	{0x14, 0x01, 0xc0, 0xc0, "1 Coin  6 Credits"		},
195 
196 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
197 	{0x15, 0x01, 0x03, 0x01, "Easy"			},
198 	{0x15, 0x01, 0x03, 0x00, "Normal"		},
199 	{0x15, 0x01, 0x03, 0x02, "Hard"			},
200 	{0x15, 0x01, 0x03, 0x03, "Very Hard"		},
201 
202 	{0   , 0xfe, 0   ,    4, "Territory/Copyright"		},
203 	{0x15, 0x01, 0x30, 0x20, "World/Taito Corp Japan"	},
204 	{0x15, 0x01, 0x30, 0x10, "USA/Taito America"		},
205 	{0x15, 0x01, 0x30, 0x00, "Japan/Taito Corp"		},
206 	{0x15, 0x01, 0x30, 0x30, "USA/Taito America (Romstar)"	},
207 
208 	{0   , 0xfe, 0   ,    2, "Dip Switch Display"	},
209 	{0x15, 0x01, 0x40, 0x00, "Off"			},
210 	{0x15, 0x01, 0x40, 0x40, "On"			},
211 
212 	{0   , 0xfe, 0   ,    2, "Allow Continue"	},
213 	{0x15, 0x01, 0x80, 0x80, "No"			},
214 	{0x15, 0x01, 0x80, 0x00, "Yes"			},
215 };
216 
217 STDDIPINFO(Rallybik)
218 
219 static struct BurnDIPInfo TruxtonDIPList[]=
220 {
221 	{0x14, 0xff, 0xff, 0x01, NULL			},
222 	{0x15, 0xff, 0xff, 0x00, NULL			},
223 	{0x16, 0xff, 0xff, 0xf2, NULL			},
224 
225 	{0   , 0xfe, 0   ,    2, "Cabinet"		},
226 	{0x14, 0x01, 0x01, 0x01, "Upright"		},
227 	{0x14, 0x01, 0x01, 0x00, "Cocktail"		},
228 
229 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
230 	{0x14, 0x01, 0x02, 0x00, "Off"			},
231 	{0x14, 0x01, 0x02, 0x02, "On"			},
232 
233 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
234 	{0x14, 0x01, 0x04, 0x00, "Off"			},
235 	{0x14, 0x01, 0x04, 0x04, "On"			},
236 
237 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
238 	{0x14, 0x01, 0x08, 0x08, "Off"			},
239 	{0x14, 0x01, 0x08, 0x00, "On"			},
240 
241 	{0   , 0xfe, 0   ,    4, "Coin A"		},
242 	{0x14, 0x01, 0x30, 0x00, "1 Coin  1 Credit"	},  // ok a/b
243 	{0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit"	},
244 	{0x14, 0x01, 0x30, 0x20, "3 Coins 1 Credit"	},
245 	{0x14, 0x01, 0x30, 0x30, "4 Coins 1 Credit"	},
246 
247 	{0   , 0xfe, 0   ,    4, "Coin B"		},
248 	{0x14, 0x01, 0xc0, 0x00, "1 Coin  2 Credits"	},
249 	{0x14, 0x01, 0xc0, 0x40, "1 Coin  3 Credits"	},
250 	{0x14, 0x01, 0xc0, 0x80, "1 Coin  4 Credits"	},
251 	{0x14, 0x01, 0xc0, 0xc0, "1 Coins 6 Credits"	},
252 
253 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
254 	{0x15, 0x01, 0x03, 0x01, "Easy"			},
255 	{0x15, 0x01, 0x03, 0x00, "Normal"		},
256 	{0x15, 0x01, 0x03, 0x02, "Hard"			},
257 	{0x15, 0x01, 0x03, 0x03, "Very Hard"		},
258 
259 	{0   , 0xfe, 0   ,	  4, "Extend bonus"},
260 	{0x15, 0x01, 0x03, 0x04, "50k 200k 150k+"	},
261 	{0x15, 0x01, 0x03, 0x00, "70k 270k 200k+"	},
262 	{0x15, 0x01, 0x03, 0x08, "100k Only"		},
263 	{0x15, 0x01, 0x03, 0x0c, "None"			},
264 
265 	{0   , 0xfe, 0   ,    4, "Lives"		},
266 	{0x15, 0x01, 0x30, 0x30, "2"			},
267 	{0x15, 0x01, 0x30, 0x00, "3"			},
268 	{0x15, 0x01, 0x30, 0x20, "4"			},
269 	{0x15, 0x01, 0x30, 0x10, "5"			},
270 
271 	{0   , 0xfe, 0   ,    2, "Dip Switch Display"	},
272 	{0x15, 0x01, 0x40, 0x00, "Off"			},
273 	{0x15, 0x01, 0x40, 0x40, "On"			},
274 
275 	{0   , 0xfe, 0   ,    2, "Allow Continue"	},
276 	{0x15, 0x01, 0x80, 0x80, "No"			},
277 	{0x15, 0x01, 0x80, 0x00, "Yes"			},
278 
279 	{0   , 0xfe, 0   ,    5, "Region"		},
280     {0x16, 0x01, 0x07, 0x00, "Japan/Taito Corp"},
281     {0x16, 0x01, 0x07, 0x01, "US/Romstar"},
282     {0x16, 0x01, 0x07, 0x02, "World/Taito Corp"},
283     {0x16, 0x01, 0x07, 0x04, "US/Taito America"},
284 	{0x16, 0x01, 0x07, 0x06, "World/Taito America"},
285 };
286 
287 STDDIPINFO(Truxton)
288 
289 static struct BurnDIPInfo HellfireDIPList[]=
290 {
291 	{0x14, 0xff, 0xff, 0x00, NULL			},
292 	{0x15, 0xff, 0xff, 0x00, NULL			},
293 	{0x16, 0xff, 0xff, 0xf2, NULL			},
294 
295 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
296 	{0x14, 0x01, 0x02, 0x00, "Off"			},
297 	{0x14, 0x01, 0x02, 0x02, "On"			},
298 
299 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
300 	{0x14, 0x01, 0x04, 0x00, "Off"			},
301 	{0x14, 0x01, 0x04, 0x04, "On"			},
302 
303 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
304 	{0x14, 0x01, 0x08, 0x08, "Off"			},
305 	{0x14, 0x01, 0x08, 0x00, "On"			},
306 
307 	{0   , 0xfe, 0   ,    4, "Coin A"		},
308 	{0x14, 0x01, 0x30, 0x00, "1 Coin  1 Credit"	}, // ok a,b
309 	{0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit"	},
310 	{0x14, 0x01, 0x30, 0x20, "3 Coins 1 Credit"	},
311 	{0x14, 0x01, 0x30, 0x30, "4 Coins 1 Credit"	},
312 
313 	{0   , 0xfe, 0   ,    4, "Coin B"		},
314 	{0x14, 0x01, 0xc0, 0x00, "1 Coin  2 Credits"	},
315 	{0x14, 0x01, 0xc0, 0x40, "1 Coin  3 Credits"	},
316 	{0x14, 0x01, 0xc0, 0x80, "1 Coin  4 Credits"	},
317 	{0x14, 0x01, 0xc0, 0xc0, "1 Coin  6 Credits"	},
318 
319 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
320 	{0x15, 0x01, 0x03, 0x01, "Easy"			},
321 	{0x15, 0x01, 0x03, 0x00, "Normal"		},
322 	{0x15, 0x01, 0x03, 0x02, "Hard"			},
323 	{0x15, 0x01, 0x03, 0x03, "Very Hard"		},
324 
325 	{0   , 0xfe, 0   ,    4, "Bonus Life"		},
326 	{0x15, 0x01, 0x03, 0x00, "70k 270k 200k+"	},
327 	{0x15, 0x01, 0x03, 0x04, "100k 350k 250k+"	},
328 	{0x15, 0x01, 0x03, 0x08, "100k Only"		},
329 	{0x15, 0x01, 0x03, 0x0c, "200k Only"		},
330 
331 	{0   , 0xfe, 0   ,    4, "Lives"		},
332 	{0x15, 0x01, 0x30, 0x30, "2"			},
333 	{0x15, 0x01, 0x30, 0x00, "3"			},
334 	{0x15, 0x01, 0x30, 0x20, "4"			},
335 	{0x15, 0x01, 0x30, 0x10, "5"			},
336 
337 	{0   , 0xfe, 0   ,    2, "Invulnerability"	},
338 	{0x15, 0x01, 0x40, 0x00, "Off"			},
339 	{0x15, 0x01, 0x40, 0x40, "On"			},
340 
341 	{0   , 0xfe, 0   ,    3, "Region"		},
342 	{0x16, 0x01, 0x03, 0x02, "Europe"		},
343 	{0x16, 0x01, 0x03, 0x01, "USA"			},
344 	{0x16, 0x01, 0x03, 0x00, "Japan"		},
345 };
346 
347 STDDIPINFO(Hellfire)
348 
349 static struct BurnDIPInfo Hellfire1DIPList[] = {
350 	{0x14, 0xff, 0xff, 0x01, NULL			},
351 	{0x15, 0xff, 0xff, 0x00, NULL			},
352 
353 	{0   , 0xfe, 0   ,    2, "Cabinet"		},
354 	{0x14, 0x01, 0x01, 0x01, "Upright"		},
355 	{0x14, 0x01, 0x01, 0x00, "Cocktail"		},
356 
357 	{0   , 0xfe, 0   ,    2, "Allow Continue"	},
358 	{0x15, 0x01, 0x40, 0x00, "Off"			},
359 	{0x15, 0x01, 0x40, 0x40, "On"			},
360 };
361 
362 STDDIPINFOEXT(Hellfire1, Hellfire,  Hellfire1)
363 
364 static struct BurnDIPInfo Hellfire2aDIPList[] = {
365 	{0x14, 0xff, 0xff, 0x01, NULL			},
366 	{0x15, 0xff, 0xff, 0x00, NULL			},
367 
368 	{0   , 0xfe, 0   ,    2, "Dip switch display"	},
369 	{0x15, 0x01, 0x40, 0x00, "Off"			},
370 	{0x15, 0x01, 0x40, 0x40, "On"			},
371 };
372 
373 STDDIPINFOEXT(Hellfire2a, Hellfire,  Hellfire2a)
374 
375 static struct BurnDIPInfo Hellfire1aDIPList[] = {
376 	{0x14, 0xff, 0xff, 0x01, NULL			},
377 	{0x15, 0xff, 0xff, 0x00, NULL			},
378 
379 	{0   , 0xfe, 0   ,    2, "Dip switch display"	},
380 	{0x15, 0x01, 0x40, 0x00, "Off"			},
381 	{0x15, 0x01, 0x40, 0x40, "On"			},
382 
383 	{0   , 0xfe, 0   ,    2, "Allow Continue"	},
384 	{0x15, 0x01, 0x80, 0x00, "Off"			},
385 	{0x15, 0x01, 0x80, 0x80, "On"			},
386 };
387 
388 STDDIPINFOEXT(Hellfire1a, Hellfire,  Hellfire1a)
389 
390 static struct BurnDIPInfo ZerowingDIPList[]=
391 {
392 	{0x14, 0xff, 0xff, 0x01, NULL			},
393 	{0x15, 0xff, 0xff, 0x00, NULL			},
394 	{0x16, 0xff, 0xff, 0xf3, NULL			},
395 
396 	{0   , 0xfe, 0   ,    2, "Cabinet"		},
397 	{0x14, 0x01, 0x01, 0x01, "Upright"		},
398 	{0x14, 0x01, 0x01, 0x00, "Cocktail"		},
399 
400 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
401 	{0x14, 0x01, 0x02, 0x00, "Off"			},
402 	{0x14, 0x01, 0x02, 0x02, "On"			},
403 
404 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
405 	{0x14, 0x01, 0x04, 0x00, "Off"			},
406 	{0x14, 0x01, 0x04, 0x04, "On"			},
407 
408 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
409 	{0x14, 0x01, 0x08, 0x08, "Off"			},
410 	{0x14, 0x01, 0x08, 0x00, "On"			},
411 
412 	{0   , 0xfe, 0   ,    4, "Coin A"		},
413 	{0x14, 0x01, 0x30, 0x00, "1 Coin  1 Credit"	},  // ok a,b
414 	{0x14, 0x01, 0x30, 0x10, "1 Coins 2 Credits"	},
415 	{0x14, 0x01, 0x30, 0x20, "2 Coins 1 Credit"	},
416 	{0x14, 0x01, 0x30, 0x30, "2 Coins 3 Credits"	},
417 
418 	{0   , 0xfe, 0   ,    3, "Coin B"		},
419 	{0x14, 0x01, 0xc0, 0x00, "1 Coin  1 Credit"	},
420 	{0x14, 0x01, 0xc0, 0x40, "1 Coin  2 Credits"	},
421 	{0x14, 0x01, 0xc0, 0x80, "2 Coins 1 Credit"	},
422 
423 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
424 	{0x15, 0x01, 0x03, 0x01, "Easy"			},
425 	{0x15, 0x01, 0x03, 0x00, "Normal"		},
426 	{0x15, 0x01, 0x03, 0x02, "Hard"			},
427 	{0x15, 0x01, 0x03, 0x03, "Very Hard"		},
428 
429 	{0   , 0xfe, 0   ,    4, "Bonus Life"		},
430 	{0x15, 0x01, 0x03, 0x00, "200k 700k 500k+"	},
431 	{0x15, 0x01, 0x03, 0x04, "500k 1500k 1000k+"	},
432 	{0x15, 0x01, 0x03, 0x08, "500k Only"		},
433 	{0x15, 0x01, 0x03, 0x0c, "None"			},
434 
435 	{0   , 0xfe, 0   ,    4, "Lives"		},
436 	{0x15, 0x01, 0x30, 0x30, "2"			},
437 	{0x15, 0x01, 0x30, 0x00, "3"			},
438 	{0x15, 0x01, 0x30, 0x20, "4"			},
439 	{0x15, 0x01, 0x30, 0x10, "5"			},
440 
441 	{0   , 0xfe, 0   ,    2, "Invulnerability"	},
442 	{0x15, 0x01, 0x40, 0x00, "Off"			},
443 	{0x15, 0x01, 0x40, 0x40, "On"			},
444 
445 	{0   , 0xfe, 0   ,    2, "Allow Continue"	},
446 	{0x15, 0x01, 0x80, 0x80, "No"			},
447 	{0x15, 0x01, 0x80, 0x00, "Yes"			},
448 
449 	{0   , 0xfe, 0   ,    3, "Region"		},
450 	{0x16, 0x01, 0x03, 0x03, "Europe"		},
451 	{0x16, 0x01, 0x03, 0x01, "USA"			},
452 	{0x16, 0x01, 0x03, 0x00, "Japan"		},
453 };
454 
455 STDDIPINFO(Zerowing)
456 
457 static struct BurnDIPInfo Zerowing2DIPList[] = {
458 	{0x14, 0xff, 0xff, 0x00, NULL			},
459 	{0x15, 0xff, 0xff, 0x00, NULL			},
460 	{0x16, 0xff, 0xff, 0x00, NULL			},
461 
462 	{0   , 0xfe, 0   ,    2, "Unused"		},
463 	{0x14, 0x01, 0x01, 0x01, "On"			},
464 	{0x14, 0x01, 0x01, 0x00, "Off"			},
465 
466 	{0   , 0xfe, 0   ,    2, "Unused"		},
467 	{0x15, 0x01, 0x80, 0x00, "Off"			},
468 	{0x15, 0x01, 0x80, 0x80, "On"			},
469 
470 	{0   , 0xfe, 0   ,    2, "Region"		},
471 	{0x16, 0x01, 0x03, 0x02, "Europe"		},
472 	{0x16, 0x01, 0x03, 0x00, "USA"			},
473 };
474 
475 STDDIPINFOEXT(Zerowing2, Zerowing,  Zerowing2)
476 
477 static struct BurnDIPInfo VimanaDIPList[]=
478 {
479 	{0x14, 0xff, 0xff, 0x01, NULL			},
480 	{0x15, 0xff, 0xff, 0x00, NULL			},
481 	{0x16, 0xff, 0xff, 0x02, NULL			},
482 
483 	{0   , 0xfe, 0   ,    2, "Cabinet"		},
484 	{0x14, 0x01, 0x01, 0x01, "Upright"		},
485 	{0x14, 0x01, 0x01, 0x00, "Cocktail"		},
486 
487 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
488 	{0x14, 0x01, 0x02, 0x00, "Off"			},
489 	{0x14, 0x01, 0x02, 0x02, "On"			},
490 
491 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
492 	{0x14, 0x01, 0x04, 0x00, "Off"			},
493 	{0x14, 0x01, 0x04, 0x04, "On"			},
494 
495 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
496 	{0x14, 0x01, 0x08, 0x08, "Off"			},
497 	{0x14, 0x01, 0x08, 0x00, "On"			},
498 
499 	{0   , 0xfe, 0   ,    4, "Coin A"		},
500 	{0x14, 0x01, 0x30, 0x00, "1 Coin  1 Credit"	},
501 	{0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit"	},
502 	{0x14, 0x01, 0x30, 0x20, "3 Coins 1 Credit"	},
503 	{0x14, 0x01, 0x30, 0x30, "4 Coins 1 Credit"	},  // a/b good.
504 
505 	{0   , 0xfe, 0   ,    4, "Coin B"		},
506 	{0x14, 0x01, 0xc0, 0x00, "1 Coin  2 Credits"	},
507 	{0x14, 0x01, 0xc0, 0x40, "1 Coin  3 Credits"	},
508 	{0x14, 0x01, 0xc0, 0x80, "1 Coin  4 Credits"	},
509 	{0x14, 0x01, 0xc0, 0xc0, "1 Coin  6 Credits"	},
510 
511 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
512 	{0x15, 0x01, 0x03, 0x01, "Easy"			},
513 	{0x15, 0x01, 0x03, 0x00, "Normal"		},
514 	{0x15, 0x01, 0x03, 0x02, "Hard"			},
515 	{0x15, 0x01, 0x03, 0x03, "Very Hard"		},
516 
517 	{0   , 0xfe, 0   ,    4, "Bonus Life"		},
518 	{0x15, 0x01, 0x03, 0x00, "70k 270k 200k+"	},
519 	{0x15, 0x01, 0x03, 0x04, "100k 350k 250k+"	},
520 	{0x15, 0x01, 0x03, 0x08, "100k Only"		},
521 	{0x15, 0x01, 0x03, 0x0c, "200k Only"		},
522 
523 	{0   , 0xfe, 0   ,    4, "Lives"		},
524 	{0x15, 0x01, 0x30, 0x30, "2"			},
525 	{0x15, 0x01, 0x30, 0x00, "3"			},
526 	{0x15, 0x01, 0x30, 0x20, "4"			},
527 	{0x15, 0x01, 0x30, 0x10, "5"			},
528 
529 	{0   , 0xfe, 0   ,    2, "Invulnerability"	},
530 	{0x15, 0x01, 0x40, 0x00, "Off"			},
531 	{0x15, 0x01, 0x40, 0x40, "On"			},
532 
533 	{0   , 0xfe, 0   ,    2, "Allow Continue"	},
534 	{0x15, 0x01, 0x80, 0x80, "No"			},
535 	{0x15, 0x01, 0x80, 0x00, "Yes"			},
536 
537 	{0   , 0xfe, 0   ,    8, "Region"		},
538 	{0x16, 0x01, 0x0f, 0x02, "Europe"		},
539 	{0x16, 0x01, 0x0f, 0x01, "USA"			},
540 	{0x16, 0x01, 0x0f, 0x07, "USA (Romstar license)"},
541 	{0x16, 0x01, 0x0f, 0x04, "Korea"		},
542 	{0x16, 0x01, 0x0f, 0x03, "Hong Kong"		},
543 	{0x16, 0x01, 0x0f, 0x08, "Hong Kong (Honest Trading license)"	},
544 	{0x16, 0x01, 0x0f, 0x05, "Taiwan"		},
545 	{0x16, 0x01, 0x0f, 0x06, "Taiwan (Spacy license)"},
546 };
547 
548 STDDIPINFO(Vimana)
549 
550 static struct BurnDIPInfo VimananDIPList[] = {
551 	{0x16, 0xff, 0xff, 0x02, NULL			},
552 
553 	{0   , 0xfe, 0   ,    8, "Region"		},
554 	{0x16, 0x01, 0x0f, 0x02, "Europe (Nova Apparate license)" },
555 	{0x16, 0x01, 0x0f, 0x01, "USA"			},
556 	{0x16, 0x01, 0x0f, 0x07, "USA (Romstar license)"},
557 	{0x16, 0x01, 0x0f, 0x04, "Korea"		},
558 	{0x16, 0x01, 0x0f, 0x03, "Hong Kong"		},
559 	{0x16, 0x01, 0x0f, 0x08, "Hong Kong (Honest Trading license)" },
560 	{0x16, 0x01, 0x0f, 0x05, "Taiwan"		},
561 	{0x16, 0x01, 0x0f, 0x06, "Taiwan (Spacy license)"},
562 };
563 
564 STDDIPINFOEXT(Vimanan, Vimana,  Vimanan)
565 
566 static struct BurnDIPInfo VimanajDIPList[] = {
567 	{0x16, 0xff, 0xff, 0x00, NULL			},
568 
569 	{0   , 0xfe, 0   ,    8, "Region"		},
570 	{0x16, 0x01, 0x0f, 0x00, "Japan (distributed by Tecmo)" },
571 };
572 
573 STDDIPINFOEXT(Vimanaj, Vimana,  Vimanaj)
574 
575 static struct BurnDIPInfo DemonwldDIPList[]=
576 {
577 	{0x16, 0xff, 0xff, 0x00, NULL			},
578 	{0x17, 0xff, 0xff, 0x00, NULL			},
579 	{0x18, 0xff, 0xff, 0x01, NULL			},
580 
581 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
582 	{0x16, 0x01, 0x02, 0x00, "Off"			},
583 	{0x16, 0x01, 0x02, 0x02, "On"			},
584 
585 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
586 	{0x16, 0x01, 0x04, 0x00, "Off"			},
587 	{0x16, 0x01, 0x04, 0x04, "On"			},
588 
589 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
590 	{0x16, 0x01, 0x08, 0x08, "Off"			},
591 	{0x16, 0x01, 0x08, 0x00, "On"			},
592 
593 	{0   , 0xfe, 0   ,    4, "Coin A"		},
594 	{0x16, 0x01, 0x30, 0x00, "1 Coin  1 Credit"	},     // ok a,b
595 	{0x16, 0x01, 0x30, 0x10, "1 Coin  2 Credits"	},
596 	{0x16, 0x01, 0x30, 0x20, "2 Coins 1 Credit"	},
597 	{0x16, 0x01, 0x30, 0x30, "2 Coins 3 Credits"	},
598 
599 	{0   , 0xfe, 0   ,    4, "Coin B"		},
600 	{0x16, 0x01, 0xc0, 0x00, "1 Coin  1 Credit"	},
601 	{0x16, 0x01, 0xc0, 0x40, "1 Coin  2 Credits"	},
602 	{0x16, 0x01, 0xc0, 0x80, "2 Coins 1 Credit"	},
603 	{0x16, 0x01, 0xc0, 0xc0, "2 Coins 3 Credits"	},
604 
605 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
606 	{0x17, 0x01, 0x03, 0x01, "Easy"			},
607 	{0x17, 0x01, 0x03, 0x00, "Medium"		},
608 	{0x17, 0x01, 0x03, 0x02, "Hard"			},
609 	{0x17, 0x01, 0x03, 0x03, "Hardest"		},
610 
611 	{0   , 0xfe, 0   ,    4, "Bonus Life"		},
612 	{0x17, 0x01, 0x0c, 0x00, "30K, every 100K"	},
613 	{0x17, 0x01, 0x0c, 0x04, "50K and 100K"		},
614 	{0x17, 0x01, 0x0c, 0x08, "100K only"		},
615 	{0x17, 0x01, 0x0c, 0x0c, "None"			},
616 
617 	{0   , 0xfe, 0   ,    4, "Lives"		},
618 	{0x17, 0x01, 0x30, 0x30, "1"			},
619 	{0x17, 0x01, 0x30, 0x20, "2"			},
620 	{0x17, 0x01, 0x30, 0x00, "3"			},
621 	{0x17, 0x01, 0x30, 0x10, "5"			},
622 
623 	{0   , 0xfe, 0   ,    2, "Invulnerability"	},
624 	{0x17, 0x01, 0x40, 0x00, "Off"			},
625 	{0x17, 0x01, 0x40, 0x40, "On"			},
626 
627 	{0   , 0xfe, 0   ,    2, "Territory/Copyright"	},
628 	{0x18, 0x01, 0x01, 0x01, "Toaplan"		},
629 	{0x18, 0x01, 0x01, 0x00, "Japan/Taito Corp"	},
630 };
631 
632 STDDIPINFO(Demonwld)
633 
634 static struct BurnDIPInfo Demonwld1DIPList[] = {
635 	{0x18, 0xff, 0xff, 0x02, NULL			},
636 
637 	{0   , 0xfe, 0   ,    4, "Territory/Copyright"	},
638 	{0x18, 0x01, 0x03, 0x02, "World/Taito Japan"	},
639 	{0x18, 0x01, 0x03, 0x03, "US/Toaplan"		},
640 	{0x18, 0x01, 0x03, 0x01, "US/Taito America"	},
641 	{0x18, 0x01, 0x03, 0x00, "Japan/Taito Corp"	},
642 };
643 
644 STDDIPINFOEXT(Demonwld1, Demonwld, Demonwld1)
645 
646 static struct BurnDIPInfo OutzoneDIPList[]=
647 {
648 	{0x16, 0xff, 0xff, 0x00, NULL			},
649 	{0x17, 0xff, 0xff, 0x00, NULL			},
650 	{0x18, 0xff, 0xff, 0x02, NULL			},
651 
652 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
653 	{0x16, 0x01, 0x02, 0x00, "Off"			},
654 	{0x16, 0x01, 0x02, 0x02, "On"			},
655 
656 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
657 	{0x16, 0x01, 0x04, 0x00, "Off"			},
658 	{0x16, 0x01, 0x04, 0x04, "On"			},
659 
660 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
661 	{0x16, 0x01, 0x08, 0x08, "Off"			},
662 	{0x16, 0x01, 0x08, 0x00, "On"			},
663 
664 	{0   , 0xfe, 0   ,    4, "Coin A"		},
665 	{0x16, 0x01, 0x30, 0x00, "1 Coin  1 Credit"	},
666 	{0x16, 0x01, 0x30, 0x10, "2 Coins 1 Credit"	},   // ok a,b
667 	{0x16, 0x01, 0x30, 0x20, "3 Coins 1 Credit"	},
668 	{0x16, 0x01, 0x30, 0x30, "4 Coins 1 Credit"	},
669 
670 	{0   , 0xfe, 0   ,    4, "Coin B"		},
671 	{0x16, 0x01, 0xc0, 0x00, "1 Coin  2 Credits"	},
672 	{0x16, 0x01, 0xc0, 0x40, "1 Coin  3 Credits"	},
673 	{0x16, 0x01, 0xc0, 0x80, "1 Coin  4 Credits"	},
674 	{0x16, 0x01, 0xc0, 0xc0, "1 Coin  6 Credits"	},
675 
676 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
677 	{0x17, 0x01, 0x03, 0x01, "Easy"			},
678 	{0x17, 0x01, 0x03, 0x00, "Normal"		},
679 	{0x17, 0x01, 0x03, 0x02, "Hard"			},
680 	{0x17, 0x01, 0x03, 0x03, "Very Hard"		},
681 
682 	{0   , 0xfe, 0   ,    4, "Bonus Life"		},
683 	{0x17, 0x01, 0x0c, 0x00, "Every 300k"		},
684 	{0x17, 0x01, 0x0c, 0x04, "200k and 500k"	},
685 	{0x17, 0x01, 0x0c, 0x08, "300k Only"		},
686 	{0x17, 0x01, 0x0c, 0x0c, "None"			},
687 
688 	{0   , 0xfe, 0   ,    4, "Lives"		},
689 	{0x17, 0x01, 0x30, 0x30, "1"			},
690 	{0x17, 0x01, 0x30, 0x20, "2"			},
691 	{0x17, 0x01, 0x30, 0x00, "3"			},
692 	{0x17, 0x01, 0x30, 0x10, "5"			},
693 
694 	{0   , 0xfe, 0   ,    2, "Invulnerability"	},
695 	{0x17, 0x01, 0x40, 0x00, "Off"			},
696 	{0x17, 0x01, 0x40, 0x40, "On"			},
697 
698 	{0   , 0xfe, 0   ,    0, "Region"		},
699 	{0x18, 0x01, 0x0f, 0x00, "Japan"		},
700 	{0x18, 0x01, 0x0f, 0x01, "USA"			},
701 	{0x18, 0x01, 0x0f, 0x02, "Europe"		},
702 	{0x18, 0x01, 0x0f, 0x03, "Hong Kong"		},
703 	{0x18, 0x01, 0x0f, 0x04, "Korea"		},
704 	{0x18, 0x01, 0x0f, 0x05, "Taiwan"		},
705 	{0x18, 0x01, 0x0f, 0x06, "Taiwan (Spacy Co., Ltd.)"	},
706 	{0x18, 0x01, 0x0f, 0x07, "USA (Romstar, Inc.)"		},
707 	{0x18, 0x01, 0x0f, 0x08, "Hong Kong & China (Honest Trading Co.)"	},
708 };
709 
710 STDDIPINFO(Outzone)
711 
712 static struct BurnDIPInfo OutzoneaDIPList[] = {
713 	{0x18, 0xff, 0xff, 0x02, NULL			},
714 
715 	{0   , 0xfe, 0   ,    4, "Territory/Copyright"	},
716 	{0x18, 0x01, 0x03, 0x02, "World/Taito Japan"	},
717 	{0x18, 0x01, 0x03, 0x03, "US/Toaplan"		},
718 	{0x18, 0x01, 0x03, 0x01, "US/Taito America"	},
719 	{0x18, 0x01, 0x03, 0x00, "Japan/Taito Corp"	},
720 };
721 
722 STDDIPINFOEXT(Outzonea, Outzone, Outzonea)
723 
724 static struct BurnDIPInfo OutzonecDIPList[] = {
725 	{0x18, 0xff, 0xff, 0x02, NULL			},
726 
727 	{0   , 0xfe, 0   ,    0, "Region"		},
728 	{0x18, 0x01, 0x07, 0x00, "Japan"		},
729 	{0x18, 0x01, 0x07, 0x01, "USA"			},
730 	{0x18, 0x01, 0x07, 0x02, "Europe"		},
731 	{0x18, 0x01, 0x07, 0x03, "Hong Kong"		},
732 	{0x18, 0x01, 0x07, 0x04, "Korea"		},
733 	{0x18, 0x01, 0x07, 0x05, "Taiwan"		},
734 	{0x18, 0x01, 0x07, 0x06, "World"		},
735 };
736 
737 STDDIPINFOEXT(Outzonec, Outzone, Outzonec)
738 
739 static struct BurnDIPInfo FireshrkDIPList[]=
740 {
741 	{0x13, 0xff, 0xff, 0x01, NULL			},
742 	{0x14, 0xff, 0xff, 0x00, NULL			},
743 	{0x15, 0xff, 0xff, 0x02, NULL			},
744 
745 	{0   , 0xfe, 0   ,    2, "Cabinet"		},
746 	{0x13, 0x01, 0x01, 0x01, "Upright"		},
747 	{0x13, 0x01, 0x01, 0x00, "Cocktail"		},
748 
749 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
750 	{0x13, 0x01, 0x02, 0x00, "Off"			},
751 	{0x13, 0x01, 0x02, 0x02, "On"			},
752 
753 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
754 	{0x13, 0x01, 0x08, 0x08, "Off"			},
755 	{0x13, 0x01, 0x08, 0x00, "On"			},
756 
757 	{0   , 0xfe, 0   ,    4, "Coin A"		},
758 	{0x13, 0x01, 0x30, 0x00, "1 Coin  1 Credits"	},  // good a,b
759 	{0x13, 0x01, 0x30, 0x10, "2 Coins 1 Credits"	},
760 	{0x13, 0x01, 0x30, 0x20, "3 Coins 1 Credits"	},
761 	{0x13, 0x01, 0x30, 0x30, "4 Coins 1 Credits"	},
762 
763 	{0   , 0xfe, 0   ,    4, "Coin B"		},
764 	{0x13, 0x01, 0xc0, 0x00, "1 Coin  2 Credits"	},
765 	{0x13, 0x01, 0xc0, 0x40, "1 Coin  3 Credits"	},
766 	{0x13, 0x01, 0xc0, 0x80, "1 Coin  4 Credits"	},
767 	{0x13, 0x01, 0xc0, 0xc0, "1 Coin  6 Credits"	},
768 
769 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
770 	{0x14, 0x01, 0x03, 0x01, "Easy"			},
771 	{0x14, 0x01, 0x03, 0x00, "Medium"		},
772 	{0x14, 0x01, 0x03, 0x02, "Hard"			},
773 	{0x14, 0x01, 0x03, 0x03, "Hardest"		},
774 
775 	{0   , 0xfe, 0   ,    4, "Bonus Life"		},
776 	{0x14, 0x01, 0x0c, 0x04, "50K, every 150K"	},
777 	{0x14, 0x01, 0x0c, 0x00, "70K, every 200K"	},
778 	{0x14, 0x01, 0x0c, 0x08, "100K"			},
779 	{0x14, 0x01, 0x0c, 0x0c, "None"			},
780 
781 	{0   , 0xfe, 0   ,    4, "Lives"		},
782 	{0x14, 0x01, 0x30, 0x30, "2"			},
783 	{0x14, 0x01, 0x30, 0x00, "3"			},
784 	{0x14, 0x01, 0x30, 0x20, "4"			},
785 	{0x14, 0x01, 0x30, 0x10, "5"			},
786 
787 	{0   , 0xfe, 0   ,    2, "Invulnerability"	},
788 	{0x14, 0x01, 0x40, 0x00, "Off"			},
789 	{0x14, 0x01, 0x40, 0x40, "On"			},
790 
791 	{0   , 0xfe, 0   ,    2, "Allow Continue"	},
792 	{0x14, 0x01, 0x80, 0x80, "No"			},
793 	{0x14, 0x01, 0x80, 0x00, "Yes"			},
794 
795 	{0   , 0xfe, 0   ,    3, "Region"		},
796 	{0x15, 0x01, 0x07, 0x02, "Europe"		},
797 	{0x15, 0x01, 0x07, 0x04, "USA"			},
798 	{0x15, 0x01, 0x07, 0x00, "USA (Romstar)"	},
799 };
800 
801 STDDIPINFO(Fireshrk)
802 
803 static struct BurnDIPInfo FireshrkaDIPList[] = {
804 	{0x15, 0xff, 0xff, 0x03, NULL			},
805 
806 	{0   , 0xfe, 0   ,    2, "Region"		},
807 	{0x15, 0x01, 0x07, 0x03, "Europe"		},
808 	{0x15, 0x01, 0x07, 0x00, "USA"			},
809 };
810 
811 STDDIPINFOEXT(Fireshrka, Fireshrk, Fireshrka)
812 
813 static struct BurnDIPInfo SamesameDIPList[] = {
814 	{0x13, 0xff, 0xff, 0x01, NULL			},
815 	{0x14, 0xff, 0xff, 0x00, NULL			},
816 	{0x15, 0xff, 0xff, 0x00, NULL			},
817 
818 	{0   , 0xfe, 0   ,    2, "Cabinet"		},
819 	{0x13, 0x01, 0x01, 0x01, "Upright"		},
820 	{0x13, 0x01, 0x01, 0x00, "Cocktail"		},
821 
822 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
823 	{0x13, 0x01, 0x02, 0x00, "Off"			},
824 	{0x13, 0x01, 0x02, 0x02, "On"			},
825 
826 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
827 	{0x13, 0x01, 0x08, 0x08, "Off"			},
828 	{0x13, 0x01, 0x08, 0x00, "On"			},
829 
830 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
831 	{0x14, 0x01, 0x03, 0x01, "Easy"			},
832 	{0x14, 0x01, 0x03, 0x00, "Medium"		},
833 	{0x14, 0x01, 0x03, 0x02, "Hard"			},
834 	{0x14, 0x01, 0x03, 0x03, "Hardest"		},
835 
836 	{0   , 0xfe, 0   ,    4, "Bonus Life"		},
837 	{0x14, 0x01, 0x0c, 0x04, "50K, every 150K"	},
838 	{0x14, 0x01, 0x0c, 0x00, "70K, every 200K"	},
839 	{0x14, 0x01, 0x0c, 0x08, "100K"			},
840 	{0x14, 0x01, 0x0c, 0x0c, "None"			},
841 
842 	{0   , 0xfe, 0   ,    4, "Lives"		},
843 	{0x14, 0x01, 0x30, 0x30, "2"			},
844 	{0x14, 0x01, 0x30, 0x00, "3"			},
845 	{0x14, 0x01, 0x30, 0x20, "4"			},
846 	{0x14, 0x01, 0x30, 0x10, "5"			},
847 
848 	{0   , 0xfe, 0   ,    2, "Invulnerability"	},
849 	{0x14, 0x01, 0x40, 0x00, "Off"			},
850 	{0x14, 0x01, 0x40, 0x40, "On"			},
851 
852 	{0   , 0xfe, 0   ,    2, "Allow Continue"	},
853 	{0x14, 0x01, 0x80, 0x80, "No"			},
854 	{0x14, 0x01, 0x80, 0x00, "Yes"			},
855 };
856 
857 STDDIPINFO(Samesame)
858 
859 static struct BurnDIPInfo Samesame2DIPList[]=
860 {
861 	{0x13, 0xff, 0xff, 0x00, NULL			},
862 	{0x14, 0xff, 0xff, 0x00, NULL			},
863 	{0x15, 0xff, 0xff, 0x00, NULL			},
864 
865 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
866 	{0x13, 0x01, 0x02, 0x00, "Off"			},
867 	{0x13, 0x01, 0x02, 0x02, "On"			},
868 
869 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
870 	{0x13, 0x01, 0x08, 0x08, "Off"			},
871 	{0x13, 0x01, 0x08, 0x00, "On"			},
872 
873 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
874 	{0x14, 0x01, 0x03, 0x01, "Easy"			},
875 	{0x14, 0x01, 0x03, 0x00, "Medium"		},
876 	{0x14, 0x01, 0x03, 0x02, "Hard"			},
877 	{0x14, 0x01, 0x03, 0x03, "Hardest"		},
878 
879 	{0   , 0xfe, 0   ,    4, "Bonus Life"		},
880 	{0x14, 0x01, 0x0c, 0x04, "50K, every 150K"	},
881 	{0x14, 0x01, 0x0c, 0x00, "70K, every 200K"	},
882 	{0x14, 0x01, 0x0c, 0x08, "100K"			},
883 	{0x14, 0x01, 0x0c, 0x0c, "None"			},
884 
885 	{0   , 0xfe, 0   ,    4, "Lives"		},
886 	{0x14, 0x01, 0x30, 0x30, "2"			},
887 	{0x14, 0x01, 0x30, 0x00, "3"			},
888 	{0x14, 0x01, 0x30, 0x20, "4"			},
889 	{0x14, 0x01, 0x30, 0x10, "5"			},
890 
891 	{0   , 0xfe, 0   ,    2, "Invulnerability"	},
892 	{0x14, 0x01, 0x40, 0x00, "Off"			},
893 	{0x14, 0x01, 0x40, 0x40, "On"			},
894 
895 	{0   , 0xfe, 0   ,    2, "Allow Continue"	},
896 	{0x14, 0x01, 0x80, 0x80, "No"			},
897 	{0x14, 0x01, 0x80, 0x00, "Yes"			},
898 
899 	{0   , 0xfe, 0   ,    2, "Show Territory Notice"},
900 	{0x15, 0x01, 0x01, 0x01, "No"			},
901 	{0x15, 0x01, 0x01, 0x00, "Yes"			},
902 };
903 
STDDIPINFO(Samesame2)904 STDDIPINFO(Samesame2)
905 
906 static void __fastcall rallybik_main_write_word(UINT32 address, UINT16 data)
907 {
908 	switch (address)
909 	{
910 		case 0x1c8000:
911 			if (data == 0) {
912 				ZetReset();
913 				BurnYM3812Reset();
914 			}
915 		return;
916 	}
917 
918 	bprintf (0, _T("MWW: %5.5x, %4.4x\n"), address, data);
919 }
920 
truxton_main_write_word(UINT32 address,UINT16 data)921 static void __fastcall truxton_main_write_word(UINT32 address, UINT16 data)
922 {
923 	switch (address)
924 	{
925 		case 0x1d0000:
926 			if (data == 0) {
927 				ZetReset();
928 				BurnYM3812Reset();
929 			}
930 		return;
931 	}
932 
933 	bprintf (0, _T("MWW: %5.5x, %4.4x\n"), address, data);
934 }
935 
hellfire_main_write_word(UINT32 address,UINT16 data)936 static void __fastcall hellfire_main_write_word(UINT32 address, UINT16 data)
937 {
938 	switch (address)
939 	{
940 		case 0x180000:
941 			tiles_offsets_x = data;
942 		return;
943 
944 		case 0x180002:
945 			tiles_offsets_y = data;
946 		return;
947 
948 		case 0x180006:
949 			sprite_flipscreen = data & 0x8000;
950 		return;
951 
952 		case 0x180008:
953 			if (data == 0) {
954 				ZetReset();
955 				BurnYM3812Reset();
956 			}
957 		return;
958 	}
959 
960 	bprintf (0, _T("MWW: %5.5x, %4.4x\n"), address, data);
961 }
962 
demonwld_dsp(INT32 enable)963 static void demonwld_dsp(INT32 enable)
964 {
965 	enable ^= 1;
966 	dsp_on = enable;
967 
968 	if (enable)
969 	{
970 		tms32010_set_irq_line(0, CPU_IRQSTATUS_ACK);
971 		m68k_halt = 1;
972 		SekRunEnd();
973 	}
974 	else
975 	{
976 		tms32010_set_irq_line(0, CPU_IRQSTATUS_NONE);
977 		tms32010RunEnd();
978 	}
979 }
980 
demonwld_main_write_word(UINT32 address,UINT16 data)981 static void __fastcall demonwld_main_write_word(UINT32 address, UINT16 data)
982 {
983 	switch (address)
984 	{
985 		case 0xe00000:
986 			tiles_offsets_x = data;
987 		return;
988 
989 		case 0xe00002:
990 			tiles_offsets_y = data;
991 		return;
992 
993 		case 0xe00006:
994 			sprite_flipscreen = data & 0x8000;
995 		return;
996 
997 		case 0xe00008:
998 			if (data == 0) {
999 				ZetReset();
1000 				BurnYM3812Reset();
1001 			}
1002 		return;
1003 
1004 		case 0xe0000a:
1005 			if (data < 2) demonwld_dsp(data & 1);
1006 		return;
1007 	}
1008 }
1009 
samesame_main_read_word(UINT32 address)1010 static UINT16 __fastcall samesame_main_read_word(UINT32 address)
1011 {
1012 	switch (address)
1013 	{
1014 		case 0x140000:
1015 			return DrvInputs[0];
1016 
1017 		case 0x140002:
1018 			return DrvInputs[1];
1019 
1020 		case 0x140004:
1021 			return DrvDips[0];
1022 
1023 		case 0x140006:
1024 			return DrvDips[1];
1025 
1026 		case 0x140008:
1027 			return (DrvInputs[2] & 0x7f) | (vblank ? 0x80 : 0);
1028 
1029 		case 0x14000a:
1030 			return DrvDips[2] | 0x80;
1031 
1032 		case 0x14000e:
1033 			return 0; // mcu read?
1034 	}
1035 
1036 	bprintf (0, _T("MRW: %5.5x\n"), address);
1037 
1038 	return 0;
1039 }
1040 
samesame_main_read_byte(UINT32 address)1041 static UINT8 __fastcall samesame_main_read_byte(UINT32 address)
1042 {
1043 	switch (address)
1044 	{
1045 		case 0x140005:
1046 			return DrvDips[0];
1047 
1048 		case 0x140007:
1049 			return DrvDips[1];
1050 
1051 		case 0x140009:
1052 			return (DrvInputs[2] & 0x7f) | (vblank ? 0x80 : 0);
1053 
1054 		case 0x14000b:
1055 			return DrvDips[2] | 0x80;
1056 	}
1057 
1058 	bprintf (0, _T("RB: %5.5x\n"), address);
1059 
1060 	return 0;
1061 }
1062 
samesame_main_write_word(UINT32 address,UINT16 data)1063 static void __fastcall samesame_main_write_word(UINT32 address, UINT16 data)
1064 {
1065 	switch (address)
1066 	{
1067 		case 0x14000c:
1068 			// coin counter / lockout
1069 		return;
1070 
1071 		case 0x14000e:
1072 			soundlatch = data;
1073 			mcu_command = 1;
1074 		return;
1075 	}
1076 
1077 	bprintf (0, _T("MWW: %5.5x, %4.4x\n"), address,data);
1078 }
1079 
toaplan1_main_read_word(UINT32 address)1080 static UINT16 __fastcall toaplan1_main_read_word(UINT32 address)
1081 {
1082 	bprintf (0, _T("MRW: %5.5x\n"), address);
1083 
1084 	return 0;
1085 }
1086 
toaplan1_main_read_byte(UINT32 address)1087 static UINT8 __fastcall toaplan1_main_read_byte(UINT32 address)
1088 {
1089 	bprintf (0, _T("MRB: %5.5x\n"), address);
1090 
1091 	return 0;
1092 }
1093 
toaplan1_main_write_word(UINT32 address,UINT16 data)1094 static void __fastcall toaplan1_main_write_word(UINT32 address, UINT16 data)
1095 {
1096 	bprintf (0, _T("MWW: %5.5x, %4.4x\n"), address, data);
1097 }
1098 
toaplan1_main_write_byte(UINT32 address,UINT8 data)1099 static void __fastcall toaplan1_main_write_byte(UINT32 address, UINT8 data)
1100 {
1101 	bprintf (0, _T("MWB: %5.5x, %2.2x\n"), address, data);
1102 }
1103 
toaplan1_miscctrl2_write_word(UINT32 address,UINT16 data)1104 static void __fastcall toaplan1_miscctrl2_write_word(UINT32 address, UINT16 data)
1105 {
1106 	switch (address & 0x0006)
1107 	{
1108 		case 0x0000:
1109 			tiles_offsets_x = data;
1110 		return;
1111 
1112 		case 0x0002:
1113 			tiles_offsets_y = data;
1114 		return;
1115 
1116 		case 0x0006:
1117 			sprite_flipscreen = data & 0x8000;
1118 		return;
1119 	}
1120 }
1121 
toaplan1_miscctrl2_write_byte(UINT32 address,UINT8 data)1122 static void __fastcall toaplan1_miscctrl2_write_byte(UINT32 address, UINT8 data)
1123 {
1124 	bprintf (0, _T("MWB: %5.5x, %2.2x\n"), address, data);
1125 }
1126 
toaplan1_miscctrl_read_word(UINT32 address)1127 static UINT16 __fastcall toaplan1_miscctrl_read_word(UINT32 address)
1128 {
1129 	switch (address & 0x03fe)
1130 	{
1131 		case 0x0000:
1132 			return (vblank ? 0x01 : 0);
1133 	}
1134 
1135 	return 0;
1136 }
1137 
toaplan1_miscctrl_read_byte(UINT32 address)1138 static UINT8 __fastcall toaplan1_miscctrl_read_byte(UINT32 address)
1139 {
1140 	switch (address & 0x03ff)
1141 	{
1142 		case 0x0001:
1143 			return (vblank ? 0x01 : 0);
1144 	}
1145 
1146 	return 0;
1147 }
1148 
toaplan1_miscctrl_write_word(UINT32 address,UINT16 data)1149 static void __fastcall toaplan1_miscctrl_write_word(UINT32 address, UINT16 data)
1150 {
1151 	switch (address & 0x000e)
1152 	{
1153 		case 0x0000:
1154 			// video frame related?
1155 		return;
1156 
1157 		case 0x0002:
1158 			interrupt_enable = data & 0xff;
1159 		return;
1160 
1161 		case 0x0008: // controls refresh rate, screen dimensions
1162 		case 0x000a:
1163 		case 0x000c:
1164 		case 0x000e:
1165 		//	bprintf (0, _T("BCU CONTROL: %5.5x, %4.4x\n"), address, data);
1166 		return;
1167 	}
1168 
1169 	bprintf (0, _T("MWW: %5.5x, %4.4x\n"), address, data);
1170 }
1171 
toaplan1_miscctrl_write_byte(UINT32 address,UINT8 data)1172 static void __fastcall toaplan1_miscctrl_write_byte(UINT32 address, UINT8 data)
1173 {
1174 	switch (address & 0x000f)
1175 	{
1176 		case 0x0001:
1177 			// video frame related?
1178 		return;
1179 	}
1180 
1181 	bprintf (0, _T("MWB: %5.5x, %2.2x\n"), address, data);
1182 }
1183 
toaplan1_tilemap_read_word(UINT32 address)1184 static UINT16 __fastcall toaplan1_tilemap_read_word(UINT32 address)
1185 {
1186 	switch (address & 0x001e)
1187 	{
1188 		case 0x0002:
1189 			return tileram_offs;
1190 
1191 		case 0x0004:
1192 		{
1193 			UINT16 ret = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRAM + ((tileram_offs & 0x3fff) * 4))));
1194 
1195 			// rallybik (doesn't seem to affect other games)
1196 			ret |= ((ret & 0xf000) >> 4);
1197 			ret |= ((ret & 0x0030) << 2);
1198 
1199 			return ret;
1200 		}
1201 
1202 		case 0x0006:
1203 			return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRAM + ((tileram_offs & 0x3fff) * 4) + (address & 2))));
1204 
1205 		case 0x0010:
1206 		case 0x0012:
1207 		case 0x0014:
1208 		case 0x0016:
1209 		case 0x0018:
1210 		case 0x001a:
1211 		case 0x001c:
1212 		case 0x001e:
1213 			return scroll[(address / 2) & 7];
1214 	}
1215 
1216 	return 0;
1217 }
1218 
toaplan1_tilemap_read_byte(UINT32 address)1219 static UINT8 __fastcall toaplan1_tilemap_read_byte(UINT32 address)
1220 {
1221 	bprintf (0, _T("MRB: %5.5x\n"), address);
1222 	return 0;
1223 }
1224 
toaplan1_tilemap_write_word(UINT32 address,UINT16 data)1225 static void __fastcall toaplan1_tilemap_write_word(UINT32 address, UINT16 data)
1226 {
1227 	switch (address & 0x001e)
1228 	{
1229 		case 0x0000:
1230 			flipscreen = data & 0x01;
1231 		return;
1232 
1233 		case 0x0002:
1234 			tileram_offs = data;
1235 		return;
1236 
1237 		case 0x0004:
1238 		case 0x0006:
1239 			*((UINT16*)(DrvVidRAM + ((tileram_offs & 0x3fff) * 4) + (address & 2))) = BURN_ENDIAN_SWAP_INT16(data);
1240 		return;
1241 
1242 		case 0x0010:
1243 		case 0x0012:
1244 		case 0x0014:
1245 		case 0x0016:
1246 		case 0x0018:
1247 		case 0x001a:
1248 		case 0x001c:
1249 		case 0x001e:
1250 			scroll[(address / 2) & 7] = data;
1251 		return;
1252 	}
1253 }
1254 
toaplan1_tilemap_write_byte(UINT32 address,UINT8 data)1255 static void __fastcall toaplan1_tilemap_write_byte(UINT32 address, UINT8 data)
1256 {
1257 	bprintf (0, _T("MWB: %5.5x, %2.2x\n"), address, data);
1258 }
1259 
toaplan1_spriteram_read_word(UINT32 address)1260 static UINT16 __fastcall toaplan1_spriteram_read_word(UINT32 address)
1261 {
1262 	switch (address & 0x0006)
1263 	{
1264 		case 0x0002:
1265 			return spriteram_offset;
1266 
1267 		case 0x0004:
1268 		{
1269 			UINT16 *spriteram = (UINT16*)DrvSprRAM;
1270 			UINT16 ret = BURN_ENDIAN_SWAP_INT16(spriteram[spriteram_offset & 0x7ff]);
1271 			spriteram_offset++;
1272 			return ret;
1273 		}
1274 
1275 		case 0x0006:
1276 		{
1277 			UINT16 *spritesizeram = (UINT16*)DrvSprSizeRAM;
1278 			UINT16 ret = BURN_ENDIAN_SWAP_INT16(spritesizeram[spriteram_offset & 0x3f]);
1279 			spriteram_offset++;
1280 			return ret;
1281 		}
1282 	}
1283 
1284 	return 0;
1285 }
1286 
toaplan1_spriteram_read_byte(UINT32 address)1287 static UINT8 __fastcall toaplan1_spriteram_read_byte(UINT32 address)
1288 {
1289 	switch (address & 0x0007)
1290 	{
1291 		case 0x0001:
1292 			return (vblank ? 0x01 : 0);
1293 	}
1294 
1295 	bprintf (0, _T("MRB: %5.5x\n"), address);
1296 
1297 	return 0;
1298 }
1299 
toaplan1_spriteram_write_word(UINT32 address,UINT16 data)1300 static void __fastcall toaplan1_spriteram_write_word(UINT32 address, UINT16 data)
1301 {
1302 	switch (address & 0x0006)
1303 	{
1304 		case 0x0002:
1305 			spriteram_offset = data;
1306 		return;
1307 
1308 		case 0x0004:
1309 		{
1310 			UINT16 *spriteram = (UINT16*)DrvSprRAM;
1311 			spriteram[spriteram_offset & 0x7ff] = BURN_ENDIAN_SWAP_INT16(data);
1312 			spriteram_offset++;
1313 		}
1314 		return;
1315 
1316 		case 0x0006:
1317 		{
1318 			UINT16 *spritesizeram = (UINT16*)DrvSprSizeRAM;
1319 			spritesizeram[spriteram_offset & 0x3f] = BURN_ENDIAN_SWAP_INT16(data);
1320 			spriteram_offset++;
1321 		}
1322 		return;
1323 	}
1324 }
1325 
toaplan1_spriteram_write_byte(UINT32 address,UINT8 data)1326 static void __fastcall toaplan1_spriteram_write_byte(UINT32 address, UINT8 data)
1327 {
1328 	bprintf (0, _T("MWB: %5.5x, %2.2x\n"), address, data);
1329 }
1330 
update_palette(INT32 offset)1331 static inline void update_palette(INT32 offset)
1332 {
1333 	UINT16 p = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvPalRAM + offset * 2)));
1334 
1335 	UINT8 r = (p >>  0) & 0x1f;
1336 	UINT8 g = (p >>  5) & 0x1f;
1337 	UINT8 b = (p >> 10) & 0x1f;
1338 
1339 	r = (r << 3) | (r >> 2);
1340 	g = (g << 3) | (g >> 2);
1341 	b = (b << 3) | (b >> 2);
1342 
1343 	DrvPalette[offset] = BurnHighCol(r,g,b,0);
1344 }
1345 
toaplan1_palette_write_word(UINT32 address,UINT16 data)1346 static void __fastcall toaplan1_palette_write_word(UINT32 address, UINT16 data)
1347 {
1348 	UINT16 *p = (UINT16*)DrvPalRAM;
1349 	INT32 offset = ((address & 0x7ff) / 2) + ((address & 0x2000) >> 3);
1350 	p[offset] = BURN_ENDIAN_SWAP_INT16(data);
1351 	update_palette(offset);
1352 }
1353 
toaplan1_palette_write_byte(UINT32 address,UINT8 data)1354 static void __fastcall toaplan1_palette_write_byte(UINT32 address, UINT8 data)
1355 {
1356 	INT32 offset = (address & 0x7ff) + ((address & 0x2000) >> 2);
1357 	DrvPalRAM[offset] = data;
1358 	update_palette(offset/2);
1359 }
1360 
toaplan1_shareram_write_word(UINT32 address,UINT16 data)1361 static void __fastcall toaplan1_shareram_write_word(UINT32 address, UINT16 data)
1362 {
1363 	DrvShareRAM[(address / 2) & 0x7ff] = data;
1364 }
1365 
toaplan1_shareram_write_byte(UINT32 address,UINT8 data)1366 static void __fastcall toaplan1_shareram_write_byte(UINT32 address, UINT8 data)
1367 {
1368 	DrvShareRAM[(address / 2) & 0x7ff] = data;
1369 }
1370 
toaplan1_shareram_read_word(UINT32 address)1371 static UINT16 __fastcall toaplan1_shareram_read_word(UINT32 address)
1372 {
1373 	return DrvShareRAM[(address / 2) & 0x7ff];
1374 }
1375 
toaplan1_shareram_read_byte(UINT32 address)1376 static UINT8 __fastcall toaplan1_shareram_read_byte(UINT32 address)
1377 {
1378 	return DrvShareRAM[(address / 2) & 0x7ff];
1379 }
1380 
demonwld_dsp_w(UINT16 data)1381 static void demonwld_dsp_w(UINT16 data)
1382 {
1383 	dsp_execute = 0;
1384 
1385 	if (main_ram_seg == 0xc00000)
1386 	{
1387 		if ((dsp_addr_w < 3) && (data == 0)) dsp_execute = 1;
1388 
1389 		SekWriteWord(main_ram_seg + dsp_addr_w, data);
1390 	}
1391 }
1392 
demonwld_dsp_bio_w(UINT16 data)1393 static void demonwld_dsp_bio_w(UINT16 data)
1394 {
1395 	if (data & 0x8000)
1396 	{
1397 		dsp_BIO = 0;
1398 	}
1399 
1400 	if (data == 0)
1401 	{
1402 		if (dsp_execute)
1403 		{
1404 			m68k_halt = 0;
1405 			dsp_execute = 0;
1406 		}
1407 
1408 		dsp_BIO = 1;
1409 	}
1410 }
1411 
dsp_write(INT32 port,UINT16 data)1412 static void dsp_write(INT32 port, UINT16 data)
1413 {
1414 	switch (port)
1415 	{
1416 		case 0x00:
1417 			main_ram_seg = ((data & 0xe000) << 9);
1418 			dsp_addr_w   = ((data & 0x1fff) << 1);
1419 		return;
1420 
1421 		case 0x01: demonwld_dsp_w(data); return;
1422 		case 0x03: demonwld_dsp_bio_w(data); return;
1423 	}
1424 }
1425 
dsp_read(INT32 port)1426 static UINT16 dsp_read(INT32 port)
1427 {
1428 	switch (port)
1429 	{
1430 		case 0x01: return SekReadWord(main_ram_seg + dsp_addr_w);
1431 		case 0x10: return dsp_BIO;
1432 	}
1433 
1434 	return 0;
1435 }
1436 
rallybik_sound_write_port(UINT16 port,UINT8 data)1437 static void __fastcall rallybik_sound_write_port(UINT16 port, UINT8 data)
1438 {
1439 	switch (port & 0xff)
1440 	{
1441 		case 0x30:
1442 			// coin counter / lockout
1443 		return;
1444 
1445 		case 0x60:
1446 		case 0x61:
1447 			BurnYM3812Write(0, port & 1, data);
1448 		return;
1449 	}
1450 }
1451 
rallybik_sound_read_port(UINT16 port)1452 static UINT8 __fastcall rallybik_sound_read_port(UINT16 port)
1453 {
1454 	switch (port & 0xff)
1455 	{
1456 		case 0x00:
1457 		case 0x10:
1458 		case 0x20:
1459 			return DrvInputs[(port >> 4) & 3];
1460 
1461 		case 0x40:
1462 		case 0x50:
1463 			return DrvDips[(port >> 4) & 1];
1464 
1465 		case 0x60:
1466 			return BurnYM3812Read(0, 0);
1467 
1468 		case 0x70: // truxton
1469 			return DrvDips[2];
1470 	}
1471 
1472 	return 0;
1473 }
1474 
hellfire_sound_write_port(UINT16 port,UINT8 data)1475 static void __fastcall hellfire_sound_write_port(UINT16 port, UINT8 data)
1476 {
1477 	switch (port & 0xff)
1478 	{
1479 		case 0x30:
1480 			// coin counter / lockout
1481 		return;
1482 
1483 		case 0x70:
1484 		case 0x71:
1485 			BurnYM3812Write(0, port & 1, data);
1486 		return;
1487 	}
1488 }
1489 
hellfire_sound_read_port(UINT16 port)1490 static UINT8 __fastcall hellfire_sound_read_port(UINT16 port)
1491 {
1492 	switch (port & 0xff)
1493 	{
1494 		case 0x00:
1495 		case 0x10:
1496 			return DrvDips[(port >> 4) & 1];
1497 
1498 		case 0x20:
1499 			return DrvDips[2];
1500 
1501 		case 0x40:
1502 		case 0x50:
1503 		case 0x60:
1504 			return DrvInputs[(port >> 4) & 3];
1505 
1506 		case 0x70:
1507 			return BurnYM3812Read(0, 0);
1508 	}
1509 
1510 	return 0;
1511 }
1512 
zerowing_sound_write_port(UINT16 port,UINT8 data)1513 static void __fastcall zerowing_sound_write_port(UINT16 port, UINT8 data)
1514 {
1515 	switch (port & 0xff)
1516 	{
1517 		case 0xa0:
1518 			// coin counter / lockout
1519 		return;
1520 
1521 		case 0xa8:
1522 		case 0xa9:
1523 			BurnYM3812Write(0, port & 1, data);
1524 		return;
1525 	}
1526 }
1527 
zerowing_sound_read_port(UINT16 port)1528 static UINT8 __fastcall zerowing_sound_read_port(UINT16 port)
1529 {
1530 	switch (port & 0xff)
1531 	{
1532 		case 0x00:
1533 		case 0x08:
1534 			return DrvInputs[(port >> 3) & 1];
1535 
1536 		case 0x20:
1537 		case 0x28:
1538 			return DrvDips[(port >> 3) & 1];
1539 
1540 		case 0x80:
1541 			return DrvInputs[2];
1542 
1543 		case 0x88:
1544 			return DrvDips[2];
1545 
1546 		case 0xa8:
1547 			return BurnYM3812Read(0, 0);
1548 	}
1549 
1550 	return 0;
1551 }
1552 
outzone_sound_write_port(UINT16 port,UINT8 data)1553 static void __fastcall outzone_sound_write_port(UINT16 port, UINT8 data)
1554 {
1555 	switch (port & 0xff)
1556 	{
1557 		case 0x00:
1558 		case 0x01:
1559 			BurnYM3812Write(0, port & 1, data);
1560 		return;
1561 
1562 		case 0x04:
1563 			// coin counter / lockout
1564 		return;
1565 	}
1566 }
1567 
outzone_sound_read_port(UINT16 port)1568 static UINT8 __fastcall outzone_sound_read_port(UINT16 port)
1569 {
1570 	switch (port & 0xff)
1571 	{
1572 		case 0x00:
1573 			return BurnYM3812Read(0, 0);
1574 
1575 		case 0x08:
1576 		case 0x0c:
1577 			return DrvDips[(port >> 2) & 1];
1578 
1579 		case 0x10:
1580 			return DrvInputs[2];
1581 
1582 		case 0x14:
1583 		case 0x18:
1584 			return DrvInputs[(port >> 3) & 1];
1585 
1586 		case 0x1c:
1587 			return DrvDips[2];
1588 	}
1589 
1590 	return 0;
1591 }
1592 
vimana_sound_write_port(UINT16 port,UINT8 data)1593 static void __fastcall vimana_sound_write_port(UINT16 port, UINT8 data)
1594 {
1595 	switch (port & 0xff)
1596 	{
1597 		case 0x84:
1598 			// coin counter / lockout
1599 		return;
1600 
1601 		case 0x87:
1602 		case 0x8f:
1603 			BurnYM3812Write(0, (port >> 3) & 1, data);
1604 		return;
1605 	}
1606 }
1607 
vimana_sound_read_port(UINT16 port)1608 static UINT8 __fastcall vimana_sound_read_port(UINT16 port)
1609 {
1610 	switch (port & 0xff)
1611 	{
1612 		case 0x87:
1613 			return BurnYM3812Read(0, 0);
1614 
1615 		case 0x60:
1616 			return DrvDips[1] ^ 0xff;
1617 
1618 		case 0x66:
1619 			return DrvDips[2] ^ 0xff;
1620 
1621 		case 0x82:
1622 			return DrvDips[0];
1623 
1624 		case 0x83:
1625 			return DrvInputs[2];
1626 
1627 		case 0x80:
1628 		case 0x81:
1629 			return DrvInputs[port & 1];
1630 	}
1631 
1632 	return 0;
1633 }
1634 
samesame_sound_write_port(UINT16 port,UINT8 data)1635 static void __fastcall samesame_sound_write_port(UINT16 port, UINT8 data)
1636 {
1637 	switch (port & 0xff)
1638 	{
1639 		case 0x80:
1640 		case 0x81:
1641 			BurnYM3812Write(0, port & 1, data);
1642 		return;
1643 
1644 		case 0xb0:
1645 			soundlatch = data;
1646 			mcu_command = 0;
1647 		return;
1648 	}
1649 }
1650 
samesame_sound_read_port(UINT16 port)1651 static UINT8 __fastcall samesame_sound_read_port(UINT16 port)
1652 {
1653 	switch (port & 0xff)
1654 	{
1655 		case 0x63:
1656 			return mcu_command ? 0xff : 0;
1657 
1658 		case 0x80:
1659 		case 0x81:
1660 			return BurnYM3812Read(0, port & 1);
1661 
1662 		case 0xa0:
1663 			return soundlatch;
1664 	}
1665 
1666 	return 0;
1667 }
1668 
demonwld_sound_write_port(UINT16 port,UINT8 data)1669 static void __fastcall demonwld_sound_write_port(UINT16 port, UINT8 data)
1670 {
1671 	switch (port & 0xff)
1672 	{
1673 		case 0x00:
1674 		case 0x01:
1675 			BurnYM3812Write(0, port & 1, data);
1676 		return;
1677 
1678 		case 0x40:
1679 			// coin counter / lockout
1680 		return;
1681 	}
1682 }
1683 
demonwld_sound_read_port(UINT16 port)1684 static UINT8 __fastcall demonwld_sound_read_port(UINT16 port)
1685 {
1686 	switch (port & 0xff)
1687 	{
1688 		case 0x00:
1689 		case 0x01:
1690 			return BurnYM3812Read(0, port & 1);
1691 
1692 		case 0x20:
1693 			return DrvDips[2];
1694 
1695 		case 0x60:
1696 			return DrvInputs[2];
1697 
1698 		case 0x80:
1699 			return DrvInputs[0];
1700 
1701 		case 0xa0:
1702 			return DrvDips[1];
1703 
1704 		case 0xc0:
1705 			return DrvInputs[1];
1706 
1707 		case 0xe0:
1708 			return DrvDips[0];
1709 	}
1710 
1711 	return 0;
1712 }
1713 
1714 #define tilemap_cb(layer)					\
1715 	UINT16 *ram = (UINT16*)(DrvVidRAM + (layer*0x4000));	\
1716 	UINT16 attr = BURN_ENDIAN_SWAP_INT16(ram[offs * 2 + 0]);			\
1717 	UINT16 code = BURN_ENDIAN_SWAP_INT16(ram[offs * 2 + 1]);			\
1718 	UINT8 color = attr & 0x3f;				\
1719 	INT32 flags = (code & 0x8000) ? TILE_SKIP : 0;		\
1720 	if (DrvTransTable[code]) flags |= TILE_SKIP;		\
1721 	flags |= TILE_GROUP(attr >> 12);			\
1722 	TILE_SET_INFO(0, code, color, flags)
1723 
tilemap_callback(layer0)1724 static tilemap_callback( layer0 )
1725 {
1726 	tilemap_cb(0);
1727 }
1728 
tilemap_callback(layer1)1729 static tilemap_callback( layer1 )
1730 {
1731 	tilemap_cb(1);
1732 }
1733 
tilemap_callback(layer2)1734 static tilemap_callback( layer2 )
1735 {
1736 	tilemap_cb(2);
1737 }
1738 
tilemap_callback(layer3)1739 static tilemap_callback( layer3 )
1740 {
1741 	tilemap_cb(3);
1742 }
1743 
toaplan1SynchroniseStream(INT32 nSoundRate)1744 inline static INT32 toaplan1SynchroniseStream(INT32 nSoundRate)
1745 {
1746 	return (INT64)(ZetTotalCycles() * nSoundRate / 3500000);
1747 }
1748 
toaplan1YM3812IrqHandler(INT32,INT32 nStatus)1749 static void toaplan1YM3812IrqHandler(INT32, INT32 nStatus)
1750 {
1751 	ZetSetIRQLine(0, (nStatus) ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
1752 }
1753 
DrvDoReset()1754 static INT32 DrvDoReset()
1755 {
1756 	memset (AllRam, 0, RamEnd - AllRam);
1757 
1758 	SekOpen(0);
1759 	SekReset();
1760 	SekClose();
1761 
1762 	ZetOpen(0);
1763 	ZetReset();
1764 	BurnYM3812Reset();
1765 	ZetClose();
1766 
1767 	HiscoreReset();
1768 
1769 	m68k_halt = 0;
1770 
1771 	if (has_dsp)
1772 	{
1773 		tms32010_reset();
1774 
1775 		main_ram_seg = 0;
1776 		dsp_addr_w = 0;
1777 		dsp_execute = 0;
1778 		dsp_BIO = 0;
1779 		dsp_on = 0;
1780 	}
1781 
1782 	flipscreen = 0;
1783 	sprite_flipscreen = 0;
1784 	interrupt_enable = 0;
1785 	tiles_offsets_x = 0;
1786 	tiles_offsets_y = 0;
1787 	tileram_offs = 0;
1788 	spriteram_offset = 0;
1789 	soundlatch = 0;
1790 	mcu_command = 0;
1791 
1792 	return 0;
1793 }
1794 
MemIndex()1795 static INT32 MemIndex()
1796 {
1797 	UINT8 *Next; Next = AllMem;
1798 
1799 	Drv68KROM	= Next; Next += 0x080000;
1800 	DrvZ80ROM	= Next; Next += 0x008000;
1801 
1802 	DrvMCUROM	= Next; Next += 0x001000;
1803 
1804 	DrvGfxROM0	= Next; Next += 0x200000;
1805 	DrvGfxROM1	= Next; Next += 0x200000;
1806 
1807 	DrvTransTable	= Next; Next += 0x200000 / 0x40;
1808 
1809 	DrvPalette	= (UINT32*)Next; Next += 0x0800 * sizeof(UINT32);
1810 
1811 	pTempDraw	= (UINT16*)Next; Next += 512 * 512 * sizeof(short);
1812 
1813 	AllRam		= Next;
1814 
1815 	Drv68KRAM	= Next; Next += 0x008000;
1816 	DrvPalRAM	= Next; Next += 0x001000;
1817 	DrvVidRAM	= Next; Next += 0x010000;
1818 	DrvShareRAM	= Next; Next += 0x000800;
1819 	DrvSprRAM	= Next; Next += 0x001000;
1820 	DrvSprBuf	= Next; Next += 0x001000;
1821 	DrvSprSizeRAM	= Next; Next += 0x000080;
1822 	DrvSprSizeBuf	= Next; Next += 0x000080;
1823 	DrvZ80RAM	= Next; Next += 0x000200;
1824 	DrvMCURAM	= Next; Next += 0x000400;
1825 
1826 	scroll		= (UINT16*)Next; Next += 8 * sizeof(INT16);
1827 
1828 	RamEnd		= Next;
1829 
1830 	MemEnd		= Next;
1831 
1832 	return 0;
1833 }
1834 
DrvGfxDecode(UINT8 * src,INT32 len,INT32 type)1835 static void DrvGfxDecode(UINT8 *src, INT32 len, INT32 type)
1836 {
1837 	INT32 Plane0[4] = { (len/2)*8+8, (len/2)*8+0, 8, 0 };
1838 	INT32 Plane1[4] = { STEP4(0, ((len/4)*8)) };
1839 	INT32 XOffs[16] = { STEP16(0,1) };
1840 	INT32 YOffs[16] = { STEP16(0,16) };
1841 
1842 	UINT8 *tmp = (UINT8*)BurnMalloc(len);
1843 
1844 	memcpy (tmp, src, len);
1845 
1846 	if (type == 0)
1847 	{
1848 		GfxDecode(((len*8)/4)/(8*8), 4, 8, 8, Plane0, XOffs, YOffs, 0x080, tmp, src);
1849 	}
1850 	else if (type == 1)
1851 	{
1852 		GfxDecode(((len*8)/4)/(16*16), 4, 16, 16, Plane1, XOffs, YOffs, 0x100, tmp, src);
1853 	}
1854 
1855 	BurnFree (tmp);
1856 }
1857 
LoadRoms()1858 static INT32 LoadRoms()
1859 {
1860 	char* pRomName;
1861 	struct BurnRomInfo ri;
1862 	UINT8 *pLoad = Drv68KROM;
1863 	UINT8 *zLoad = DrvZ80ROM;
1864 	UINT8 *gLoad = DrvGfxROM0;
1865 	UINT8 *sLoad = DrvGfxROM1;
1866 	INT32 sprite_type = 0;
1867 
1868 	for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++)
1869 	{
1870 		BurnDrvGetRomInfo(&ri, i);
1871 
1872 		if ((ri.nType & 0xf) == 1) {
1873 			if (BurnLoadRom(pLoad + 1, i+0, 2)) return 1;
1874 			if (BurnLoadRom(pLoad + 0, i+1, 2)) return 1;
1875 			pLoad += 0x40000; i++;
1876 			continue;
1877 		}
1878 
1879 		if ((ri.nType & 0xf) == 2) {
1880 			if (BurnLoadRom(zLoad, i, 1)) return 1;
1881 			zLoad += ri.nLen;
1882 			continue;
1883 		}
1884 
1885 		if ((ri.nType & 0xf) == 3) {
1886 			if (BurnLoadRom(gLoad + 0, i+0, 2)) return 1;
1887 			if (BurnLoadRom(gLoad + 1, i+1, 2)) return 1;
1888 			gLoad += ri.nLen * 2; i++;
1889 			continue;
1890 		}
1891 
1892 		if ((ri.nType & 0xf) == 4) {
1893 			if (BurnLoadRom(gLoad, i, 1)) return 1;
1894 			gLoad += ri.nLen;
1895 			continue;
1896 		}
1897 
1898 		if ((ri.nType & 0xf) == 5) {
1899 			if (BurnLoadRom(sLoad + 0, i+0, 2)) return 1;
1900 			if (BurnLoadRom(sLoad + 1, i+1, 2)) return 1;
1901 			sLoad += ri.nLen * 2; i++;
1902 			continue;
1903 		}
1904 
1905 		if ((ri.nType & 0xf) == 6 || (ri.nType & 0xf) == 8) {
1906 			if (BurnLoadRom(sLoad, i, 1)) return 1;
1907 			sLoad += ri.nLen;
1908 			sprite_type = ((ri.nType & 0xf) == 6) ? 1 : 0; // rallybik / vimana
1909 			continue;
1910 		}
1911 
1912 		if ((ri.nType & 0xf) == 7) {
1913 			if (BurnLoadRom(DrvMCUROM + 0, i+0, 2)) return 1;
1914 			if (BurnLoadRom(DrvMCUROM + 1, i+1, 2)) return 1;
1915 			i++;
1916 			continue;
1917 		}
1918 	}
1919 
1920 	mainrom_size = (pLoad - Drv68KROM);
1921 
1922 	tile_mask = gLoad - DrvGfxROM0;
1923 	sprite_mask = sLoad - DrvGfxROM1;
1924 
1925 	DrvGfxDecode(DrvGfxROM0, tile_mask, 0);
1926 	DrvGfxDecode(DrvGfxROM1, sprite_mask, sprite_type);
1927 
1928 	tile_mask *= 2;
1929 	sprite_mask = ((sprite_mask * 2) / (sprite_type ? 0x100 : 0x40)) - 1;
1930 
1931 	{
1932 		for (INT32 i = 0; i < tile_mask; i+=0x40)
1933 		{
1934 			DrvTransTable[i/0x40] = 1;
1935 
1936 			for (INT32 j = 0; j < 0x40; j++)
1937 			{
1938 				if (DrvGfxROM0[i+j]) {
1939 					DrvTransTable[i/0x40] = 0;
1940 					break;
1941 				}
1942 			}
1943 		}
1944 	}
1945 
1946 	return 0;
1947 }
1948 
configure_68k_map(UINT32 mainram,UINT32 palette,UINT32 share,UINT32 sprite,UINT32 tilemap,UINT32 misc,UINT32 misc2)1949 static void configure_68k_map(UINT32 mainram, UINT32 palette, UINT32 share, UINT32 sprite, UINT32 tilemap, UINT32 misc, UINT32 misc2)
1950 {
1951 	SekInit(0, 0x68000);
1952 	SekOpen(0);
1953 	SekMapMemory(Drv68KROM,			0x000000, mainrom_size-1, MAP_ROM);
1954 	SekMapMemory(Drv68KRAM,			mainram,  mainram+0x7fff, MAP_RAM); // some only have 4000
1955 	SekSetWriteWordHandler(0,		toaplan1_main_write_word);
1956 	SekSetWriteByteHandler(0,		toaplan1_main_write_byte);
1957 	SekSetReadWordHandler(0,		toaplan1_main_read_word);
1958 	SekSetReadByteHandler(0,		toaplan1_main_read_byte);
1959 
1960 	if (palette != (UINT32)~0)
1961 	{
1962 		SekMapMemory(DrvPalRAM,			palette + 0x0000, palette + 0x07ff, MAP_RAM);
1963 		SekMapMemory(DrvPalRAM + 0x800,		palette + 0x2000, palette + 0x27ff, MAP_RAM);
1964 
1965 		SekMapHandler(1,			palette, palette + 0x27ff, MAP_WRITE);
1966 		SekSetWriteWordHandler(1,		toaplan1_palette_write_word);
1967 		SekSetWriteByteHandler(1,		toaplan1_palette_write_byte);
1968 	}
1969 
1970 	if (share != (UINT32)~0)
1971 	{
1972 		SekMapHandler(2,			share, share + 0xfff, MAP_RAM);
1973 		SekSetWriteWordHandler(2,		toaplan1_shareram_write_word);
1974 		SekSetWriteByteHandler(2,		toaplan1_shareram_write_byte);
1975 		SekSetReadWordHandler(2,		toaplan1_shareram_read_word);
1976 		SekSetReadByteHandler(2,		toaplan1_shareram_read_byte);
1977 	}
1978 
1979 	if (sprite != (UINT32)~0)
1980 	{
1981 		SekMapHandler(3,			sprite, sprite + 0x007, MAP_RAM);
1982 		SekSetWriteWordHandler(3,		toaplan1_spriteram_write_word);
1983 		SekSetWriteByteHandler(3,		toaplan1_spriteram_write_byte);
1984 		SekSetReadWordHandler(3,		toaplan1_spriteram_read_word);
1985 		SekSetReadByteHandler(3,		toaplan1_spriteram_read_byte);
1986 	}
1987 
1988 	if (tilemap != (UINT32)~0)
1989 	{
1990 		SekMapHandler(4,			tilemap, tilemap + 0x01f, MAP_RAM);
1991 		SekSetWriteWordHandler(4,		toaplan1_tilemap_write_word);
1992 		SekSetWriteByteHandler(4,		toaplan1_tilemap_write_byte);
1993 		SekSetReadWordHandler(4,		toaplan1_tilemap_read_word);
1994 		SekSetReadByteHandler(4,		toaplan1_tilemap_read_byte);
1995 	}
1996 
1997 	if (misc != (UINT32)~0)
1998 	{
1999 		SekMapHandler(5,			misc, misc + 0x00f, MAP_RAM);
2000 		SekSetWriteWordHandler(5,		toaplan1_miscctrl_write_word);
2001 		SekSetWriteByteHandler(5,		toaplan1_miscctrl_write_byte);
2002 		SekSetReadWordHandler(5,		toaplan1_miscctrl_read_word);
2003 		SekSetReadByteHandler(5,		toaplan1_miscctrl_read_byte);
2004 	}
2005 
2006 	if (misc != (UINT32)~0)
2007 	{
2008 		SekMapHandler(6,			misc2, misc2 + 0x007, MAP_WRITE);
2009 		SekSetWriteWordHandler(6,		toaplan1_miscctrl2_write_word);
2010 		SekSetWriteByteHandler(6,		toaplan1_miscctrl2_write_byte);
2011 	}
2012 
2013 	SekClose();
2014 }
2015 
common_sound_init(void (__fastcall * write_port)(UINT16,UINT8),UINT8 (__fastcall * read_port)(UINT16))2016 static void common_sound_init(void (__fastcall *write_port)(UINT16, UINT8), UINT8 (__fastcall *read_port)(UINT16))
2017 {
2018 	ZetInit(0);
2019 	ZetOpen(0);
2020 	ZetMapMemory(DrvZ80ROM,			0x0000, 0x7fff, MAP_ROM);
2021 	ZetMapMemory(DrvShareRAM,		0x8000, 0x87ff, MAP_RAM);
2022 	ZetMapMemory(DrvZ80RAM,			0xfe00, 0xffff, MAP_RAM); // for z180 games
2023 	ZetSetOutHandler(write_port);
2024 	ZetSetInHandler(read_port);
2025 	ZetClose();
2026 
2027 	BurnYM3812Init(1, 3500000, &toaplan1YM3812IrqHandler, toaplan1SynchroniseStream, 0);
2028 	BurnTimerAttachYM3812(&ZetConfig, 3500000);
2029 	BurnYM3812SetRoute(0, BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH);
2030 }
2031 
configure_graphics(INT32 xoffs,INT32 yoffs,INT32 adjust_sprite_y)2032 static void configure_graphics(INT32 xoffs, INT32 yoffs, INT32 adjust_sprite_y)
2033 {
2034 	GenericTilesInit();
2035 	GenericTilemapInit(0, TILEMAP_SCAN_ROWS, layer0_map_callback, 8, 8, 64, 64);
2036 	GenericTilemapInit(1, TILEMAP_SCAN_ROWS, layer1_map_callback, 8, 8, 64, 64);
2037 	GenericTilemapInit(2, TILEMAP_SCAN_ROWS, layer2_map_callback, 8, 8, 64, 64);
2038 	GenericTilemapInit(3, TILEMAP_SCAN_ROWS, layer3_map_callback, 8, 8, 64, 64);
2039 	GenericTilemapSetGfx(0, DrvGfxROM0, 4, 8, 8, tile_mask, 0, 0x3f);
2040 	GenericTilemapSetTransparent(0, 0);
2041 	GenericTilemapSetTransparent(1, 0);
2042 	GenericTilemapSetTransparent(2, 0);
2043 	GenericTilemapSetTransparent(3, 0);
2044 	GenericTilemapSetOffsets(0, -(xoffs+6), -(256+1+yoffs));
2045 	GenericTilemapSetOffsets(1, -(xoffs+4), -(256+1+yoffs));
2046 	GenericTilemapSetOffsets(2, -(xoffs+2), -(256+1+yoffs));
2047 	GenericTilemapSetOffsets(3, -(xoffs+0), -(256+1+yoffs));
2048 
2049 	sprite_y_adjust = adjust_sprite_y;
2050 }
2051 
RallybikInit()2052 static INT32 RallybikInit()
2053 {
2054 	vertical_lines = 282;
2055 	BurnSetRefreshRate(((28000000.0 / 4.0) / (450.0 * vertical_lines)));
2056 
2057 	AllMem = NULL;
2058 	MemIndex();
2059 	INT32 nLen = MemEnd - (UINT8 *)0;
2060 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
2061 	memset(AllMem, 0, nLen);
2062 	MemIndex();
2063 
2064 	if (LoadRoms()) return 1;
2065 
2066 	configure_68k_map(0x080000, 0x144000, 0x180000, ~0, 0x100000, 0x140000, 0x1c0000);
2067 
2068 	SekOpen(0);
2069 	SekMapMemory(DrvSprRAM,		0x0c0000, 0x0c0fff, MAP_RAM);
2070 	SekSetWriteWordHandler(0,	rallybik_main_write_word);
2071 	SekClose();
2072 
2073 	common_sound_init(rallybik_sound_write_port, rallybik_sound_read_port);
2074 
2075 	configure_graphics(13, 16, 0);
2076 
2077 	DrvDoReset();
2078 
2079 	return 0;
2080 }
2081 
TruxtonInit()2082 static INT32 TruxtonInit()
2083 {
2084 	vertical_lines = 270;
2085 	BurnSetRefreshRate(((28000000.0 / 4.0) / (450.0 * vertical_lines)));
2086 
2087 	AllMem = NULL;
2088 	MemIndex();
2089 	INT32 nLen = MemEnd - (UINT8 *)0;
2090 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
2091 	memset(AllMem, 0, nLen);
2092 	MemIndex();
2093 
2094 	if (LoadRoms()) return 1;
2095 
2096 	configure_68k_map(0x080000, 0x144000, 0x180000, 0x0c0000, 0x100000, 0x140000, 0x1c0000);
2097 
2098 	SekOpen(0);
2099 	SekSetWriteWordHandler(0,	truxton_main_write_word);
2100 	SekClose();
2101 
2102 	common_sound_init(rallybik_sound_write_port, rallybik_sound_read_port);
2103 
2104 	configure_graphics(495, 0, 0);
2105 
2106 	DrvDoReset();
2107 
2108 	return 0;
2109 }
2110 
HellfireInit()2111 static INT32 HellfireInit()
2112 {
2113 	vertical_lines = 270;
2114 	BurnSetRefreshRate(((28000000.0 / 4.0) / (450.0 * vertical_lines)));
2115 
2116 	AllMem = NULL;
2117 	MemIndex();
2118 	INT32 nLen = MemEnd - (UINT8 *)0;
2119 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
2120 	memset(AllMem, 0, nLen);
2121 	MemIndex();
2122 
2123 	if (LoadRoms()) return 1;
2124 
2125 	configure_68k_map(0x040000, 0x084000, 0x0c0000, 0x140000, 0x100000, 0x080000, ~0);
2126 
2127 	SekOpen(0);
2128 	SekSetWriteWordHandler(0,	hellfire_main_write_word);
2129 	SekClose();
2130 
2131 	common_sound_init(hellfire_sound_write_port, hellfire_sound_read_port);
2132 
2133 	configure_graphics(495, 16, 16);
2134 
2135 	DrvDoReset();
2136 
2137 	return 0;
2138 }
2139 
ZerowingInit()2140 static INT32 ZerowingInit()
2141 {
2142 	vertical_lines = 270;
2143 	BurnSetRefreshRate(((28000000.0 / 4.0) / (450.0 * vertical_lines)));
2144 
2145 	AllMem = NULL;
2146 	MemIndex();
2147 	INT32 nLen = MemEnd - (UINT8 *)0;
2148 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
2149 	memset(AllMem, 0, nLen);
2150 	MemIndex();
2151 
2152 	if (LoadRoms()) return 1;
2153 
2154 	configure_68k_map(0x080000, 0x404000, 0x440000, 0x4c0000, 0x480000, 0x400000, 0x0c0000);
2155 
2156 	common_sound_init(zerowing_sound_write_port, zerowing_sound_read_port);
2157 
2158 	configure_graphics(495, 16, 16);
2159 
2160 	DrvDoReset();
2161 
2162 	return 0;
2163 }
2164 
OutzoneInit()2165 static INT32 OutzoneInit()
2166 {
2167 	vertical_lines = 282;
2168 	BurnSetRefreshRate(((28000000.0 / 4.0) / (450.0 * vertical_lines)));
2169 
2170 	AllMem = NULL;
2171 	MemIndex();
2172 	INT32 nLen = MemEnd - (UINT8 *)0;
2173 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
2174 	memset(AllMem, 0, nLen);
2175 	MemIndex();
2176 
2177 	if (LoadRoms()) return 1;
2178 
2179 	configure_68k_map(0x240000, 0x304000, 0x140000, 0x100000, 0x200000, 0x300000, 0x340000);
2180 
2181 	common_sound_init(outzone_sound_write_port, outzone_sound_read_port);
2182 
2183 	configure_graphics(495, 0, 0);
2184 
2185 	DrvDoReset();
2186 
2187 	return 0;
2188 }
2189 
OutzonecvInit()2190 static INT32 OutzonecvInit()
2191 {
2192 	vertical_lines = 270;
2193 	BurnSetRefreshRate(((28000000.0 / 4.0) / (450.0 * vertical_lines)));
2194 
2195 	AllMem = NULL;
2196 	MemIndex();
2197 	INT32 nLen = MemEnd - (UINT8 *)0;
2198 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
2199 	memset(AllMem, 0, nLen);
2200 	MemIndex();
2201 
2202 	if (LoadRoms()) return 1;
2203 
2204 	configure_68k_map(0x080000, 0x404000, 0x440000, 0x4c0000, 0x480000,0x400000, 0x0c0000);
2205 
2206 	common_sound_init(zerowing_sound_write_port, zerowing_sound_read_port);
2207 
2208 	configure_graphics(495, 0, 0);
2209 
2210 	DrvDoReset();
2211 
2212 	return 0;
2213 }
2214 
VimanaInit()2215 static INT32 VimanaInit()
2216 {
2217 	vertical_lines = 270;
2218 	BurnSetRefreshRate(((28000000.0 / 4.0) / (450.0 * vertical_lines)));
2219 
2220 	AllMem = NULL;
2221 	MemIndex();
2222 	INT32 nLen = MemEnd - (UINT8 *)0;
2223 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
2224 	memset(AllMem, 0, nLen);
2225 	MemIndex();
2226 
2227 	if (LoadRoms()) return 1;
2228 
2229 	configure_68k_map(0x480000, 0x404000, 0x440000, 0x0c0000, 0x4c0000, 0x400000, 0x080000);
2230 
2231 	// z180 cpu!
2232 	common_sound_init(vimana_sound_write_port, vimana_sound_read_port);
2233 
2234 	configure_graphics(495, 0, 0);
2235 
2236 	DrvDoReset();
2237 
2238 	return 0;
2239 }
2240 
SamesameInit()2241 static INT32 SamesameInit()
2242 {
2243 	samesame = 1;
2244 	vertical_lines = 270;
2245 	BurnSetRefreshRate(((28000000.0 / 4.0) / (450.0 * vertical_lines)));
2246 
2247 	AllMem = NULL;
2248 	MemIndex();
2249 	INT32 nLen = MemEnd - (UINT8 *)0;
2250 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
2251 	memset(AllMem, 0, nLen);
2252 	MemIndex();
2253 
2254 	if (LoadRoms()) return 1;
2255 
2256 	configure_68k_map(0x0c0000, 0x104000, ~0, 0x1c0000, 0x180000, 0x100000, 0x080000);
2257 
2258 	SekOpen(0);
2259 	SekSetWriteWordHandler(0,		samesame_main_write_word);
2260 	SekSetReadWordHandler(0,		samesame_main_read_word);
2261 	SekSetReadByteHandler(0,		samesame_main_read_byte);
2262 	SekClose();
2263 
2264 	// z180 cpu!
2265 	common_sound_init(samesame_sound_write_port, samesame_sound_read_port);
2266 
2267 	configure_graphics(495, 0, 0);
2268 
2269 	DrvDoReset();
2270 
2271 	return 0;
2272 }
2273 
DemonwldInit()2274 static INT32 DemonwldInit()
2275 {
2276 	vertical_lines = 282;
2277 	BurnSetRefreshRate(((28000000.0 / 4.0) / (450.0 * vertical_lines)));
2278 
2279 	AllMem = NULL;
2280 	MemIndex();
2281 	INT32 nLen = MemEnd - (UINT8 *)0;
2282 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
2283 	memset(AllMem, 0, nLen);
2284 	MemIndex();
2285 
2286 	if (LoadRoms()) return 1;
2287 
2288 	configure_68k_map(0xc00000, 0x404000, 0x600000, 0xa00000, 0x800000, 0x400000, ~0);
2289 
2290 	SekOpen(0);
2291 	SekSetWriteWordHandler(0,		demonwld_main_write_word);
2292 	SekClose();
2293 
2294 	{
2295 		has_dsp = 1;
2296 		tms32010_init();
2297 		tms32010_set_write_port_handler(dsp_write);
2298 		tms32010_set_read_port_handler(dsp_read);
2299 		tms32010_ram = (UINT16*)DrvMCURAM;
2300 		tms32010_rom = (UINT16*)DrvMCUROM;
2301 	}
2302 
2303 	common_sound_init(demonwld_sound_write_port, demonwld_sound_read_port);
2304 
2305 	configure_graphics(495, 16, 16);
2306 
2307 	DrvDoReset();
2308 
2309 	return 0;
2310 }
2311 
DrvExit()2312 static INT32 DrvExit()
2313 {
2314 	GenericTilesExit();
2315 
2316 	BurnYM3812Exit();
2317 
2318 	SekExit();
2319 	ZetExit();
2320 
2321 	if (has_dsp) {
2322 		tms32010_exit();
2323 	}
2324 
2325 	BurnFree (AllMem);
2326 
2327 	has_dsp = 0;
2328 	samesame = 0;
2329 
2330 	return 0;
2331 }
2332 
DrvPaletteUpdate()2333 static void DrvPaletteUpdate()
2334 {
2335 	UINT16 *p = (UINT16*)DrvPalRAM;
2336 
2337 	for (INT32 i = 0; i < BurnDrvGetPaletteEntries(); i++)
2338 	{
2339 		UINT8 r = (BURN_ENDIAN_SWAP_INT16(p[i]) >>  0) & 0x1f;
2340 		UINT8 g = (BURN_ENDIAN_SWAP_INT16(p[i]) >>  5) & 0x1f;
2341 		UINT8 b = (BURN_ENDIAN_SWAP_INT16(p[i]) >> 10) & 0x1f;
2342 
2343 		r = (r << 3) | (r >> 2);
2344 		g = (g << 3) | (g >> 2);
2345 		b = (b << 3) | (b >> 2);
2346 
2347 		DrvPalette[i] = BurnHighCol(r,g,b,0);
2348 	}
2349 }
2350 
rallybik_draw_sprites()2351 static void rallybik_draw_sprites()
2352 {
2353 	INT32 xoffs = 35;
2354 	INT32 xoffs_flipped = 15;
2355 
2356 	UINT16 *spriteram = (UINT16*)DrvSprBuf;
2357 
2358 	for (INT32 offs = (0x1000/2)-4; offs >= 0; offs -= 4)
2359 	{
2360 		UINT16 attr = BURN_ENDIAN_SWAP_INT16(spriteram[offs + 1]);
2361 		UINT16 priority = (attr & 0x0c00)>>8;
2362 		if (!priority) continue;
2363 
2364 		INT32 sy = BURN_ENDIAN_SWAP_INT16(spriteram[offs + 3]) >> 7;
2365 
2366 		if (sy != 0x0100)
2367 		{
2368 			UINT16 code  = BURN_ENDIAN_SWAP_INT16(spriteram[offs]) & 0x7ff;
2369 			UINT16 color = ((attr & 0x3f) << 4) | 0x400;
2370 			INT32  sx    = BURN_ENDIAN_SWAP_INT16(spriteram[offs + 2]) >> 7;
2371 			INT32 flipx  = attr & 0x100;
2372 			INT32 flipy  = attr & 0x200;
2373 
2374 			if (flipx) sx -= xoffs_flipped;
2375 
2376 			{
2377 				sx -= xoffs;
2378 				sy -= 16;
2379 
2380 				if (sy < -15 || sx < -15 || sx >= nScreenWidth || sy >= nScreenHeight) continue;
2381 
2382 				UINT8 *gfx = DrvGfxROM1 + (code * 0x100);
2383 
2384 				INT32 flip = (flipx ? 0x0f : 0) | (flipy ? 0xf0 : 0);
2385 
2386 				UINT16 *dst = pTransDraw + (sy * nScreenWidth) + sx;
2387 				UINT8  *pri = pPrioDraw + (sy * nScreenWidth) + sx;
2388 
2389 				for (INT32 y = 0; y < 16; y++, dst += nScreenWidth, pri += nScreenWidth)
2390 				{
2391 					if ((sy + y) < 0 || (sy + y) >= nScreenHeight) continue;
2392 
2393 					for (INT32 x = 0; x < 16; x++)
2394 					{
2395 						if ((sx + x) < 0 || (sx + x) >= nScreenWidth) continue;
2396 
2397 						INT32 pxl = gfx[((y * 16) + x) ^ flip];
2398 
2399 						if (pxl) {
2400 							if (pri[x] <= priority) {
2401 								dst[x] = pxl + color;
2402 								pri[x] = 0xff;
2403 							}
2404 						}
2405 					}
2406 				}
2407 			}
2408 		}
2409 	}
2410 }
2411 
RallybikDraw()2412 static INT32 RallybikDraw()
2413 {
2414 	if (DrvRecalc) {
2415 		DrvPaletteUpdate();
2416 		DrvRecalc = 0;
2417 	}
2418 
2419 	for (INT32 i = 0; i < 4; i++) {
2420 		GenericTilemapSetScrollX(i, (scroll[0+i*2] >> 7) - tiles_offsets_x);
2421 		GenericTilemapSetScrollY(i, (scroll[1+i*2] >> 7) - tiles_offsets_y);
2422 	}
2423 
2424 	BurnTransferClear();
2425 
2426 	if (nBurnLayer & 8) GenericTilemapDraw(0, pTransDraw, TMAP_FORCEOPAQUE);
2427 
2428 	for (INT32 priority = 1; priority < 16; priority++)
2429 	{
2430 		if (nBurnLayer & 1) GenericTilemapDraw(3, pTransDraw, TMAP_SET_GROUP(priority)|priority);
2431 		if (nBurnLayer & 2) GenericTilemapDraw(2, pTransDraw, TMAP_SET_GROUP(priority)|priority);
2432 		if (nBurnLayer & 4) GenericTilemapDraw(1, pTransDraw, TMAP_SET_GROUP(priority)|priority);
2433 		if (nBurnLayer & 8) GenericTilemapDraw(0, pTransDraw, TMAP_SET_GROUP(priority)|priority);
2434 	}
2435 
2436 	rallybik_draw_sprites();
2437 
2438 	BurnTransferCopy(DrvPalette);
2439 
2440 	return 0;
2441 }
2442 
toaplan1_draw_sprite_custom(UINT32 code,UINT32 color,INT32 flipx,INT32 flipy,INT32 sx,INT32 sy,INT32 priority)2443 static void toaplan1_draw_sprite_custom(UINT32 code, UINT32 color, INT32 flipx, INT32 flipy, INT32 sx, INT32 sy, INT32 priority)
2444 {
2445 	sy -= sprite_y_adjust;
2446 
2447 	INT32 pal_base = 0x400 + (color & 0x3f) * 0x10;
2448 	UINT8 *source_base = DrvGfxROM1 + (code * 0x40);
2449 	UINT8 *priority_bitmap = pPrioDraw;
2450 
2451 	int sprite_screen_height = ((1<<16)*8+0x8000)>>16;
2452 	int sprite_screen_width = ((1<<16)*8+0x8000)>>16;
2453 
2454 	if (sprite_screen_width && sprite_screen_height)
2455 	{
2456 		int dx = (8<<16)/sprite_screen_width;
2457 		int dy = (8<<16)/sprite_screen_height;
2458 
2459 		int ex = sx+sprite_screen_width;
2460 		int ey = sy+sprite_screen_height;
2461 
2462 		int x_index_base;
2463 		int y_index;
2464 
2465 		if( flipx )
2466 		{
2467 			x_index_base = (sprite_screen_width-1)*dx;
2468 			dx = -dx;
2469 		}
2470 		else
2471 		{
2472 			x_index_base = 0;
2473 		}
2474 
2475 		if( flipy )
2476 		{
2477 			y_index = (sprite_screen_height-1)*dy;
2478 			dy = -dy;
2479 		}
2480 		else
2481 		{
2482 			y_index = 0;
2483 		}
2484 
2485 		if( sx < 0/*clip.min_x*/)
2486 		{
2487 			int pixels = 0-sx; //clip.min_x-sx;
2488 			sx += pixels;
2489 			x_index_base += pixels*dx;
2490 		}
2491 
2492 		if( sy < 0/*clip.min_y*/)
2493 		{
2494 			int pixels = 0-sy; //clip.min_y-sy;
2495 			sy += pixels;
2496 			y_index += pixels*dy;
2497 		}
2498 
2499 		if( ex > nScreenWidth/*clip.max_x+1*/)
2500 		{
2501 			int pixels = ex-nScreenWidth; //clip.max_x-1;
2502 			ex -= pixels;
2503 		}
2504 
2505 		if( ey > nScreenHeight/*clip.max_y+1*/)
2506 		{
2507 			int pixels = ey-nScreenHeight; //clip.max_y-1;
2508 			ey -= pixels;
2509 		}
2510 
2511 		if( ex>sx )
2512 		{
2513 			for(INT32 y=sy; y<ey; y++ )
2514 			{
2515 				const UINT8 *source = source_base + (y_index>>16) * 8;
2516 				UINT16 *dest = pTransDraw + (y * nScreenWidth);
2517 				uint8_t *pri = priority_bitmap + (y * nScreenWidth);
2518 
2519 				int x_index = x_index_base;
2520 				for(INT32 x=sx; x<ex; x++ )
2521 				{
2522 					int c = source[x_index>>16];
2523 					if( c != 0 )
2524 					{
2525 						if (pri[x] < priority)
2526 							dest[x] = pal_base+c;
2527 						pri[x] = 0xff; // mark it "already drawn"
2528 					}
2529 					x_index += dx;
2530 				}
2531 
2532 				y_index += dy;
2533 			}
2534 		}
2535 	}
2536 }
2537 
draw_sprites()2538 static void draw_sprites()
2539 {
2540 	UINT16 *source = (UINT16*)DrvSprBuf;
2541 	UINT16 *size   = (UINT16*)DrvSprSizeBuf;
2542 	INT32 fcu_flipscreen = sprite_flipscreen;
2543 
2544 	for (INT32 offs = 0x1000/2 - 4; offs >= 0; offs -= 4)
2545 	{
2546 		if (!(BURN_ENDIAN_SWAP_INT16(source[offs]) & 0x8000))
2547 		{
2548 			INT32 sx, sy;
2549 
2550 			INT32 attrib = BURN_ENDIAN_SWAP_INT16(source[offs+1]);
2551 			INT32 priority = (attrib & 0xf000) >> 12;
2552 
2553 			INT32 sprite = BURN_ENDIAN_SWAP_INT16(source[offs]) & 0x7fff;
2554 			INT32 color = attrib & 0x3f;
2555 
2556 			INT32 sizeram_ptr = (attrib >> 6) & 0x3f;
2557 			INT32 sprite_sizex = (BURN_ENDIAN_SWAP_INT16(size[sizeram_ptr])       & 0x0f) * 8;
2558 			INT32 sprite_sizey = ((BURN_ENDIAN_SWAP_INT16(size[sizeram_ptr]) >> 4) & 0x0f) * 8;
2559 
2560 			INT32 sx_base = (BURN_ENDIAN_SWAP_INT16(source[offs + 2]) >> 7) & 0x1ff;
2561 			INT32 sy_base = (BURN_ENDIAN_SWAP_INT16(source[offs + 3]) >> 7) & 0x1ff;
2562 
2563 			if (sx_base >= 0x180) sx_base -= 0x200;
2564 			if (sy_base >= 0x180) sy_base -= 0x200;
2565 
2566 			if (fcu_flipscreen)
2567 			{
2568 				sx_base = 320 - (sx_base + 8);
2569 				sy_base = 240 - (sy_base + 8);
2570 			//	sy_base += ((visarea.max_y + 1) - 240) * 2;    // Horizontal games are offset so adjust by +0x20
2571 			}
2572 
2573 			for (INT32 dim_y = 0; dim_y < sprite_sizey; dim_y += 8)
2574 			{
2575 				if (fcu_flipscreen) sy = sy_base - dim_y;
2576 				else                sy = sy_base + dim_y;
2577 
2578 				for (INT32 dim_x = 0; dim_x < sprite_sizex; dim_x += 8)
2579 				{
2580 					if (fcu_flipscreen) sx = sx_base - dim_x;
2581 					else                sx = sx_base + dim_x;
2582 
2583 					toaplan1_draw_sprite_custom(sprite & sprite_mask,color, fcu_flipscreen,fcu_flipscreen, sx,sy, priority);
2584 
2585 					sprite++ ;
2586 				}
2587 			}
2588 		}
2589 	}
2590 }
2591 
DrvDraw()2592 static INT32 DrvDraw()
2593 {
2594 	if (DrvRecalc) {
2595 		DrvPaletteUpdate();
2596 		DrvRecalc = 0;
2597 	}
2598 
2599 	for (INT32 i = 0; i < 4; i++) {
2600 		GenericTilemapSetScrollX(i, (scroll[0+i*2] >> 7) - tiles_offsets_x);
2601 		GenericTilemapSetScrollY(i, (scroll[1+i*2] >> 7) - tiles_offsets_y);
2602 	}
2603 
2604 	BurnTransferClear();
2605 
2606 	if (nBurnLayer & 8) GenericTilemapDraw(0, pTransDraw, TMAP_FORCEOPAQUE);
2607 
2608 	for (INT32 priority = 1; priority < 16; priority++)
2609 	{
2610 		if (nBurnLayer & 1) GenericTilemapDraw(3, pTransDraw, TMAP_SET_GROUP(priority)|priority);
2611 		if (nBurnLayer & 2) GenericTilemapDraw(2, pTransDraw, TMAP_SET_GROUP(priority)|priority);
2612 		if (nBurnLayer & 4) GenericTilemapDraw(1, pTransDraw, TMAP_SET_GROUP(priority)|priority);
2613 		if (nBurnLayer & 8) GenericTilemapDraw(0, pTransDraw, TMAP_SET_GROUP(priority)|priority);
2614 	}
2615 
2616 	draw_sprites();
2617 
2618 	BurnTransferCopy(DrvPalette);
2619 
2620 	return 0;
2621 }
2622 
DrvFrame()2623 static INT32 DrvFrame()
2624 {
2625 	if (DrvReset) {
2626 		DrvDoReset();
2627 	}
2628 
2629 	SekNewFrame();
2630 	ZetNewFrame();
2631 
2632 	{
2633 		DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = 0;
2634 
2635 		for (INT32 i = 0; i < 8; i++) {
2636 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
2637 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
2638 			DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
2639 		}
2640 	}
2641 
2642 	INT32 nInterleave = vertical_lines;
2643 	INT32 nCyclesTotal[3] = { (10000000 * 100) / nBurnFPS, (3500000 * 100) / nBurnFPS, (14000000 * 100) / nBurnFPS };
2644 	INT32 nCyclesDone[3] = { 0, 0, 0 };
2645 	INT32 nVBlankLine = 240 + sprite_y_adjust;
2646 
2647 	SekOpen(0);
2648 	ZetOpen(0);
2649 
2650 	vblank = 0;
2651 
2652 	for (INT32 i = 0; i < nInterleave; i++)
2653 	{
2654 		if (m68k_halt) {
2655 			CPU_IDLE(0, Sek);
2656 		} else {
2657 			CPU_RUN(0, Sek);
2658 		}
2659 
2660 		if (i == nVBlankLine) {
2661 			vblank = 1;
2662 			if (interrupt_enable) SekSetIRQLine(4, CPU_IRQSTATUS_AUTO);
2663 
2664 			if (pBurnDraw) {
2665 				BurnDrvRedraw();
2666 			}
2667 
2668 			memcpy (DrvSprBuf , DrvSprRAM , 0x1000);
2669 			memcpy (DrvSprSizeBuf , DrvSprSizeRAM , 0x80);
2670 		}
2671 
2672 		if (samesame && i == nVBlankLine + 2) {
2673 			SekSetIRQLine(2, CPU_IRQSTATUS_AUTO);
2674 		}
2675 
2676 		BurnTimerUpdateYM3812((i + 1) * (nCyclesTotal[1] / nInterleave));
2677 
2678 		if (has_dsp && dsp_on) {
2679 			CPU_RUN(2, tms32010);
2680 		}
2681 	}
2682 
2683 	BurnTimerEndFrameYM3812(nCyclesTotal[1]);
2684 
2685 	if (pBurnSoundOut) {
2686 		BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
2687 	}
2688 
2689 	ZetClose();
2690 	SekClose();
2691 
2692 	return 0;
2693 }
2694 
DrvScan(INT32 nAction,INT32 * pnMin)2695 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
2696 {
2697 	struct BurnArea ba;
2698 
2699 	if (pnMin) {
2700 		*pnMin = 0x029698;
2701 	}
2702 
2703 	if (nAction & ACB_VOLATILE) {
2704 		memset(&ba, 0, sizeof(ba));
2705 
2706 		ba.Data	  = AllRam;
2707 		ba.nLen	  = RamEnd - AllRam;
2708 		ba.szName = "All Ram";
2709 		BurnAcb(&ba);
2710 
2711 		SekScan(nAction);
2712 		ZetScan(nAction);
2713 
2714 		BurnYM3812Scan(nAction, pnMin);
2715 
2716 		SCAN_VAR(flipscreen);
2717 		SCAN_VAR(interrupt_enable);
2718 		SCAN_VAR(tiles_offsets_x);
2719 		SCAN_VAR(tiles_offsets_y);
2720 		SCAN_VAR(tileram_offs);
2721 		SCAN_VAR(spriteram_offset);
2722 		SCAN_VAR(sprite_flipscreen);
2723 		SCAN_VAR(soundlatch);
2724 		SCAN_VAR(mcu_command);
2725 
2726 		if (has_dsp) {
2727 			tms32010_scan(nAction);
2728 
2729 			SCAN_VAR(m68k_halt);
2730 			SCAN_VAR(main_ram_seg);
2731 			SCAN_VAR(dsp_addr_w);
2732 			SCAN_VAR(dsp_execute);
2733 			SCAN_VAR(dsp_BIO);
2734 			SCAN_VAR(dsp_on);
2735 		}
2736 	}
2737 
2738 	return 0;
2739 }
2740 
2741 
2742 // Rally Bike / Dash Yarou
2743 
2744 static struct BurnRomInfo rallybikRomDesc[] = {
2745 	{ "b45-02.rom",			0x08000, 0x383386d7, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2746 	{ "b45-01.rom",			0x08000, 0x7602f6a7, 1 | BRF_PRG | BRF_ESS }, //  1
2747 	{ "b45-04.rom",			0x20000, 0xe9b005b1, 1 | BRF_PRG | BRF_ESS }, //  2
2748 	{ "b45-03.rom",			0x20000, 0x555344ce, 1 | BRF_PRG | BRF_ESS }, //  3
2749 
2750 	{ "b45-05.rom",			0x04000, 0x10814601, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 Code
2751 
2752 	{ "b45-09.bin",			0x20000, 0x1dc7b010, 3 | BRF_GRA },           //  5 Layer Tiles
2753 	{ "b45-08.bin",			0x20000, 0xfab661ba, 3 | BRF_GRA },           //  6
2754 	{ "b45-07.bin",			0x20000, 0xcd3748b4, 3 | BRF_GRA },           //  7
2755 	{ "b45-06.bin",			0x20000, 0x144b085c, 3 | BRF_GRA },           //  8
2756 
2757 	{ "b45-11.rom",			0x10000, 0x0d56e8bb, 6 | BRF_GRA },           //  9 Sprites
2758 	{ "b45-10.rom",			0x10000, 0xdbb7c57e, 6 | BRF_GRA },           // 10
2759 	{ "b45-12.rom",			0x10000, 0xcf5aae4e, 6 | BRF_GRA },           // 11
2760 	{ "b45-13.rom",			0x10000, 0x1683b07c, 6 | BRF_GRA },           // 12
2761 
2762 	{ "b45-15.bpr",			0x00100, 0x24e7d62f, 0 | BRF_OPT },           // 13 PROMs
2763 	{ "b45-16.bpr",			0x00100, 0xa50cef09, 0 | BRF_OPT },           // 14
2764 	{ "b45-14.bpr",			0x00020, 0xf72482db, 0 | BRF_OPT },           // 15
2765 	{ "b45-17.bpr",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 16
2766 };
2767 
2768 STD_ROM_PICK(rallybik)
2769 STD_ROM_FN(rallybik)
2770 
2771 struct BurnDriver BurnDrvRallybik = {
2772 	"rallybik", NULL, NULL, NULL, "1988",
2773 	"Rally Bike / Dash Yarou\0", NULL, "Toaplan / Taito Corporation", "Toaplan BCU-2 / FCU-2 based",
2774 	L"Rally Bike\0\u30C0\u30C3\u30B7\u30E5\uC91E\u90CE\0", NULL, NULL, NULL,
2775 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RACING, 0,
2776 	NULL, rallybikRomInfo, rallybikRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, RallybikDIPInfo,
2777 	RallybikInit, DrvExit, DrvFrame, RallybikDraw, DrvScan, &DrvRecalc, 0x800,
2778 	240, 320, 3, 4
2779 };
2780 
2781 
2782 // Truxton / Tatsujin
2783 
2784 static struct BurnRomInfo truxtonRomDesc[] = {
2785 	{ "b65_11.bin",			0x20000, 0x1a62379a, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2786 	{ "b65_10.bin",			0x20000, 0xaff5195d, 1 | BRF_PRG | BRF_ESS }, //  1
2787 
2788 	{ "b65_09.bin",			0x04000, 0x1bdd4ddc, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
2789 
2790 	{ "b65_08.bin",			0x20000, 0xd2315b37, 3 | BRF_GRA },           //  3 Layer Tiles
2791 	{ "b65_07.bin",			0x20000, 0xfb83252a, 3 | BRF_GRA },           //  4
2792 	{ "b65_06.bin",			0x20000, 0x36cedcbe, 3 | BRF_GRA },           //  5
2793 	{ "b65_05.bin",			0x20000, 0x81cd95f1, 3 | BRF_GRA },           //  6
2794 
2795 	{ "b65_04.bin",			0x20000, 0x8c6ff461, 5 | BRF_GRA },           //  7 Sprites
2796 	{ "b65_03.bin",			0x20000, 0x58b1350b, 5 | BRF_GRA },           //  8
2797 	{ "b65_02.bin",			0x20000, 0x1dd55161, 5 | BRF_GRA },           //  9
2798 	{ "b65_01.bin",			0x20000, 0xe974937f, 5 | BRF_GRA },           // 10
2799 
2800 	{ "b65_12.bpr",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 11 PROMs
2801 	{ "b65_13.bpr",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 12
2802 };
2803 
2804 STD_ROM_PICK(truxton)
2805 STD_ROM_FN(truxton)
2806 
2807 struct BurnDriver BurnDrvTruxton = {
2808 	"truxton", NULL, NULL, NULL, "1988",
2809 	"Truxton / Tatsujin\0", NULL, "Toaplan / Taito Corporation", "Toaplan BCU-2 / FCU-2 based",
2810 	NULL, NULL, NULL, NULL,
2811 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
2812 	NULL, truxtonRomInfo, truxtonRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, TruxtonDIPInfo,
2813 	TruxtonInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
2814 	240, 320, 3, 4
2815 };
2816 
2817 
2818 // Hellfire (2P set)
2819 
2820 static struct BurnRomInfo hellfireRomDesc[] = {
2821 	{ "b90_14.0",			0x20000, 0x101df9f5, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2822 	{ "b90_15.1",			0x20000, 0xe67fd452, 1 | BRF_PRG | BRF_ESS }, //  1
2823 
2824 	{ "b90_03.2",			0x08000, 0x4058fa67, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
2825 
2826 	{ "b90_04.3",			0x20000, 0xea6150fc, 3 | BRF_GRA },           //  3 Layer Tiles
2827 	{ "b90_05.4",			0x20000, 0xbb52c507, 3 | BRF_GRA },           //  4
2828 	{ "b90_06.5",			0x20000, 0xcf5b0252, 3 | BRF_GRA },           //  5
2829 	{ "b90_07.6",			0x20000, 0xb98af263, 3 | BRF_GRA },           //  6
2830 
2831 	{ "b90_11.10",			0x20000, 0xc33e543c, 5 | BRF_GRA },           //  7 Sprites
2832 	{ "b90_10.9",			0x20000, 0x35fd1092, 5 | BRF_GRA },           //  8
2833 	{ "b90_09.8",			0x20000, 0xcf01009e, 5 | BRF_GRA },           //  9
2834 	{ "b90_08.7",			0x20000, 0x3404a5e3, 5 | BRF_GRA },           // 10
2835 
2836 	{ "13.3w",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 11 PROMs
2837 	{ "12.6b",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 12
2838 };
2839 
2840 STD_ROM_PICK(hellfire)
2841 STD_ROM_FN(hellfire)
2842 
2843 struct BurnDriver BurnDrvHellfire = {
2844 	"hellfire", NULL, NULL, NULL, "1989",
2845 	"Hellfire (2P set)\0", NULL, "Toaplan (Taito license)", "Toaplan BCU-2 / FCU-2 based",
2846 	NULL, NULL, NULL, NULL,
2847 	BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
2848 	NULL, hellfireRomInfo, hellfireRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, HellfireDIPInfo,
2849 	HellfireInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
2850 	320, 240, 4, 3
2851 };
2852 
2853 
2854 // Hellfire (1P set)
2855 
2856 static struct BurnRomInfo hellfire1RomDesc[] = {
2857 	{ "b90_01.10m",			0x20000, 0x034966d3, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2858 	{ "b90_02.9m",			0x20000, 0x06dd24c7, 1 | BRF_PRG | BRF_ESS }, //  1
2859 
2860 	{ "b90_03.2",			0x08000, 0x4058fa67, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
2861 
2862 	{ "b90_04.3",			0x20000, 0xea6150fc, 3 | BRF_GRA },           //  3 Layer Tiles
2863 	{ "b90_05.4",			0x20000, 0xbb52c507, 3 | BRF_GRA },           //  4
2864 	{ "b90_06.5",			0x20000, 0xcf5b0252, 3 | BRF_GRA },           //  5
2865 	{ "b90_07.6",			0x20000, 0xb98af263, 3 | BRF_GRA },           //  6
2866 
2867 	{ "b90_11.10",			0x20000, 0xc33e543c, 5 | BRF_GRA },           //  7 Sprites
2868 	{ "b90_10.9",			0x20000, 0x35fd1092, 5 | BRF_GRA },           //  8
2869 	{ "b90_09.8",			0x20000, 0xcf01009e, 5 | BRF_GRA },           //  9
2870 	{ "b90_08.7",			0x20000, 0x3404a5e3, 5 | BRF_GRA },           // 10
2871 
2872 	{ "13.3w",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 11 PROMs
2873 	{ "12.6b",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 12
2874 };
2875 
2876 STD_ROM_PICK(hellfire1)
2877 STD_ROM_FN(hellfire1)
2878 
2879 struct BurnDriver BurnDrvHellfire1 = {
2880 	"hellfire1", "hellfire", NULL, NULL, "1989",
2881 	"Hellfire (1P set)\0", NULL, "Toaplan (Taito license)", "Toaplan BCU-2 / FCU-2 based",
2882 	NULL, NULL, NULL, NULL,
2883 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
2884 	NULL, hellfire1RomInfo, hellfire1RomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, Hellfire1DIPInfo,
2885 	HellfireInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
2886 	320, 240, 4, 3
2887 };
2888 
2889 
2890 // Hellfire (2P set, older)
2891 
2892 static struct BurnRomInfo hellfire2aRomDesc[] = {
2893 	{ "b90_01.0",			0x20000, 0xc94acf53, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2894 	{ "b90_02.1",			0x20000, 0xd17f03c3, 1 | BRF_PRG | BRF_ESS }, //  1
2895 
2896 	{ "b90_03.2",			0x08000, 0x4058fa67, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
2897 
2898 	{ "b90_04.3",			0x20000, 0xea6150fc, 3 | BRF_GRA },           //  3 Layer Tiles
2899 	{ "b90_05.4",			0x20000, 0xbb52c507, 3 | BRF_GRA },           //  4
2900 	{ "b90_06.5",			0x20000, 0xcf5b0252, 3 | BRF_GRA },           //  5
2901 	{ "b90_07.6",			0x20000, 0xb98af263, 3 | BRF_GRA },           //  6
2902 
2903 	{ "b90_11.10",			0x20000, 0xc33e543c, 5 | BRF_GRA },           //  7 Sprites
2904 	{ "b90_10.9",			0x20000, 0x35fd1092, 5 | BRF_GRA },           //  8
2905 	{ "b90_09.8",			0x20000, 0xcf01009e, 5 | BRF_GRA },           //  9
2906 	{ "b90_08.7",			0x20000, 0x3404a5e3, 5 | BRF_GRA },           // 10
2907 
2908 	{ "13.3w",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 11 PROMs
2909 	{ "12.6b",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 12
2910 };
2911 
2912 STD_ROM_PICK(hellfire2a)
2913 STD_ROM_FN(hellfire2a)
2914 
2915 struct BurnDriver BurnDrvHellfire2a = {
2916 	"hellfire2a", "hellfire", NULL, NULL, "1989",
2917 	"Hellfire (2P set, older)\0", NULL, "Toaplan (Taito license)", "Toaplan BCU-2 / FCU-2 based",
2918 	NULL, NULL, NULL, NULL,
2919 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
2920 	NULL, hellfire2aRomInfo, hellfire2aRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, Hellfire2aDIPInfo,
2921 	HellfireInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
2922 	320, 240, 4, 3
2923 };
2924 
2925 
2926 // Hellfire (1P set, older)
2927 
2928 static struct BurnRomInfo hellfire1aRomDesc[] = {
2929 	{ "b90_14x.0",			0x20000, 0xa3141ea5, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2930 	{ "b90_15x.1",			0x20000, 0xe864daf4, 1 | BRF_PRG | BRF_ESS }, //  1
2931 
2932 	{ "b90_03x.2",			0x08000, 0xf58c368f, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
2933 
2934 	{ "b90_04.3",			0x20000, 0xea6150fc, 3 | BRF_GRA },           //  3 Layer Tiles
2935 	{ "b90_05.4",			0x20000, 0xbb52c507, 3 | BRF_GRA },           //  4
2936 	{ "b90_06.5",			0x20000, 0xcf5b0252, 3 | BRF_GRA },           //  5
2937 	{ "b90_07.6",			0x20000, 0xb98af263, 3 | BRF_GRA },           //  6
2938 
2939 	{ "b90_11.10",			0x20000, 0xc33e543c, 5 | BRF_GRA },           //  7 Sprites
2940 	{ "b90_10.9",			0x20000, 0x35fd1092, 5 | BRF_GRA },           //  8
2941 	{ "b90_09.8",			0x20000, 0xcf01009e, 5 | BRF_GRA },           //  9
2942 	{ "b90_08.7",			0x20000, 0x3404a5e3, 5 | BRF_GRA },           // 10
2943 
2944 	{ "13.3w",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 11 PROMs
2945 	{ "12.6b",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 12
2946 };
2947 
2948 STD_ROM_PICK(hellfire1a)
2949 STD_ROM_FN(hellfire1a)
2950 
2951 struct BurnDriver BurnDrvHellfire1a = {
2952 	"hellfire1a", "hellfire", NULL, NULL, "1989",
2953 	"Hellfire (1P set, older)\0", NULL, "Toaplan (Taito license)", "Toaplan BCU-2 / FCU-2 based",
2954 	NULL, NULL, NULL, NULL,
2955 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
2956 	NULL, hellfire1aRomInfo, hellfire1aRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, Hellfire1aDIPInfo,
2957 	HellfireInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
2958 	320, 240, 4, 3
2959 };
2960 
2961 
2962 // Zero Wing (2P set)
2963 
2964 static struct BurnRomInfo zerowingRomDesc[] = {
2965 	{ "o15-11ii.bin",		0x08000, 0xe697ecb9, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2966 	{ "o15-12ii.bin",		0x08000, 0xb29ee3ad, 1 | BRF_PRG | BRF_ESS }, //  1
2967 	{ "o15-09.rom",			0x20000, 0x13764e95, 1 | BRF_PRG | BRF_ESS }, //  2
2968 	{ "o15-10.rom",			0x20000, 0x351ba71a, 1 | BRF_PRG | BRF_ESS }, //  3
2969 
2970 	{ "o15-13.rom",			0x08000, 0xe7b72383, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 Code
2971 
2972 	{ "o15-05.rom",			0x20000, 0x4e5dd246, 3 | BRF_GRA },           //  5 Layer Tiles
2973 	{ "o15-06.rom",			0x20000, 0xc8c6d428, 3 | BRF_GRA },           //  6
2974 	{ "o15-07.rom",			0x20000, 0xefc40e99, 3 | BRF_GRA },           //  7
2975 	{ "o15-08.rom",			0x20000, 0x1b019eab, 3 | BRF_GRA },           //  8
2976 
2977 	{ "o15-03.rom",			0x20000, 0x7f245fd3, 5 | BRF_GRA },           //  9 Sprites
2978 	{ "o15-04.rom",			0x20000, 0x0b1a1289, 5 | BRF_GRA },           // 10
2979 	{ "o15-01.rom",			0x20000, 0x70570e43, 5 | BRF_GRA },           // 11
2980 	{ "o15-02.rom",			0x20000, 0x724b487f, 5 | BRF_GRA },           // 12
2981 
2982 	{ "tp015_14.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
2983 	{ "tp015_15.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
2984 };
2985 
2986 STD_ROM_PICK(zerowing)
2987 STD_ROM_FN(zerowing)
2988 
2989 struct BurnDriver BurnDrvZerowing = {
2990 	"zerowing", NULL, NULL, NULL, "1989",
2991 	"Zero Wing (2P set)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
2992 	NULL, NULL, NULL, NULL,
2993 	BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
2994 	NULL, zerowingRomInfo, zerowingRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, Zerowing2DIPInfo,
2995 	ZerowingInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
2996 	320, 240, 4, 3
2997 };
2998 
2999 
3000 // Zero Wing (1P set)
3001 
3002 static struct BurnRomInfo zerowing1RomDesc[] = {
3003 	{ "o15-11.rom",			0x08000, 0x6ff2b9a0, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3004 	{ "o15-12.rom",			0x08000, 0x9773e60b, 1 | BRF_PRG | BRF_ESS }, //  1
3005 	{ "o15-09.rom",			0x20000, 0x13764e95, 1 | BRF_PRG | BRF_ESS }, //  2
3006 	{ "o15-10.rom",			0x20000, 0x351ba71a, 1 | BRF_PRG | BRF_ESS }, //  3
3007 
3008 	{ "o15-13.rom",			0x08000, 0xe7b72383, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 Code
3009 
3010 	{ "o15-05.rom",			0x20000, 0x4e5dd246, 3 | BRF_GRA },           //  5 Layer Tiles
3011 	{ "o15-06.rom",			0x20000, 0xc8c6d428, 3 | BRF_GRA },           //  6
3012 	{ "o15-07.rom",			0x20000, 0xefc40e99, 3 | BRF_GRA },           //  7
3013 	{ "o15-08.rom",			0x20000, 0x1b019eab, 3 | BRF_GRA },           //  8
3014 
3015 	{ "o15-03.rom",			0x20000, 0x7f245fd3, 5 | BRF_GRA },           //  9 Sprites
3016 	{ "o15-04.rom",			0x20000, 0x0b1a1289, 5 | BRF_GRA },           // 10
3017 	{ "o15-01.rom",			0x20000, 0x70570e43, 5 | BRF_GRA },           // 11
3018 	{ "o15-02.rom",			0x20000, 0x724b487f, 5 | BRF_GRA },           // 12
3019 
3020 	{ "tp015_14.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3021 	{ "tp015_15.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3022 };
3023 
3024 STD_ROM_PICK(zerowing1)
3025 STD_ROM_FN(zerowing1)
3026 
3027 struct BurnDriver BurnDrvZerowing1 = {
3028 	"zerowing1", "zerowing", NULL, NULL, "1989",
3029 	"Zero Wing (1P set)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3030 	NULL, NULL, NULL, NULL,
3031 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3032 	NULL, zerowing1RomInfo, zerowing1RomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, ZerowingDIPInfo,
3033 	ZerowingInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3034 	320, 240, 4, 3
3035 };
3036 
3037 
3038 // Zero Wing (2P set, Williams license)
3039 
3040 static struct BurnRomInfo zerowingwRomDesc[] = {
3041 	{ "o15-11iiw.bin",		0x08000, 0x38b0bb5b, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3042 	{ "o15-12iiw.bin",		0x08000, 0x74c91e6f, 1 | BRF_PRG | BRF_ESS }, //  1
3043 	{ "o15-09.rom",			0x20000, 0x13764e95, 1 | BRF_PRG | BRF_ESS }, //  2
3044 	{ "o15-10.rom",			0x20000, 0x351ba71a, 1 | BRF_PRG | BRF_ESS }, //  3
3045 
3046 	{ "o15-13.rom",			0x08000, 0xe7b72383, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 Code
3047 
3048 	{ "o15-05.rom",			0x20000, 0x4e5dd246, 3 | BRF_GRA },           //  5 Layer Tiles
3049 	{ "o15-06.rom",			0x20000, 0xc8c6d428, 3 | BRF_GRA },           //  6
3050 	{ "o15-07.rom",			0x20000, 0xefc40e99, 3 | BRF_GRA },           //  7
3051 	{ "o15-08.rom",			0x20000, 0x1b019eab, 3 | BRF_GRA },           //  8
3052 
3053 	{ "o15-03.rom",			0x20000, 0x7f245fd3, 5 | BRF_GRA },           //  9 Sprites
3054 	{ "o15-04.rom",			0x20000, 0x0b1a1289, 5 | BRF_GRA },           // 10
3055 	{ "o15-01.rom",			0x20000, 0x70570e43, 5 | BRF_GRA },           // 11
3056 	{ "o15-02.rom",			0x20000, 0x724b487f, 5 | BRF_GRA },           // 12
3057 
3058 	{ "tp015_14.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3059 	{ "tp015_15.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3060 };
3061 
3062 STD_ROM_PICK(zerowingw)
3063 STD_ROM_FN(zerowingw)
3064 
3065 struct BurnDriver BurnDrvZerowingw = {
3066 	"zerowingw", "zerowing", NULL, NULL, "1989",
3067 	"Zero Wing (2P set, Williams license)\0", NULL, "Toaplan (Williams license)", "Toaplan BCU-2 / FCU-2 based",
3068 	NULL, NULL, NULL, NULL,
3069 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3070 	NULL, zerowingwRomInfo, zerowingwRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, Zerowing2DIPInfo,
3071 	ZerowingInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3072 	320, 240, 4, 3
3073 };
3074 
3075 
3076 // Demon's World / Horror Story (set 1)
3077 
3078 static struct BurnRomInfo demonwldRomDesc[] = {
3079 	{ "o16-10.v2",			0x20000, 0xca8194f3, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3080 	{ "o16-09.v2",			0x20000, 0x7baea7ba, 1 | BRF_PRG | BRF_ESS }, //  1
3081 
3082 	{ "rom11.v2",			0x08000, 0xdbe08c85, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3083 
3084 	{ "dsp_21.bin",			0x00800, 0x2d135376, 7 | BRF_PRG | BRF_ESS }, //  3 DSP Code
3085 	{ "dsp_22.bin",			0x00800, 0x79389a71, 7 | BRF_PRG | BRF_ESS }, //  4
3086 
3087 	{ "rom05",			0x20000, 0x6506c982, 3 | BRF_GRA },           //  5 Layer Tiles
3088 	{ "rom07",			0x20000, 0xa3a0d993, 3 | BRF_GRA },           //  6
3089 	{ "rom06",			0x20000, 0x4fc5e5f3, 3 | BRF_GRA },           //  7
3090 	{ "rom08",			0x20000, 0xeb53ab09, 3 | BRF_GRA },           //  8
3091 
3092 	{ "rom01",			0x20000, 0x1b3724e9, 5 | BRF_GRA },           //  9 Sprites
3093 	{ "rom02",			0x20000, 0x7b20a44d, 5 | BRF_GRA },           // 10
3094 	{ "rom03",			0x20000, 0x2cacdcd0, 5 | BRF_GRA },           // 11
3095 	{ "rom04",			0x20000, 0x76fd3201, 5 | BRF_GRA },           // 12
3096 
3097 	{ "prom12.bpr",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3098 	{ "prom13.bpr",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3099 };
3100 
3101 STD_ROM_PICK(demonwld)
3102 STD_ROM_FN(demonwld)
3103 
3104 struct BurnDriver BurnDrvDemonwld = {
3105 	"demonwld", NULL, NULL, NULL, "1990",
3106 	"Demon's World / Horror Story (set 1)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3107 	L"Demon's World\0\u30DB\u30E9\u30FC\u30B9\u30C8\u30FC\u30EA\u30FC (set 1)\0", NULL, NULL, NULL,
3108 	BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3109 	NULL, demonwldRomInfo, demonwldRomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, DemonwldDIPInfo,
3110 	DemonwldInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3111 	320, 240, 4, 3
3112 };
3113 
3114 
3115 // Demon's World / Horror Story (set 2)
3116 
3117 static struct BurnRomInfo demonwld1RomDesc[] = {
3118 	{ "o16n-10.bin",		0x20000, 0xfc38aeaa, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3119 	{ "o16n-09.bin",		0x20000, 0x74f66643, 1 | BRF_PRG | BRF_ESS }, //  1
3120 
3121 	{ "o16-11.bin",			0x08000, 0xdbe08c85, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3122 
3123 	{ "dsp_21.bin",			0x00800, 0x2d135376, 7 | BRF_PRG | BRF_ESS }, //  3 DSP Code
3124 	{ "dsp_22.bin",			0x00800, 0x79389a71, 7 | BRF_PRG | BRF_ESS }, //  4
3125 
3126 	{ "rom05",			0x20000, 0x6506c982, 3 | BRF_GRA },           //  5 Layer Tiles
3127 	{ "rom07",			0x20000, 0xa3a0d993, 3 | BRF_GRA },           //  6
3128 	{ "rom06",			0x20000, 0x4fc5e5f3, 3 | BRF_GRA },           //  7
3129 	{ "rom08",			0x20000, 0xeb53ab09, 3 | BRF_GRA },           //  8
3130 
3131 	{ "rom01",			0x20000, 0x1b3724e9, 5 | BRF_GRA },           //  9 Sprites
3132 	{ "rom02",			0x20000, 0x7b20a44d, 5 | BRF_GRA },           // 10
3133 	{ "rom03",			0x20000, 0x2cacdcd0, 5 | BRF_GRA },           // 11
3134 	{ "rom04",			0x20000, 0x76fd3201, 5 | BRF_GRA },           // 12
3135 
3136 	{ "prom12.bpr",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3137 	{ "prom13.bpr",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3138 };
3139 
3140 STD_ROM_PICK(demonwld1)
3141 STD_ROM_FN(demonwld1)
3142 
3143 struct BurnDriver BurnDrvDemonwld1 = {
3144 	"demonwld1", "demonwld", NULL, NULL, "1989",
3145 	"Demon's World / Horror Story (set 2)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3146 	L"Demon's World\0\u30DB\u30E9\u30FC\u30B9\u30C8\u30FC\u30EA\u30FC (set 2)\0", NULL, NULL, NULL,
3147 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3148 	NULL, demonwld1RomInfo, demonwld1RomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, DemonwldDIPInfo,
3149 	DemonwldInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3150 	320, 240, 4, 3
3151 };
3152 
3153 
3154 // Demon's World / Horror Story (set 3)
3155 
3156 static struct BurnRomInfo demonwld2RomDesc[] = {
3157 	{ "o16-10.rom",			0x20000, 0x036ee46c, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3158 	{ "o16-09.rom",			0x20000, 0xbed746e3, 1 | BRF_PRG | BRF_ESS }, //  1
3159 
3160 	{ "rom11",			0x08000, 0x397eca1b, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3161 
3162 	{ "dsp_21.bin",			0x00800, 0x2d135376, 7 | BRF_PRG | BRF_ESS }, //  3 DSP Code
3163 	{ "dsp_22.bin",			0x00800, 0x79389a71, 7 | BRF_PRG | BRF_ESS }, //  4
3164 
3165 	{ "rom05",			0x20000, 0x6506c982, 3 | BRF_GRA },           //  5 Layer Tiles
3166 	{ "rom07",			0x20000, 0xa3a0d993, 3 | BRF_GRA },           //  6
3167 	{ "rom06",			0x20000, 0x4fc5e5f3, 3 | BRF_GRA },           //  7
3168 	{ "rom08",			0x20000, 0xeb53ab09, 3 | BRF_GRA },           //  8
3169 
3170 	{ "rom01",			0x20000, 0x1b3724e9, 5 | BRF_GRA },           //  9 Sprites
3171 	{ "rom02",			0x20000, 0x7b20a44d, 5 | BRF_GRA },           // 10
3172 	{ "rom03",			0x20000, 0x2cacdcd0, 5 | BRF_GRA },           // 11
3173 	{ "rom04",			0x20000, 0x76fd3201, 5 | BRF_GRA },           // 12
3174 
3175 	{ "prom12.bpr",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3176 	{ "prom13.bpr",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3177 };
3178 
3179 STD_ROM_PICK(demonwld2)
3180 STD_ROM_FN(demonwld2)
3181 
3182 struct BurnDriver BurnDrvDemonwld2 = {
3183 	"demonwld2", "demonwld", NULL, NULL, "1989",
3184 	"Demon's World / Horror Story (set 3)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3185 	L"Demon's World\0\u30DB\u30E9\u30FC\u30B9\u30C8\u30FC\u30EA\u30FC (set 3)\0", NULL, NULL, NULL,
3186 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3187 	NULL, demonwld2RomInfo, demonwld2RomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, Demonwld1DIPInfo,
3188 	DemonwldInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3189 	320, 240, 4, 3
3190 };
3191 
3192 
3193 // Demon's World / Horror Story (set 4)
3194 
3195 static struct BurnRomInfo demonwld3RomDesc[] = {
3196 	{ "o16-10-2.bin",		0x20000, 0x84ee5218, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3197 	{ "o16-09-2.bin",		0x20000, 0xcf474cb2, 1 | BRF_PRG | BRF_ESS }, //  1
3198 
3199 	{ "rom11",			0x08000, 0x397eca1b, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3200 
3201 	{ "dsp_21.bin",			0x00800, 0x2d135376, 7 | BRF_PRG | BRF_ESS }, //  3 DSP Code
3202 	{ "dsp_22.bin",			0x00800, 0x79389a71, 7 | BRF_PRG | BRF_ESS }, //  4
3203 
3204 	{ "rom05",			0x20000, 0x6506c982, 3 | BRF_GRA },           //  5 Layer Tiles
3205 	{ "rom07",			0x20000, 0xa3a0d993, 3 | BRF_GRA },           //  6
3206 	{ "rom06",			0x20000, 0x4fc5e5f3, 3 | BRF_GRA },           //  7
3207 	{ "rom08",			0x20000, 0xeb53ab09, 3 | BRF_GRA },           //  8
3208 
3209 	{ "rom01",			0x20000, 0x1b3724e9, 5 | BRF_GRA },           //  9 Sprites
3210 	{ "rom02",			0x20000, 0x7b20a44d, 5 | BRF_GRA },           // 10
3211 	{ "rom03",			0x20000, 0x2cacdcd0, 5 | BRF_GRA },           // 11
3212 	{ "rom04",			0x20000, 0x76fd3201, 5 | BRF_GRA },           // 12
3213 
3214 	{ "prom12.bpr",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3215 	{ "prom13.bpr",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3216 };
3217 
3218 STD_ROM_PICK(demonwld3)
3219 STD_ROM_FN(demonwld3)
3220 
3221 struct BurnDriver BurnDrvDemonwld3 = {
3222 	"demonwld3", "demonwld", NULL, NULL, "1989",
3223 	"Demon's World / Horror Story (set 4)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3224 	L"Demon's World\0\u30DB\u30E9\u30FC\u30B9\u30C8\u30FC\u30EA\u30FC (set 4)\0", NULL, NULL, NULL,
3225 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3226 	NULL, demonwld3RomInfo, demonwld3RomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, Demonwld1DIPInfo,
3227 	DemonwldInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3228 	320, 240, 4, 3
3229 };
3230 
3231 
3232 // Demon's World / Horror Story (set 5)
3233 
3234 static struct BurnRomInfo demonwld4RomDesc[] = {
3235 	{ "o16-10.bin",			0x20000, 0x6f7468e0, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3236 	{ "o16-09.bin",			0x20000, 0xa572f5f7, 1 | BRF_PRG | BRF_ESS }, //  1
3237 
3238 	{ "rom11",			0x08000, 0x397eca1b, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3239 
3240 	{ "dsp_21.bin",			0x00800, 0x2d135376, 7 | BRF_PRG | BRF_ESS }, //  3 DSP Code
3241 	{ "dsp_22.bin",			0x00800, 0x79389a71, 7 | BRF_PRG | BRF_ESS }, //  4
3242 
3243 	{ "rom05",			0x20000, 0x6506c982, 3 | BRF_GRA },           //  5 Layer Tiles
3244 	{ "rom07",			0x20000, 0xa3a0d993, 3 | BRF_GRA },           //  6
3245 	{ "rom06",			0x20000, 0x4fc5e5f3, 3 | BRF_GRA },           //  7
3246 	{ "rom08",			0x20000, 0xeb53ab09, 3 | BRF_GRA },           //  8
3247 
3248 	{ "rom01",			0x20000, 0x1b3724e9, 5 | BRF_GRA },           //  9 Sprites
3249 	{ "rom02",			0x20000, 0x7b20a44d, 5 | BRF_GRA },           // 10
3250 	{ "rom03",			0x20000, 0x2cacdcd0, 5 | BRF_GRA },           // 11
3251 	{ "rom04",			0x20000, 0x76fd3201, 5 | BRF_GRA },           // 12
3252 
3253 	{ "prom12.bpr",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3254 	{ "prom13.bpr",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3255 };
3256 
3257 STD_ROM_PICK(demonwld4)
3258 STD_ROM_FN(demonwld4)
3259 
3260 struct BurnDriver BurnDrvDemonwld4 = {
3261 	"demonwld4", "demonwld", NULL, NULL, "1989",
3262 	"Demon's World / Horror Story (set 5)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3263 	L"Demon's World\0\u30DB\u30E9\u30FC\u30B9\u30C8\u30FC\u30EA\u30FC (set 5)\0", NULL, NULL, NULL,
3264 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3265 	NULL, demonwld4RomInfo, demonwld4RomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, Demonwld1DIPInfo,
3266 	DemonwldInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3267 	320, 240, 4, 3
3268 };
3269 
3270 
3271 // Same! Same! Same! (1P set)
3272 
3273 static struct BurnRomInfo samesameRomDesc[] = {
3274 	{ "o17_09.8j",			0x08000, 0x3f69e437, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3275 	{ "o17_10.8l",			0x08000, 0x4e723e0a, 1 | BRF_PRG | BRF_ESS }, //  1
3276 	{ "o17_11.7j",			0x20000, 0xbe07d101, 1 | BRF_PRG | BRF_ESS }, //  2
3277 	{ "o17_12.7l",			0x20000, 0xef698811, 1 | BRF_PRG | BRF_ESS }, //  3
3278 
3279 	{ "hd647180.017",		0x08000, 0x43523032, 2 | BRF_PRG | BRF_ESS }, //  4 Z180 Code
3280 
3281 	{ "o17_05.12j",			0x20000, 0x565315f8, 3 | BRF_GRA },           //  5 Layer Tiles
3282 	{ "o17_06.13j",			0x20000, 0x95262d4c, 3 | BRF_GRA },           //  6
3283 	{ "o17_07.12l",			0x20000, 0x4c4b735c, 3 | BRF_GRA },           //  7
3284 	{ "o17_08.13l",			0x20000, 0x95c6586c, 3 | BRF_GRA },           //  8
3285 
3286 	{ "o17_01.1d",			0x20000, 0xea12e491, 5 | BRF_GRA },           //  9 Sprites
3287 	{ "o17_02.3d",			0x20000, 0x32a13a9f, 5 | BRF_GRA },           // 10
3288 	{ "o17_03.5d",			0x20000, 0x68723dc9, 5 | BRF_GRA },           // 11
3289 	{ "o17_04.7d",			0x20000, 0xfe0ecb13, 5 | BRF_GRA },           // 12
3290 
3291 	{ "prom14.25b",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3292 	{ "prom15.20c",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3293 };
3294 
3295 STD_ROM_PICK(samesame)
3296 STD_ROM_FN(samesame)
3297 
3298 struct BurnDriver BurnDrvSamesame = {
3299 	"samesame", "fireshrk", NULL, NULL, "1989",
3300 	"Same! Same! Same! (1P set)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3301 	L"\u9BAB!\u9BAB!\u9BAB!\0Same! Same! Same! (1P set)\0", NULL, NULL, NULL,
3302 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3303 	NULL, samesameRomInfo, samesameRomName, NULL, NULL, NULL, NULL, FiresharkInputInfo, SamesameDIPInfo,
3304 	SamesameInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3305 	240, 320, 3, 4
3306 };
3307 
3308 
3309 // Same! Same! Same! (2P set)
3310 
3311 static struct BurnRomInfo samesame2RomDesc[] = {
3312 	{ "o17_09x.8j",			0x08000, 0x3472e03e, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3313 	{ "o17_10x.8l",			0x08000, 0xa3ac49b5, 1 | BRF_PRG | BRF_ESS }, //  1
3314 	{ "o17_11ii.7j",		0x20000, 0x6beac378, 1 | BRF_PRG | BRF_ESS }, //  2
3315 	{ "o17_12ii.7l",		0x20000, 0x6adb6eb5, 1 | BRF_PRG | BRF_ESS }, //  3
3316 
3317 	{ "hd647180.017",		0x08000, 0x43523032, 2 | BRF_PRG | BRF_ESS }, //  4 Z180 Code
3318 
3319 	{ "o17_05.12j",			0x20000, 0x565315f8, 3 | BRF_GRA },           //  5 Layer Tiles
3320 	{ "o17_06.13j",			0x20000, 0x95262d4c, 3 | BRF_GRA },           //  6
3321 	{ "o17_07.12l",			0x20000, 0x4c4b735c, 3 | BRF_GRA },           //  7
3322 	{ "o17_08.13l",			0x20000, 0x95c6586c, 3 | BRF_GRA },           //  8
3323 
3324 	{ "o17_01.1d",			0x20000, 0xea12e491, 5 | BRF_GRA },           //  9 Sprites
3325 	{ "o17_02.3d",			0x20000, 0x32a13a9f, 5 | BRF_GRA },           // 10
3326 	{ "o17_03.5d",			0x20000, 0x68723dc9, 5 | BRF_GRA },           // 11
3327 	{ "o17_04.7d",			0x20000, 0xfe0ecb13, 5 | BRF_GRA },           // 12
3328 
3329 	{ "prom14.25b",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3330 	{ "prom15.20c",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3331 };
3332 
3333 STD_ROM_PICK(samesame2)
3334 STD_ROM_FN(samesame2)
3335 
3336 struct BurnDriver BurnDrvSamesame2 = {
3337 	"samesame2", "fireshrk", NULL, NULL, "1989",
3338 	"Same! Same! Same! (2P set)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3339 	L"\u9BAB!\u9BAB!\u9BAB!\0Same! Same! Same!\0", NULL, NULL, NULL,
3340 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3341 	NULL, samesame2RomInfo, samesame2RomName, NULL, NULL, NULL, NULL, FiresharkInputInfo, Samesame2DIPInfo,
3342 	SamesameInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3343 	240, 320, 3, 4
3344 };
3345 
3346 
3347 // Jiao! Jiao! Jiao! (China, 2P set)
3348 
3349 static struct BurnRomInfo samesamecnRomDesc[] = {
3350 	{ "o17-09-h2.8j",		0x08000, 0xfc8c2420, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3351 	{ "o17_10-h2.8l",		0x08000, 0xcc0ffbeb, 1 | BRF_PRG | BRF_ESS }, //  1
3352 	{ "o17-11-2.7j",		0x20000, 0x6beac378, 1 | BRF_PRG | BRF_ESS }, //  2
3353 	{ "o17-12-2.7l",		0x20000, 0x6adb6eb5, 1 | BRF_PRG | BRF_ESS }, //  3
3354 
3355 	{ "hd647180.017",		0x08000, 0x43523032, 2 | BRF_PRG | BRF_ESS }, //  4 Z180 Code
3356 
3357 	{ "o17_05.12j",			0x20000, 0x565315f8, 3 | BRF_GRA },           //  5 Layer Tiles
3358 	{ "o17_06.13j",			0x20000, 0x95262d4c, 3 | BRF_GRA },           //  6
3359 	{ "o17_07.12l",			0x20000, 0x4c4b735c, 3 | BRF_GRA },           //  7
3360 	{ "o17_08.13l",			0x20000, 0x95c6586c, 3 | BRF_GRA },           //  8
3361 
3362 	{ "o17_01.1d",			0x20000, 0xea12e491, 5 | BRF_GRA },           //  9 Sprites
3363 	{ "o17_02.3d",			0x20000, 0x32a13a9f, 5 | BRF_GRA },           // 10
3364 	{ "o17_03.5d",			0x20000, 0x68723dc9, 5 | BRF_GRA },           // 11
3365 	{ "o17_04.7d",			0x20000, 0xfe0ecb13, 5 | BRF_GRA },           // 12
3366 
3367 	{ "prom14.25b",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3368 	{ "prom15.20c",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3369 };
3370 
3371 STD_ROM_PICK(samesamecn)
3372 STD_ROM_FN(samesamecn)
3373 
3374 struct BurnDriver BurnDrvSamesamecn = {
3375 	"samesamecn", "fireshrk", NULL, NULL, "1989",
3376 	"Jiao! Jiao! Jiao! (China, 2P set)\0", NULL, "Toaplan (Hong Kong Honest Trading license)", "Toaplan BCU-2 / FCU-2 based",
3377 	L"\u9BAB!\u9BAB!\u9BAB!\0Jiao! Jiao! Jiao! (China, 2P set)\0", NULL, NULL, NULL,
3378 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3379 	NULL, samesamecnRomInfo, samesamecnRomName, NULL, NULL, NULL, NULL, FiresharkInputInfo, Samesame2DIPInfo,
3380 	SamesameInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3381 	240, 320, 3, 4
3382 };
3383 
3384 
3385 // Same! Same! Same! (1P set, NEW VER! hack)
3386 
3387 static struct BurnRomInfo samesamenhRomDesc[] = {
3388 	{ "o17_09_nv.8j",		0x08000, 0xf60af2f9, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3389 	{ "o17_10_nv.8l",		0x08000, 0x023bcb95, 1 | BRF_PRG | BRF_ESS }, //  1
3390 	{ "o17_11.7j",			0x20000, 0xbe07d101, 1 | BRF_PRG | BRF_ESS }, //  2
3391 	{ "o17_12.7l",			0x20000, 0xef698811, 1 | BRF_PRG | BRF_ESS }, //  3
3392 
3393 	{ "hd647180.017",		0x08000, 0x43523032, 2 | BRF_PRG | BRF_ESS }, //  4 Z180 Code
3394 
3395 	{ "o17_05.12j",			0x20000, 0x565315f8, 3 | BRF_GRA },           //  5 Layer Tiles
3396 	{ "o17_06.13j",			0x20000, 0x95262d4c, 3 | BRF_GRA },           //  6
3397 	{ "o17_07.12l",			0x20000, 0x4c4b735c, 3 | BRF_GRA },           //  7
3398 	{ "o17_08.13l",			0x20000, 0x95c6586c, 3 | BRF_GRA },           //  8
3399 
3400 	{ "o17_01.1d",			0x20000, 0xea12e491, 5 | BRF_GRA },           //  9 Sprites
3401 	{ "o17_02.3d",			0x20000, 0x32a13a9f, 5 | BRF_GRA },           // 10
3402 	{ "o17_03.5d",			0x20000, 0x68723dc9, 5 | BRF_GRA },           // 11
3403 	{ "o17_04.7d",			0x20000, 0xfe0ecb13, 5 | BRF_GRA },           // 12
3404 
3405 	{ "prom14.25b",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3406 	{ "prom15.20c",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3407 };
3408 
3409 STD_ROM_PICK(samesamenh)
3410 STD_ROM_FN(samesamenh)
3411 
3412 struct BurnDriver BurnDrvSamesamenh = {
3413 	"samesamenh", "fireshrk", NULL, NULL, "2015",
3414 	"Same! Same! Same! (1P set, NEW VER! hack)\0", NULL, "hack (trap15)", "Toaplan BCU-2 / FCU-2 based",
3415 	NULL, NULL, NULL, NULL,
3416 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3417 	NULL, samesamenhRomInfo, samesamenhRomName, NULL, NULL, NULL, NULL, FiresharkInputInfo, SamesameDIPInfo,
3418 	SamesameInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3419 	240, 320, 3, 4
3420 };
3421 
3422 
3423 // Fire Shark
3424 
3425 static struct BurnRomInfo fireshrkRomDesc[] = {
3426 	{ "09.8j",			0x08000, 0xf0c70e6f, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3427 	{ "10.8l",			0x08000, 0x9d253d77, 1 | BRF_PRG | BRF_ESS }, //  1
3428 	{ "o17_11ii.7j",		0x20000, 0x6beac378, 1 | BRF_PRG | BRF_ESS }, //  2
3429 	{ "o17_12ii.7l",		0x20000, 0x6adb6eb5, 1 | BRF_PRG | BRF_ESS }, //  3
3430 
3431 	{ "hd647180.017",		0x08000, 0x43523032, 2 | BRF_PRG | BRF_ESS }, //  4 Z180 Code
3432 
3433 	{ "o17_05.12j",			0x20000, 0x565315f8, 3 | BRF_GRA },           //  5 Layer Tiles
3434 	{ "o17_06.13j",			0x20000, 0x95262d4c, 3 | BRF_GRA },           //  6
3435 	{ "o17_07.12l",			0x20000, 0x4c4b735c, 3 | BRF_GRA },           //  7
3436 	{ "o17_08.13l",			0x20000, 0x95c6586c, 3 | BRF_GRA },           //  8
3437 
3438 	{ "o17_01.1d",			0x20000, 0xea12e491, 5 | BRF_GRA },           //  9 Sprites
3439 	{ "o17_02.3d",			0x20000, 0x32a13a9f, 5 | BRF_GRA },           // 10
3440 	{ "o17_03.5d",			0x20000, 0x68723dc9, 5 | BRF_GRA },           // 11
3441 	{ "o17_04.7d",			0x20000, 0xfe0ecb13, 5 | BRF_GRA },           // 12
3442 
3443 	{ "prom14.25b",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3444 	{ "prom15.20c",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3445 };
3446 
3447 STD_ROM_PICK(fireshrk)
3448 STD_ROM_FN(fireshrk)
3449 
3450 struct BurnDriver BurnDrvFireshrk = {
3451 	"fireshrk", NULL, NULL, NULL, "1990",
3452 	"Fire Shark\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3453 	NULL, NULL, NULL, NULL,
3454 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3455 	NULL, fireshrkRomInfo, fireshrkRomName, NULL, NULL, NULL, NULL, FiresharkInputInfo, FireshrkDIPInfo,
3456 	SamesameInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3457 	240, 320, 3, 4
3458 };
3459 
3460 
3461 // Fire Shark (earlier)
3462 
3463 static struct BurnRomInfo fireshrkaRomDesc[] = {
3464 	{ "o17_09ii.8j",		0x08000, 0xb60541ee, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3465 	{ "o17_10ii.8l",		0x08000, 0x96f5045e, 1 | BRF_PRG | BRF_ESS }, //  1
3466 	{ "o17_11ii.7j",		0x20000, 0x6beac378, 1 | BRF_PRG | BRF_ESS }, //  2
3467 	{ "o17_12ii.7l",		0x20000, 0x6adb6eb5, 1 | BRF_PRG | BRF_ESS }, //  3
3468 
3469 	{ "hd647180.017",		0x08000, 0x43523032, 2 | BRF_PRG | BRF_ESS }, //  4 Z180 Code
3470 
3471 	{ "o17_05.12j",			0x20000, 0x565315f8, 3 | BRF_GRA },           //  5 Layer Tiles
3472 	{ "o17_06.13j",			0x20000, 0x95262d4c, 3 | BRF_GRA },           //  6
3473 	{ "o17_07.12l",			0x20000, 0x4c4b735c, 3 | BRF_GRA },           //  7
3474 	{ "o17_08.13l",			0x20000, 0x95c6586c, 3 | BRF_GRA },           //  8
3475 
3476 	{ "o17_01.1d",			0x20000, 0xea12e491, 5 | BRF_GRA },           //  9 Sprites
3477 	{ "o17_02.3d",			0x20000, 0x32a13a9f, 5 | BRF_GRA },           // 10
3478 	{ "o17_03.5d",			0x20000, 0x68723dc9, 5 | BRF_GRA },           // 11
3479 	{ "o17_04.7d",			0x20000, 0xfe0ecb13, 5 | BRF_GRA },           // 12
3480 
3481 	{ "prom14.25b",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3482 	{ "prom15.20c",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3483 };
3484 
3485 STD_ROM_PICK(fireshrka)
3486 STD_ROM_FN(fireshrka)
3487 
3488 struct BurnDriver BurnDrvFireshrka = {
3489 	"fireshrka", "fireshrk", NULL, NULL, "1989",
3490 	"Fire Shark (earlier)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3491 	NULL, NULL, NULL, NULL,
3492 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3493 	NULL, fireshrkaRomInfo, fireshrkaRomName, NULL, NULL, NULL, NULL, FiresharkInputInfo, FireshrkaDIPInfo,
3494 	SamesameInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3495 	240, 320, 3, 4
3496 };
3497 
3498 
3499 // Fire Shark (Korea, set 1, easier)
3500 
3501 static struct BurnRomInfo fireshrkdRomDesc[] = {
3502 	{ "o17_09dyn.8j",		0x10000, 0xe25eee27, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3503 	{ "o17_10dyn.8l",		0x10000, 0xc4c58cf6, 1 | BRF_PRG | BRF_ESS }, //  1
3504 	{ "o17_11ii.7j",		0x20000, 0x6beac378, 1 | BRF_PRG | BRF_ESS }, //  2
3505 	{ "o17_12ii.7l",		0x20000, 0x6adb6eb5, 1 | BRF_PRG | BRF_ESS }, //  3
3506 
3507 	{ "hd647180.017",		0x08000, 0x43523032, 2 | BRF_PRG | BRF_ESS }, //  4 Z180 Code
3508 
3509 	{ "o17_05.12j",			0x20000, 0x565315f8, 3 | BRF_GRA },           //  5 Layer Tiles
3510 	{ "o17_06.13j",			0x20000, 0x95262d4c, 3 | BRF_GRA },           //  6
3511 	{ "o17_07.12l",			0x20000, 0x4c4b735c, 3 | BRF_GRA },           //  7
3512 	{ "o17_08.13l",			0x20000, 0x95c6586c, 3 | BRF_GRA },           //  8
3513 
3514 	{ "o17_01.1d",			0x20000, 0xea12e491, 5 | BRF_GRA },           //  9 Sprites
3515 	{ "o17_02.3d",			0x20000, 0x32a13a9f, 5 | BRF_GRA },           // 10
3516 	{ "o17_03.5d",			0x20000, 0x68723dc9, 5 | BRF_GRA },           // 11
3517 	{ "o17_04.7d",			0x20000, 0xfe0ecb13, 5 | BRF_GRA },           // 12
3518 
3519 	{ "prom14.25b",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3520 	{ "prom15.20c",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3521 };
3522 
3523 STD_ROM_PICK(fireshrkd)
3524 STD_ROM_FN(fireshrkd)
3525 
3526 struct BurnDriver BurnDrvFireshrkd = {
3527 	"fireshrkd", "fireshrk", NULL, NULL, "1990",
3528 	"Fire Shark (Korea, set 1, easier)\0", NULL, "Toaplan (Dooyong license)", "Toaplan BCU-2 / FCU-2 based",
3529 	NULL, NULL, NULL, NULL,
3530 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3531 	NULL, fireshrkdRomInfo, fireshrkdRomName, NULL, NULL, NULL, NULL, FiresharkInputInfo, Samesame2DIPInfo,
3532 	SamesameInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3533 	240, 320, 3, 4
3534 };
3535 
3536 
3537 // Fire Shark (Korea, set 2, harder)
3538 
3539 static struct BurnRomInfo fireshrkdhRomDesc[] = {
3540 	{ "o17_09dyh.8j",		0x10000, 0x7b4c14dd, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3541 	{ "o17_10dyh.8l",		0x10000, 0xa3f159f9, 1 | BRF_PRG | BRF_ESS }, //  1
3542 	{ "o17_11ii.7j",		0x20000, 0x6beac378, 1 | BRF_PRG | BRF_ESS }, //  2
3543 	{ "o17_12ii.7l",		0x20000, 0x6adb6eb5, 1 | BRF_PRG | BRF_ESS }, //  3
3544 
3545 	{ "hd647180.017",		0x08000, 0x43523032, 2 | BRF_PRG | BRF_ESS }, //  4 Z180 Code
3546 
3547 	{ "o17_05.12j",			0x20000, 0x565315f8, 3 | BRF_GRA },           //  5 Layer Tiles
3548 	{ "o17_06.13j",			0x20000, 0x95262d4c, 3 | BRF_GRA },           //  6
3549 	{ "o17_07.12l",			0x20000, 0x4c4b735c, 3 | BRF_GRA },           //  7
3550 	{ "o17_08.13l",			0x20000, 0x95c6586c, 3 | BRF_GRA },           //  8
3551 
3552 	{ "o17_01.1d",			0x20000, 0xea12e491, 5 | BRF_GRA },           //  9 Sprites
3553 	{ "o17_02.3d",			0x20000, 0x32a13a9f, 5 | BRF_GRA },           // 10
3554 	{ "o17_03.5d",			0x20000, 0x68723dc9, 5 | BRF_GRA },           // 11
3555 	{ "o17_04.7d",			0x20000, 0xfe0ecb13, 5 | BRF_GRA },           // 12
3556 
3557 	{ "prom14.25b",			0x00020, 0xbc88cced, 0 | BRF_OPT },           // 13 PROMs
3558 	{ "prom15.20c",			0x00020, 0xa1e17492, 0 | BRF_OPT },           // 14
3559 };
3560 
3561 STD_ROM_PICK(fireshrkdh)
3562 STD_ROM_FN(fireshrkdh)
3563 
3564 struct BurnDriver BurnDrvFireshrkdh = {
3565 	"fireshrkdh", "fireshrk", NULL, NULL, "1990",
3566 	"Fire Shark (Korea, set 2, harder)\0", NULL, "Toaplan (Dooyong license)", "Toaplan BCU-2 / FCU-2 based",
3567 	NULL, NULL, NULL, NULL,
3568 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3569 	NULL, fireshrkdhRomInfo, fireshrkdhRomName, NULL, NULL, NULL, NULL, FiresharkInputInfo, Samesame2DIPInfo,
3570 	SamesameInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3571 	240, 320, 3, 4
3572 };
3573 
3574 
3575 // Out Zone
3576 
3577 static struct BurnRomInfo outzoneRomDesc[] = {
3578 	{ "tp_018_08.bin",		0x20000, 0x127a38d7, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3579 	{ "tp_018_07.bin",		0x20000, 0x9704db16, 1 | BRF_PRG | BRF_ESS }, //  1
3580 
3581 	{ "tp_018_09.bin",		0x08000, 0x73d8e235, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3582 
3583 	{ "tp-018_rom5.bin",	0x80000, 0xc64ec7b6, 4 | BRF_GRA },           //  3 Layer Tiles
3584 	{ "tp-018_rom6.bin",	0x80000, 0x64b6c5ac, 4 | BRF_GRA },           //  4
3585 
3586 	{ "tp-018_rom2.bin",	0x20000, 0x6bb72d16, 5 | BRF_GRA },           //  5 Sprites
3587 	{ "tp-018_rom1.bin",	0x20000, 0x0934782d, 5 | BRF_GRA },           //  6
3588 	{ "tp-018_rom3.bin",	0x20000, 0xec903c07, 5 | BRF_GRA },           //  7
3589 	{ "tp-018_rom4.bin",	0x20000, 0x50cbf1a8, 5 | BRF_GRA },           //  8
3590 
3591 	{ "tp018_10.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           //  9 PROMs
3592 	{ "tp018_11.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 10
3593 };
3594 
3595 STD_ROM_PICK(outzone)
3596 STD_ROM_FN(outzone)
3597 
3598 struct BurnDriver BurnDrvOutzone = {
3599 	"outzone", NULL, NULL, NULL, "1990",
3600 	"Out Zone\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3601 	NULL, NULL, NULL, NULL,
3602 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3603 	NULL, outzoneRomInfo, outzoneRomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, OutzoneDIPInfo,
3604 	OutzoneInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3605 	240, 320, 3, 4
3606 };
3607 
3608 
3609 // Out Zone (harder)
3610 
3611 static struct BurnRomInfo outzonehRomDesc[] = {
3612 	{ "tp_018_07h.bin",		0x20000, 0x0c2ac02d, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3613 	{ "tp_018_08h.bin",		0x20000, 0xca7e48aa, 1 | BRF_PRG | BRF_ESS }, //  1
3614 
3615 	{ "tp_018_09.bin",		0x08000, 0x73d8e235, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3616 
3617 	{ "tp-018_rom5.bin",	0x80000, 0xc64ec7b6, 4 | BRF_GRA },           //  3 Layer Tiles
3618 	{ "tp-018_rom6.bin",	0x80000, 0x64b6c5ac, 4 | BRF_GRA },           //  4
3619 
3620 	{ "tp-018_rom2.bin",	0x20000, 0x6bb72d16, 5 | BRF_GRA },           //  5 Sprites
3621 	{ "tp-018_rom1.bin",	0x20000, 0x0934782d, 5 | BRF_GRA },           //  6
3622 	{ "tp-018_rom3.bin",	0x20000, 0xec903c07, 5 | BRF_GRA },           //  7
3623 	{ "tp-018_rom4.bin",	0x20000, 0x50cbf1a8, 5 | BRF_GRA },           //  8
3624 
3625 	{ "tp018_10.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           //  9 PROMs
3626 	{ "tp018_11.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 10
3627 };
3628 
3629 STD_ROM_PICK(outzoneh)
3630 STD_ROM_FN(outzoneh)
3631 
3632 struct BurnDriver BurnDrvOutzoneh = {
3633 	"outzoneh", "outzone", NULL, NULL, "1990",
3634 	"Out Zone (harder)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3635 	NULL, NULL, NULL, NULL,
3636 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3637 	NULL, outzonehRomInfo, outzonehRomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, OutzoneDIPInfo,
3638 	OutzoneInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3639 	240, 320, 3, 4
3640 };
3641 
3642 
3643 // Out Zone (old set)
3644 
3645 static struct BurnRomInfo outzoneaRomDesc[] = {
3646 	{ "18.bin",			0x20000, 0x31a171bb, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3647 	{ "19.bin",			0x20000, 0x804ecfd1, 1 | BRF_PRG | BRF_ESS }, //  1
3648 
3649 	{ "tp_018_09.bin",		0x08000, 0x73d8e235, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3650 
3651 	{ "tp-018_rom5.bin",	0x80000, 0xc64ec7b6, 4 | BRF_GRA },           //  3 Layer Tiles
3652 	{ "tp-018_rom6.bin",	0x80000, 0x64b6c5ac, 4 | BRF_GRA },           //  4
3653 
3654 	{ "tp-018_rom2.bin",	0x20000, 0x6bb72d16, 5 | BRF_GRA },           //  5 Sprites
3655 	{ "tp-018_rom1.bin",	0x20000, 0x0934782d, 5 | BRF_GRA },           //  6
3656 	{ "tp-018_rom3.bin",	0x20000, 0xec903c07, 5 | BRF_GRA },           //  7
3657 	{ "tp-018_rom4.bin",	0x20000, 0x50cbf1a8, 5 | BRF_GRA },           //  8
3658 
3659 	{ "tp018_10.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           //  9 PROMs
3660 	{ "tp018_11.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 10
3661 };
3662 
3663 STD_ROM_PICK(outzonea)
3664 STD_ROM_FN(outzonea)
3665 
3666 struct BurnDriver BurnDrvOutzonea = {
3667 	"outzonea", "outzone", NULL, NULL, "1990",
3668 	"Out Zone (old set)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3669 	NULL, NULL, NULL, NULL,
3670 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3671 	NULL, outzoneaRomInfo, outzoneaRomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, OutzoneaDIPInfo,
3672 	OutzoneInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3673 	240, 320, 3, 4
3674 };
3675 
3676 
3677 // Out Zone (older set)
3678 
3679 static struct BurnRomInfo outzonebRomDesc[] = {
3680 	{ "tp07.bin",			0x20000, 0xa85a1d48, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3681 	{ "tp08.bin",			0x20000, 0xd8cc44af, 1 | BRF_PRG | BRF_ESS }, //  1
3682 
3683 	{ "tp09.bin",			0x08000, 0xdd56041f, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3684 
3685 	{ "tp-018_rom5.bin",	0x80000, 0xc64ec7b6, 4 | BRF_GRA },           //  3 Layer Tiles
3686 	{ "tp-018_rom6.bin",	0x80000, 0x64b6c5ac, 4 | BRF_GRA },           //  4
3687 
3688 	{ "tp-018_rom2.bin",	0x20000, 0x6bb72d16, 5 | BRF_GRA },           //  5 Sprites
3689 	{ "tp-018_rom1.bin",	0x20000, 0x0934782d, 5 | BRF_GRA },           //  6
3690 	{ "tp-018_rom3.bin",	0x20000, 0xec903c07, 5 | BRF_GRA },           //  7
3691 	{ "tp-018_rom4.bin",	0x20000, 0x50cbf1a8, 5 | BRF_GRA },           //  8
3692 
3693 	{ "tp018_10.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           //  9 PROMs
3694 	{ "tp018_11.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 10
3695 };
3696 
3697 STD_ROM_PICK(outzoneb)
3698 STD_ROM_FN(outzoneb)
3699 
3700 struct BurnDriver BurnDrvOutzoneb = {
3701 	"outzoneb", "outzone", NULL, NULL, "1990",
3702 	"Out Zone (older set)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3703 	NULL, NULL, NULL, NULL,
3704 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3705 	NULL, outzonebRomInfo, outzonebRomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, OutzoneaDIPInfo,
3706 	OutzoneInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3707 	240, 320, 3, 4
3708 };
3709 
3710 
3711 // Out Zone (oldest set)
3712 
3713 static struct BurnRomInfo outzonecRomDesc[] = {
3714 	{ "rom7.bin",			0x20000, 0x936e25d8, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3715 	{ "rom8.bin",			0x20000, 0xd19b3ecf, 1 | BRF_PRG | BRF_ESS }, //  1
3716 
3717 	{ "tp_018_09.bin",		0x08000, 0x73d8e235, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3718 
3719 	{ "tp-018_rom5.bin",	0x80000, 0xc64ec7b6, 4 | BRF_GRA },           //  3 Layer Tiles
3720 	{ "tp-018_rom6.bin",	0x80000, 0x64b6c5ac, 4 | BRF_GRA },           //  4
3721 
3722 	{ "tp-018_rom2.bin",	0x20000, 0x6bb72d16, 5 | BRF_GRA },           //  5 Sprites
3723 	{ "tp-018_rom1.bin",	0x20000, 0x0934782d, 5 | BRF_GRA },           //  6
3724 	{ "tp-018_rom3.bin",	0x20000, 0xec903c07, 5 | BRF_GRA },           //  7
3725 	{ "tp-018_rom4.bin",	0x20000, 0x50cbf1a8, 5 | BRF_GRA },           //  8
3726 
3727 	{ "tp018_10.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           //  9 PROMs
3728 	{ "tp018_11.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 10
3729 };
3730 
3731 STD_ROM_PICK(outzonec)
3732 STD_ROM_FN(outzonec)
3733 
3734 struct BurnDriver BurnDrvOutzonec = {
3735 	"outzonec", "outzone", NULL, NULL, "1990",
3736 	"Out Zone (oldest set)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3737 	NULL, NULL, NULL, NULL,
3738 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3739 	NULL, outzonecRomInfo, outzonecRomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, OutzonecDIPInfo,
3740 	OutzoneInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3741 	240, 320, 3, 4
3742 };
3743 
3744 
3745 // Out Zone (Zero Wing TP-015 PCB conversion)
3746 
3747 static struct BurnRomInfo outzonecvRomDesc[] = {
3748 	{ "tp_018_07+.bin",		0x20000, 0x8768d843, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3749 	{ "tp_018_08+.bin",		0x20000, 0xaf238f71, 1 | BRF_PRG | BRF_ESS }, //  1
3750 
3751 	{ "tp_018_09+.bin",		0x08000, 0xb7201606, 2 | BRF_PRG | BRF_ESS }, //  2 Z80 Code
3752 
3753 	{ "tp-018_rom5.bin",	0x80000, 0xc64ec7b6, 4 | BRF_GRA },           //  3 Layer Tiles
3754 	{ "tp-018_rom6.bin",	0x80000, 0x64b6c5ac, 4 | BRF_GRA },           //  4
3755 
3756 	{ "tp-018_rom2.bin",	0x20000, 0x6bb72d16, 5 | BRF_GRA },           //  5 Sprites
3757 	{ "tp-018_rom1.bin",	0x20000, 0x0934782d, 5 | BRF_GRA },           //  6
3758 	{ "tp-018_rom3.bin",	0x20000, 0xec903c07, 5 | BRF_GRA },           //  7
3759 	{ "tp-018_rom4.bin",	0x20000, 0x50cbf1a8, 5 | BRF_GRA },           //  8
3760 
3761 	{ "tp018_10.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           //  9 PROMs
3762 	{ "tp018_11.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 10
3763 };
3764 
3765 STD_ROM_PICK(outzonecv)
3766 STD_ROM_FN(outzonecv)
3767 
3768 struct BurnDriver BurnDrvOutzonecv = {
3769 	"outzonecv", "outzone", NULL, NULL, "1990",
3770 	"Out Zone (Zero Wing TP-015 PCB conversion)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3771 	NULL, NULL, NULL, NULL,
3772 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_RUNGUN, 0,
3773 	NULL, outzonecvRomInfo, outzonecvRomName, NULL, NULL, NULL, NULL, Drv3bInputInfo, OutzoneDIPInfo,
3774 	OutzonecvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3775 	240, 320, 3, 4
3776 };
3777 
3778 
3779 // Vimana (World, set 1)
3780 
3781 static struct BurnRomInfo vimanaRomDesc[] = {
3782 	{ "tp019-7a.bin",		0x20000, 0x5a4bf73e, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3783 	{ "tp019-8a.bin",		0x20000, 0x03ba27e8, 1 | BRF_PRG | BRF_ESS }, //  1
3784 
3785 	{ "hd647180.019",		0x08000, 0x41a97ebe, 2 | BRF_PRG | BRF_ESS }, //  2 Z180 Code
3786 
3787 	{ "vim6.bin",			0x20000, 0x2886878d, 3 | BRF_GRA },           //  3 Layer Tiles
3788 	{ "vim5.bin",			0x20000, 0x61a63d7a, 3 | BRF_GRA },           //  4
3789 	{ "vim4.bin",			0x20000, 0xb0515768, 3 | BRF_GRA },           //  5
3790 	{ "vim3.bin",			0x20000, 0x0b539131, 3 | BRF_GRA },           //  6
3791 
3792 	{ "vim1.bin",			0x80000, 0xcdde26cd, 8 | BRF_GRA },           //  7 Sprites
3793 	{ "vim2.bin",			0x80000, 0x1dbfc118, 8 | BRF_GRA },           //  8
3794 
3795 	{ "tp019-09.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           //  9 PROMs
3796 	{ "tp019-10.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 10
3797 };
3798 
3799 STD_ROM_PICK(vimana)
3800 STD_ROM_FN(vimana)
3801 
3802 struct BurnDriver BurnDrvVimana = {
3803 	"vimana", NULL, NULL, NULL, "1991",
3804 	"Vimana (World, set 1)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3805 	NULL, NULL, NULL, NULL,
3806 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3807 	NULL, vimanaRomInfo, vimanaRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, VimanaDIPInfo,
3808 	VimanaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3809 	240, 320, 3, 4
3810 };
3811 
3812 
3813 // Vimana (World, set 2)
3814 
3815 static struct BurnRomInfo vimananRomDesc[] = {
3816 	{ "tp019-07.rom",		0x20000, 0x78888ff2, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3817 	{ "tp019-08.rom",		0x20000, 0x6cd2dc3c, 1 | BRF_PRG | BRF_ESS }, //  1
3818 
3819 	{ "hd647180.019",		0x08000, 0x41a97ebe, 2 | BRF_PRG | BRF_ESS }, //  2 Z180 Code
3820 
3821 	{ "vim6.bin",			0x20000, 0x2886878d, 3 | BRF_GRA },           //  3 Layer Tiles
3822 	{ "vim5.bin",			0x20000, 0x61a63d7a, 3 | BRF_GRA },           //  4
3823 	{ "vim4.bin",			0x20000, 0xb0515768, 3 | BRF_GRA },           //  5
3824 	{ "vim3.bin",			0x20000, 0x0b539131, 3 | BRF_GRA },           //  6
3825 
3826 	{ "vim1.bin",			0x80000, 0xcdde26cd, 8 | BRF_GRA },           //  7 Sprites
3827 	{ "vim2.bin",			0x80000, 0x1dbfc118, 8 | BRF_GRA },           //  8
3828 
3829 	{ "tp019-09.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           //  9 PROMs
3830 	{ "tp019-10.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 10
3831 };
3832 
3833 STD_ROM_PICK(vimanan)
3834 STD_ROM_FN(vimanan)
3835 
3836 struct BurnDriver BurnDrvVimanan = {
3837 	"vimanan", "vimana", NULL, NULL, "1991",
3838 	"Vimana (World, set 2)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3839 	NULL, NULL, NULL, NULL,
3840 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3841 	NULL, vimananRomInfo, vimananRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, VimananDIPInfo,
3842 	VimanaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3843 	240, 320, 3, 4
3844 };
3845 
3846 
3847 // Vimana (Japan)
3848 
3849 static struct BurnRomInfo vimanajRomDesc[] = {
3850 	{ "vim07.bin",			0x20000, 0x1efaea84, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3851 	{ "vim08.bin",			0x20000, 0xe45b7def, 1 | BRF_PRG | BRF_ESS }, //  1
3852 
3853 	{ "hd647180.019",		0x08000, 0x41a97ebe, 2 | BRF_PRG | BRF_ESS }, //  2 Z180 Code
3854 
3855 	{ "vim6.bin",			0x20000, 0x2886878d, 3 | BRF_GRA },           //  3 Layer Tiles
3856 	{ "vim5.bin",			0x20000, 0x61a63d7a, 3 | BRF_GRA },           //  4
3857 	{ "vim4.bin",			0x20000, 0xb0515768, 3 | BRF_GRA },           //  5
3858 	{ "vim3.bin",			0x20000, 0x0b539131, 3 | BRF_GRA },           //  6
3859 
3860 	{ "vim1.bin",			0x80000, 0xcdde26cd, 8 | BRF_GRA },           //  7 Sprites
3861 	{ "vim2.bin",			0x80000, 0x1dbfc118, 8 | BRF_GRA },           //  8
3862 
3863 	{ "tp019-09.bpr",		0x00020, 0xbc88cced, 0 | BRF_OPT },           //  9 PROMs
3864 	{ "tp019-10.bpr",		0x00020, 0xa1e17492, 0 | BRF_OPT },           // 10
3865 };
3866 
3867 STD_ROM_PICK(vimanaj)
3868 STD_ROM_FN(vimanaj)
3869 
3870 struct BurnDriver BurnDrvVimanaj = {
3871 	"vimanaj", "vimana", NULL, NULL, "1991",
3872 	"Vimana (Japan)\0", NULL, "Toaplan", "Toaplan BCU-2 / FCU-2 based",
3873 	NULL, NULL, NULL, NULL,
3874 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_HISCORE_SUPPORTED, 2, HARDWARE_TOAPLAN_RAIZING, GBF_VERSHOOT, 0,
3875 	NULL, vimanajRomInfo, vimanajRomName, NULL, NULL, NULL, NULL, Drv2bInputInfo, VimanajDIPInfo,
3876 	VimanaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
3877 	240, 320, 3, 4
3878 };
3879