1 // FB Alpha Beast Busters and Mechanized Attack driver module
2 // Based on MAME driver by Bryan McPhail
3 
4 // Solved both ym2608 + deltaT problems July 31, 2021 -dink
5 // Problem:
6 // Mechanized Attack, music lost on savestate load
7 // I _think_ it's something to do with the ymdeltat part of the ym2608
8 // fighting over the fm status register w/the ym2608 itself.  First and
9 // second attempt to fix it failed.  Game marked w/state issues.     - dink apr.1.2021
10 
11 // Note:
12 // This problem also affects Hatris in pst90s/d_pipedrm.cpp, but has a different
13 // issue: the deltat samples stop playing on state load, yet the music continues
14 // to play.
15 
16 #include "tiles_generic.h"
17 #include "m68000_intf.h"
18 #include "z80_intf.h"
19 #include "burn_ym2610.h"
20 #include "burn_ym2608.h"
21 #include "burn_gun.h"
22 
23 static UINT8 *AllMem;
24 static UINT8 *MemEnd;
25 static UINT8 *AllRam;
26 static UINT8 *RamEnd;
27 static UINT8 *Drv68KROM;
28 static UINT8 *DrvZ80ROM;
29 static UINT8 *DrvGfxROM0;
30 static UINT8 *DrvGfxROM1;
31 static UINT8 *DrvGfxROM2;
32 static UINT8 *DrvGfxROM3;
33 static UINT8 *DrvGfxROM4;
34 static UINT8 *DrvZoomTab;
35 static UINT8 *DrvSndROM0;
36 static UINT8 *DrvSndROM1;
37 static UINT8 *DrvEeprom;
38 static UINT8 *Drv68KRAM;
39 static UINT8 *DrvZ80RAM;
40 static UINT8 *DrvVidRAM;
41 static UINT8 *DrvPfRAM0;
42 static UINT8 *DrvPfRAM1;
43 static UINT8 *DrvPalRAM;
44 static UINT8 *DrvSprRAM;
45 static UINT8 *DrvSprBuf;
46 static UINT8 *DrvPfScroll0;
47 static UINT8 *DrvPfScroll1;
48 
49 static UINT16 *SpriteBitmap[2];
50 
51 static UINT32 *DrvPalette;
52 static UINT8 DrvRecalc;
53 
54 static UINT8 sound_status;
55 static UINT8 soundlatch;
56 static UINT8 gun_select;
57 static INT16 LethalGun0 = 0;
58 static INT16 LethalGun1 = 0;
59 static INT16 LethalGun2 = 0;
60 static INT16 LethalGun3 = 0;
61 static INT16 LethalGun4 = 0;
62 static INT16 LethalGun5 = 0;
63 
64 static INT32 game_select = 0; // bbuster = 0, mechatt = 1
65 
66 static UINT8 DrvJoy1[16];
67 static UINT8 DrvJoy2[16];
68 static UINT8 DrvJoy3[16];
69 static UINT8 DrvDips[2];
70 static UINT16 DrvInputs[3];
71 static UINT8 DrvReset;
72 
73 #define A(a, b, c, d) {a, b, (UINT8*)(c), d}
74 static struct BurnInputInfo BbustersInputList[] = {
75 	{"P1 Coin",			BIT_DIGITAL,	DrvJoy3 + 0,	"p1 coin"	},
76 	{"P1 Start",		BIT_DIGITAL,	DrvJoy1 + 0,	"p1 start"	},
77 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy1 + 1,	"p1 fire 1"	},
78 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy1 + 2,	"p1 fire 2"	},
79 	A("P1 Gun X",    	BIT_ANALOG_REL, &LethalGun0,    "mouse x-axis"	),
80 	A("P1 Gun Y",    	BIT_ANALOG_REL, &LethalGun1,    "mouse y-axis"	),
81 
82 	{"P2 Coin",			BIT_DIGITAL,	DrvJoy3 + 1,	"p2 coin"	},
83 	{"P2 Start",		BIT_DIGITAL,	DrvJoy1 + 4,	"p2 start"	},
84 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy1 + 5,	"p2 fire 1"	},
85 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy1 + 6,	"p2 fire 2"	},
86 	A("P2 Gun X",    	BIT_ANALOG_REL, &LethalGun2,    "p2 x-axis"	),
87 	A("P2 Gun Y",    	BIT_ANALOG_REL, &LethalGun3,    "p2 y-axis"	),
88 
89 	{"P3 Coin",			BIT_DIGITAL,	DrvJoy3 + 2,	"p3 coin"	},
90 	{"P3 Start",		BIT_DIGITAL,	DrvJoy2 + 0,	"p3 start"	},
91 	{"P3 Button 1",		BIT_DIGITAL,	DrvJoy2 + 1,	"p3 fire 1"	},
92 	{"P3 Button 2",		BIT_DIGITAL,	DrvJoy2 + 2,	"p3 fire 2"	},
93 	A("P3 Gun X",    	BIT_ANALOG_REL, &LethalGun4,    "p2 x-axis"	),
94 	A("P3 Gun Y",   	 BIT_ANALOG_REL,&LethalGun5,    "p2 y-axis"	),
95 
96 	{"Reset",			BIT_DIGITAL,	&DrvReset,		"reset"		},
97 	{"Service",			BIT_DIGITAL,	DrvJoy3 + 6,	"service"	},
98 	{"Dip A",			BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
99 	{"Dip B",			BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
100 };
101 
102 STDINPUTINFO(Bbusters)
103 
104 static struct BurnInputInfo Bbusters2pInputList[] = {
105 	{"P1 Coin",			BIT_DIGITAL,	DrvJoy3 + 0,	"p1 coin"	},
106 	{"P1 Start",		BIT_DIGITAL,	DrvJoy1 + 0,	"p1 start"	},
107 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy1 + 1,	"p1 fire 1"	},
108 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy1 + 2,	"p1 fire 2"	},
109 	A("P1 Gun X",    	BIT_ANALOG_REL, &LethalGun0,    "mouse x-axis"	),
110 	A("P1 Gun Y",    	BIT_ANALOG_REL, &LethalGun1,    "mouse y-axis"	),
111 
112 	{"P2 Coin",			BIT_DIGITAL,	DrvJoy3 + 1,	"p2 coin"	},
113 	{"P2 Start",		BIT_DIGITAL,	DrvJoy1 + 4,	"p2 start"	},
114 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy1 + 5,	"p2 fire 1"	},
115 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy1 + 6,	"p2 fire 2"	},
116 	A("P2 Gun X",    	BIT_ANALOG_REL, &LethalGun2,    "p2 x-axis"	),
117 	A("P2 Gun Y",    	BIT_ANALOG_REL, &LethalGun3,    "p2 y-axis"	),
118 
119 	{"Reset",			BIT_DIGITAL,	&DrvReset,		"reset"		},
120 	{"Service",			BIT_DIGITAL,	DrvJoy3 + 6,	"service"	},
121 	{"Dip A",			BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
122 	{"Dip B",			BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
123 };
124 
125 STDINPUTINFO(Bbusters2p)
126 
127 static struct BurnInputInfo MechattInputList[] = {
128 	{"P1 Coin",			BIT_DIGITAL,	DrvJoy1 + 0,	"p1 coin"	},
129 	{"P1 Start",		BIT_DIGITAL,	DrvJoy1 + 8,	"p1 start"	},
130 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy1 + 9,	"p1 fire 1"	},
131 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy1 + 10,	"p1 fire 2"	},
132 	A("P1 Gun X",    	BIT_ANALOG_REL, &LethalGun0,    "mouse x-axis"	),
133 	A("P1 Gun Y",    	BIT_ANALOG_REL, &LethalGun1,    "mouse y-axis"	),
134 
135 	{"P2 Coin",			BIT_DIGITAL,	DrvJoy1 + 1,	"p2 coin"	},
136 	{"P2 Start",		BIT_DIGITAL,	DrvJoy1 + 12,	"p2 start"	},
137 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy1 + 13,	"p2 fire 1"	},
138 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy1 + 14,	"p2 fire 2"	},
139 	A("P2 Gun X",    	BIT_ANALOG_REL, &LethalGun2,    "p2 x-axis"	),
140 	A("P2 Gun Y",    	BIT_ANALOG_REL, &LethalGun3,    "p2 y-axis"	),
141 
142 	{"Reset",			BIT_DIGITAL,	&DrvReset,		"reset"		},
143 	{"Service",			BIT_DIGITAL,	DrvJoy1 + 2,	"service"	},
144 	{"Dip A",			BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
145 	{"Dip B",			BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
146 };
147 
148 STDINPUTINFO(Mechatt)
149 #undef A
150 
151 static struct BurnDIPInfo BbustersDIPList[]=
152 {
153 	{0x14, 0xff, 0xff, 0xf9, NULL						},
154 	{0x15, 0xff, 0xff, 0x8f, NULL						},
155 
156 	{0   , 0xfe, 0   ,    2, "Allow Continue"			},
157 	{0x14, 0x01, 0x01, 0x00, "No"						},
158 	{0x14, 0x01, 0x01, 0x01, "Yes"						},
159 
160 	{0   , 0xfe, 0   ,    4, "Magazine / Grenade"		},
161 	{0x14, 0x01, 0x06, 0x04, "5 / 2"					},
162 	{0x14, 0x01, 0x06, 0x06, "7 / 3"					},
163 	{0x14, 0x01, 0x06, 0x02, "9 / 4"					},
164 	{0x14, 0x01, 0x06, 0x00, "12 / 5"					},
165 
166 	{0   , 0xfe, 0   ,    4, "Coin A"					},
167 	{0x14, 0x01, 0x18, 0x00, "4 Coins 1 Credits"		},
168 	{0x14, 0x01, 0x18, 0x08, "3 Coins 1 Credits"		},
169 	{0x14, 0x01, 0x18, 0x10, "2 Coins 1 Credits"		},
170 	{0x14, 0x01, 0x18, 0x18, "1 Coin  1 Credits"		},
171 
172 	{0   , 0xfe, 0   ,    4, "Coin B"					},
173 	{0x14, 0x01, 0x60, 0x60, "1 Coin  2 Credits"		},
174 	{0x14, 0x01, 0x60, 0x40, "1 Coin  3 Credits"		},
175 	{0x14, 0x01, 0x60, 0x20, "1 Coin  4 Credits"		},
176 	{0x14, 0x01, 0x60, 0x00, "1 Coin  6 Credits"		},
177 
178 	{0   , 0xfe, 0   ,    2, "Coin Slots"				},
179 	{0x14, 0x01, 0x80, 0x80, "Common"					},
180 	{0x14, 0x01, 0x80, 0x00, "Individual"				},
181 
182 	{0   , 0xfe, 0   ,    4, "Difficulty"				},
183 	{0x15, 0x01, 0x03, 0x02, "Easy"						},
184 	{0x15, 0x01, 0x03, 0x03, "Normal"					},
185 	{0x15, 0x01, 0x03, 0x01, "Hard"						},
186 	{0x15, 0x01, 0x03, 0x00, "Hardest"					},
187 
188 	{0   , 0xfe, 0   ,    4, "Game Mode"				},
189 	{0x15, 0x01, 0x0c, 0x08, "Demo Sounds Off"			},
190 	{0x15, 0x01, 0x0c, 0x0c, "Demo Sounds On"			},
191 	{0x15, 0x01, 0x0c, 0x04, "Infinite Energy (Cheat)"	},
192 	{0x15, 0x01, 0x0c, 0x00, "Freeze"					},
193 
194 	{0   , 0xfe, 0   ,    2, "Service Mode"				},
195 	{0x15, 0x01, 0x80, 0x80, "Off"						},
196 	{0x15, 0x01, 0x80, 0x00, "On"						},
197 };
198 
199 STDDIPINFO(Bbusters)
200 
201 static struct BurnDIPInfo Bbusters2pDIPList[]=
202 {
203 	{0x0e, 0xff, 0xff, 0xf9, NULL						},
204 	{0x0f, 0xff, 0xff, 0x8f, NULL						},
205 
206 	{0   , 0xfe, 0   ,    2, "Allow Continue"			},
207 	{0x0e, 0x01, 0x01, 0x00, "No"						},
208 	{0x0e, 0x01, 0x01, 0x01, "Yes"						},
209 
210 	{0   , 0xfe, 0   ,    4, "Magazine / Grenade"		},
211 	{0x0e, 0x01, 0x06, 0x04, "5 / 2"					},
212 	{0x0e, 0x01, 0x06, 0x06, "7 / 3"					},
213 	{0x0e, 0x01, 0x06, 0x02, "9 / 4"					},
214 	{0x0e, 0x01, 0x06, 0x00, "12 / 5"					},
215 
216 	{0   , 0xfe, 0   ,    4, "Coin A"					},
217 	{0x0e, 0x01, 0x18, 0x00, "4 Coins 1 Credits"		},
218 	{0x0e, 0x01, 0x18, 0x08, "3 Coins 1 Credits"		},
219 	{0x0e, 0x01, 0x18, 0x10, "2 Coins 1 Credits"		},
220 	{0x0e, 0x01, 0x18, 0x18, "1 Coin  1 Credits"		},
221 
222 	{0   , 0xfe, 0   ,    4, "Coin B"					},
223 	{0x0e, 0x01, 0x60, 0x60, "1 Coin  2 Credits"		},
224 	{0x0e, 0x01, 0x60, 0x40, "1 Coin  3 Credits"		},
225 	{0x0e, 0x01, 0x60, 0x20, "1 Coin  4 Credits"		},
226 	{0x0e, 0x01, 0x60, 0x00, "1 Coin  6 Credits"		},
227 
228 	{0   , 0xfe, 0   ,    2, "Coin Slots"				},
229 	{0x0e, 0x01, 0x80, 0x80, "Common"					},
230 	{0x0e, 0x01, 0x80, 0x00, "Individual"				},
231 
232 	{0   , 0xfe, 0   ,    4, "Difficulty"				},
233 	{0x0f, 0x01, 0x03, 0x02, "Easy"						},
234 	{0x0f, 0x01, 0x03, 0x03, "Normal"					},
235 	{0x0f, 0x01, 0x03, 0x01, "Hard"						},
236 	{0x0f, 0x01, 0x03, 0x00, "Hardest"					},
237 
238 	{0   , 0xfe, 0   ,    4, "Game Mode"				},
239 	{0x0f, 0x01, 0x0c, 0x08, "Demo Sounds Off"			},
240 	{0x0f, 0x01, 0x0c, 0x0c, "Demo Sounds On"			},
241 	{0x0f, 0x01, 0x0c, 0x04, "Infinite Energy (Cheat)"	},
242 	{0x0f, 0x01, 0x0c, 0x00, "Freeze"					},
243 
244 	{0   , 0xfe, 0   ,    2, "Service Mode"				},
245 	{0x0f, 0x01, 0x80, 0x80, "Off"						},
246 	{0x0f, 0x01, 0x80, 0x00, "On"						},
247 };
248 
249 STDDIPINFO(Bbusters2p)
250 
251 static struct BurnDIPInfo MechattDIPList[]=
252 {
253 	{0x0e, 0xff, 0xff, 0xff, NULL						},
254 	{0x0f, 0xff, 0xff, 0xff, NULL						},
255 
256 	{0   , 0xfe, 0   ,    2, "Coin Slots"				},
257 	{0x0e, 0x01, 0x01, 0x01, "Common"					},
258 	{0x0e, 0x01, 0x01, 0x00, "Individual"				},
259 
260 	{0   , 0xfe, 0   ,    2, "Allow Continue"			},
261 	{0x0e, 0x01, 0x02, 0x00, "No"						},
262 	{0x0e, 0x01, 0x02, 0x02, "Yes"						},
263 
264 	{0   , 0xfe, 0   ,    4, "Magazine / Grenade"		},
265 	{0x0e, 0x01, 0x0c, 0x08, "5 / 2"					},
266 	{0x0e, 0x01, 0x0c, 0x0c, "6 / 3"					},
267 	{0x0e, 0x01, 0x0c, 0x04, "7 / 4"					},
268 	{0x0e, 0x01, 0x0c, 0x00, "8 / 5"					},
269 
270 	{0   , 0xfe, 0   ,    4, "Coin A"					},
271 	{0x0e, 0x01, 0x30, 0x00, "4 Coins 1 Credits"		},
272 	{0x0e, 0x01, 0x30, 0x10, "3 Coins 1 Credits"		},
273 	{0x0e, 0x01, 0x30, 0x20, "2 Coins 1 Credits"		},
274 	{0x0e, 0x01, 0x30, 0x30, "1 Coin  1 Credits"		},
275 
276 	{0   , 0xfe, 0   ,    4, "Coin B"					},
277 	{0x0e, 0x01, 0xc0, 0xc0, "1 Coin  1 Credits"		},
278 	{0x0e, 0x01, 0xc0, 0x80, "1 Coin  2 Credits"		},
279 	{0x0e, 0x01, 0xc0, 0x40, "1 Coin  3 Credits"		},
280 	{0x0e, 0x01, 0xc0, 0x00, "1 Coin  4 Credits"		},
281 
282 	{0   , 0xfe, 0   ,    4, "Difficulty"				},
283 	{0x0f, 0x01, 0x03, 0x02, "Easy"						},
284 	{0x0f, 0x01, 0x03, 0x03, "Normal"					},
285 	{0x0f, 0x01, 0x03, 0x01, "Hard"						},
286 	{0x0f, 0x01, 0x03, 0x00, "Hardest"					},
287 
288 	{0   , 0xfe, 0   ,    4, "Game Mode"				},
289 	{0x0f, 0x01, 0x0c, 0x08, "Demo Sounds Off"			},
290 	{0x0f, 0x01, 0x0c, 0x0c, "Demo Sounds On"			},
291 	{0x0f, 0x01, 0x0c, 0x04, "Infinite Energy (Cheat)"	},
292 	{0x0f, 0x01, 0x0c, 0x00, "Freeze"					},
293 
294 	{0   , 0xfe, 0   ,    2, "Service Mode"				},
295 	{0x0f, 0x01, 0x80, 0x80, "Off"						},
296 	{0x0f, 0x01, 0x80, 0x00, "On"						},
297 };
298 
299 STDDIPINFO(Mechatt)
300 
301 static struct BurnDIPInfo MechattuDIPList[]=
302 {
303 	{0x0e, 0xff, 0xff, 0xff, NULL						},
304 	{0x0f, 0xff, 0xff, 0xff, NULL						},
305 
306 	{0   , 0xfe, 0   ,    2, "Coin Slots"				},
307 	{0x0e, 0x01, 0x01, 0x01, "Common"					},
308 	{0x0e, 0x01, 0x01, 0x00, "Individual"				},
309 
310 	{0   , 0xfe, 0   ,    2, "Allow Continue"			},
311 	{0x0e, 0x01, 0x02, 0x00, "No"						},
312 	{0x0e, 0x01, 0x02, 0x02, "Yes"						},
313 
314 	{0   , 0xfe, 0   ,    4, "Magazine / Grenade"		},
315 	{0x0e, 0x01, 0x0c, 0x08, "5 / 2"					},
316 	{0x0e, 0x01, 0x0c, 0x0c, "6 / 3"					},
317 	{0x0e, 0x01, 0x0c, 0x04, "7 / 4"					},
318 	{0x0e, 0x01, 0x0c, 0x00, "8 / 5"					},
319 
320 	{0   , 0xfe, 0   ,    4, "Coin A"					},
321 	{0x0e, 0x01, 0x30, 0x00, "Free_Play"				},
322 	{0x0e, 0x01, 0x30, 0x10, "1 Coin/2 Credits first, then 1 Coin/1 Credit"	},
323 	{0x0e, 0x01, 0x30, 0x20, "2 Coins/1 Credit first, then 1 Coin/1 Credit"	},
324 	{0x0e, 0x01, 0x30, 0x30, "1 Coin  1 Credits"		},
325 
326 	{0   , 0xfe, 0   ,    4, "Coin B"					},
327 	{0x0e, 0x01, 0xc0, 0xc0, "1 Coin  1 Credits"		},
328 	{0x0e, 0x01, 0xc0, 0x80, "1 Coin  2 Credits"		},
329 	{0x0e, 0x01, 0xc0, 0x40, "1 Coin  3 Credits"		},
330 	{0x0e, 0x01, 0xc0, 0x00, "1 Coin  4 Credits"		},
331 
332 	{0   , 0xfe, 0   ,    4, "Difficulty"				},
333 	{0x0f, 0x01, 0x03, 0x02, "Easy"						},
334 	{0x0f, 0x01, 0x03, 0x03, "Normal"					},
335 	{0x0f, 0x01, 0x03, 0x01, "Hard"						},
336 	{0x0f, 0x01, 0x03, 0x00, "Hardest"					},
337 
338 	{0   , 0xfe, 0   ,    4, "Game Mode"				},
339 	{0x0f, 0x01, 0x0c, 0x08, "Demo Sounds Off"			},
340 	{0x0f, 0x01, 0x0c, 0x0c, "Demo Sounds On"			},
341 	{0x0f, 0x01, 0x0c, 0x04, "Infinite Energy (Cheat)"	},
342 	{0x0f, 0x01, 0x0c, 0x00, "Freeze"					},
343 
344 	{0   , 0xfe, 0   ,    2, "Service Mode"				},
345 	{0x0f, 0x01, 0x80, 0x80, "Off"						},
346 	{0x0f, 0x01, 0x80, 0x00, "On"						},
347 };
348 
STDDIPINFO(Mechattu)349 STDDIPINFO(Mechattu)
350 
351 static UINT16 control_3_r()
352 {
353 	UINT16 retdata = 0;
354 	// Dink's method of maddness for dealing with the creepage AKA. the farther the crosshair
355 	// goes in a + direction, the more it creeps away from the crosshair.
356 	// NOTE: each gun needs different offsets _and_ has different creepage. odd?
357 	if (gun_select >> 1 == 0) {
358 		if (gun_select & 1) { // Player 1
359 			retdata = (BurnGunReturnX(gun_select >> 1) + 0xa0) + (BurnGunReturnX(gun_select >> 1) >> 4);
360 		} else {
361 			retdata = (BurnGunReturnY(gun_select >> 1) + 0x60+0x1a) - (BurnGunReturnY(gun_select >> 1) >> 2);
362 		}
363 	} else if (gun_select >> 1 == 1) {
364 		if (gun_select & 1) { // Player 2
365 			retdata = (BurnGunReturnX(gun_select >> 1) + 0xa0-0x1a) - (BurnGunReturnX(gun_select >> 1) >> 3);
366 		} else {
367 			retdata = (BurnGunReturnY(gun_select >> 1) + 0x60) + (0x40 - (BurnGunReturnY(gun_select >> 1) >> 2));
368 		}
369 	} else if (gun_select >> 1 == 2) {
370 		if (gun_select & 1) { // Player 3
371 			retdata = (BurnGunReturnX(gun_select >> 1) + 0xa0-0x8) - (BurnGunReturnX(gun_select >> 1) >> 5);
372 		} else {
373 			retdata = (BurnGunReturnY(gun_select >> 1) + 0x60+0x1a) + (0x40 - (BurnGunReturnY(gun_select >> 1) >> 2));
374 		}
375 	}
376 
377 	return retdata >> 1;
378 }
379 
mechatt_gun_r(UINT16 offset)380 static UINT16 mechatt_gun_r(UINT16 offset)
381 {
382 	INT32 x = BurnGunReturnX((offset) ? 1 : 0) + 0x18;
383 	INT32 y = BurnGunReturnY((offset) ? 1 : 0);
384 
385 	//if (x > 0xff) x = 0xff;
386 	if (y > 0xef) y = 0xef;
387 
388 	return x | (y << 8);
389 }
390 
sound_sync()391 static void sound_sync()
392 {
393 	INT32 cyc = ((SekTotalCycles() * 4) / 12) - ZetTotalCycles();
394 	if (cyc > 0) {
395 		BurnTimerUpdate(ZetTotalCycles() + cyc);
396 	}
397 }
398 
bbusters_main_read_word(UINT32 address)399 static UINT16 __fastcall bbusters_main_read_word(UINT32 address)
400 {
401 	if ((address & 0xffff00) == 0x0f8000) {
402 		return (DrvEeprom[(address >> 1) & 0x7f] | (DrvEeprom[(address >> 1) & 0x7f] << 8));
403 	}
404 
405 	switch (address)
406 	{
407 		case 0x0e0000:
408 			return DrvInputs[2];
409 
410 		case 0x0e0002:
411 			return DrvInputs[0];
412 
413 		case 0x0e0004:
414 			return DrvInputs[1];
415 
416 		case 0x0e0008:
417 			return DrvDips[0];
418 
419 		case 0x0e000a:
420 			return DrvDips[1];
421 
422 		case 0x0e0018:
423 			sound_sync();
424 			return sound_status;
425 
426 		case 0x0e8000:
427 			return 0;
428 
429 		case 0x0e8002:
430 			return control_3_r();
431 	}
432 
433 	return 0;
434 }
435 
bbusters_main_read_byte(UINT32 address)436 static UINT8 __fastcall bbusters_main_read_byte(UINT32 address)
437 {
438 	if ((address & 0xffff00) == 0x0f8000) {
439 		return (DrvEeprom[(address >> 1) & 0x7f]);
440 	}
441 
442 	return 0;
443 }
444 
bbusters_main_write_word(UINT32 address,UINT16 data)445 static void __fastcall bbusters_main_write_word(UINT32 address, UINT16 data)
446 {
447 	if ((address & 0xffff00) == 0x0f8000) {
448 		DrvEeprom[(address & 0xfe)>>1] = data;
449 		return;
450 	}
451 
452 	switch (address)
453 	{
454 		case 0x0b8000:
455 		case 0x0b8002:
456 			*((UINT16*)(DrvPfScroll0 + (address & 2))) = BURN_ENDIAN_SWAP_INT16(data);
457 		return;
458 
459 		case 0x0b8008:
460 		case 0x0b800a:
461 			*((UINT16*)(DrvPfScroll1 + (address & 2))) = BURN_ENDIAN_SWAP_INT16(data);
462 		return;
463 
464 		case 0x0e8000: {
465 			SekSetIRQLine(2, CPU_IRQSTATUS_AUTO);
466 			gun_select = data & 0xff;
467 		}
468 		return;
469 
470 		case 0x0f0008:
471 			// three_gun_output
472 		return;
473 
474 		case 0x0f0018: {
475 			sound_sync();
476 			soundlatch = data;
477 			ZetNmi();
478 		}
479 		return;
480 	}
481 }
482 
bbusters_main_write_byte(UINT32 address,UINT8 data)483 static void __fastcall bbusters_main_write_byte(UINT32 address, UINT8 data)
484 {
485 	bprintf (0, _T("MWB: %5.5x, %2.2x\n"), address, data);
486 }
487 
mechatt_main_read_word(UINT32 address)488 static UINT16 __fastcall mechatt_main_read_word(UINT32 address)
489 {
490 	//bprintf (0, _T("MRW: %5.5x\n"), address);
491 
492 	switch (address)
493 	{
494 		case 0x0e0000:
495 			return DrvInputs[0];
496 
497 		case 0x0e0002:
498 			return DrvDips[0] | (DrvDips[1] << 8);
499 
500 		case 0x0e0004:
501 		case 0x0e0006:
502 			return mechatt_gun_r(address - 0xe0004);
503 
504 		case 0x0e8000:
505 			sound_sync();
506 			return sound_status;
507 	}
508 
509 	return 0;
510 }
511 
mechatt_main_read_byte(UINT32)512 static UINT8 __fastcall mechatt_main_read_byte(UINT32 /*address*/)
513 {
514 	//bprintf (0, _T("MRB: %5.5x\n"), address);
515 
516 	return 0;
517 }
518 
mechatt_main_write_word(UINT32 address,UINT16 data)519 static void __fastcall mechatt_main_write_word(UINT32 address, UINT16 data)
520 {
521 	if ((address & 0xf0000) == 0xa0000) return; // nop
522 
523 	switch (address)
524 	{
525 		case 0x0b8000:
526 		case 0x0b8002:
527 			*((UINT16*)(DrvPfScroll0 + (address & 2))) = BURN_ENDIAN_SWAP_INT16(data);
528 		return;
529 
530 		case 0x0c8000:
531 		case 0x0c8002:
532 			*((UINT16*)(DrvPfScroll1 + (address & 2))) = BURN_ENDIAN_SWAP_INT16(data);
533 		return;
534 
535 		case 0x0e4002:
536 			// two_gun_output
537 		return;
538 
539 		case 0x0e8000: {
540 			sound_sync();
541 			soundlatch = data;
542 			ZetNmi();
543 		}
544 		return;
545 	}
546 }
547 
mechatt_main_write_byte(UINT32,UINT8)548 static void __fastcall mechatt_main_write_byte(UINT32 /*address*/, UINT8 /*data*/)
549 {
550 	//bprintf (0, _T("MWB: %5.5x, %2.2x\n"), address, data);
551 }
552 
bbusters_sound_write(UINT16 address,UINT8 data)553 static void __fastcall bbusters_sound_write(UINT16 address, UINT8 data)
554 {
555 	switch (address)
556 	{
557 		case 0xf800:
558 			sound_status = data;
559 		return;
560 	}
561 }
562 
bbusters_sound_read(UINT16 address)563 static UINT8 __fastcall bbusters_sound_read(UINT16 address)
564 {
565 	switch (address)
566 	{
567 		case 0xf800:
568 			return soundlatch;
569 	}
570 
571 	return 0;
572 }
573 
bbusters_sound_write_port(UINT16 port,UINT8 data)574 static void __fastcall bbusters_sound_write_port(UINT16 port, UINT8 data)
575 {
576 	switch (port & 0xff)
577 	{
578 		case 0x00:
579 		case 0x01:
580 		case 0x02:
581 		case 0x03:
582 			if (game_select) {
583 				BurnYM2608Write(port & 3, data);
584 			} else {
585 				BurnYM2610Write(port & 3, data);
586 			}
587 		return;
588 	}
589 }
590 
bbusters_sound_read_port(UINT16 port)591 static UINT8 __fastcall bbusters_sound_read_port(UINT16 port)
592 {
593 	switch (port & 0xff)
594 	{
595 		case 0x00:
596 		case 0x01:
597 		case 0x02:
598 		case 0x03:
599 		if (game_select) {
600 			return BurnYM2608Read(port & 3);
601 		} else {
602 			return BurnYM2610Read(port & 3);
603 		}
604 	}
605 
606 	return 0;
607 }
608 
DrvFMIRQHandler(INT32,INT32 nStatus)609 static void DrvFMIRQHandler(INT32, INT32 nStatus)
610 {
611 	ZetSetIRQLine(0, 0, (nStatus) ?  CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
612 }
613 
DrvDoReset()614 static INT32 DrvDoReset()
615 {
616 	memset (AllRam, 0, RamEnd - AllRam);
617 
618 	SekOpen(0);
619 	SekReset();
620 	SekClose();
621 
622 	ZetOpen(0);
623 	ZetReset();
624 	if (game_select) {
625 		BurnYM2608Reset();
626 	} else {
627 		BurnYM2610Reset();
628 	}
629 	ZetClose();
630 
631 	HiscoreReset();
632 
633 	sound_status = 0;
634 	soundlatch = 0;
635 	gun_select = 0;
636 
637 	return 0;
638 }
639 
MemIndex()640 static INT32 MemIndex()
641 {
642 	UINT8 *Next; Next = AllMem;
643 
644 	Drv68KROM		= Next; Next += 0x080000;
645 	DrvZ80ROM		= Next; Next += 0x010000;
646 
647 	DrvGfxROM0		= Next; Next += 0x040000;
648 	DrvGfxROM1		= Next; Next += 0x400000;
649 	DrvGfxROM2		= Next; Next += 0x400000;
650 	DrvGfxROM3		= Next; Next += 0x100000;
651 	DrvGfxROM4		= Next; Next += 0x100000;
652 
653 	DrvZoomTab		= Next; Next += 0x010000;
654 
655 	DrvSndROM0		= Next; Next += 0x080000;
656 	DrvSndROM1		= Next; Next += 0x080000;
657 
658 	DrvEeprom		= Next; Next += 0x000100;
659 
660 	DrvPalette		= (UINT32*)Next; Next += 0x800 * sizeof(UINT32);
661 
662 	AllRam			= Next;
663 
664 	Drv68KRAM		= Next; Next += 0x010000;
665 	DrvZ80RAM		= Next; Next += 0x000800;
666 
667 	DrvVidRAM		= Next; Next += 0x001000;
668 	DrvPfRAM0		= Next; Next += 0x004000;
669 	DrvPfRAM1		= Next; Next += 0x004000;
670 	DrvPalRAM		= Next; Next += 0x001000;
671 	DrvSprRAM		= Next; Next += 0x010000;
672 	DrvSprBuf		= Next; Next += 0x002000;
673 
674 	DrvPfScroll0	= Next; Next += 0x000004;
675 	DrvPfScroll1	= Next; Next += 0x000004;
676 
677 	RamEnd			= Next;
678 
679 	SpriteBitmap[0] = (UINT16*)Next; Next += 256 * 256 * sizeof(UINT16);
680 	SpriteBitmap[1] = (UINT16*)Next; Next += 256 * 256 * sizeof(UINT16);
681 
682 	MemEnd			= Next;
683 
684 	return 0;
685 }
686 
DrvGfxDecode()687 static INT32 DrvGfxDecode()
688 {
689 	INT32 Planes0[4] = { STEP4(0,1) };
690 	INT32 XOffs0[16] = { STEP8(0,4), STEP8(512, 4) };
691 	INT32 YOffs0[16] = { STEP16(0,32) };
692 
693 	INT32 Planes1[4] = { 8, 12, 0, 4 };
694 	INT32 XOffs1[16] = { STEP4(0,1), STEP4(16,1), STEP4(256,1), STEP4(272,1) };
695 	INT32 YOffs1[16] = { STEP8(0,32), STEP8(512,32) };
696 
697 	UINT8 *tmp = (UINT8*)BurnMalloc(0x200000);
698 	if (tmp == NULL) {
699 		return 1;
700 	}
701 
702 	memcpy (tmp, DrvGfxROM0, 0x020000);
703 
704 	GfxDecode(((0x020000/4)*8)/( 8 *  8), 4,  8,  8, Planes0, XOffs0, YOffs0, 0x100, tmp, DrvGfxROM0);
705 
706 	memcpy (tmp, DrvGfxROM1, 0x200000);
707 
708 	GfxDecode(((0x200000/4)*8)/(16 * 16), 4, 16, 16, Planes1, XOffs1, YOffs1, 0x400, tmp, DrvGfxROM1);
709 
710 	memcpy (tmp, DrvGfxROM2, 0x200000);
711 
712 	GfxDecode(((0x200000/4)*8)/(16 * 16), 4, 16, 16, Planes1, XOffs1, YOffs1, 0x400, tmp, DrvGfxROM2);
713 
714 	memcpy (tmp, DrvGfxROM3, 0x080000);
715 
716 	GfxDecode(((0x080000/4)*8)/(16 * 16), 4, 16, 16, Planes0, XOffs0, YOffs0, 0x400, tmp, DrvGfxROM3);
717 
718 	memcpy (tmp, DrvGfxROM4, 0x080000);
719 
720 	GfxDecode(((0x080000/4)*8)/(16 * 16), 4, 16, 16, Planes0, XOffs0, YOffs0, 0x400, tmp, DrvGfxROM4);
721 
722 
723 	BurnFree (tmp);
724 
725 	return 0;
726 }
727 
DrvInit()728 static INT32 DrvInit()
729 {
730 	game_select = 0;
731 
732 	BurnSetRefreshRate(56.00);
733 
734 	BurnAllocMemIndex();
735 
736 	{
737 		if (BurnLoadRom(Drv68KROM  + 0x000001,  0, 2)) return 1;
738 		if (BurnLoadRom(Drv68KROM  + 0x000000,  1, 2)) return 1;
739 		if (BurnLoadRom(Drv68KROM  + 0x040001,  2, 2)) return 1;
740 		if (BurnLoadRom(Drv68KROM  + 0x040000,  3, 2)) return 1;
741 
742 		if (BurnLoadRom(DrvZ80ROM  + 0x000000,  4, 1)) return 1;
743 
744 		if (BurnLoadRom(DrvGfxROM0 + 0x000000,  5, 1)) return 1;
745 
746 		if (BurnLoadRom(DrvGfxROM1 + 0x000000,  6, 1)) return 1;
747 		if (BurnLoadRom(DrvGfxROM1 + 0x080000,  7, 1)) return 1;
748 		if (BurnLoadRom(DrvGfxROM1 + 0x100000,  8, 1)) return 1;
749 		if (BurnLoadRom(DrvGfxROM1 + 0x180000,  9, 1)) return 1;
750 
751 		if (BurnLoadRom(DrvGfxROM2 + 0x000000, 10, 1)) return 1;
752 		if (BurnLoadRom(DrvGfxROM2 + 0x080000, 11, 1)) return 1;
753 		if (BurnLoadRom(DrvGfxROM2 + 0x100000, 12, 1)) return 1;
754 		if (BurnLoadRom(DrvGfxROM2 + 0x180000, 13, 1)) return 1;
755 
756 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 14, 1)) return 1;
757 
758 		if (BurnLoadRom(DrvGfxROM4 + 0x000000, 15, 1)) return 1;
759 
760 		if (BurnLoadRom(DrvZoomTab + 0x000000, 16, 1)) return 1;
761 	//	if (BurnLoadRom(DrvZoomTab + 0x000000, 17, 1)) return 1;
762 	//	if (BurnLoadRom(DrvZoomTab + 0x000000, 18, 1)) return 1;
763 	//	if (BurnLoadRom(DrvZoomTab + 0x000000, 19, 1)) return 1;
764 
765 		if (BurnLoadRom(DrvSndROM0 + 0x000000, 20, 1)) return 1;
766 
767 		if (BurnLoadRom(DrvSndROM1 + 0x000000, 21, 1)) return 1;
768 
769 		//if (BurnLoadRom(DrvEeprom  + 0x000000, 22, 1)) return 1; // don't use mame's default eeprom file -dink aug.02.2020
770 		memset(DrvEeprom, 0xff, 0x100);
771 		DrvGfxDecode();
772 	}
773 
774 	SekInit(0, 0x68000);
775 	SekOpen(0);
776 	SekMapMemory(Drv68KROM,		0x000000, 0x07ffff, MAP_ROM);
777 	SekMapMemory(Drv68KRAM,		0x080000, 0x08ffff, MAP_RAM);
778 	SekMapMemory(DrvVidRAM,		0x090000, 0x090fff, MAP_RAM);
779 	SekMapMemory(DrvSprRAM,		0x0a0000, 0x0affff, MAP_RAM);
780 	SekMapMemory(DrvPfRAM0,		0x0b0000, 0x0b1fff, MAP_RAM);
781 	SekMapMemory(DrvPfRAM1,		0x0b2000, 0x0b5fff, MAP_RAM);
782 	SekMapMemory(DrvPalRAM,		0x0d0000, 0x0d0fff, MAP_RAM);
783 	SekSetWriteWordHandler(0,	bbusters_main_write_word);
784 	SekSetWriteByteHandler(0,	bbusters_main_write_byte);
785 	SekSetReadWordHandler(0,	bbusters_main_read_word);
786 	SekSetReadByteHandler(0,	bbusters_main_read_byte);
787 	SekClose();
788 
789 	ZetInit(0);
790 	ZetOpen(0);
791 	ZetMapMemory(DrvZ80ROM,		0x0000, 0xefff, MAP_ROM);
792 	ZetMapMemory(DrvZ80RAM,		0xf000, 0xf7ff, MAP_RAM);
793 	ZetSetWriteHandler(bbusters_sound_write);
794 	ZetSetReadHandler(bbusters_sound_read);
795 	ZetSetOutHandler(bbusters_sound_write_port);
796 	ZetSetInHandler(bbusters_sound_read_port);
797 	ZetClose();
798 
799 	INT32 nSoundROMLen = 0x80000;
800 	BurnYM2610Init(8000000, DrvSndROM0, &nSoundROMLen, DrvSndROM1, &nSoundROMLen, &DrvFMIRQHandler, 0);
801 	BurnTimerAttachZet(4000000);
802 	BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_1, 2.00, BURN_SND_ROUTE_LEFT);
803 	BurnYM2610SetRoute(BURN_SND_YM2610_YM2610_ROUTE_2, 2.00, BURN_SND_ROUTE_RIGHT);
804 	BurnYM2610SetRoute(BURN_SND_YM2610_AY8910_ROUTE, 2.00, BURN_SND_ROUTE_BOTH);
805 
806 	GenericTilesInit();
807 
808 	BurnGunInit(3, true);
809 
810 	DrvDoReset();
811 
812 	return 0;
813 }
814 
MechattInit()815 static INT32 MechattInit()
816 {
817 	game_select = 1;
818 
819 	BurnAllocMemIndex();
820 
821 	{
822 		if (BurnLoadRom(Drv68KROM  + 0x000001,  0, 2)) return 1;
823 		if (BurnLoadRom(Drv68KROM  + 0x000000,  1, 2)) return 1;
824 		if (BurnLoadRom(Drv68KROM  + 0x040001,  2, 2)) return 1;
825 		if (BurnLoadRom(Drv68KROM  + 0x040000,  3, 2)) return 1;
826 
827 		if (BurnLoadRom(DrvZ80ROM  + 0x000000,  4, 1)) return 1;
828 
829 		if (BurnLoadRom(DrvGfxROM0 + 0x000000,  5, 1)) return 1;
830 
831 		if (BurnLoadRom(DrvGfxROM1 + 0x000000,  6, 1)) return 1;
832 		if (BurnLoadRom(DrvGfxROM1 + 0x080000,  7, 1)) return 1;
833 		if (BurnLoadRom(DrvGfxROM1 + 0x100000,  8, 1)) return 1;
834 		if (BurnLoadRom(DrvGfxROM1 + 0x180000,  9, 1)) return 1;
835 
836 		memset (DrvGfxROM2, 0xff, 0x200000);
837 
838 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 10, 1)) return 1;
839 
840 		if (BurnLoadRom(DrvGfxROM4 + 0x000000, 11, 1)) return 1;
841 
842 		if (BurnLoadRom(DrvSndROM0 + 0x000000, 12, 1)) return 1;
843 
844 		if (BurnLoadRom(DrvZoomTab + 0x000000, 13, 1)) return 1;
845 	//	if (BurnLoadRom(DrvZoomTab + 0x000000, 14, 1)) return 1;
846 
847 		if (BurnLoadRom(DrvSndROM1,		0x80, 1)) return 1; // ym2608 rom
848 
849 		DrvGfxDecode();
850 	}
851 
852 	SekInit(0, 0x68000);
853 	SekOpen(0);
854 	SekMapMemory(Drv68KROM,		0x000000, 0x06ffff, MAP_ROM);
855 	SekMapMemory(Drv68KRAM,		0x070000, 0x07ffff, MAP_RAM);
856 	SekMapMemory(DrvVidRAM,		0x090000, 0x090fff, MAP_RAM);
857 	SekMapMemory(DrvSprRAM,		0x0a0000, 0x0a0fff, MAP_RAM);
858 	SekMapMemory(DrvPfRAM0,		0x0b0000, 0x0b3fff, MAP_RAM);
859 	SekMapMemory(DrvPfRAM1,		0x0c0000, 0x0c3fff, MAP_RAM);
860 	SekMapMemory(DrvPalRAM,		0x0d0000, 0x0d07ff, MAP_RAM);
861 	SekSetWriteWordHandler(0,	mechatt_main_write_word);
862 	SekSetWriteByteHandler(0,	mechatt_main_write_byte);
863 	SekSetReadWordHandler(0,	mechatt_main_read_word);
864 	SekSetReadByteHandler(0,	mechatt_main_read_byte);
865 	SekClose();
866 
867 	ZetInit(0);
868 	ZetOpen(0);
869 	ZetMapMemory(DrvZ80ROM,		0x0000, 0xefff, MAP_ROM);
870 	ZetMapMemory(DrvZ80RAM,		0xf000, 0xf7ff, MAP_RAM);
871 	ZetSetWriteHandler(bbusters_sound_write);
872 	ZetSetReadHandler(bbusters_sound_read);
873 	ZetSetOutHandler(bbusters_sound_write_port);
874 	ZetSetInHandler(bbusters_sound_read_port);
875 	ZetClose();
876 
877 	INT32 nSndROMLen = 0x20000;
878 	BurnYM2608Init(8000000, DrvSndROM0, &nSndROMLen, DrvSndROM1, &DrvFMIRQHandler, 0);
879 	BurnTimerAttachZet(4000000);
880 	BurnYM2608SetRoute(BURN_SND_YM2608_YM2608_ROUTE_1, 0.45, BURN_SND_ROUTE_BOTH);
881 	BurnYM2608SetRoute(BURN_SND_YM2608_YM2608_ROUTE_2, 0.45, BURN_SND_ROUTE_BOTH);
882 	BurnYM2608SetRoute(BURN_SND_YM2608_AY8910_ROUTE,   0.15, BURN_SND_ROUTE_BOTH);
883 
884 	GenericTilesInit();
885 
886 	BurnGunInit(3, true);
887 
888 	DrvDoReset();
889 
890 	return 0;
891 }
892 
MechattjInit()893 static INT32 MechattjInit()
894 {
895 	game_select = 1;
896 
897 	BurnAllocMemIndex();
898 
899 	{
900 		if (BurnLoadRom(Drv68KROM  + 0x000001,  0, 2)) return 1;
901 		if (BurnLoadRom(Drv68KROM  + 0x000000,  1, 2)) return 1;
902 		if (BurnLoadRom(Drv68KROM  + 0x040001,  2, 2)) return 1;
903 		if (BurnLoadRom(Drv68KROM  + 0x040000,  3, 2)) return 1;
904 
905 		if (BurnLoadRom(DrvZ80ROM  + 0x000000,  4, 1)) return 1;
906 
907 		if (BurnLoadRom(DrvGfxROM0 + 0x000000,  5, 1)) return 1;
908 
909 		if (BurnLoadRom(DrvGfxROM1 + 0x000000,  6, 2)) return 1;
910 		if (BurnLoadRom(DrvGfxROM1 + 0x000001,  7, 2)) return 1;
911 		if (BurnLoadRom(DrvGfxROM1 + 0x040000,  8, 2)) return 1;
912 		if (BurnLoadRom(DrvGfxROM1 + 0x040001,  9, 2)) return 1;
913 		if (BurnLoadRom(DrvGfxROM1 + 0x080000, 10, 2)) return 1;
914 		if (BurnLoadRom(DrvGfxROM1 + 0x080001, 11, 2)) return 1;
915 		if (BurnLoadRom(DrvGfxROM1 + 0x0c0000, 12, 2)) return 1;
916 		if (BurnLoadRom(DrvGfxROM1 + 0x0c0001, 13, 2)) return 1;
917 		if (BurnLoadRom(DrvGfxROM1 + 0x100000, 14, 2)) return 1;
918 		if (BurnLoadRom(DrvGfxROM1 + 0x100001, 15, 2)) return 1;
919 		if (BurnLoadRom(DrvGfxROM1 + 0x140000, 16, 2)) return 1;
920 		if (BurnLoadRom(DrvGfxROM1 + 0x140001, 17, 2)) return 1;
921 		if (BurnLoadRom(DrvGfxROM1 + 0x180000, 18, 2)) return 1;
922 		if (BurnLoadRom(DrvGfxROM1 + 0x180001, 19, 2)) return 1;
923 		if (BurnLoadRom(DrvGfxROM1 + 0x1c0000, 20, 2)) return 1;
924 		if (BurnLoadRom(DrvGfxROM1 + 0x1c0001, 21, 2)) return 1;
925 
926 		memset (DrvGfxROM2, 0xff, 0x200000);
927 
928 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 22, 1)) return 1;
929 		if (BurnLoadRom(DrvGfxROM3 + 0x020000, 23, 1)) return 1;
930 		if (BurnLoadRom(DrvGfxROM3 + 0x040000, 24, 1)) return 1;
931 		if (BurnLoadRom(DrvGfxROM3 + 0x060000, 25, 1)) return 1;
932 
933 		if (BurnLoadRom(DrvGfxROM4 + 0x000000, 26, 1)) return 1;
934 		if (BurnLoadRom(DrvGfxROM4 + 0x020000, 27, 1)) return 1;
935 		if (BurnLoadRom(DrvGfxROM4 + 0x040000, 28, 1)) return 1;
936 		if (BurnLoadRom(DrvGfxROM4 + 0x060000, 29, 1)) return 1;
937 
938 		if (BurnLoadRom(DrvSndROM0 + 0x000000, 30, 1)) return 1;
939 
940 		if (BurnLoadRom(DrvZoomTab + 0x000000, 31, 1)) return 1;
941 	//	if (BurnLoadRom(DrvZoomTab + 0x000000, 32, 1)) return 1;
942 
943 		if (BurnLoadRom(DrvSndROM1,		0x80, 1)) return 1; // ym2608 rom
944 
945 		DrvGfxDecode();
946 	}
947 
948 	SekInit(0, 0x68000);
949 	SekOpen(0);
950 	SekMapMemory(Drv68KROM,		0x000000, 0x06ffff, MAP_ROM);
951 	SekMapMemory(Drv68KRAM,		0x070000, 0x07ffff, MAP_RAM);
952 	SekMapMemory(DrvVidRAM,		0x090000, 0x090fff, MAP_RAM);
953 	SekMapMemory(DrvSprRAM,		0x0a0000, 0x0a0fff, MAP_RAM);
954 	SekMapMemory(DrvPfRAM0,		0x0b0000, 0x0b3fff, MAP_RAM);
955 	SekMapMemory(DrvPfRAM1,		0x0c0000, 0x0c3fff, MAP_RAM);
956 	SekMapMemory(DrvPalRAM,		0x0d0000, 0x0d07ff, MAP_RAM);
957 	SekSetWriteWordHandler(0,	mechatt_main_write_word);
958 	SekSetWriteByteHandler(0,	mechatt_main_write_byte);
959 	SekSetReadWordHandler(0,	mechatt_main_read_word);
960 	SekSetReadByteHandler(0,	mechatt_main_read_byte);
961 	SekClose();
962 
963 	ZetInit(0);
964 	ZetOpen(0);
965 	ZetMapMemory(DrvZ80ROM,		0x0000, 0xefff, MAP_ROM);
966 	ZetMapMemory(DrvZ80RAM,		0xf000, 0xf7ff, MAP_RAM);
967 	ZetSetWriteHandler(bbusters_sound_write);
968 	ZetSetReadHandler(bbusters_sound_read);
969 	ZetSetOutHandler(bbusters_sound_write_port);
970 	ZetSetInHandler(bbusters_sound_read_port);
971 	ZetClose();
972 
973 	INT32 nSndROMLen = 0x20000;
974 	BurnYM2608Init(8000000, DrvSndROM0, &nSndROMLen, DrvSndROM1, &DrvFMIRQHandler, 0);
975 	BurnTimerAttachZet(4000000);
976 	BurnYM2608SetRoute(BURN_SND_YM2608_YM2608_ROUTE_1, 0.45, BURN_SND_ROUTE_BOTH);
977 	BurnYM2608SetRoute(BURN_SND_YM2608_YM2608_ROUTE_2, 0.45, BURN_SND_ROUTE_BOTH);
978 	BurnYM2608SetRoute(BURN_SND_YM2608_AY8910_ROUTE,   0.15, BURN_SND_ROUTE_BOTH);
979 
980 	GenericTilesInit();
981 
982 	BurnGunInit(3, true);
983 
984 	DrvDoReset();
985 
986 	return 0;
987 }
988 
DrvExit()989 static INT32 DrvExit()
990 {
991 	GenericTilesExit();
992 
993 	SekExit();
994 	ZetExit();
995 	if (game_select) {
996 		BurnYM2608Exit();
997 	} else {
998 		BurnYM2610Exit();
999 	}
1000 	BurnGunExit();
1001 
1002 	BurnFreeMemIndex();
1003 
1004 	game_select = 0;
1005 
1006 	return 0;
1007 }
1008 
DrvPaletteUpdate()1009 static void DrvPaletteUpdate()
1010 {
1011 	UINT16 *ram = (UINT16*)DrvPalRAM;
1012 
1013 	for (INT32 offs = 0; offs < BurnDrvGetPaletteEntries(); offs++)
1014 	{
1015 		INT32 r = BURN_ENDIAN_SWAP_INT16(ram[offs]) >> 12;
1016 		INT32 g = (BURN_ENDIAN_SWAP_INT16(ram[offs]) >> 8) & 0xf;
1017 		INT32 b = (BURN_ENDIAN_SWAP_INT16(ram[offs]) >> 4) & 0xf;
1018 
1019 		DrvPalette[offs] = BurnHighCol(r*16+r, g*16+g, b*16+b, 0);
1020 	}
1021 }
1022 
draw_text_layer()1023 static void draw_text_layer()
1024 {
1025 	UINT16 *ram = (UINT16*)DrvVidRAM;
1026 
1027 	for (INT32 offs = 0; offs < 32 * 32; offs++)
1028 	{
1029 		INT32 sx = (offs & 0x1f) * 8;
1030 		INT32 sy = (offs / 0x20) * 8;
1031 
1032 		Render8x8Tile_Mask_Clip(pTransDraw, BURN_ENDIAN_SWAP_INT16(ram[offs]) & 0xfff, sx, sy - 16, BURN_ENDIAN_SWAP_INT16(ram[offs]) >> 12, 4, 0xf, 0, DrvGfxROM0);
1033 	}
1034 }
1035 
draw_layer(UINT8 * rambase,UINT8 * gfx,INT32 color_offset,INT32 transp,UINT8 * scroll,INT32 wide)1036 static void draw_layer(UINT8 *rambase, UINT8 *gfx, INT32 color_offset, INT32 transp, UINT8 *scroll, INT32 wide)
1037 {
1038 	UINT16 *scr = (UINT16*)scroll;
1039 	UINT16 *ram = (UINT16*)rambase;
1040 
1041 	INT32 width = (wide) ? 256 : 128;
1042 
1043 	INT32 scrollx = BURN_ENDIAN_SWAP_INT16(scr[0]) & ((width * 16)-1);
1044 	INT32 scrolly = (BURN_ENDIAN_SWAP_INT16(scr[1]) + 16) & 0x1ff;
1045 
1046 	for (INT32 offs = 0; offs < width * 32; offs++)
1047 	{
1048 		INT32 sx = (offs / 0x20) * 16;
1049 		INT32 sy = (offs & 0x1f) * 16;
1050 
1051 		sx -= scrollx;
1052 		if (sx < -15) sx += width * 16;
1053 		sy -= scrolly;
1054 		if (sy < -15) sy += 0x200;
1055 		if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
1056 
1057 		if (transp) {
1058 			Render16x16Tile_Mask_Clip(pTransDraw, BURN_ENDIAN_SWAP_INT16(ram[offs]) & 0xfff, sx, sy, BURN_ENDIAN_SWAP_INT16(ram[offs])>>12, 4, 0xf, color_offset, gfx);
1059 		} else {
1060 			Render16x16Tile_Clip(pTransDraw, BURN_ENDIAN_SWAP_INT16(ram[offs]) & 0xfff, sx, sy, BURN_ENDIAN_SWAP_INT16(ram[offs])>>12, 4, color_offset, gfx);
1061 		}
1062 	}
1063 }
1064 
1065 #define ADJUST_4x4 \
1066 		if ((dx&0x10) && (dy&0x10)) code+=3;    \
1067 		else if (dy&0x10) code+=2;              \
1068 		else if (dx&0x10) code+=1
1069 
1070 #define ADJUST_8x8 \
1071 		if ((dx&0x20) && (dy&0x20)) code+=12;   \
1072 		else if (dy&0x20) code+=8;              \
1073 		else if (dx&0x20) code+=4
1074 
1075 #define ADJUST_16x16 \
1076 		if ((dx&0x40) && (dy&0x40)) code+=48;   \
1077 		else if (dy&0x40) code+=32;             \
1078 		else if (dx&0x40) code+=16
1079 
get_source_ptr(UINT8 * gfx,UINT32 sprite,INT32 dx,INT32 dy,INT32 block)1080 inline const UINT8 *get_source_ptr(UINT8 *gfx, UINT32 sprite, INT32 dx, INT32 dy, INT32 block)
1081 {
1082 	int code=0;
1083 
1084 	switch (block)
1085 	{
1086 		case 0:
1087 		break;
1088 
1089 		case 1:
1090 			ADJUST_4x4;
1091 		break;
1092 
1093 		case 2:
1094 			ADJUST_4x4;
1095 			ADJUST_8x8;
1096 		break;
1097 
1098 		case 3:
1099 			ADJUST_4x4;
1100 			ADJUST_8x8;
1101 			ADJUST_16x16;
1102 		break;
1103 	}
1104 
1105 	return gfx + (((sprite + code) & 0x3fff) * 0x100) + ((dy & 0xf) * 0x10);
1106 }
1107 
draw_block(INT32 chip,const UINT8 * scale_table_ptr,INT32 scale_line_count,INT32 x,INT32 y,INT32 size,INT32 flipx,INT32 flipy,UINT32 sprite,INT32 color,INT32 bank,INT32 block)1108 static void draw_block(INT32 chip, const UINT8 *scale_table_ptr,INT32 scale_line_count,INT32 x,INT32 y,INT32 size,INT32 flipx,INT32 flipy,UINT32 sprite,INT32 color,INT32 bank,INT32 block)
1109 {
1110 	UINT8 *gfx = (bank == 2) ? DrvGfxROM2 : DrvGfxROM1;
1111 	INT32 pen_base = ((bank == 2) ? 0x200 : 0x100) + ((color & 0xf) << 4);
1112 	UINT32 xinc=(scale_line_count * 0x10000 ) / size;
1113 	UINT8 pixel;
1114 	INT32 x_index;
1115 	INT32 dy=y;
1116 	INT32 sx, ex = scale_line_count;
1117 
1118 	while (scale_line_count) {
1119 		if (dy>=16 && dy<240) {
1120 			UINT16 *destline = SpriteBitmap[chip] + (dy - 16) * nScreenWidth;
1121 			UINT8 srcline=*scale_table_ptr;
1122 			const UINT8 *srcptr=NULL;
1123 
1124 			if (!flipy)
1125 				srcline=size-srcline-1;
1126 
1127 			if (flipx)
1128 				x_index=(ex-1)*0x10000;
1129 			else
1130 				x_index=0;
1131 
1132 			for (sx=0; sx<size; sx++) {
1133 				if ((sx%16)==0)
1134 					srcptr=get_source_ptr(gfx,sprite,sx,srcline,block);
1135 
1136 				pixel=*srcptr++;
1137 				if (pixel!=15 && ((x+(x_index>>16)) & 0x1ff) < nScreenWidth)
1138 					destline[(x+(x_index>>16)) & 0x1ff]= pen_base + pixel;
1139 
1140 				if (flipx)
1141 					x_index-=xinc;
1142 				else
1143 					x_index+=xinc;
1144 			}
1145 		}
1146 
1147 		dy++;
1148 		scale_table_ptr--;
1149 		scale_line_count--;
1150 	}
1151 }
1152 
draw_sprites(INT32 chip,UINT8 * source8,INT32 bank)1153 static void draw_sprites(INT32 chip, UINT8 *source8, INT32 bank)
1154 {
1155 	UINT16 *source = (UINT16*)source8;
1156 	const UINT8 *scale_table=DrvZoomTab;
1157 
1158 	for (INT32 offs = 0; offs < 0x800; offs += 4) {
1159 		INT32 scale;
1160 
1161 		INT32 sprite=BURN_ENDIAN_SWAP_INT16(source[offs+1]);
1162 		INT32 colour=BURN_ENDIAN_SWAP_INT16(source[offs+0]);
1163 
1164 		if ((colour==0xf7 || colour==0xffff || colour == 0x43f9) && (sprite==0x3fff || sprite==0xffff || sprite==0x0001))
1165 			continue; // sprite 1, color 0x43f9 is the dead sprite in the top-right of the screen in Mechanized Attack's High Score table.
1166 
1167 		INT16 y=BURN_ENDIAN_SWAP_INT16(source[offs+3]);
1168 		INT32 x=BURN_ENDIAN_SWAP_INT16(source[offs+2]);
1169 
1170 		if (x&0x200) x=-(0x100-(x&0xff));
1171 
1172 		if (y > 320 || y < -256) y &= 0x1ff; // fix for bbusters ending & "Zing!" attract-mode fullscreen zombie & Helicopter on the 3rd rotation of the attractmode sequence
1173 
1174 		colour>>=12;
1175 		INT32 block=(BURN_ENDIAN_SWAP_INT16(source[offs+0])>>8)&0x3;
1176 		INT32 fy=BURN_ENDIAN_SWAP_INT16(source[offs+0])&0x400;
1177 		INT32 fx=BURN_ENDIAN_SWAP_INT16(source[offs+0])&0x800;
1178 		sprite&=0x3fff;
1179 
1180 		switch ((BURN_ENDIAN_SWAP_INT16(source[offs+0])>>8)&0x3)
1181 		{
1182 			case 0: {
1183 				scale=BURN_ENDIAN_SWAP_INT16(source[offs+0])&0x7;
1184 				const UINT8 *scale_table_ptr = scale_table+0x387f+(0x80*scale);
1185 				INT32 scale_line_count = 0x10-scale;
1186 				draw_block(chip, scale_table_ptr,scale_line_count,x,y,16,fx,fy,sprite,colour,bank,block);
1187 			}
1188 			break;
1189 			case 1: { // 2 x 2
1190 				scale=BURN_ENDIAN_SWAP_INT16(source[offs+0])&0xf;
1191 				const UINT8 *scale_table_ptr = scale_table+0x707f+(0x80*scale);
1192 				INT32 scale_line_count = 0x20-scale;
1193 				draw_block(chip, scale_table_ptr,scale_line_count,x,y,32,fx,fy,sprite,colour,bank,block);
1194 			}
1195 			break;
1196 			case 2: { // 64 by 64 block (2 x 2) x 2
1197 				scale=BURN_ENDIAN_SWAP_INT16(source[offs+0])&0x1f;
1198 				const UINT8 *scale_table_ptr = scale_table+0xa07f+(0x80*scale);
1199 				INT32 scale_line_count = 0x40-scale;
1200 				draw_block(chip, scale_table_ptr,scale_line_count,x,y,64,fx,fy,sprite,colour,bank,block);
1201 			}
1202 			break;
1203 			case 3: { // 2 x 2 x 2 x 2
1204 				scale=BURN_ENDIAN_SWAP_INT16(source[offs+0])&0x3f;
1205 				const UINT8 *scale_table_ptr = scale_table+0xc07f+(0x80*scale);
1206 				INT32 scale_line_count = 0x80-scale;
1207 				draw_block(chip, scale_table_ptr,scale_line_count,x,y,128,fx,fy,sprite,colour,bank,block);
1208 			}
1209 			break;
1210 		}
1211 	}
1212 }
1213 
mix_sprites(INT32 chip,INT32 pass)1214 static void mix_sprites(INT32 chip, INT32 pass)
1215 {
1216 	for (INT32 y = 0; y < nScreenHeight; y++) {
1217 		UINT16 *src = SpriteBitmap[chip] + y * nScreenWidth;
1218 		UINT16 *dest = pTransDraw + y * nScreenWidth;
1219 
1220 		for (INT32 x = 0; x < nScreenWidth; x++) {
1221 			if (src[x] != 0xffff) {
1222 				switch (pass) {
1223 					case 0: {
1224 						if ((src[x] & 0xc0) != 0xc0)
1225 							dest[x] = src[x];
1226 						break;
1227 					}
1228 					case 1: {
1229 						if ((src[x] & 0xc0) == 0xc0)
1230 							dest[x] = src[x];
1231 						break;
1232 					}
1233 					case -1: {
1234 						dest[x] = src[x];
1235 						break;
1236 					}
1237 				}
1238 			}
1239 		}
1240 	}
1241 }
1242 
BbustersDraw()1243 static INT32 BbustersDraw()
1244 {
1245 	if (DrvRecalc) {
1246 		DrvPaletteUpdate();
1247 		DrvRecalc = 1;
1248 	}
1249 
1250 	BurnTransferClear();
1251 
1252 	// sprites -> sprite bitmaps
1253 	memset(SpriteBitmap[0], 0xff, 256 * 256 * sizeof(UINT16));
1254 	memset(SpriteBitmap[1], 0xff, 256 * 256 * sizeof(UINT16));
1255 	draw_sprites(1, DrvSprBuf + 0x1000, 2);
1256 	draw_sprites(0, DrvSprBuf + 0x0000, 1);
1257 
1258 	if (nBurnLayer & 1) draw_layer(DrvPfRAM1, DrvGfxROM4, 0x500, 0, DrvPfScroll1, 0);
1259 	if (nSpriteEnable & 1) mix_sprites(1, 1);
1260 	if (nBurnLayer & 2) draw_layer(DrvPfRAM0, DrvGfxROM3, 0x300, 1, DrvPfScroll0, 0);
1261 	if (nSpriteEnable & 2) mix_sprites(1, 0);
1262 	if (nSpriteEnable & 4) mix_sprites(0, -1);
1263 	if (nBurnLayer & 4) draw_text_layer();
1264 
1265 	BurnTransferCopy(DrvPalette);
1266 
1267 	BurnGunDrawTargets();
1268 
1269 	return 0;
1270 }
1271 
MechattDraw()1272 static INT32 MechattDraw()
1273 {
1274 	if (DrvRecalc) {
1275 		DrvPaletteUpdate();
1276 		DrvRecalc = 1;
1277 	}
1278 
1279 	BurnTransferClear();
1280 
1281 	// sprites -> sprite bitmaps
1282 	memset(SpriteBitmap[0], 0xff, 256 * 256 * sizeof(UINT16));
1283 	draw_sprites(0, DrvSprBuf + 0x0000, 1);
1284 
1285 	if (nBurnLayer & 1) draw_layer(DrvPfRAM1, DrvGfxROM4, 0x300, 0, DrvPfScroll1, 1);
1286 	if (nSpriteEnable & 1) mix_sprites(0, 1);
1287 	if (nBurnLayer & 2) draw_layer(DrvPfRAM0, DrvGfxROM3, 0x200, 1, DrvPfScroll0, 1);
1288 	if (nSpriteEnable & 2) mix_sprites(0, 0);
1289 	if (nBurnLayer & 4) draw_text_layer();
1290 
1291 	BurnTransferCopy(DrvPalette);
1292 
1293 	BurnGunDrawTargets();
1294 
1295 	return 0;
1296 }
1297 
DrvFrame()1298 static INT32 DrvFrame()
1299 {
1300 	if (DrvReset) {
1301 		DrvDoReset();
1302 	}
1303 
1304 	SekNewFrame();
1305 	ZetNewFrame();
1306 
1307 	{
1308 		memset(DrvInputs, 0xff, 3 * sizeof(INT16));
1309 
1310 		for (INT32 i = 0; i < 16; i++) {
1311 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
1312 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
1313 			DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
1314 		}
1315 
1316 		BurnGunMakeInputs(0, LethalGun0, LethalGun1);
1317 		BurnGunMakeInputs(1, LethalGun2, LethalGun3);
1318 		BurnGunMakeInputs(2, LethalGun4, LethalGun5);
1319 
1320 	}
1321 
1322 	INT32 nInterleave = 30;
1323 	INT32 nCyclesTotal[2] = { 12000000 / 56, 4000000 / 56 };
1324 	INT32 nCyclesDone[2] = { 0, 0 };
1325 
1326 	SekOpen(0);
1327 	ZetOpen(0);
1328 
1329 	for (INT32 i = 0; i < nInterleave; i++) {
1330 		CPU_RUN(0, Sek);
1331 		CPU_RUN_TIMER(1);
1332 	}
1333 
1334 	SekSetIRQLine((game_select) ? 4 : 6, CPU_IRQSTATUS_AUTO);
1335 
1336 	if (pBurnSoundOut) {
1337 		if (game_select) {
1338 			BurnYM2608Update(pBurnSoundOut, nBurnSoundLen);
1339 		} else {
1340 			BurnYM2610Update(pBurnSoundOut, nBurnSoundLen);
1341 		}
1342 		BurnSoundDCFilter(); // dc offset in mechatt
1343 	}
1344 
1345 	ZetClose();
1346 	SekClose();
1347 
1348 	if (pBurnDraw) {
1349 		BurnDrvRedraw();
1350 	}
1351 
1352 	memcpy (DrvSprBuf + 0x00000, DrvSprRAM + 0x00000, 0x01000);
1353 	memcpy (DrvSprBuf + 0x01000, DrvSprRAM + 0x08000, 0x01000);
1354 
1355 	return 0;
1356 }
1357 
DrvScan(INT32 nAction,INT32 * pnMin)1358 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
1359 {
1360 	struct BurnArea ba;
1361 
1362 	if (pnMin) {
1363 		*pnMin = 0x029702;
1364 	}
1365 
1366 	if (nAction & ACB_VOLATILE) {
1367 		memset(&ba, 0, sizeof(ba));
1368 
1369 		ba.Data	  = AllRam;
1370 		ba.nLen	  = RamEnd - AllRam;
1371 		ba.szName = "All Ram";
1372 		BurnAcb(&ba);
1373 
1374 		SekScan(nAction);
1375 		ZetScan(nAction);
1376 
1377 		if (game_select) {
1378 			BurnYM2608Scan(nAction, pnMin);
1379 		} else {
1380 			BurnYM2610Scan(nAction, pnMin);
1381 		}
1382 
1383 		BurnGunScan();
1384 
1385 		SCAN_VAR(sound_status);
1386 		SCAN_VAR(soundlatch);
1387 		SCAN_VAR(gun_select);
1388 	}
1389 
1390 	if (nAction & ACB_NVRAM && game_select == 0) { // bbusters only!
1391 		ba.Data		= DrvEeprom;
1392 		ba.nLen		= 0x00100;
1393 		ba.nAddress	= 0;
1394 		ba.szName	= "NV RAM";
1395 		BurnAcb(&ba);
1396 	}
1397 
1398 	return 0;
1399 }
1400 
1401 
1402 // Beast Busters (World)
1403 
1404 static struct BurnRomInfo bbustersRomDesc[] = {
1405 	{ "bb-3.k10",			0x20000, 0x04da1820, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
1406 	{ "bb-5.k12",			0x20000, 0x777e0611, 1 | BRF_PRG | BRF_ESS }, //  1
1407 	{ "bb-2.k8",			0x20000, 0x20141805, 1 | BRF_PRG | BRF_ESS }, //  2
1408 	{ "bb-4.k11",			0x20000, 0xd482e0e9, 1 | BRF_PRG | BRF_ESS }, //  3
1409 
1410 	{ "bb-1.e6",			0x10000, 0x4360f2ee, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 code
1411 
1412 	{ "bb-10.l9",			0x20000, 0x490c0d9b, 3 | BRF_GRA },           //  5 Characters
1413 
1414 	{ "bb-f11.m16",			0x80000, 0x39fdf9c0, 4 | BRF_GRA },           //  6 Sprite Chip 0
1415 	{ "bb-f12.m13",			0x80000, 0x69ee046b, 4 | BRF_GRA },           //  7
1416 	{ "bb-f13.m12",			0x80000, 0xf5ef840e, 4 | BRF_GRA },           //  8
1417 	{ "bb-f14.m11",			0x80000, 0x1a7df3bb, 4 | BRF_GRA },           //  9
1418 
1419 	{ "bb-f21.l10",			0x80000, 0x530f595b, 5 | BRF_GRA },           // 10 Sprite Chip 1
1420 	{ "bb-f22.l12",			0x80000, 0x889c562e, 5 | BRF_GRA },           // 11
1421 	{ "bb-f23.l13",			0x80000, 0xc89fe0da, 5 | BRF_GRA },           // 12
1422 	{ "bb-f24.l15",			0x80000, 0xe0d81359, 5 | BRF_GRA },           // 13
1423 
1424 	{ "bb-back1.m4",		0x80000, 0xb5445313, 6 | BRF_GRA },           // 14 Background Tiles
1425 
1426 	{ "bb-back2.m6",		0x80000, 0x8be996f6, 7 | BRF_GRA },           // 15 Foreground Tiles
1427 
1428 	{ "bb-6.e7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 16 Zoom Tables
1429 	{ "bb-7.h7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 17
1430 	{ "bb-8.a14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 18
1431 	{ "bb-9.c14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 19
1432 
1433 	{ "bb-pcma.l5",			0x80000, 0x44cd5bfe, 9 | BRF_GRA },           // 20 YM2610 Samples
1434 
1435 	{ "bb-pcmb.l3",			0x80000, 0xc8d5dd53, 10 | BRF_GRA },          // 21 YM2610 Deltat Samples
1436 
1437 	{ "bbusters-eeprom.bin",0x00100, 0xa52ebd66, 11 | BRF_GRA },          // 22 EEPROM
1438 };
1439 
1440 STD_ROM_PICK(bbusters)
1441 STD_ROM_FN(bbusters)
1442 
1443 struct BurnDriver BurnDrvBbusters = {
1444 	"bbusters", NULL, NULL, NULL, "1989",
1445 	"Beast Busters (World)\0", NULL, "SNK", "Miscellaneous",
1446 	NULL, NULL, NULL, NULL,
1447 	BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1448 	NULL, bbustersRomInfo, bbustersRomName, NULL, NULL, NULL, NULL, BbustersInputInfo, BbustersDIPInfo,
1449 	DrvInit, DrvExit, DrvFrame, BbustersDraw, DrvScan, &DrvRecalc, 0x600,
1450 	256, 224, 4, 3
1451 };
1452 
1453 // Beast Busters (US, Version 3)
1454 
1455 static struct BurnRomInfo bbustersuRomDesc[] = {
1456 	{ "bb-ver3-u3.k10",		0x20000, 0xc80ec3bc, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
1457 	{ "bb-ver3-u5.k12",		0x20000, 0x5ded86d1, 1 | BRF_PRG | BRF_ESS }, //  1
1458 	{ "bb-2.k8",			0x20000, 0x20141805, 1 | BRF_PRG | BRF_ESS }, //  2
1459 	{ "bb-4.k11",			0x20000, 0xd482e0e9, 1 | BRF_PRG | BRF_ESS }, //  3
1460 
1461 	{ "bb-1.e6",			0x10000, 0x4360f2ee, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 code
1462 
1463 	{ "bb-10.l9",			0x20000, 0x490c0d9b, 3 | BRF_GRA },           //  5 Characters
1464 
1465 	{ "bb-f11.m16",			0x80000, 0x39fdf9c0, 4 | BRF_GRA },           //  6 Sprite Chip 0
1466 	{ "bb-f12.m13",			0x80000, 0x69ee046b, 4 | BRF_GRA },           //  7
1467 	{ "bb-f13.m12",			0x80000, 0xf5ef840e, 4 | BRF_GRA },           //  8
1468 	{ "bb-f14.m11",			0x80000, 0x1a7df3bb, 4 | BRF_GRA },           //  9
1469 
1470 	{ "bb-f21.l10",			0x80000, 0x530f595b, 5 | BRF_GRA },           // 10 Sprite Chip 1
1471 	{ "bb-f22.l12",			0x80000, 0x889c562e, 5 | BRF_GRA },           // 11
1472 	{ "bb-f23.l13",			0x80000, 0xc89fe0da, 5 | BRF_GRA },           // 12
1473 	{ "bb-f24.l15",			0x80000, 0xe0d81359, 5 | BRF_GRA },           // 13
1474 
1475 	{ "bb-back1.m4",		0x80000, 0xb5445313, 6 | BRF_GRA },           // 14 Background Tiles
1476 
1477 	{ "bb-back2.m6",		0x80000, 0x8be996f6, 7 | BRF_GRA },           // 15 Foreground Tiles
1478 
1479 	{ "bb-6.e7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 16 Zoom Tables
1480 	{ "bb-7.h7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 17
1481 	{ "bb-8.a14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 18
1482 	{ "bb-9.c14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 19
1483 
1484 	{ "bb-pcma.l5",			0x80000, 0x44cd5bfe, 9 | BRF_GRA },           // 20 YM2610 Samples
1485 
1486 	{ "bb-pcma.l5",			0x80000, 0x44cd5bfe, 10 | BRF_GRA },          // 21 YM2610 Deltat Samples
1487 
1488 	{ "bbusters-eeprom.bin",0x00100, 0xa52ebd66, 11 | BRF_GRA },          // 22 EEPROM
1489 };
1490 
1491 STD_ROM_PICK(bbustersu)
1492 STD_ROM_FN(bbustersu)
1493 
1494 struct BurnDriver BurnDrvBbustersu = {
1495 	"bbustersu", "bbusters", NULL, NULL, "1989",
1496 	"Beast Busters (US, Version 3)\0", NULL, "SNK", "Miscellaneous",
1497 	NULL, NULL, NULL, NULL,
1498 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1499 	NULL, bbustersuRomInfo, bbustersuRomName, NULL, NULL, NULL, NULL, BbustersInputInfo, BbustersDIPInfo,
1500 	DrvInit, DrvExit, DrvFrame, BbustersDraw, DrvScan, &DrvRecalc, 0x600,
1501 	256, 224, 4, 3
1502 };
1503 
1504 // Beast Busters (US, Version 2)
1505 
1506 static struct BurnRomInfo bbustersuaRomDesc[] = {
1507 	{ "bb-ver2-u3.k10",		0x20000, 0x6930088b, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
1508 	{ "bb-ver2-u5.k12",		0x20000, 0xcfdb2c6c, 1 | BRF_PRG | BRF_ESS }, //  1
1509 	{ "bb-2.k8",			0x20000, 0x20141805, 1 | BRF_PRG | BRF_ESS }, //  2
1510 	{ "bb-4.k11",			0x20000, 0xd482e0e9, 1 | BRF_PRG | BRF_ESS }, //  3
1511 
1512 	{ "bb-1.e6",			0x10000, 0x4360f2ee, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 code
1513 
1514 	{ "bb-10.l9",			0x20000, 0x490c0d9b, 3 | BRF_GRA },           //  5 Characters
1515 
1516 	{ "bb-f11.m16",			0x80000, 0x39fdf9c0, 4 | BRF_GRA },           //  6 Sprite Chip 0
1517 	{ "bb-f12.m13",			0x80000, 0x69ee046b, 4 | BRF_GRA },           //  7
1518 	{ "bb-f13.m12",			0x80000, 0xf5ef840e, 4 | BRF_GRA },           //  8
1519 	{ "bb-f14.m11",			0x80000, 0x1a7df3bb, 4 | BRF_GRA },           //  9
1520 
1521 	{ "bb-f21.l10",			0x80000, 0x530f595b, 5 | BRF_GRA },           // 10 Sprite Chip 1
1522 	{ "bb-f22.l12",			0x80000, 0x889c562e, 5 | BRF_GRA },           // 11
1523 	{ "bb-f23.l13",			0x80000, 0xc89fe0da, 5 | BRF_GRA },           // 12
1524 	{ "bb-f24.l15",			0x80000, 0xe0d81359, 5 | BRF_GRA },           // 13
1525 
1526 	{ "bb-back1.m4",		0x80000, 0xb5445313, 6 | BRF_GRA },           // 14 Background Tiles
1527 
1528 	{ "bb-back2.m6",		0x80000, 0x8be996f6, 7 | BRF_GRA },           // 15 Foreground Tiles
1529 
1530 	{ "bb-6.e7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 16 Zoom Tables
1531 	{ "bb-7.h7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 17
1532 	{ "bb-8.a14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 18
1533 	{ "bb-9.c14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 19
1534 
1535 	{ "bb-pcma.l5",			0x80000, 0x44cd5bfe, 9 | BRF_GRA },           // 20 YM2610 Samples
1536 
1537 	{ "bb-pcma.l5",			0x80000, 0x44cd5bfe, 10 | BRF_GRA },          // 21 YM2610 Deltat Samples
1538 
1539 	{ "bbusters-eeprom.bin",0x00100, 0xa52ebd66, 11 | BRF_GRA },          // 22 EEPROM
1540 };
1541 
1542 STD_ROM_PICK(bbustersua)
1543 STD_ROM_FN(bbustersua)
1544 
1545 struct BurnDriver BurnDrvBbustersua = {
1546 	"bbustersua", "bbusters", NULL, NULL, "1989",
1547 	"Beast Busters (US, Version 2)\0", NULL, "SNK", "Miscellaneous",
1548 	NULL, NULL, NULL, NULL,
1549 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1550 	NULL, bbustersuaRomInfo, bbustersuaRomName, NULL, NULL, NULL, NULL, BbustersInputInfo, BbustersDIPInfo,
1551 	DrvInit, DrvExit, DrvFrame, BbustersDraw, DrvScan, &DrvRecalc, 0x600,
1552 	256, 224, 4, 3
1553 };
1554 
1555 // Beast Busters (Japan, Version 2, 3 Players)
1556 
1557 static struct BurnRomInfo bbustersjRomDesc[] = {
1558 	{ "bb3_ver2_j3.k10",	0x20000, 0x6a1cd941, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
1559 	{ "bb5_ver2_j3.k12",	0x20000, 0x7b180752, 1 | BRF_PRG | BRF_ESS }, //  1
1560 	{ "bb-2.k8",			0x20000, 0x20141805, 1 | BRF_PRG | BRF_ESS }, //  2
1561 	{ "bb-4.k11",			0x20000, 0xd482e0e9, 1 | BRF_PRG | BRF_ESS }, //  3
1562 
1563 	{ "bb-1.e6",			0x10000, 0x4360f2ee, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 code
1564 
1565 	{ "bb-10.l9",			0x20000, 0x490c0d9b, 3 | BRF_GRA },           //  5 Characters
1566 
1567 	{ "bb-f11.m16",			0x80000, 0x39fdf9c0, 4 | BRF_GRA },           //  6 Sprite Chip 0
1568 	{ "bb-f12.m13",			0x80000, 0x69ee046b, 4 | BRF_GRA },           //  7
1569 	{ "bb-f13.m12",			0x80000, 0xf5ef840e, 4 | BRF_GRA },           //  8
1570 	{ "bb-f14.m11",			0x80000, 0x1a7df3bb, 4 | BRF_GRA },           //  9
1571 
1572 	{ "bb-f21.l10",			0x80000, 0x530f595b, 5 | BRF_GRA },           // 10 Sprite Chip 1
1573 	{ "bb-f22.l12",			0x80000, 0x889c562e, 5 | BRF_GRA },           // 11
1574 	{ "bb-f23.l13",			0x80000, 0xc89fe0da, 5 | BRF_GRA },           // 12
1575 	{ "bb-f24.l15",			0x80000, 0xe0d81359, 5 | BRF_GRA },           // 13
1576 
1577 	{ "bb-back1.m4",		0x80000, 0xb5445313, 6 | BRF_GRA },           // 14 Background Tiles
1578 
1579 	{ "bb-back2.m6",		0x80000, 0x8be996f6, 7 | BRF_GRA },           // 15 Foreground Tiles
1580 
1581 	{ "bb-6.e7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 16 Zoom Tables
1582 	{ "bb-7.h7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 17
1583 	{ "bb-8.a14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 18
1584 	{ "bb-9.c14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 19
1585 
1586 	{ "bb-pcma.l5",			0x80000, 0x44cd5bfe, 9 | BRF_GRA },           // 20 YM2610 Samples
1587 
1588 	{ "bb-pcmb.l3",			0x80000, 0xc8d5dd53, 10 | BRF_GRA },          // 21 YM2610 Deltat Samples
1589 
1590 	{ "bbusters-eeprom.bin",0x00100, 0xa52ebd66, 11 | BRF_GRA },          // 22 EEPROM
1591 };
1592 
1593 STD_ROM_PICK(bbustersj)
1594 STD_ROM_FN(bbustersj)
1595 
1596 struct BurnDriver BurnDrvBbustersj = {
1597 	"bbustersj", "bbusters", NULL, NULL, "1989",
1598 	"Beast Busters (Japan, Version 2, 3 Players)\0", NULL, "SNK", "Miscellaneous",
1599 	NULL, NULL, NULL, NULL,
1600 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1601 	NULL, bbustersjRomInfo, bbustersjRomName, NULL, NULL, NULL, NULL, Bbusters2pInputInfo, Bbusters2pDIPInfo,
1602 	DrvInit, DrvExit, DrvFrame, BbustersDraw, DrvScan, &DrvRecalc, 0x600,
1603 	256, 224, 4, 3
1604 };
1605 
1606 // Beast Busters (Japan, Version 2, 2 Players)
1607 
1608 static struct BurnRomInfo bbustersjaRomDesc[] = {
1609 	{ "bb3_ver2_j2.k10",	0x20000, 0x605eb62f, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
1610 	{ "bb5_ver2_j2.k12",	0x20000, 0x9deea26f, 1 | BRF_PRG | BRF_ESS }, //  1
1611 	{ "bb-2.k8",			0x20000, 0x20141805, 1 | BRF_PRG | BRF_ESS }, //  2
1612 	{ "bb-4.k11",			0x20000, 0xd482e0e9, 1 | BRF_PRG | BRF_ESS }, //  3
1613 
1614 	{ "bb-1.e6",			0x10000, 0x4360f2ee, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 code
1615 
1616 	{ "bb-10.l9",			0x20000, 0x490c0d9b, 3 | BRF_GRA },           //  5 Characters
1617 
1618 	{ "bb-f11.m16",			0x80000, 0x39fdf9c0, 4 | BRF_GRA },           //  6 Sprite Chip 0
1619 	{ "bb-f12.m13",			0x80000, 0x69ee046b, 4 | BRF_GRA },           //  7
1620 	{ "bb-f13.m12",			0x80000, 0xf5ef840e, 4 | BRF_GRA },           //  8
1621 	{ "bb-f14.m11",			0x80000, 0x1a7df3bb, 4 | BRF_GRA },           //  9
1622 
1623 	{ "bb-f21.l10",			0x80000, 0x530f595b, 5 | BRF_GRA },           // 10 Sprite Chip 1
1624 	{ "bb-f22.l12",			0x80000, 0x889c562e, 5 | BRF_GRA },           // 11
1625 	{ "bb-f23.l13",			0x80000, 0xc89fe0da, 5 | BRF_GRA },           // 12
1626 	{ "bb-f24.l15",			0x80000, 0xe0d81359, 5 | BRF_GRA },           // 13
1627 
1628 	{ "bb-back1.m4",		0x80000, 0xb5445313, 6 | BRF_GRA },           // 14 Background Tiles
1629 
1630 	{ "bb-back2.m6",		0x80000, 0x8be996f6, 7 | BRF_GRA },           // 15 Foreground Tiles
1631 
1632 	{ "bb-6.e7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 16 Zoom Tables
1633 	{ "bb-7.h7",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 17
1634 	{ "bb-8.a14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 18
1635 	{ "bb-9.c14",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 19
1636 
1637 	{ "bb-pcma.l5",			0x80000, 0x44cd5bfe, 9 | BRF_GRA },           // 20 YM2610 Samples
1638 
1639 	{ "bb-pcmb.l3",			0x80000, 0xc8d5dd53, 10 | BRF_GRA },          // 21 YM2610 Deltat Samples
1640 
1641 	{ "bbusters-eeprom.bin",0x00100, 0xa52ebd66, 11 | BRF_GRA },          // 22 EEPROM
1642 };
1643 
1644 STD_ROM_PICK(bbustersja)
1645 STD_ROM_FN(bbustersja)
1646 
1647 struct BurnDriver BurnDrvBbustersja = {
1648 	"bbustersja", "bbusters", NULL, NULL, "1989",
1649 	"Beast Busters (Japan, Version 2, 2 Players)\0", NULL, "SNK", "Miscellaneous",
1650 	NULL, NULL, NULL, NULL,
1651 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1652 	NULL, bbustersjaRomInfo, bbustersjaRomName, NULL, NULL, NULL, NULL, Bbusters2pInputInfo, Bbusters2pDIPInfo,
1653 	DrvInit, DrvExit, DrvFrame, BbustersDraw, DrvScan, &DrvRecalc, 0x600,
1654 	256, 224, 4, 3
1655 };
1656 
1657 // YM2608 ROM for Mechanized Attack
1658 static struct BurnRomInfo emptyRomDesc[] = {
1659 	{ "",                    0,          0, 0 },
1660 };
1661 
1662 static struct BurnRomInfo Ym2608RomDesc[] = {
1663 #if !defined (ROM_VERIFY)
1664 	{ "ym2608_adpcm_rom.bin",  0x002000, 0x23c9e0d8, BRF_ESS | BRF_PRG | BRF_BIOS },
1665 #else
1666 	{ "",  0x000000, 0x00000000, BRF_ESS | BRF_PRG | BRF_BIOS },
1667 #endif
1668 };
1669 
1670 // Mechanized Attack (World)
1671 
1672 static struct BurnRomInfo mechattRomDesc[] = {
1673 	{ "ma5-e.n12",			0x20000, 0x9bbb852a, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
1674 	{ "ma4.l12",			0x20000, 0x0d414918, 1 | BRF_PRG | BRF_ESS }, //  1
1675 	{ "ma7.n13",			0x20000, 0x61d85e1b, 1 | BRF_PRG | BRF_ESS }, //  2
1676 	{ "ma6-f.l13",			0x20000, 0x4055fe8d, 1 | BRF_PRG | BRF_ESS }, //  3
1677 
1678 	{ "ma_3.e13",			0x10000, 0xc06cc8e1, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 Code
1679 
1680 	{ "ma_1.l2",			0x10000, 0x24766917, 3 | BRF_GRA },           //  5 Characters
1681 
1682 	{ "mao89p13.bin",		0x80000, 0x8bcb16cf, 4 | BRF_GRA },           //  6 Sprites
1683 	{ "ma189p15.bin",		0x80000, 0xb84d9658, 4 | BRF_GRA },           //  7
1684 	{ "ma289p17.bin",		0x80000, 0x6cbe08ac, 4 | BRF_GRA },           //  8
1685 	{ "ma389m15.bin",		0x80000, 0x34d4585e, 4 | BRF_GRA },           //  9
1686 
1687 	{ "mab189a2.bin",		0x80000, 0xe1c8b4d0, 5 | BRF_GRA },           // 10 Background Tiles
1688 
1689 	{ "mab289c2.bin",		0x80000, 0x14f97ceb, 6 | BRF_GRA },           // 11 Foreground Tiles
1690 
1691 	{ "ma_2.d10",			0x20000, 0xea4cc30d, 7 | BRF_GRA },           // 12 YM2608 Samples
1692 
1693 	{ "ma_8.f10",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 13 Zoom Tables
1694 	{ "ma_9.f12",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 14
1695 };
1696 
1697 STDROMPICKEXT(mechatt, mechatt, Ym2608)
1698 STD_ROM_FN(mechatt)
1699 
1700 struct BurnDriver BurnDrvMechatt = {
1701 	"mechatt", NULL, "ym2608", NULL, "1989",
1702 	"Mechanized Attack (World)\0", NULL, "SNK", "Miscellaneous",
1703 	NULL, NULL, NULL, NULL,
1704 	BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1705 	NULL, mechattRomInfo, mechattRomName, NULL, NULL, NULL, NULL, MechattInputInfo, MechattDIPInfo,
1706 	MechattInit, DrvExit, DrvFrame, MechattDraw, DrvScan, &DrvRecalc, 0x400,
1707 	256, 224, 4, 3
1708 };
1709 
1710 // Mechanized Attack (Japan)
1711 
1712 static struct BurnRomInfo mechattjRomDesc[] = {
1713 	{ "ma5j.n12",			0x20000, 0xe6bb5952, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
1714 	{ "ma4j.l12",			0x20000, 0xc78baa62, 1 | BRF_PRG | BRF_ESS }, //  1
1715 	{ "ma7j.n13",			0x20000, 0x12a68fc2, 1 | BRF_PRG | BRF_ESS }, //  2
1716 	{ "ma6j.l13",			0x20000, 0x332b2f54, 1 | BRF_PRG | BRF_ESS }, //  3
1717 
1718 	{ "ma_3.e13",			0x10000, 0xc06cc8e1, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 Code
1719 
1720 	{ "ma_1.l2",			0x10000, 0x24766917, 3 | BRF_GRA },           //  5 Characters
1721 
1722 	{ "s_9.a1",				0x20000, 0x6e8e194c, 4 | BRF_GRA },           //  6 Sprites
1723 	{ "s_1.b1",				0x20000, 0xfd9161ed, 4 | BRF_GRA },           //  7
1724 	{ "s_10.a2",			0x20000, 0xfad6a1ab, 4 | BRF_GRA },           //  8
1725 	{ "s_2.b2",				0x20000, 0x549056f0, 4 | BRF_GRA },           //  9
1726 	{ "s_11.a3",			0x20000, 0x3887a382, 4 | BRF_GRA },           // 10
1727 	{ "s_3.b3",				0x20000, 0xcb99f565, 4 | BRF_GRA },           // 11
1728 	{ "s_12.a4",			0x20000, 0x63417b49, 4 | BRF_GRA },           // 12
1729 	{ "s_4.b4",				0x20000, 0xd739d48a, 4 | BRF_GRA },           // 13
1730 	{ "s_13.a5",			0x20000, 0xeccd47b6, 4 | BRF_GRA },           // 14
1731 	{ "s_5.b5",				0x20000, 0xe15244da, 4 | BRF_GRA },           // 15
1732 	{ "s_14.a6",			0x20000, 0xbbbf0461, 4 | BRF_GRA },           // 16
1733 	{ "s_6.b6",				0x20000, 0x4ee89f75, 4 | BRF_GRA },           // 17
1734 	{ "s_15.a7",			0x20000, 0xcde29bad, 4 | BRF_GRA },           // 18
1735 	{ "s_7.b7",				0x20000, 0x065ed221, 4 | BRF_GRA },           // 19
1736 	{ "s_16.a8",			0x20000, 0x70f28040, 4 | BRF_GRA },           // 20
1737 	{ "s_8.b8",				0x20000, 0xa6f8574f, 4 | BRF_GRA },           // 21
1738 
1739 	{ "s_21.b3",			0x20000, 0x701a0072, 5 | BRF_GRA },           // 22 Background Tiles
1740 	{ "s_22.b4",			0x20000, 0x34e6225c, 5 | BRF_GRA },           // 23
1741 	{ "s_23.b5",			0x20000, 0x9a7399d3, 5 | BRF_GRA },           // 24
1742 	{ "s_24.b6",			0x20000, 0xf097459d, 5 | BRF_GRA },           // 25
1743 
1744 	{ "s_17.a3",			0x20000, 0xcc47c4a3, 6 | BRF_GRA },           // 26 Foreground Tiles
1745 	{ "s_18.a4",			0x20000, 0xa04377e8, 6 | BRF_GRA },           // 27
1746 	{ "s_19.a5",			0x20000, 0xb07f5289, 6 | BRF_GRA },           // 28
1747 	{ "s_20.a6",			0x20000, 0xa9bb4fa9, 6 | BRF_GRA },           // 29
1748 
1749 	{ "ma_2.d10",			0x20000, 0xea4cc30d, 7 | BRF_GRA },           // 30 YM2608 Samples
1750 
1751 	{ "ma_8.f10",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 31 Zoom Tables
1752 	{ "ma_9.f12",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 32
1753 };
1754 
1755 STDROMPICKEXT(mechattj, mechattj, Ym2608)
1756 STD_ROM_FN(mechattj)
1757 
1758 struct BurnDriver BurnDrvMechattj = {
1759 	"mechattj", "mechatt", "ym2608", NULL, "1989",
1760 	"Mechanized Attack (Japan)\0", NULL, "SNK", "Miscellaneous",
1761 	NULL, NULL, NULL, NULL,
1762 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1763 	NULL, mechattjRomInfo, mechattjRomName, NULL, NULL, NULL, NULL, MechattInputInfo, MechattDIPInfo,
1764 	MechattjInit, DrvExit, DrvFrame, MechattDraw, DrvScan, &DrvRecalc, 0x400,
1765 	256, 224, 4, 3
1766 };
1767 
1768 // Mechanized Attack (US)
1769 
1770 static struct BurnRomInfo mechattuRomDesc[] = {
1771 	{ "ma5u.n12",			0x20000, 0x485ea606, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
1772 	{ "ma4u.l12",			0x20000, 0x09fa31ec, 1 | BRF_PRG | BRF_ESS }, //  1
1773 	{ "ma7u.n13",			0x20000, 0xf45b2c70, 1 | BRF_PRG | BRF_ESS }, //  2
1774 	{ "ma6u.l13",			0x20000, 0xd5d68ce6, 1 | BRF_PRG | BRF_ESS }, //  3
1775 
1776 	{ "ma_3.e13",			0x10000, 0xc06cc8e1, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 Code
1777 
1778 	{ "ma_1.l2",			0x10000, 0x24766917, 3 | BRF_GRA },           //  5 Characters
1779 
1780 	{ "mao89p13.bin",		0x80000, 0x8bcb16cf, 4 | BRF_GRA },           //  6 Sprites
1781 	{ "ma189p15.bin",		0x80000, 0xb84d9658, 4 | BRF_GRA },           //  7
1782 	{ "ma289p17.bin",		0x80000, 0x6cbe08ac, 4 | BRF_GRA },           //  8
1783 	{ "ma389m15.bin",		0x80000, 0x34d4585e, 4 | BRF_GRA },           //  9
1784 
1785 	{ "mab189a2.bin",		0x80000, 0xe1c8b4d0, 5 | BRF_GRA },           // 10 Background Tiles
1786 
1787 	{ "mab289c2.bin",		0x80000, 0x14f97ceb, 6 | BRF_GRA },           // 11 Foreground Tiles
1788 
1789 	{ "ma_2.d10",			0x20000, 0xea4cc30d, 7 | BRF_GRA },           // 12 YM2608 Samples
1790 
1791 	{ "ma_8.f10",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 13 Zoom Tables
1792 	{ "ma_9.f12",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 14
1793 };
1794 
1795 STDROMPICKEXT(mechattu, mechattu, Ym2608)
1796 STD_ROM_FN(mechattu)
1797 
1798 struct BurnDriver BurnDrvMechattu = {
1799 	"mechattu", "mechatt", "ym2608", NULL, "1989",
1800 	"Mechanized Attack (US)\0", NULL, "SNK", "Miscellaneous",
1801 	NULL, NULL, NULL, NULL,
1802 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1803 	NULL, mechattuRomInfo, mechattuRomName, NULL, NULL, NULL, NULL, MechattInputInfo, MechattuDIPInfo,
1804 	MechattInit, DrvExit, DrvFrame, MechattDraw, DrvScan, &DrvRecalc, 0x400,
1805 	256, 224, 4, 3
1806 };
1807 
1808 // Mechanized Attack (US, Version 1, Single Player)
1809 
1810 static struct BurnRomInfo mechattu1RomDesc[] = {
1811 	{ "ma_ver1_5u.n12",		0x20000, 0xdcd2e971, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
1812 	{ "ma_ver1_4u.l12",		0x20000, 0x69c8a85b, 1 | BRF_PRG | BRF_ESS }, //  1
1813 	{ "ma7u.n13",			0x20000, 0xf45b2c70, 1 | BRF_PRG | BRF_ESS }, //  2
1814 	{ "ma6u.l13",			0x20000, 0xd5d68ce6, 1 | BRF_PRG | BRF_ESS }, //  3
1815 
1816 	{ "ma_3.e13",			0x10000, 0xc06cc8e1, 2 | BRF_PRG | BRF_ESS }, //  4 Z80 Code
1817 
1818 	{ "ma_1.l2",			0x10000, 0x24766917, 3 | BRF_GRA },           //  5 Characters
1819 
1820 	{ "s_9.a1",				0x20000, 0x6e8e194c, 4 | BRF_GRA },           //  6 Sprites
1821 	{ "s_1.b1",				0x20000, 0xfd9161ed, 4 | BRF_GRA },           //  7
1822 	{ "s_10.a2",			0x20000, 0xfad6a1ab, 4 | BRF_GRA },           //  8
1823 	{ "s_2.b2",				0x20000, 0x549056f0, 4 | BRF_GRA },           //  9
1824 	{ "s_11.a3",			0x20000, 0x3887a382, 4 | BRF_GRA },           // 10
1825 	{ "s_3.b3",				0x20000, 0xcb99f565, 4 | BRF_GRA },           // 11
1826 	{ "s_12.a4",			0x20000, 0x63417b49, 4 | BRF_GRA },           // 12
1827 	{ "s_4.b4",				0x20000, 0xd739d48a, 4 | BRF_GRA },           // 13
1828 	{ "s_13.a5",			0x20000, 0xeccd47b6, 4 | BRF_GRA },           // 14
1829 	{ "s_5.b5",				0x20000, 0xe15244da, 4 | BRF_GRA },           // 15
1830 	{ "s_14.a6",			0x20000, 0xbbbf0461, 4 | BRF_GRA },           // 16
1831 	{ "s_6.b6",				0x20000, 0x4ee89f75, 4 | BRF_GRA },           // 17
1832 	{ "s_15.a7",			0x20000, 0xcde29bad, 4 | BRF_GRA },           // 18
1833 	{ "s_7.b7",				0x20000, 0x065ed221, 4 | BRF_GRA },           // 19
1834 	{ "s_16.a8",			0x20000, 0x70f28040, 4 | BRF_GRA },           // 20
1835 	{ "s_8.b8",				0x20000, 0xa6f8574f, 4 | BRF_GRA },           // 21
1836 
1837 	{ "s_21.b3",			0x20000, 0x701a0072, 5 | BRF_GRA },           // 22 Background Tiles
1838 	{ "s_22.b4",			0x20000, 0x34e6225c, 5 | BRF_GRA },           // 23
1839 	{ "s_23.b5",			0x20000, 0x9a7399d3, 5 | BRF_GRA },           // 24
1840 	{ "s_24.b6",			0x20000, 0xf097459d, 5 | BRF_GRA },           // 25
1841 
1842 	{ "s_17.a3",			0x20000, 0xcc47c4a3, 6 | BRF_GRA },           // 26 Foreground Tiles
1843 	{ "s_18.a4",			0x20000, 0xa04377e8, 6 | BRF_GRA },           // 27
1844 	{ "s_19.a5",			0x20000, 0xb07f5289, 6 | BRF_GRA },           // 28
1845 	{ "s_20.a6",			0x20000, 0xa9bb4fa9, 6 | BRF_GRA },           // 29
1846 
1847 	{ "ma_2.d10",			0x20000, 0xea4cc30d, 7 | BRF_GRA },           // 30 YM2608 Samples
1848 
1849 	{ "ma_8.f10",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 31 Zoom Tables
1850 	{ "ma_9.f12",			0x10000, 0x61f3de03, 8 | BRF_GRA },           // 32
1851 };
1852 
1853 STDROMPICKEXT(mechattu1, mechattu1, Ym2608)
1854 STD_ROM_FN(mechattu1)
1855 
1856 struct BurnDriver BurnDrvMechattu1 = {
1857 	"mechattu1", "mechatt", "ym2608", NULL, "1989",
1858 	"Mechanized Attack (US, Version 1, Single Player)\0", NULL, "SNK", "Miscellaneous",
1859 	NULL, NULL, NULL, NULL,
1860 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1861 	NULL, mechattu1RomInfo, mechattu1RomName, NULL, NULL, NULL, NULL, MechattInputInfo, MechattuDIPInfo,
1862 	MechattjInit, DrvExit, DrvFrame, MechattDraw, DrvScan, &DrvRecalc, 0x400,
1863 	256, 224, 4, 3
1864 };
1865