1 // FB Alpha Caveman Ninja driver module
2 // Based on MAME driver by Bryan McPhail
3 
4 #include "tiles_generic.h"
5 #include "m68000_intf.h"
6 #include "z80_intf.h"
7 #include "h6280_intf.h"
8 #include "deco16ic.h"
9 #include "deco146.h"
10 #include "burn_ym2203.h"
11 #include "burn_ym2151.h"
12 #include "msm6295.h"
13 #include "timer.h"
14 
15 static UINT8 *AllMem;
16 static UINT8 *MemEnd;
17 static UINT8 *AllRam;
18 static UINT8 *RamEnd;
19 static UINT8 *Drv68KROM;
20 static UINT8 *DrvZ80ROM;
21 static UINT8 *DrvHucROM;
22 static UINT8 *DrvGfxROM0;
23 static UINT8 *DrvGfxROM1;
24 static UINT8 *DrvGfxROM2;
25 static UINT8 *DrvGfxROM3;
26 static UINT8 *DrvGfxROM4;
27 static UINT8 *DrvSndROM0;
28 static UINT8 *DrvSndROM1;
29 static UINT8 *Drv68KRAM;
30 static UINT8 *DrvHucRAM;
31 static UINT8 *DrvPalRAM;
32 static UINT8 *DrvSprRAM;
33 static UINT8 *DrvSprRAM1;
34 static UINT8 *DrvSprBuf;
35 static UINT8 *DrvSprBuf1;
36 static UINT8 *DrvZ80RAM;
37 
38 static UINT32 *DrvPalette;
39 static UINT8 DrvRecalc;
40 
41 static UINT8 *soundlatch;
42 static UINT8 *flipscreen;
43 
44 static UINT8 DrvJoy1[16];
45 static UINT8 DrvJoy2[16];
46 static UINT8 DrvDips[3];
47 static UINT8 DrvReset;
48 static UINT16 DrvInputs[3];
49 
50 static INT32 scanline;
51 static INT32 irq_mask;
52 static INT32 irq_timer;
53 
54 static INT32 DrvOkiBank;
55 
56 static INT32 has_z80 = 0;
57 
58 static struct BurnInputInfo DrvInputList[] = {
59 	{"P1 Coin",		BIT_DIGITAL,	DrvJoy2 + 0,	"p1 coin"	},
60 	{"P1 Start",		BIT_DIGITAL,	DrvJoy1 + 7,	"p1 start"	},
61 	{"P1 Up",		BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
62 	{"P1 Down",		BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
63 	{"P1 Left",		BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
64 	{"P1 Right",		BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
65 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
66 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy1 + 5,	"p1 fire 2"	},
67 
68 	{"P2 Coin",		BIT_DIGITAL,	DrvJoy2 + 1,	"p2 coin"	},
69 	{"P2 Start",		BIT_DIGITAL,	DrvJoy1 + 15,	"p2 start"	},
70 	{"P2 Up",		BIT_DIGITAL,	DrvJoy1 + 8,	"p2 up"		},
71 	{"P2 Down",		BIT_DIGITAL,	DrvJoy1 + 9,	"p2 down"	},
72 	{"P2 Left",		BIT_DIGITAL,	DrvJoy1 + 10,	"p2 left"	},
73 	{"P2 Right",		BIT_DIGITAL,	DrvJoy1 + 11,	"p2 right"	},
74 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy1 + 12,	"p2 fire 1"	},
75 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy1 + 13,	"p2 fire 2"	},
76 
77 	{"Reset",		BIT_DIGITAL,	&DrvReset,	"reset"		},
78 	{"Service",		BIT_DIGITAL,	DrvJoy2 + 2,	"service"	},
79 	{"Dip A",		BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
80 	{"Dip B",		BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
81 };
82 
83 STDINPUTINFO(Drv)
84 
85 static struct BurnInputInfo Robocop2InputList[] = {
86 	{"P1 Coin",		BIT_DIGITAL,	DrvJoy2 + 0,	"p1 coin"	},
87 	{"P1 Start",		BIT_DIGITAL,	DrvJoy1 + 7,	"p1 start"	},
88 	{"P1 Up",		BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
89 	{"P1 Down",		BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
90 	{"P1 Left",		BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
91 	{"P1 Right",		BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
92 	{"P1 Button 1",		BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
93 	{"P1 Button 2",		BIT_DIGITAL,	DrvJoy1 + 5,	"p1 fire 2"	},
94 	{"P1 Button 3",		BIT_DIGITAL,	DrvJoy1 + 6,	"p1 fire 3"	},
95 
96 	{"P2 Coin",		BIT_DIGITAL,	DrvJoy2 + 1,	"p2 coin"	},
97 	{"P2 Start",		BIT_DIGITAL,	DrvJoy1 + 15,	"p2 start"	},
98 	{"P2 Up",		BIT_DIGITAL,	DrvJoy1 + 8,	"p2 up"		},
99 	{"P2 Down",		BIT_DIGITAL,	DrvJoy1 + 9,	"p2 down"	},
100 	{"P2 Left",		BIT_DIGITAL,	DrvJoy1 + 10,	"p2 left"	},
101 	{"P2 Right",		BIT_DIGITAL,	DrvJoy1 + 11,	"p2 right"	},
102 	{"P2 Button 1",		BIT_DIGITAL,	DrvJoy1 + 12,	"p2 fire 1"	},
103 	{"P2 Button 2",		BIT_DIGITAL,	DrvJoy1 + 13,	"p2 fire 2"	},
104 	{"P2 Button 3",		BIT_DIGITAL,	DrvJoy1 + 14,	"p2 fire 3"	},
105 
106 	{"Reset",		BIT_DIGITAL,	&DrvReset,	"reset"		},
107 	{"Service",		BIT_DIGITAL,	DrvJoy2 + 2,	"service"	},
108 	{"Dip A",		BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
109 	{"Dip B",		BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
110 	{"Dip C",		BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
111 };
112 
113 STDINPUTINFO(Robocop2)
114 
115 static struct BurnDIPInfo CninjaDIPList[]=
116 {
117 	{0x12, 0xff, 0xff, 0xff, NULL			},
118 	{0x13, 0xff, 0xff, 0x7f, NULL			},
119 
120 	{0   , 0xfe, 0   ,    8, "Coin A"		},
121 	{0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits"	},
122 	{0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits"	},
123 	{0x12, 0x01, 0x07, 0x07, "1 Coin  1 Credits"	},
124 	{0x12, 0x01, 0x07, 0x06, "1 Coin  2 Credits"	},
125 	{0x12, 0x01, 0x07, 0x05, "1 Coin  3 Credits"	},
126 	{0x12, 0x01, 0x07, 0x04, "1 Coin  4 Credits"	},
127 	{0x12, 0x01, 0x07, 0x03, "1 Coin  5 Credits"	},
128 	{0x12, 0x01, 0x07, 0x02, "1 Coin  6 Credits"	},
129 
130 	{0   , 0xfe, 0   ,    8, "Coin B"		},
131 	{0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits"	},
132 	{0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits"	},
133 	{0x12, 0x01, 0x38, 0x38, "1 Coin  1 Credits"	},
134 	{0x12, 0x01, 0x38, 0x30, "1 Coin  2 Credits"	},
135 	{0x12, 0x01, 0x38, 0x28, "1 Coin  3 Credits"	},
136 	{0x12, 0x01, 0x38, 0x20, "1 Coin  4 Credits"	},
137 	{0x12, 0x01, 0x38, 0x18, "1 Coin  5 Credits"	},
138 	{0x12, 0x01, 0x38, 0x10, "1 Coin  6 Credits"	},
139 
140 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
141 	{0x12, 0x01, 0x40, 0x40, "Off"			},
142 	{0x12, 0x01, 0x40, 0x00, "On"			},
143 
144 	{0   , 0xfe, 0   ,    4, "Lives"		},
145 	{0x13, 0x01, 0x03, 0x01, "1"			},
146 	{0x13, 0x01, 0x03, 0x00, "2"			},
147 	{0x13, 0x01, 0x03, 0x03, "3"			},
148 	{0x13, 0x01, 0x03, 0x02, "4"			},
149 
150 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
151 	{0x13, 0x01, 0x0c, 0x08, "Easy"			},
152 	{0x13, 0x01, 0x0c, 0x0c, "Normal"		},
153 	{0x13, 0x01, 0x0c, 0x04, "Hard"			},
154 	{0x13, 0x01, 0x0c, 0x00, "Hardest"		},
155 
156 	{0   , 0xfe, 0   ,    2, "Restore Life Meter"	},
157 	{0x13, 0x01, 0x10, 0x10, "Off"			},
158 	{0x13, 0x01, 0x10, 0x00, "On"			},
159 
160 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
161 	{0x13, 0x01, 0x80, 0x80, "Off"			},
162 	{0x13, 0x01, 0x80, 0x00, "On"			},
163 };
164 
165 STDDIPINFO(Cninja)
166 
167 static struct BurnDIPInfo CninjauDIPList[]=
168 {
169 	{0x12, 0xff, 0xff, 0xff, NULL			},
170 	{0x13, 0xff, 0xff, 0x7f, NULL			},
171 
172 	{0   , 0xfe, 0   ,    8, "Coin A"		},
173 	{0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits"	},
174 	{0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits"	},
175 	{0x12, 0x01, 0x07, 0x07, "1 Coin  1 Credits"	},
176 	{0x12, 0x01, 0x07, 0x06, "1 Coin  2 Credits"	},
177 	{0x12, 0x01, 0x07, 0x05, "1 Coin  3 Credits"	},
178 	{0x12, 0x01, 0x07, 0x04, "1 Coin  4 Credits"	},
179 	{0x12, 0x01, 0x07, 0x03, "1 Coin  5 Credits"	},
180 	{0x12, 0x01, 0x07, 0x02, "1 Coin  6 Credits"	},
181 
182 	{0   , 0xfe, 0   ,    8, "Coin B"		},
183 	{0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits"	},
184 	{0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits"	},
185 	{0x12, 0x01, 0x38, 0x38, "1 Coin  1 Credits"	},
186 	{0x12, 0x01, 0x38, 0x30, "1 Coin  2 Credits"	},
187 	{0x12, 0x01, 0x38, 0x28, "1 Coin  3 Credits"	},
188 	{0x12, 0x01, 0x38, 0x20, "1 Coin  4 Credits"	},
189 	{0x12, 0x01, 0x38, 0x18, "1 Coin  5 Credits"	},
190 	{0x12, 0x01, 0x38, 0x10, "1 Coin  6 Credits"	},
191 
192 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
193 	{0x12, 0x01, 0x40, 0x40, "Off"			},
194 	{0x12, 0x01, 0x40, 0x00, "On"			},
195 
196 	{0   , 0xfe, 0   ,    2, "Credit(s) to Start"	},
197 	{0x12, 0x01, 0x80, 0x80, "1"			},
198 	{0x12, 0x01, 0x80, 0x00, "2"			},
199 
200 	{0   , 0xfe, 0   ,    4, "Lives"		},
201 	{0x13, 0x01, 0x03, 0x01, "1"			},
202 	{0x13, 0x01, 0x03, 0x00, "2"			},
203 	{0x13, 0x01, 0x03, 0x03, "3"			},
204 	{0x13, 0x01, 0x03, 0x02, "4"			},
205 
206 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
207 	{0x13, 0x01, 0x0c, 0x08, "Easy"			},
208 	{0x13, 0x01, 0x0c, 0x0c, "Normal"		},
209 	{0x13, 0x01, 0x0c, 0x04, "Hard"			},
210 	{0x13, 0x01, 0x0c, 0x00, "Hardest"		},
211 
212 	{0   , 0xfe, 0   ,    2, "Restore Life Meter"	},
213 	{0x13, 0x01, 0x10, 0x10, "Off"			},
214 	{0x13, 0x01, 0x10, 0x00, "On"			},
215 
216 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
217 	{0x13, 0x01, 0x80, 0x80, "Off"			},
218 	{0x13, 0x01, 0x80, 0x00, "On"			},
219 };
220 
221 STDDIPINFO(Cninjau)
222 
223 static struct BurnDIPInfo MutantfDIPList[]=
224 {
225 	{0x12, 0xff, 0xff, 0xff, NULL			},
226 	{0x13, 0xff, 0xff, 0x7f, NULL			},
227 
228 	{0   , 0xfe, 0   ,    8, "Coin A"		},
229 	{0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits"	},
230 	{0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits"	},
231 	{0x12, 0x01, 0x07, 0x07, "1 Coin  1 Credits"	},
232 	{0x12, 0x01, 0x07, 0x06, "1 Coin  2 Credits"	},
233 	{0x12, 0x01, 0x07, 0x05, "1 Coin  3 Credits"	},
234 	{0x12, 0x01, 0x07, 0x04, "1 Coin  4 Credits"	},
235 	{0x12, 0x01, 0x07, 0x03, "1 Coin  5 Credits"	},
236 	{0x12, 0x01, 0x07, 0x02, "1 Coin  6 Credits"	},
237 
238 	{0   , 0xfe, 0   ,    8, "Coin B"		},
239 	{0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits"	},
240 	{0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits"	},
241 	{0x12, 0x01, 0x38, 0x38, "1 Coin  1 Credits"	},
242 	{0x12, 0x01, 0x38, 0x30, "1 Coin  2 Credits"	},
243 	{0x12, 0x01, 0x38, 0x28, "1 Coin  3 Credits"	},
244 	{0x12, 0x01, 0x38, 0x20, "1 Coin  4 Credits"	},
245 	{0x12, 0x01, 0x38, 0x18, "1 Coin  5 Credits"	},
246 	{0x12, 0x01, 0x38, 0x10, "1 Coin  6 Credits"	},
247 
248 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
249 	{0x12, 0x01, 0x40, 0x40, "Off"			},
250 	{0x12, 0x01, 0x40, 0x00, "On"			},
251 
252 	{0   , 0xfe, 0   ,    2, "Credit(s) to Start"	},
253 	{0x12, 0x01, 0x80, 0x80, "1"			},
254 	{0x12, 0x01, 0x80, 0x00, "2"			},
255 
256 	{0   , 0xfe, 0   ,    4, "Timer Decrement"	},
257 	{0x13, 0x01, 0x03, 0x01, "Slow"			},
258 	{0x13, 0x01, 0x03, 0x03, "Normal"		},
259 	{0x13, 0x01, 0x03, 0x02, "Fast"			},
260 	{0x13, 0x01, 0x03, 0x00, "Very Fast"		},
261 
262 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
263 	{0x13, 0x01, 0x0c, 0x08, "Easy"			},
264 	{0x13, 0x01, 0x0c, 0x0c, "Normal"		},
265 	{0x13, 0x01, 0x0c, 0x04, "Hard"			},
266 	{0x13, 0x01, 0x0c, 0x00, "Hardest"		},
267 
268 	{0   , 0xfe, 0   ,    4, "Life Per Stage"	},
269 	{0x13, 0x01, 0x30, 0x00, "Least"		},
270 	{0x13, 0x01, 0x30, 0x10, "Little"		},
271 	{0x13, 0x01, 0x30, 0x20, "Less"			},
272 	{0x13, 0x01, 0x30, 0x30, "Normal"		},
273 
274 	{0   , 0xfe, 0   ,    2, "Continues"		},
275 	{0x13, 0x01, 0x40, 0x00, "Off"			},
276 	{0x13, 0x01, 0x40, 0x40, "On"			},
277 
278 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
279 	{0x13, 0x01, 0x80, 0x80, "Off"			},
280 	{0x13, 0x01, 0x80, 0x00, "On"			},
281 };
282 
283 STDDIPINFO(Mutantf)
284 
285 static struct BurnDIPInfo EdrandyDIPList[]=
286 {
287 	{0x12, 0xff, 0xff, 0xbf, NULL			},
288 	{0x13, 0xff, 0xff, 0x7f, NULL			},
289 
290 	{0   , 0xfe, 0   ,    8, "Coin A"		},
291 	{0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits"	},
292 	{0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits"	},
293 	{0x12, 0x01, 0x07, 0x07, "1 Coin  1 Credits"	},
294 	{0x12, 0x01, 0x07, 0x06, "1 Coin  2 Credits"	},
295 	{0x12, 0x01, 0x07, 0x05, "1 Coin  3 Credits"	},
296 	{0x12, 0x01, 0x07, 0x04, "1 Coin  4 Credits"	},
297 	{0x12, 0x01, 0x07, 0x03, "1 Coin  5 Credits"	},
298 	{0x12, 0x01, 0x07, 0x02, "1 Coin  6 Credits"	},
299 
300 	{0   , 0xfe, 0   ,    8, "Coin B"		},
301 	{0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits"	},
302 	{0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits"	},
303 	{0x12, 0x01, 0x38, 0x38, "1 Coin  1 Credits"	},
304 	{0x12, 0x01, 0x38, 0x30, "1 Coin  2 Credits"	},
305 	{0x12, 0x01, 0x38, 0x28, "1 Coin  3 Credits"	},
306 	{0x12, 0x01, 0x38, 0x20, "1 Coin  4 Credits"	},
307 	{0x12, 0x01, 0x38, 0x18, "1 Coin  5 Credits"	},
308 	{0x12, 0x01, 0x38, 0x10, "1 Coin  6 Credits"	},
309 
310 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
311 	{0x12, 0x01, 0x40, 0x00, "Off"			},
312 	{0x12, 0x01, 0x40, 0x40, "On"			},
313 
314 	{0   , 0xfe, 0   ,    2, "Credit(s) to Start"	},
315 	{0x12, 0x01, 0x80, 0x80, "1"			},
316 	{0x12, 0x01, 0x80, 0x00, "2"			},
317 
318 	{0   , 0xfe, 0   ,    4, "Player's Power"	},
319 	{0x13, 0x01, 0x03, 0x01, "Very Low"		},
320 	{0x13, 0x01, 0x03, 0x00, "Low"			},
321 	{0x13, 0x01, 0x03, 0x03, "Medium"		},
322 	{0x13, 0x01, 0x03, 0x02, "High"			},
323 
324 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
325 	{0x13, 0x01, 0x0c, 0x08, "Easy"			},
326 	{0x13, 0x01, 0x0c, 0x0c, "Normal"		},
327 	{0x13, 0x01, 0x0c, 0x04, "Hard"			},
328 	{0x13, 0x01, 0x0c, 0x00, "Hardest"		},
329 
330 	{0   , 0xfe, 0   ,    2, "Continues"		},
331 	{0x13, 0x01, 0x40, 0x00, "Off"			},
332 	{0x13, 0x01, 0x40, 0x40, "On"			},
333 
334 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
335 	{0x13, 0x01, 0x80, 0x80, "Off"			},
336 	{0x13, 0x01, 0x80, 0x00, "On"			},
337 };
338 
339 STDDIPINFO(Edrandy)
340 
341 static struct BurnDIPInfo EdrandcDIPList[]=
342 {
343 	{0x12, 0xff, 0xff, 0xbf, NULL			},
344 	{0x13, 0xff, 0xff, 0x7f, NULL			},
345 
346 	{0   , 0xfe, 0   ,    8, "Coin A"		},
347 	{0x12, 0x01, 0x07, 0x00, "3 Coins 1 Credits"	},
348 	{0x12, 0x01, 0x07, 0x01, "2 Coins 1 Credits"	},
349 	{0x12, 0x01, 0x07, 0x07, "1 Coin  1 Credits"	},
350 	{0x12, 0x01, 0x07, 0x06, "1 Coin  2 Credits"	},
351 	{0x12, 0x01, 0x07, 0x05, "1 Coin  3 Credits"	},
352 	{0x12, 0x01, 0x07, 0x04, "1 Coin  4 Credits"	},
353 	{0x12, 0x01, 0x07, 0x03, "1 Coin  5 Credits"	},
354 	{0x12, 0x01, 0x07, 0x02, "1 Coin  6 Credits"	},
355 
356 	{0   , 0xfe, 0   ,    8, "Coin B"		},
357 	{0x12, 0x01, 0x38, 0x00, "3 Coins 1 Credits"	},
358 	{0x12, 0x01, 0x38, 0x08, "2 Coins 1 Credits"	},
359 	{0x12, 0x01, 0x38, 0x38, "1 Coin  1 Credits"	},
360 	{0x12, 0x01, 0x38, 0x30, "1 Coin  2 Credits"	},
361 	{0x12, 0x01, 0x38, 0x28, "1 Coin  3 Credits"	},
362 	{0x12, 0x01, 0x38, 0x20, "1 Coin  4 Credits"	},
363 	{0x12, 0x01, 0x38, 0x18, "1 Coin  5 Credits"	},
364 	{0x12, 0x01, 0x38, 0x10, "1 Coin  6 Credits"	},
365 
366 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
367 	{0x12, 0x01, 0x40, 0x00, "Off"			},
368 	{0x12, 0x01, 0x40, 0x40, "On"			},
369 
370 	{0   , 0xfe, 0   ,    2, "Unknown"		},
371 	{0x12, 0x01, 0x80, 0x80, "Off"			},
372 	{0x12, 0x01, 0x80, 0x00, "On"			},
373 
374 	{0   , 0xfe, 0   ,    4, "Player's Power"	},
375 	{0x13, 0x01, 0x03, 0x01, "Very Low"		},
376 	{0x13, 0x01, 0x03, 0x00, "Low"			},
377 	{0x13, 0x01, 0x03, 0x03, "Medium"		},
378 	{0x13, 0x01, 0x03, 0x02, "High"			},
379 
380 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
381 	{0x13, 0x01, 0x0c, 0x08, "Easy"			},
382 	{0x13, 0x01, 0x0c, 0x0c, "Normal"		},
383 	{0x13, 0x01, 0x0c, 0x04, "Hard"			},
384 	{0x13, 0x01, 0x0c, 0x00, "Hardest"		},
385 
386 	{0   , 0xfe, 0   ,    2, "Continues"		},
387 	{0x13, 0x01, 0x40, 0x00, "Off"			},
388 	{0x13, 0x01, 0x40, 0x40, "On"			},
389 
390 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
391 	{0x13, 0x01, 0x80, 0x80, "Off"			},
392 	{0x13, 0x01, 0x80, 0x00, "On"			},
393 };
394 
395 STDDIPINFO(Edrandc)
396 
397 static struct BurnDIPInfo Robocop2DIPList[]=
398 {
399 	{0x14, 0xff, 0xff, 0xbf, NULL		},
400 	{0x15, 0xff, 0xff, 0x7f, NULL			},
401 	{0x16, 0xff, 0xff, 0xff, NULL			},
402 
403 	{0   , 0xfe, 0   ,    8, "Coin A"		},
404 	{0x14, 0x01, 0x07, 0x00, "3 Coins 1 Credits"	},
405 	{0x14, 0x01, 0x07, 0x01, "2 Coins 1 Credits"	},
406 	{0x14, 0x01, 0x07, 0x07, "1 Coin  1 Credits"	},
407 	{0x14, 0x01, 0x07, 0x06, "1 Coin  2 Credits"	},
408 	{0x14, 0x01, 0x07, 0x05, "1 Coin  3 Credits"	},
409 	{0x14, 0x01, 0x07, 0x04, "1 Coin  4 Credits"	},
410 	{0x14, 0x01, 0x07, 0x03, "1 Coin  5 Credits"	},
411 	{0x14, 0x01, 0x07, 0x02, "1 Coin  6 Credits"	},
412 
413 	{0   , 0xfe, 0   ,    8, "Coin B"		},
414 	{0x14, 0x01, 0x38, 0x00, "3 Coins 1 Credits"	},
415 	{0x14, 0x01, 0x38, 0x08, "2 Coins 1 Credits"	},
416 	{0x14, 0x01, 0x38, 0x38, "1 Coin  1 Credits"	},
417 	{0x14, 0x01, 0x38, 0x30, "1 Coin  2 Credits"	},
418 	{0x14, 0x01, 0x38, 0x28, "1 Coin  3 Credits"	},
419 	{0x14, 0x01, 0x38, 0x20, "1 Coin  4 Credits"	},
420 	{0x14, 0x01, 0x38, 0x18, "1 Coin  5 Credits"	},
421 	{0x14, 0x01, 0x38, 0x10, "1 Coin  6 Credits"	},
422 
423 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
424 	{0x14, 0x01, 0x40, 0x00, "Off"			},
425 	{0x14, 0x01, 0x40, 0x40, "On"			},
426 
427 	{0   , 0xfe, 0   ,    4, "Lives"		},
428 	{0x15, 0x01, 0x03, 0x01, "1"			},
429 	{0x15, 0x01, 0x03, 0x00, "2"			},
430 	{0x15, 0x01, 0x03, 0x03, "3"			},
431 	{0x15, 0x01, 0x03, 0x02, "4"			},
432 
433 	{0   , 0xfe, 0   ,    4, "Time"			},
434 	{0x15, 0x01, 0x0c, 0x08, "400 Seconds"		},
435 	{0x15, 0x01, 0x0c, 0x0c, "300 Seconds"		},
436 	{0x15, 0x01, 0x0c, 0x04, "200 Seconds"		},
437 	{0x15, 0x01, 0x0c, 0x00, "100 Seconds"		},
438 
439 	{0   , 0xfe, 0   ,    4, "Health"		},
440 	{0x15, 0x01, 0x30, 0x00, "17"			},
441 	{0x15, 0x01, 0x30, 0x10, "24"			},
442 	{0x15, 0x01, 0x30, 0x30, "33"			},
443 	{0x15, 0x01, 0x30, 0x20, "40"			},
444 
445 	{0   , 0xfe, 0   ,    2, "Continues"		},
446 	{0x15, 0x01, 0x40, 0x00, "Off"			},
447 	{0x15, 0x01, 0x40, 0x40, "On"			},
448 
449 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
450 	{0x15, 0x01, 0x80, 0x80, "Off"			},
451 	{0x15, 0x01, 0x80, 0x00, "On"			},
452 
453 	{0   , 0xfe, 0   ,    4, "Bullets"		},
454 	{0x16, 0x01, 0x03, 0x00, "Least"		},
455 	{0x16, 0x01, 0x03, 0x01, "Less"			},
456 	{0x16, 0x01, 0x03, 0x03, "Normal"		},
457 	{0x16, 0x01, 0x03, 0x02, "More"			},
458 
459 	{0   , 0xfe, 0   ,    4, "Enemy Movement"	},
460 	{0x16, 0x01, 0x0c, 0x08, "Slow"			},
461 	{0x16, 0x01, 0x0c, 0x0c, "Normal"		},
462 	{0x16, 0x01, 0x0c, 0x04, "Fast"			},
463 	{0x16, 0x01, 0x0c, 0x00, "Fastest"		},
464 
465 	{0   , 0xfe, 0   ,    4, "Enemy Strength"	},
466 	{0x16, 0x01, 0x30, 0x20, "Less"			},
467 	{0x16, 0x01, 0x30, 0x30, "Normal"		},
468 	{0x16, 0x01, 0x30, 0x10, "More"			},
469 	{0x16, 0x01, 0x30, 0x00, "Most"			},
470 
471 	{0   , 0xfe, 0   ,    2, "Enemy Weapon Speed"	},
472 	{0x16, 0x01, 0x40, 0x40, "Normal"		},
473 	{0x16, 0x01, 0x40, 0x00, "Fast"			},
474 
475 	{0   , 0xfe, 0   ,    2, "Game Over Message"	},
476 	{0x16, 0x01, 0x80, 0x80, "Off"			},
477 	{0x16, 0x01, 0x80, 0x00, "On"			},
478 };
479 
STDDIPINFO(Robocop2)480 STDDIPINFO(Robocop2)
481 
482 static void __fastcall cninja_main_write_word(UINT32 address, UINT16 data)
483 {
484 	deco16_write_control_word(0, address, 0x140000, data)
485 	deco16_write_control_word(1, address, 0x150000, data)
486 
487 	switch (address)
488 	{
489 		case 0x190000:
490 		case 0x1a4000:
491 			irq_mask = data & 0xff;
492 		return;
493 
494 		case 0x190002:
495 		case 0x1a4002:
496 		{
497 			scanline = data & 0xff;
498 
499 			if ((~irq_mask & 0x02) && (scanline > 0) && (scanline < 240)) {
500 				irq_timer = scanline;
501 			} else {
502 				irq_timer = -1;
503 			}
504 		}
505 		return;
506 
507 		case 0x1ac000:
508 		case 0x1b4000:
509 			memcpy (DrvSprBuf, DrvSprRAM, 0x800);
510 		return;
511 
512 		case 0x17ff2a:
513 		case 0x198064:
514 		case 0x1bc0a8:
515 			if (has_z80) {
516 				*soundlatch = data & 0xff;
517 				ZetNmi();
518 			} else {
519 				deco16_soundlatch = data & 0xff;
520 				h6280SetIRQLine(0, CPU_IRQSTATUS_ACK);
521 			}
522 		break;
523 	}
524 
525 	if (address >= 0x198000 && address <= 0x19bfff) { // edrandy
526 		deco146_104_prot_ww(0x198000, address, data);
527 		return;
528 	}
529 
530 	if (address >= 0x1a0000 && address <= 0x1a3fff) { // edrandy
531 		deco146_104_prot_ww(0x1a0000, address, data);
532 		return;
533 	}
534 
535 	if (address >= 0x1bc000 && address <= 0x1bffff) { // cninja
536 		deco146_104_prot_ww(0, address, data);
537 		return;
538 	}
539 }
540 
cninja_main_write_byte(UINT32 address,UINT8 data)541 static void __fastcall cninja_main_write_byte(UINT32 address, UINT8 data)
542 {
543 	// need for cliffhanger
544 	deco16_write_control_byte(0, address, 0x140000, data)
545 	deco16_write_control_byte(1, address, 0x150000, data)
546 
547 	switch (address)
548 	{
549 	//	case 0x190000:
550 		case 0x190001:
551 	//	case 0x1a4000:
552 		case 0x1a4001:
553 			irq_mask = data & 0xff;
554 		return;
555 
556 		case 0x190002:
557 		case 0x190003:
558 		case 0x1a4002:
559 		case 0x1a4003:
560 		{
561 			scanline = data & 0xff;
562 
563 			if ((~irq_mask & 0x02) && (scanline > 0) && (scanline < 240)) {
564 				irq_timer = scanline;
565 			} else {
566 				irq_timer = -1;
567 			}
568 		}
569 		return;
570 
571 	//	case 0x1ac000:
572 		case 0x1ac001:
573 	//	case 0x1b4000:
574 		case 0x1b4001:
575 			memcpy (DrvSprBuf, DrvSprRAM, 0x800);
576 		return;
577 
578 		case 0x198065:
579 		case 0x1bc0a9:
580 			if (has_z80) {
581 				*soundlatch = data;
582 				ZetNmi();
583 			} else {
584 				deco16_soundlatch = data;
585 				h6280SetIRQLine(0, CPU_IRQSTATUS_ACK);
586 			}
587 		break;
588 	}
589 
590 	if (address >= 0x198000 && address <= 0x19bfff) { // edrandy
591 		deco146_104_prot_wb(0x198000, address, data);
592 		return;
593 	}
594 
595 	if (address >= 0x1a0000 && address <= 0x1a3fff) { // edrandy
596 		deco146_104_prot_wb(0x1a0000, address, data);
597 		return;
598 	}
599 
600 	if (address >= 0x1bc000 && address <= 0x1bffff) { // cninja
601 		deco146_104_prot_wb(0, address, data);
602 		return;
603 	}
604 
605 	//bprintf(PRINT_NORMAL, _T("Write Byte %x, %x\n"), address, data);
606 }
607 
cninja_main_read_word(UINT32 address)608 static UINT16 __fastcall cninja_main_read_word(UINT32 address)
609 {
610 	switch (address)
611 	{
612 		case 0x17ff22:
613 			return (DrvDips[1] << 8) | (DrvDips[0] << 0);
614 
615 		case 0x17ff28:
616 			return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08);
617 
618 		case 0x17ff2c:
619 			return DrvInputs[0];
620 
621 		case 0x1a4002:
622 		case 0x190002:
623 			return scanline;
624 
625 		case 0x1a4004:
626 		case 0x190004:
627 			SekSetIRQLine(3, CPU_IRQSTATUS_NONE);
628 			SekSetIRQLine(4, CPU_IRQSTATUS_NONE);
629 			return 0;
630 	}
631 
632 	if (address >= 0x198000 && address <= 0x19bfff) { // edrandy
633 		return deco146_104_prot_rw(0x198000, address);
634 	}
635 
636 	if (address >= 0x1a0000 && address <= 0x1a3fff) { // edrandy
637 		return deco146_104_prot_rw(0x1a0000, address);
638 	}
639 
640 	if (address >= 0x1bc000 && address <= 0x1bffff) { // cninja
641 		return deco146_104_prot_rw(0, address);
642 	}
643 
644 	//bprintf(PRINT_NORMAL, _T("Read Word %x, %x\n"), address);
645 
646 	return 0;
647 }
648 
cninja_main_read_byte(UINT32 address)649 static UINT8 __fastcall cninja_main_read_byte(UINT32 address)
650 {
651 	switch (address)
652 	{
653 		case 0x17ff22:
654 			return DrvDips[1];
655 
656 		case 0x17ff23:
657 			return DrvDips[0];
658 
659 	//	case 0x17ff28:
660 		case 0x17ff29:
661 			return (DrvInputs[1] & 0x07) | (deco16_vblank & 0x08);
662 
663 		case 0x17ff2c:
664 			return DrvInputs[0] >> 8;
665 
666 		case 0x17ff2d:
667 			return DrvInputs[0];
668 
669 	//	case 0x1a4002:
670 		case 0x1a4003:
671 	//	case 0x190002:
672 		case 0x190003:
673 			return scanline;
674 
675 	//	case 0x1a4004:
676 		case 0x1a4005:
677 	//	case 0x190004:
678 		case 0x190005:
679 			SekSetIRQLine(3, CPU_IRQSTATUS_NONE);
680 			SekSetIRQLine(4, CPU_IRQSTATUS_NONE);
681 			return 0;
682 	}
683 
684 	if (address >= 0x198000 && address <= 0x19bfff) { // edrandy
685 		return deco146_104_prot_rb(0x198000, address);
686 	}
687 
688 	if (address >= 0x1a0000 && address <= 0x1a3fff) { // edrandy
689 		return deco146_104_prot_rb(0x1a0000, address);
690 	}
691 
692 	if (address >= 0x1bc000 && address <= 0x1bffff) { // cninja
693 		return deco146_104_prot_rb(0, address);
694 	}
695 
696 	//bprintf(PRINT_NORMAL, _T("Read Byte %x, %x\n"), address);
697 
698 	return 0;
699 }
700 
mutantf_main_write_word(UINT32 address,UINT16 data)701 static void __fastcall mutantf_main_write_word(UINT32 address, UINT16 data)
702 {
703 	deco16_write_control_word(0, address, 0x300000, data)
704 	deco16_write_control_word(1, address, 0x310000, data)
705 
706 	switch (address)
707 	{
708 		case 0x180000:
709 			deco16_priority = data;
710 		return;
711 
712 		case 0x1a0064:
713 			deco16_soundlatch = data & 0xff;
714 			h6280SetIRQLine(0, CPU_IRQSTATUS_ACK);
715 		break;
716 
717 		case 0x1c0000:
718 			memcpy (DrvSprBuf, DrvSprRAM, 0x800);
719 		return;
720 
721 		case 0x1e0000:
722 			memcpy (DrvSprBuf1, DrvSprRAM1, 0x800);
723 		return;
724 	}
725 
726 	if (address >= 0x1a0000 && address <= 0x1a3fff) {
727 		deco146_104_prot_ww(0, address, data);
728 	}
729 }
730 
mutantf_main_write_byte(UINT32 address,UINT8 data)731 static void __fastcall mutantf_main_write_byte(UINT32 address, UINT8 data)
732 {
733 	switch (address)
734 	{
735 		case 0x180000:
736 		case 0x180001:
737 			deco16_priority = data;
738 		return;
739 
740 		case 0x1c0000:
741 		case 0x1c0001:
742 			memcpy (DrvSprBuf, DrvSprRAM, 0x800);
743 		return;
744 
745 		case 0x1e0000:
746 		case 0x1e0001:
747 			memcpy (DrvSprBuf1, DrvSprRAM1, 0x800);
748 		return;
749 
750 		case 0x1a0065:
751 			deco16_soundlatch = data;
752 			h6280SetIRQLine(0, CPU_IRQSTATUS_ACK);
753 		break;
754 	}
755 
756 	if (address >= 0x1a0000 && address <= 0x1a3fff) {
757 		deco146_104_prot_wb(0, address, data);
758 	}
759 }
760 
mutantf_main_read_word(UINT32 address)761 static UINT16 __fastcall mutantf_main_read_word(UINT32 address)
762 {
763 	if (address >= 0x1a0000 && address <= 0x1a3fff) {
764 		return deco146_104_prot_rw(0, address);
765 	}
766 
767 	return 0;
768 }
769 
mutantf_main_read_byte(UINT32 address)770 static UINT8 __fastcall mutantf_main_read_byte(UINT32 address)
771 {
772 	if (address == 0x1c0001) return deco16ic_71_read() & 0xff;
773 
774 	if (address >= 0x1a0000 && address <= 0x1a3fff) {
775 		return deco146_104_prot_rb(0, address);
776 	}
777 
778 	return 0;
779 }
780 
robocop2_main_write_word(UINT32 address,UINT16 data)781 static void __fastcall robocop2_main_write_word(UINT32 address, UINT16 data)
782 {
783 	deco16_write_control_word(0, address, 0x140000, data)
784 	deco16_write_control_word(1, address, 0x150000, data)
785 
786 	switch (address)
787 	{
788 		case 0x1b0000:
789 			irq_mask = data & 0xff;
790 		return;
791 
792 		case 0x1b0002: {
793 			scanline = data & 0xff;
794 
795 			if ((~irq_mask & 0x02) && (scanline > 0) && (scanline < 240)) {
796 				irq_timer = scanline;
797 			} else {
798 				irq_timer = -1;
799 			}
800 		}
801 		return;
802 
803 		case 0x198000:
804 			memcpy (DrvSprBuf, DrvSprRAM, 0x800);
805 		return;
806 
807 		case 0x18c064:
808 			deco16_soundlatch = data & 0xff;
809 			h6280SetIRQLine(0, CPU_IRQSTATUS_ACK);
810 		return;;
811 
812 		case 0x1f0000:
813 			deco16_priority = data;
814 		return;
815 	}
816 
817 	if (address >= 0x18c000 && address <= 0x18ffff) {
818 		deco146_104_prot_ww(0, address, data);
819 	}
820 
821 }
822 
robocop2_main_write_byte(UINT32 address,UINT8 data)823 static void __fastcall robocop2_main_write_byte(UINT32 address, UINT8 data)
824 {
825 	switch (address)
826 	{
827 		case 0x1b0000:
828 		case 0x1b0001:
829 
830 			irq_mask = data & 0xff;
831 		return;
832 
833 		case 0x1b0002:
834 		case 0x1b0003: {
835 			scanline = data & 0xff;
836 			if ((~irq_mask & 0x02) && (scanline > 0) && (scanline < 240)) {
837 				irq_timer = scanline;
838 			} else {
839 				irq_timer = -1;
840 			}
841 		}
842 		return;
843 
844 		case 0x198000:
845 		case 0x198001:
846 			memcpy (DrvSprBuf, DrvSprRAM, 0x800);
847 		return;
848 
849 		case 0x18c065:
850 			deco16_soundlatch = data;
851 			h6280SetIRQLine(0, CPU_IRQSTATUS_ACK);
852 		break;
853 
854 		case 0x1f0000:
855 		case 0x1f0001:
856 			deco16_priority = data;
857 		return;
858 	}
859 
860 	if (address >= 0x18c000 && address <= 0x18ffff) {
861 		deco146_104_prot_wb(0, address, data);
862 	}
863 }
864 
robocop2_main_read_word(UINT32 address)865 static UINT16 __fastcall robocop2_main_read_word(UINT32 address)
866 {
867 	switch (address)
868 	{
869 		case 0x1b0002:
870 			return scanline;
871 
872 		case 0x1b0004:
873 			SekSetIRQLine(3, CPU_IRQSTATUS_NONE);
874 			SekSetIRQLine(4, CPU_IRQSTATUS_NONE);
875 			return 0;
876 
877 		case 0x1f8000:
878 			return DrvDips[2];
879 	}
880 
881 	if (address >= 0x18c000 && address <= 0x18ffff) {
882 		return deco146_104_prot_rw(0, address);
883 	}
884 
885 	return 0;
886 }
887 
robocop2_main_read_byte(UINT32 address)888 static UINT8 __fastcall robocop2_main_read_byte(UINT32 address)
889 {
890 	switch (address)
891 	{
892 		case 0x1b0002:
893 		case 0x1b0003:
894 			return scanline;
895 
896 		case 0x1b0004:
897 		case 0x1b0005:
898 			SekSetIRQLine(3, CPU_IRQSTATUS_NONE);
899 			SekSetIRQLine(4, CPU_IRQSTATUS_NONE);
900 			return 0;
901 
902 		case 0x1f8000:
903 		case 0x1f8001:
904 			return DrvDips[2];
905 	}
906 
907 	if (address >= 0x18c000 && address <= 0x18ffff) {
908 		return deco146_104_prot_rb(0, address);
909 	}
910 
911 	return 0;
912 }
913 
stoneage_sound_write(UINT16 address,UINT8 data)914 static void __fastcall stoneage_sound_write(UINT16 address, UINT8 data)
915 {
916 	switch (address)
917 	{
918 		case 0x8800:
919 			BurnYM2151SelectRegister(data);
920 		return;
921 
922 		case 0x8801:
923 			BurnYM2151WriteRegister(data);
924 		return;
925 
926 		case 0x9800:
927 			MSM6295Write(0, data);
928 		return;
929 	}
930 }
931 
stoneage_sound_read(UINT16 address)932 static UINT8 __fastcall stoneage_sound_read(UINT16 address)
933 {
934 	switch (address)
935 	{
936 		case 0x8800:
937 		case 0x8801:
938 			return BurnYM2151Read();
939 
940 		case 0x9800:
941 			return MSM6295Read(0);
942 
943 		case 0xa000:
944 			ZetSetIRQLine(0x20, CPU_IRQSTATUS_NONE);
945 			return *soundlatch;
946 	}
947 
948 	return 0;
949 }
950 
DrvYM2151IrqHandler(INT32 state)951 static void DrvYM2151IrqHandler(INT32 state)
952 {
953 	ZetSetIRQLine(0, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
954 }
955 
DrvYM2151WritePort(UINT32,UINT32 data)956 static void DrvYM2151WritePort(UINT32, UINT32 data)
957 {
958 	DrvOkiBank = data & 1;
959 
960 	memcpy (DrvSndROM1, DrvSndROM1 + 0x40000 + (data & 1) * 0x40000, 0x40000);
961 }
962 
cninja_bank_callback(const INT32 bank)963 static INT32 cninja_bank_callback(const INT32 bank)
964 {
965 	if ((bank >> 4) & 0xf) return 0x0000;
966 	return 0x1000;
967 }
968 
mutantf_1_bank_callback(const INT32 bank)969 static INT32 mutantf_1_bank_callback(const INT32 bank)
970 {
971 	return ((bank >> 4) & 0x3) << 12;
972 }
973 
mutantf_2_bank_callback(const INT32 bank)974 static INT32 mutantf_2_bank_callback(const INT32 bank)
975 {
976 	return ((bank >> 5) & 0x1) << 14;
977 }
978 
robocop2_bank_callback(const INT32 bank)979 static INT32 robocop2_bank_callback(const INT32 bank)
980 {
981 	return (bank & 0x30) << 8;
982 }
983 
DrvDoReset()984 static INT32 DrvDoReset()
985 {
986 	memset (AllRam, 0, RamEnd - AllRam);
987 
988 	SekOpen(0);
989 	SekReset();
990 	SekClose();
991 
992 	if (has_z80) {
993 		ZetOpen(0);
994 		ZetReset();
995 		ZetClose();
996 
997 		MSM6295Reset();
998 		BurnYM2151Reset();
999 	} else {
1000 		deco16SoundReset();
1001 	}
1002 
1003 	DrvYM2151WritePort(0, 0); // set initial oki bank
1004 
1005 	deco16Reset();
1006 
1007 	scanline = 0;
1008 	irq_mask = 0;
1009 	irq_timer = -1;
1010 
1011 	return 0;
1012 }
1013 
DrvBootlegCharDecode(UINT8 * gfx,INT32 len)1014 static void DrvBootlegCharDecode(UINT8 *gfx, INT32 len)
1015 {
1016 	UINT8 *dst = (UINT8*)BurnMalloc(len);
1017 
1018 	memcpy (dst, gfx, len);
1019 
1020 	for (INT32 r = 0; r < len; r+=4) {
1021 		for (INT32 i = 0; i < 8; i++) {
1022 			INT32 t0 = (dst[r + 3] >> (7 - (i & 7))) & 1;
1023 			INT32 t1 = (dst[r + 1] >> (7 - (i & 7))) & 1;
1024 			INT32 t2 = (dst[r + 2] >> (7 - (i & 7))) & 1;
1025 			INT32 t3 = (dst[r + 0] >> (7 - (i & 7))) & 1;
1026 
1027 			gfx[(r * 2) + i] = (t0 << 3) | (t1 << 2) | (t2 << 1) | (t3 << 0);
1028 		}
1029 	}
1030 
1031 	BurnFree (dst);
1032 }
1033 
MemIndex()1034 static INT32 MemIndex()
1035 {
1036 	UINT8 *Next; Next = AllMem;
1037 
1038 	Drv68KROM	= Next; Next += 0x100000;
1039 	DrvZ80ROM	= Next;
1040 	DrvHucROM	= Next; Next += 0x010000;
1041 
1042 	DrvGfxROM0	= Next; Next += 0x200000;
1043 	DrvGfxROM1	= Next; Next += 0x200000;
1044 	DrvGfxROM2	= Next; Next += 0x300000;
1045 	DrvGfxROM3	= Next; Next += 0xa00000;
1046 	DrvGfxROM4	= Next; Next += 0x100000;
1047 
1048 	MSM6295ROM	= Next;
1049 	DrvSndROM0	= Next; Next += 0x100000;
1050 	DrvSndROM1	= Next; Next += 0x0c0000;
1051 
1052 	DrvPalette	= (UINT32*)Next; Next += 0x0800 * sizeof(UINT32);
1053 
1054 	AllRam		= Next;
1055 
1056 	Drv68KRAM	= Next; Next += 0x008000;
1057 	DrvHucRAM	= Next; Next += 0x002000;
1058 	DrvSprRAM	= Next; Next += 0x000800;
1059 	DrvSprBuf	= Next; Next += 0x000800;
1060 	DrvSprRAM1	= Next; Next += 0x000800;
1061 	DrvSprBuf1	= Next; Next += 0x000800;
1062 	DrvPalRAM	= Next; Next += 0x002000;
1063 
1064 	DrvZ80RAM	= Next; Next += 0x000800;
1065 
1066 	soundlatch	= Next; Next += 0x000001;
1067 	flipscreen	= Next; Next += 0x000001;
1068 
1069 	RamEnd		= Next;
1070 	MemEnd		= Next;
1071 
1072 	return 0;
1073 }
1074 
deco_104_port_a_cb()1075 static UINT16 deco_104_port_a_cb()
1076 {
1077 	return DrvInputs[0];
1078 }
1079 
deco_104_port_b_cb()1080 static UINT16 deco_104_port_b_cb()
1081 {
1082 	return (DrvInputs[1] & ~8) | deco16_vblank;
1083 }
1084 
deco_104_port_c_cb()1085 static UINT16 deco_104_port_c_cb()
1086 {
1087 	return DrvInputs[2];
1088 }
1089 
cninja_patch()1090 static void cninja_patch()
1091 {
1092 	UINT16 *rom = (UINT16 *)Drv68KROM;
1093 
1094 	for (INT32 i = 0; i < 0x80000 / 2; i++)
1095 	{
1096 		if (rom[i] == BURN_ENDIAN_SWAP_INT16(0x66ff) || rom[i] == BURN_ENDIAN_SWAP_INT16(0x67ff))
1097 		{
1098 			if (rom[i - 4] == BURN_ENDIAN_SWAP_INT16(0x0c39) || rom[i - 4] == BURN_ENDIAN_SWAP_INT16(0x0839))
1099 			{
1100 				rom[i - 0] = BURN_ENDIAN_SWAP_INT16(0x4e71);
1101 				rom[i - 1] = BURN_ENDIAN_SWAP_INT16(0x4e71);
1102 				rom[i - 2] = BURN_ENDIAN_SWAP_INT16(0x4e71);
1103 				rom[i - 3] = BURN_ENDIAN_SWAP_INT16(0x4e71);
1104 				rom[i - 4] = BURN_ENDIAN_SWAP_INT16(0x4e71);
1105 			}
1106 		}
1107 	}
1108 }
1109 
CninjaInit()1110 static INT32 CninjaInit()
1111 {
1112 	BurnSetRefreshRate(58.00);
1113 
1114 	AllMem = NULL;
1115 	MemIndex();
1116 	INT32 nLen = MemEnd - (UINT8 *)0;
1117 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1118 	memset(AllMem, 0, nLen);
1119 	MemIndex();
1120 
1121 	{
1122 		if (BurnLoadRom(Drv68KROM  + 0x00001,  0, 2)) return 1;
1123 		if (BurnLoadRom(Drv68KROM  + 0x00000,  1, 2)) return 1;
1124 		if (BurnLoadRom(Drv68KROM  + 0x40001,  2, 2)) return 1;
1125 		if (BurnLoadRom(Drv68KROM  + 0x40000,  3, 2)) return 1;
1126 		if (BurnLoadRom(Drv68KROM  + 0x80001,  4, 2)) return 1;
1127 		if (BurnLoadRom(Drv68KROM  + 0x80000,  5, 2)) return 1;
1128 
1129 		if (BurnLoadRom(DrvHucROM  + 0x00000,  6, 1)) return 1;
1130 
1131 		if (BurnLoadRom(DrvGfxROM0 + 0x00001,  7, 2)) return 1;
1132 		if (BurnLoadRom(DrvGfxROM0 + 0x00000,  8, 2)) return 1;
1133 
1134 		if (BurnLoadRom(DrvGfxROM1 + 0x00000,  9, 1)) return 1;
1135 
1136 		if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1;
1137 		if (BurnLoadRom(DrvGfxROM2 + 0x80000, 11, 1)) return 1;
1138 
1139 		for (INT32 i = 0; i < 0x40000; i++) {
1140 			INT32 n = DrvGfxROM2[i + 0x40000];
1141 			DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000];
1142 			DrvGfxROM2[i + 0x80000] = n;
1143 		}
1144 
1145 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 12, 2)) return 1;
1146 		if (BurnLoadRom(DrvGfxROM3 + 0x000001, 13, 2)) return 1;
1147 		if (BurnLoadRom(DrvGfxROM3 + 0x100000, 14, 2)) return 1;
1148 		if (BurnLoadRom(DrvGfxROM3 + 0x100001, 15, 2)) return 1;
1149 
1150 		BurnByteswap(DrvGfxROM3, 0x200000);
1151 
1152 		if (BurnLoadRom(DrvSndROM0 + 0x00000, 16, 1)) return 1;
1153 
1154 		if (BurnLoadRom(DrvSndROM1 + 0x40000, 17, 1)) return 1;
1155 
1156 		deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1);
1157 		deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0);
1158 		deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0);
1159 
1160 		deco16_sprite_decode(DrvGfxROM3, 0x200000); // 16x16
1161 
1162 		cninja_patch();
1163 	}
1164 
1165 	deco16Init(0, 1, 1);
1166 	deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2);
1167 	deco16_set_global_offsets(0, 8);
1168 
1169 	deco16_set_color_base(2, 0x200 + 0x000);
1170 	deco16_set_color_base(3, 0x200 + 0x300);
1171 	deco16_set_bank_callback(2, cninja_bank_callback);
1172 	deco16_set_bank_callback(3, cninja_bank_callback);
1173 
1174 	// 146_104 prot
1175 	deco_104_init();
1176 	deco_146_104_set_use_magic_read_address_xor(1);
1177 	deco_146_104_set_port_a_cb(deco_104_port_a_cb);
1178 	deco_146_104_set_port_b_cb(deco_104_port_b_cb);
1179 	deco_146_104_set_port_c_cb(deco_104_port_c_cb);
1180 	//deco_146_104_set_soundlatch_cb(deco_146_soundlatch_dummy);
1181 
1182 	SekInit(0, 0x68000);
1183 	SekOpen(0);
1184 	SekMapMemory(Drv68KROM,			0x000000, 0x0bffff, MAP_ROM);
1185 	SekMapMemory(deco16_pf_ram[0],		0x144000, 0x144fff, MAP_RAM);
1186 	SekMapMemory(deco16_pf_ram[1],		0x146000, 0x146fff, MAP_RAM);
1187 	SekMapMemory(deco16_pf_rowscroll[0],	0x14c000, 0x14c7ff, MAP_RAM);
1188 	SekMapMemory(deco16_pf_rowscroll[1],	0x14e000, 0x14e7ff, MAP_RAM);
1189 	SekMapMemory(deco16_pf_ram[2],		0x154000, 0x154fff, MAP_RAM);
1190 	SekMapMemory(deco16_pf_ram[3],		0x156000, 0x156fff, MAP_RAM);
1191 	SekMapMemory(deco16_pf_rowscroll[2],	0x15c000, 0x15c7ff, MAP_RAM);
1192 	SekMapMemory(deco16_pf_rowscroll[3],	0x15e000, 0x15e7ff, MAP_RAM);
1193 	SekMapMemory(Drv68KRAM,			0x184000, 0x187fff, MAP_RAM);
1194 	SekMapMemory(DrvPalRAM,			0x19c000, 0x19dfff, MAP_RAM);
1195 	SekMapMemory(DrvSprRAM,			0x1a4000, 0x1a47ff, MAP_RAM);
1196 	SekSetWriteWordHandler(0,		cninja_main_write_word);
1197 	SekSetWriteByteHandler(0,		cninja_main_write_byte);
1198 	SekSetReadWordHandler(0,		cninja_main_read_word);
1199 	SekSetReadByteHandler(0,		cninja_main_read_byte);
1200 	SekClose();
1201 
1202 	deco16SoundInit(DrvHucROM, DrvHucRAM, 4027500, 1, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60);
1203 	BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH);
1204 	BurnYM2151SetInterleave(117); // "BurnYM2151Render()" called this many times per frame
1205 
1206 	GenericTilesInit();
1207 
1208 	DrvDoReset();
1209 
1210 	return 0;
1211 }
1212 
EdrandyInit()1213 static INT32 EdrandyInit()
1214 {
1215 	BurnSetRefreshRate(58.00);
1216 
1217 	AllMem = NULL;
1218 	MemIndex();
1219 	INT32 nLen = MemEnd - (UINT8 *)0;
1220 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1221 	memset(AllMem, 0, nLen);
1222 	MemIndex();
1223 
1224 	{
1225 		if (BurnLoadRom(Drv68KROM  + 0x00001,  0, 2)) return 1;
1226 		if (BurnLoadRom(Drv68KROM  + 0x00000,  1, 2)) return 1;
1227 		if (BurnLoadRom(Drv68KROM  + 0x40001,  2, 2)) return 1;
1228 		if (BurnLoadRom(Drv68KROM  + 0x40000,  3, 2)) return 1;
1229 		if (BurnLoadRom(Drv68KROM  + 0x80001,  4, 2)) return 1;
1230 		if (BurnLoadRom(Drv68KROM  + 0x80000,  5, 2)) return 1;
1231 		if (BurnLoadRom(Drv68KROM  + 0xc0001,  6, 2)) return 1;
1232 		if (BurnLoadRom(Drv68KROM  + 0xc0000,  7, 2)) return 1;
1233 
1234 		if (BurnLoadRom(DrvHucROM  + 0x00000,  8, 1)) return 1;
1235 
1236 		if (BurnLoadRom(DrvGfxROM0 + 0x00001,  9, 2)) return 1;
1237 		if (BurnLoadRom(DrvGfxROM0 + 0x00000, 10, 2)) return 1;
1238 
1239 		if (BurnLoadRom(DrvGfxROM1 + 0x00000, 11, 1)) return 1;
1240 
1241 		if (BurnLoadRom(DrvGfxROM2 + 0x00000, 12, 1)) return 1;
1242 		if (BurnLoadRom(DrvGfxROM2 + 0x80000, 13, 1)) return 1;
1243 
1244 		for (INT32 i = 0; i < 0x40000; i++) {
1245 			INT32 n = DrvGfxROM2[i + 0x40000];
1246 			DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000];
1247 			DrvGfxROM2[i + 0x80000] = n;
1248 		}
1249 
1250 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 14, 2)) return 1;
1251 		if (BurnLoadRom(DrvGfxROM3 + 0x000001, 15, 2)) return 1;
1252 		if (BurnLoadRom(DrvGfxROM3 + 0x100000, 16, 2)) return 1;
1253 		if (BurnLoadRom(DrvGfxROM3 + 0x100001, 17, 2)) return 1;
1254 		if (BurnLoadRom(DrvGfxROM3 + 0x200000, 18, 2)) return 1;
1255 		if (BurnLoadRom(DrvGfxROM3 + 0x200001, 19, 2)) return 1;
1256 		if (BurnLoadRom(DrvGfxROM3 + 0x300000, 20, 2)) return 1;
1257 		if (BurnLoadRom(DrvGfxROM3 + 0x300001, 21, 2)) return 1;
1258 		if (BurnLoadRom(DrvGfxROM3 + 0x400000, 22, 2)) return 1;
1259 		if (BurnLoadRom(DrvGfxROM3 + 0x400001, 23, 2)) return 1;
1260 
1261 		BurnByteswap(DrvGfxROM3, 0x500000);
1262 
1263 		if (BurnLoadRom(DrvSndROM0 + 0x00000, 24, 1)) return 1;
1264 
1265 		if (BurnLoadRom(DrvSndROM1 + 0x40000, 25, 1)) return 1;
1266 
1267 		deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1);
1268 		deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0);
1269 		deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0);
1270 
1271 		deco16_sprite_decode(DrvGfxROM3, 0x500000); // 16x16
1272 	}
1273 
1274 	deco16Init(0, 0, 1);
1275 	deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2);
1276 	deco16_set_global_offsets(0, 8);
1277 
1278 	deco16_set_color_base(2, 0x200 + 0x000);
1279 	deco16_set_color_base(3, 0x200 + 0x300);
1280 	deco16_set_bank_callback(2, cninja_bank_callback);
1281 	deco16_set_bank_callback(3, cninja_bank_callback);
1282 
1283 	// 146_104 prot
1284 	deco_146_init();
1285 	deco_146_104_set_port_a_cb(deco_104_port_a_cb);
1286 	deco_146_104_set_port_b_cb(deco_104_port_b_cb);
1287 	deco_146_104_set_port_c_cb(deco_104_port_c_cb);
1288 	//deco_146_104_set_soundlatch_cb(deco_146_soundlatch_dummy);
1289 
1290 	SekInit(0, 0x68000);
1291 	SekOpen(0);
1292 	SekMapMemory(Drv68KROM,			0x000000, 0x0fffff, MAP_ROM);
1293 	SekMapMemory(deco16_pf_ram[0],		0x144000, 0x144fff, MAP_RAM);
1294 	SekMapMemory(deco16_pf_ram[1],		0x146000, 0x146fff, MAP_RAM);
1295 	SekMapMemory(deco16_pf_rowscroll[0],	0x14c000, 0x14c7ff, MAP_RAM);
1296 	SekMapMemory(deco16_pf_rowscroll[1],	0x14e000, 0x14e7ff, MAP_RAM);
1297 	SekMapMemory(deco16_pf_ram[2],		0x154000, 0x154fff, MAP_RAM);
1298 	SekMapMemory(deco16_pf_ram[3],		0x156000, 0x156fff, MAP_RAM);
1299 	SekMapMemory(deco16_pf_rowscroll[2],	0x15c000, 0x15c7ff, MAP_RAM);
1300 	SekMapMemory(deco16_pf_rowscroll[3],	0x15e000, 0x15e7ff, MAP_RAM);
1301 	SekMapMemory(DrvPalRAM,			0x188000, 0x189fff, MAP_RAM);
1302 	SekMapMemory(Drv68KRAM,			0x194000, 0x197fff, MAP_RAM);
1303 	SekMapMemory(DrvSprRAM,			0x1bc000, 0x1bc7ff, MAP_RAM);
1304 	SekSetWriteWordHandler(0,		cninja_main_write_word);
1305 	SekSetWriteByteHandler(0,		cninja_main_write_byte);
1306 	SekSetReadWordHandler(0,		cninja_main_read_word);
1307 	SekSetReadByteHandler(0,		cninja_main_read_byte);
1308 	SekClose();
1309 
1310 	deco16SoundInit(DrvHucROM, DrvHucRAM, 4027500, 1, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60);
1311 	BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH);
1312 
1313 	GenericTilesInit();
1314 
1315 	DrvDoReset();
1316 
1317 	return 0;
1318 }
1319 
MutantfInit()1320 static INT32 MutantfInit()
1321 {
1322 	BurnSetRefreshRate(58.00);
1323 
1324 	AllMem = NULL;
1325 	MemIndex();
1326 	INT32 nLen = MemEnd - (UINT8 *)0;
1327 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1328 	memset(AllMem, 0, nLen);
1329 	MemIndex();
1330 
1331 	{
1332 		if (BurnLoadRom(Drv68KROM  + 0x00001,  0, 2)) return 1;
1333 		if (BurnLoadRom(Drv68KROM  + 0x00000,  1, 2)) return 1;
1334 		if (BurnLoadRom(Drv68KROM  + 0x40001,  2, 2)) return 1;
1335 		if (BurnLoadRom(Drv68KROM  + 0x40000,  3, 2)) return 1;
1336 
1337 		if (BurnLoadRom(DrvHucROM  + 0x00000,  4, 1)) return 1;
1338 
1339 		if (BurnLoadRom(DrvGfxROM0 + 0x00000,  5, 2)) return 1;
1340 		if (BurnLoadRom(DrvGfxROM0 + 0x00001,  6, 2)) return 1;
1341 
1342 		if (BurnLoadRom(DrvGfxROM1 + 0x00000,  7, 1)) return 1;
1343 
1344 		memcpy (DrvGfxROM0 + 0x50000, DrvGfxROM0 + 0x10000, 0x10000);
1345 		memcpy (DrvGfxROM0 + 0x10000, DrvGfxROM1 + 0x00000, 0x40000);
1346 		memcpy (DrvGfxROM0 + 0x60000, DrvGfxROM1 + 0x40000, 0x40000);
1347 
1348 		if (BurnLoadRom(DrvGfxROM2 + 0x00000,  8, 1)) return 1;
1349 		if (BurnLoadRom(DrvGfxROM2 + 0x80000,  9, 1)) return 1;
1350 
1351 		for (INT32 i = 0; i < 0x40000; i++) {
1352 			INT32 n = DrvGfxROM2[i + 0x40000];
1353 			DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000];
1354 			DrvGfxROM2[i + 0x80000] = n;
1355 		}
1356 
1357 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 10, 2)) return 1;
1358 		if (BurnLoadRom(DrvGfxROM3 + 0x000001, 13, 2)) return 1;
1359 		if (BurnLoadRom(DrvGfxROM3 + 0x200000, 11, 2)) return 1;
1360 		if (BurnLoadRom(DrvGfxROM3 + 0x200001, 14, 2)) return 1;
1361 		if (BurnLoadRom(DrvGfxROM3 + 0x400000, 12, 2)) return 1;
1362 		if (BurnLoadRom(DrvGfxROM3 + 0x400001, 15, 2)) return 1;
1363 
1364 		if (BurnLoadRom(DrvGfxROM4 + 0x000001, 16, 4)) return 1;
1365 		if (BurnLoadRom(DrvGfxROM4 + 0x000003, 17, 4)) return 1;
1366 		if (BurnLoadRom(DrvGfxROM4 + 0x000000, 18, 4)) return 1;
1367 		if (BurnLoadRom(DrvGfxROM4 + 0x000002, 19, 4)) return 1;
1368 
1369 		BurnByteswap(DrvGfxROM3, 0x500000);
1370 		BurnByteswap(DrvGfxROM4, 0x040000);
1371 
1372 		if (BurnLoadRom(DrvSndROM0 + 0x00000, 20, 1)) return 1;
1373 
1374 		if (BurnLoadRom(DrvSndROM1 + 0x40000, 21, 1)) return 1;
1375 
1376 		deco56_decrypt_gfx(DrvGfxROM0, 0xa0000);
1377 		deco56_decrypt_gfx(DrvGfxROM1, 0x80000);
1378 
1379 		deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x0a0000, 1);
1380 		deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0);
1381 		deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0);
1382 
1383 		deco16_sprite_decode(DrvGfxROM3, 0x500000); // 16x16
1384 		deco16_sprite_decode(DrvGfxROM4, 0x040000);
1385 	}
1386 
1387 	deco16Init(0, 0, 1);
1388 	deco16_set_graphics(DrvGfxROM0, 0xa0000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2);
1389 	deco16_set_global_offsets(0, 8);
1390 
1391 	deco16_set_color_base(0, 0x000);
1392 	deco16_set_color_base(1, 0x300);
1393 	deco16_set_color_base(2, 0x200);
1394 	deco16_set_color_base(3, 0x400);
1395 	deco16_set_bank_callback(0, mutantf_1_bank_callback);
1396 	deco16_set_bank_callback(1, mutantf_2_bank_callback);
1397 	deco16_set_bank_callback(2, mutantf_1_bank_callback);
1398 	deco16_set_bank_callback(3, mutantf_1_bank_callback);
1399 
1400 	// 146_104 prot
1401 	deco_146_init();
1402 	deco_146_104_set_port_a_cb(deco_104_port_a_cb);
1403 	deco_146_104_set_port_b_cb(deco_104_port_b_cb);
1404 	deco_146_104_set_port_c_cb(deco_104_port_c_cb);
1405 	//deco_146_104_set_soundlatch_cb(deco_146_soundlatch_dummy);
1406 
1407 	SekInit(0, 0x68000);
1408 	SekOpen(0);
1409 	SekMapMemory(Drv68KROM,			0x000000, 0x07ffff, MAP_ROM);
1410 	SekMapMemory(Drv68KRAM,			0x100000, 0x103fff, MAP_RAM);
1411 	SekMapMemory(DrvSprRAM,			0x120000, 0x1207ff, MAP_RAM);
1412 	SekMapMemory(DrvSprRAM1,		0x140000, 0x1407ff, MAP_RAM);
1413 	SekMapMemory(DrvPalRAM,			0x160000, 0x161fff, MAP_RAM);
1414 	SekMapMemory(deco16_pf_ram[0],		0x304000, 0x305fff, MAP_RAM);
1415 	SekMapMemory(deco16_pf_ram[1],		0x306000, 0x307fff, MAP_RAM);
1416 	SekMapMemory(deco16_pf_rowscroll[0],	0x308000, 0x3087ff, MAP_RAM);
1417 	SekMapMemory(deco16_pf_rowscroll[1],	0x30a000, 0x30a7ff, MAP_RAM);
1418 	SekMapMemory(deco16_pf_ram[2],		0x314000, 0x315fff, MAP_RAM);
1419 	SekMapMemory(deco16_pf_ram[3],		0x316000, 0x317fff, MAP_RAM);
1420 	SekMapMemory(deco16_pf_rowscroll[2],	0x318000, 0x3187ff, MAP_RAM);
1421 	SekMapMemory(deco16_pf_rowscroll[3],	0x31a000, 0x31a7ff, MAP_RAM);
1422 	SekSetWriteWordHandler(0,		mutantf_main_write_word);
1423 	SekSetWriteByteHandler(0,		mutantf_main_write_byte);
1424 	SekSetReadWordHandler(0,		mutantf_main_read_word);
1425 	SekSetReadByteHandler(0,		mutantf_main_read_byte);
1426 	SekClose();
1427 
1428 	deco16SoundInit(DrvHucROM, DrvHucRAM, 4027500, 0, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60);
1429 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT);
1430 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT);
1431 
1432 	GenericTilesInit();
1433 
1434 	DrvDoReset();
1435 
1436 	return 0;
1437 }
1438 
CninjablInit()1439 static INT32 CninjablInit()
1440 {
1441 	BurnSetRefreshRate(58.00);
1442 
1443 	AllMem = NULL;
1444 	MemIndex();
1445 	INT32 nLen = MemEnd - (UINT8 *)0;
1446 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1447 	memset(AllMem, 0, nLen);
1448 	MemIndex();
1449 
1450 	{
1451 		if (BurnLoadRom(Drv68KROM  + 0x00000,  0, 1)) return 1;
1452 		if (BurnLoadRom(Drv68KROM  + 0x80000,  1, 1)) return 1;
1453 
1454 		if (BurnLoadRom(DrvZ80ROM  + 0x00000,  2, 1)) return 1;
1455 
1456 		UINT8 *tmp = (UINT8*)BurnMalloc(0x400000);
1457 
1458 		if (BurnLoadRom(tmp + 0x00000,  3, 2)) return 1;
1459 		if (BurnLoadRom(tmp + 0x00001,  4, 2)) return 1;
1460 		BurnByteswap(tmp, 0x400000);
1461 
1462 		for (INT32 i = 0; i < 0x200000; i++) tmp[i] ^= 0xff;
1463 
1464 		memcpy (DrvGfxROM0 + 0x000000, tmp + 0x000000, 0x020000);
1465 		memcpy (DrvGfxROM1 + 0x000000, tmp + 0x080000, 0x080000);
1466 		memcpy (DrvGfxROM2 + 0x000000, tmp + 0x180000, 0x080000);
1467 		memcpy (DrvGfxROM2 + 0x080000, tmp + 0x100000, 0x080000);
1468 		memcpy (DrvGfxROM3 + 0x000000, tmp + 0x200000, 0x200000);
1469 
1470 		BurnFree(tmp);
1471 
1472 		if (BurnLoadRom(DrvSndROM0  + 0x00000,  5, 1)) return 1;
1473 
1474 		DrvBootlegCharDecode(DrvGfxROM0, 0x020000);
1475 		deco16_sprite_decode(DrvGfxROM1, 0x080000);
1476 		deco16_sprite_decode(DrvGfxROM2, 0x100000);
1477 		deco16_sprite_decode(DrvGfxROM3, 0x200000);
1478 	}
1479 
1480 	deco16Init(0, 1, 1);
1481 	deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2);
1482 	deco16_set_global_offsets(0, 8);
1483 	deco16_set_scroll_offs(3, 1,  2, 0);
1484 	deco16_set_scroll_offs(2, 1,  2, 0);
1485 	deco16_set_color_base(2, 0x200 + 0x000);
1486 	deco16_set_color_base(3, 0x200 + 0x300);
1487 	deco16_set_bank_callback(2, cninja_bank_callback);
1488 	deco16_set_bank_callback(3, cninja_bank_callback);
1489 
1490 	SekInit(0, 0x68000);
1491 	SekOpen(0);
1492 	SekMapMemory(Drv68KROM,			0x000000, 0x0bffff, MAP_ROM);
1493 	SekMapMemory(DrvSprRAM,			0x138000, 0x1387ff, MAP_RAM);
1494 	SekMapMemory(deco16_pf_ram[0],		0x144000, 0x144fff, MAP_RAM);
1495 	SekMapMemory(deco16_pf_ram[1],		0x146000, 0x146fff, MAP_RAM);
1496 	SekMapMemory(deco16_pf_rowscroll[0],	0x14c000, 0x14c7ff, MAP_RAM);
1497 	SekMapMemory(deco16_pf_rowscroll[1],	0x14e000, 0x14e7ff, MAP_RAM);
1498 	SekMapMemory(deco16_pf_ram[2],		0x154000, 0x154fff, MAP_RAM);
1499 	SekMapMemory(deco16_pf_ram[3],		0x156000, 0x156fff, MAP_RAM);
1500 	SekMapMemory(deco16_pf_rowscroll[2],	0x15c000, 0x15c7ff, MAP_RAM);
1501 	SekMapMemory(deco16_pf_rowscroll[3],	0x15e000, 0x15e7ff, MAP_RAM);
1502 	SekMapMemory(Drv68KRAM,			0x180000, 0x187fff, MAP_RAM);
1503 	SekMapMemory(DrvPalRAM,			0x19c000, 0x19dfff, MAP_RAM);
1504 	SekSetWriteWordHandler(0,		cninja_main_write_word);
1505 	SekSetWriteByteHandler(0,		cninja_main_write_byte);
1506 	SekSetReadWordHandler(0,		cninja_main_read_word);
1507 	SekSetReadByteHandler(0,		cninja_main_read_byte);
1508 	SekClose();
1509 
1510 	has_z80 = 1;
1511 
1512 	ZetInit(0);
1513 	ZetOpen(0);
1514 	ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM);
1515 	ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM);
1516 	ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM);
1517 	ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM);
1518 	ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM);
1519 	ZetSetWriteHandler(stoneage_sound_write);
1520 	ZetSetReadHandler(stoneage_sound_read);
1521 	ZetClose();
1522 
1523 	BurnYM2151Init(3580000);
1524 	BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler);
1525 	BurnYM2151SetAllRoutes(0.45, BURN_SND_ROUTE_BOTH);
1526 
1527 	MSM6295Init(0, 1006875 / 132, 1);
1528 	MSM6295Init(1, 2013750 / 132, 1);
1529 	MSM6295SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH);
1530 	MSM6295SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH);
1531 
1532 	GenericTilesInit();
1533 
1534 	DrvDoReset();
1535 
1536 	return 0;
1537 }
1538 
StoneageInit()1539 static INT32 StoneageInit()
1540 {
1541 	BurnSetRefreshRate(58.00);
1542 
1543 	AllMem = NULL;
1544 	MemIndex();
1545 	INT32 nLen = MemEnd - (UINT8 *)0;
1546 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1547 	memset(AllMem, 0, nLen);
1548 	MemIndex();
1549 
1550 	{
1551 		if (BurnLoadRom(Drv68KROM  + 0x00001,  0, 2)) return 1;
1552 		if (BurnLoadRom(Drv68KROM  + 0x00000,  1, 2)) return 1;
1553 		if (BurnLoadRom(Drv68KROM  + 0x40001,  2, 2)) return 1;
1554 		if (BurnLoadRom(Drv68KROM  + 0x40000,  3, 2)) return 1;
1555 		if (BurnLoadRom(Drv68KROM  + 0x80001,  4, 2)) return 1;
1556 		if (BurnLoadRom(Drv68KROM  + 0x80000,  5, 2)) return 1;
1557 
1558 		if (BurnLoadRom(DrvZ80ROM  + 0x00000,  6, 1)) return 1;
1559 
1560 		if (BurnLoadRom(DrvGfxROM0 + 0x00001,  7, 2)) return 1;
1561 		if (BurnLoadRom(DrvGfxROM0 + 0x00000,  8, 2)) return 1;
1562 
1563 		if (BurnLoadRom(DrvGfxROM1 + 0x00000,  9, 1)) return 1;
1564 
1565 		if (BurnLoadRom(DrvGfxROM2 + 0x00000, 10, 1)) return 1;
1566 		if (BurnLoadRom(DrvGfxROM2 + 0x80000, 11, 1)) return 1;
1567 
1568 		for (INT32 i = 0; i < 0x40000; i++) {
1569 			INT32 n = DrvGfxROM2[i + 0x40000];
1570 			DrvGfxROM2[i + 0x40000] = DrvGfxROM2[i + 0x80000];
1571 			DrvGfxROM2[i + 0x80000] = n;
1572 		}
1573 
1574 
1575 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 12, 2)) return 1;
1576 		if (BurnLoadRom(DrvGfxROM3 + 0x000001, 13, 2)) return 1;
1577 		if (BurnLoadRom(DrvGfxROM3 + 0x100000, 14, 2)) return 1;
1578 		if (BurnLoadRom(DrvGfxROM3 + 0x100001, 15, 2)) return 1;
1579 
1580 		BurnByteswap(DrvGfxROM3, 0x200000);
1581 
1582 		if (BurnLoadRom(DrvSndROM0 + 0x00000, 16, 1)) return 1;
1583 
1584 		memset (DrvSndROM1, 0xff, 0x80000);
1585 
1586 		deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1);
1587 		deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x080000, 0);
1588 		deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x100000, 0);
1589 
1590 		deco16_sprite_decode(DrvGfxROM3, 0x200000); // 16x16
1591 	}
1592 
1593 	deco16Init(0, 1, 1);
1594 	deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x080000 * 2, DrvGfxROM2, 0x100000 * 2);
1595 	deco16_set_global_offsets(0, 8);
1596 	deco16_set_scroll_offs(3, 1, 10, 0);
1597 	deco16_set_scroll_offs(1, 1, 10, 0);
1598 	deco16_set_scroll_offs(0, 1, -2, 0);
1599 	deco16_set_color_base(2, 0x200 + 0x000);
1600 	deco16_set_color_base(3, 0x200 + 0x300);
1601 	deco16_set_bank_callback(2, cninja_bank_callback);
1602 	deco16_set_bank_callback(3, cninja_bank_callback);
1603 
1604 	SekInit(0, 0x68000);
1605 	SekOpen(0);
1606 	SekMapMemory(Drv68KROM,			0x000000, 0x0bffff, MAP_ROM);
1607 	SekMapMemory(deco16_pf_ram[0],		0x144000, 0x144fff, MAP_RAM);
1608 	SekMapMemory(deco16_pf_ram[1],		0x146000, 0x146fff, MAP_RAM);
1609 	SekMapMemory(deco16_pf_rowscroll[0],	0x14c000, 0x14c7ff, MAP_RAM);
1610 	SekMapMemory(deco16_pf_rowscroll[1],	0x14e000, 0x14e7ff, MAP_RAM);
1611 	SekMapMemory(deco16_pf_ram[2],		0x154000, 0x154fff, MAP_RAM);
1612 	SekMapMemory(deco16_pf_ram[3],		0x156000, 0x156fff, MAP_RAM);
1613 	SekMapMemory(deco16_pf_rowscroll[2],	0x15c000, 0x15c7ff, MAP_RAM);
1614 	SekMapMemory(deco16_pf_rowscroll[3],	0x15e000, 0x15e7ff, MAP_RAM);
1615 	SekMapMemory(Drv68KRAM,			0x184000, 0x187fff, MAP_RAM);
1616 	SekMapMemory(DrvPalRAM,			0x19c000, 0x19dfff, MAP_RAM);
1617 	SekMapMemory(DrvSprRAM,			0x1a4000, 0x1a47ff, MAP_RAM);
1618 	SekSetWriteWordHandler(0,		cninja_main_write_word);
1619 	SekSetWriteByteHandler(0,		cninja_main_write_byte);
1620 	SekSetReadWordHandler(0,		cninja_main_read_word);
1621 	SekSetReadByteHandler(0,		cninja_main_read_byte);
1622 	SekClose();
1623 
1624 	has_z80 = 1;
1625 
1626 	ZetInit(0);
1627 	ZetOpen(0);
1628 	ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM);
1629 	ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM);
1630 	ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM);
1631 	ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM);
1632 	ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM);
1633 	ZetSetWriteHandler(stoneage_sound_write);
1634 	ZetSetReadHandler(stoneage_sound_read);
1635 	ZetClose();
1636 
1637 	MSM6295Init(0, 1006875 / 132, 1);
1638 	MSM6295Init(1, 2013750 / 132, 1);
1639 	MSM6295SetRoute(0, 0.75, BURN_SND_ROUTE_BOTH);
1640 	MSM6295SetRoute(1, 0.60, BURN_SND_ROUTE_BOTH);
1641 
1642 	BurnYM2151Init(3580000);
1643 	BurnYM2151SetAllRoutes(0.45, BURN_SND_ROUTE_BOTH);
1644 	BurnYM2151SetIrqHandler(&DrvYM2151IrqHandler);
1645 
1646 	GenericTilesInit();
1647 
1648 	DrvDoReset();
1649 
1650 	return 0;
1651 }
1652 
Robocop2Init()1653 static INT32 Robocop2Init()
1654 {
1655 	BurnSetRefreshRate(58.00);
1656 
1657 	AllMem = NULL;
1658 	MemIndex();
1659 	INT32 nLen = MemEnd - (UINT8 *)0;
1660 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1661 	memset(AllMem, 0, nLen);
1662 	MemIndex();
1663 
1664 	{
1665 		if (BurnLoadRom(Drv68KROM  + 0x00001,  0, 2)) return 1;
1666 		if (BurnLoadRom(Drv68KROM  + 0x00000,  1, 2)) return 1;
1667 		if (BurnLoadRom(Drv68KROM  + 0x40001,  2, 2)) return 1;
1668 		if (BurnLoadRom(Drv68KROM  + 0x40000,  3, 2)) return 1;
1669 		if (BurnLoadRom(Drv68KROM  + 0x80001,  4, 2)) return 1;
1670 		if (BurnLoadRom(Drv68KROM  + 0x80000,  5, 2)) return 1;
1671 		if (BurnLoadRom(Drv68KROM  + 0xc0001,  6, 2)) return 1;
1672 		if (BurnLoadRom(Drv68KROM  + 0xc0000,  7, 2)) return 1;
1673 
1674 		if (BurnLoadRom(DrvHucROM  + 0x00000,  8, 1)) return 1;
1675 
1676 		if (BurnLoadRom(DrvGfxROM0 + 0x00001,  9, 2)) return 1;
1677 		if (BurnLoadRom(DrvGfxROM0 + 0x00000, 10, 2)) return 1;
1678 
1679 		if (BurnLoadRom(DrvGfxROM1 + 0x00000, 11, 1)) return 1;
1680 		if (BurnLoadRom(DrvGfxROM1 + 0x80000, 12, 1)) return 1;
1681 
1682 		for (INT32 i = 0; i < 0x40000; i++) {
1683 			INT32 n = DrvGfxROM1[i + 0x40000];
1684 			DrvGfxROM1[i + 0x40000] = DrvGfxROM1[i + 0x80000];
1685 			DrvGfxROM1[i + 0x80000] = n;
1686 		}
1687 
1688 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 13, 1)) return 1;
1689 		memcpy (DrvGfxROM2 + 0x000000, DrvGfxROM3 + 0x000000, 0x040000);
1690 		memcpy (DrvGfxROM2 + 0x0c0000, DrvGfxROM3 + 0x040000, 0x040000);
1691 
1692 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 14, 1)) return 1;
1693 		memcpy (DrvGfxROM2 + 0x040000, DrvGfxROM3 + 0x000000, 0x040000);
1694 		memcpy (DrvGfxROM2 + 0x100000, DrvGfxROM3 + 0x040000, 0x040000);
1695 
1696 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 15, 1)) return 1;
1697 		memcpy (DrvGfxROM2 + 0x080000, DrvGfxROM3 + 0x000000, 0x040000);
1698 		memcpy (DrvGfxROM2 + 0x140000, DrvGfxROM3 + 0x040000, 0x040000);
1699 
1700 		if (BurnLoadRom(DrvGfxROM3 + 0x000000, 16, 2)) return 1;
1701 		if (BurnLoadRom(DrvGfxROM3 + 0x000001, 17, 2)) return 1;
1702 		if (BurnLoadRom(DrvGfxROM3 + 0x100000, 18, 2)) return 1;
1703 		if (BurnLoadRom(DrvGfxROM3 + 0x100001, 19, 2)) return 1;
1704 		if (BurnLoadRom(DrvGfxROM3 + 0x200000, 20, 2)) return 1;
1705 		if (BurnLoadRom(DrvGfxROM3 + 0x200001, 21, 2)) return 1;
1706 
1707 		BurnByteswap(DrvGfxROM3, 0x300000);
1708 
1709 		if (BurnLoadRom(DrvSndROM0 + 0x00000, 22, 1)) return 1;
1710 
1711 		if (BurnLoadRom(DrvSndROM1 + 0x40000, 23, 1)) return 1;
1712 
1713 		deco16_tile_decode(DrvGfxROM0, DrvGfxROM0, 0x020000, 1);
1714 		deco16_tile_decode(DrvGfxROM1, DrvGfxROM1, 0x100000, 0);
1715 		deco16_tile_decode(DrvGfxROM2, DrvGfxROM4, 0x180000, 2);
1716 		deco16_tile_decode(DrvGfxROM2, DrvGfxROM2, 0x180000, 0);
1717 
1718 		deco16_sprite_decode(DrvGfxROM3, 0x300000); // 16x16
1719 	}
1720 
1721 	deco16Init(0, 0, 1);
1722 	deco16_set_graphics(DrvGfxROM0, 0x20000 * 2, DrvGfxROM1, 0x100000 * 2, DrvGfxROM2, 0x180000 * 2);
1723 	deco16_set_global_offsets(0, 8);
1724 
1725 	deco16_set_color_base(2, 0x200 + 0x000);
1726 	deco16_set_color_base(3, 0x200 + 0x300);
1727 	deco16_set_bank_callback(1, robocop2_bank_callback);
1728 	deco16_set_bank_callback(2, robocop2_bank_callback);
1729 	deco16_set_bank_callback(3, robocop2_bank_callback);
1730 
1731 	// 146_104 prot
1732 	deco_146_init();
1733 	deco_146_104_set_use_magic_read_address_xor(1);
1734 	deco_146_104_set_port_a_cb(deco_104_port_a_cb);
1735 	deco_146_104_set_port_b_cb(deco_104_port_b_cb);
1736 	deco_146_104_set_port_c_cb(deco_104_port_c_cb);
1737 	//deco_146_104_set_soundlatch_cb(deco_146_soundlatch_dummy);
1738 
1739 	SekInit(0, 0x68000);
1740 	SekOpen(0);
1741 	SekMapMemory(Drv68KROM,			0x000000, 0x0fffff, MAP_ROM);
1742 	SekMapMemory(deco16_pf_ram[0],		0x144000, 0x144fff, MAP_RAM);
1743 	SekMapMemory(deco16_pf_ram[1],		0x146000, 0x146fff, MAP_RAM);
1744 	SekMapMemory(deco16_pf_rowscroll[0],	0x14c000, 0x14c7ff, MAP_RAM);
1745 	SekMapMemory(deco16_pf_rowscroll[1],	0x14e000, 0x14e7ff, MAP_RAM);
1746 	SekMapMemory(deco16_pf_ram[2],		0x154000, 0x154fff, MAP_RAM);
1747 	SekMapMemory(deco16_pf_ram[3],		0x156000, 0x156fff, MAP_RAM);
1748 	SekMapMemory(deco16_pf_rowscroll[2],	0x15c000, 0x15c7ff, MAP_RAM);
1749 	SekMapMemory(deco16_pf_rowscroll[3],	0x15e000, 0x15e7ff, MAP_RAM);
1750 	SekMapMemory(DrvSprRAM,			0x180000, 0x1807ff, MAP_RAM);
1751 	SekMapMemory(DrvPalRAM,			0x1a8000, 0x1a9fff, MAP_RAM);
1752 	SekMapMemory(Drv68KRAM,			0x1b8000, 0x1bbfff, MAP_RAM);
1753 	SekSetWriteWordHandler(0,		robocop2_main_write_word);
1754 	SekSetWriteByteHandler(0,		robocop2_main_write_byte);
1755 	SekSetReadWordHandler(0,		robocop2_main_read_word);
1756 	SekSetReadByteHandler(0,		robocop2_main_read_byte);
1757 	SekClose();
1758 
1759 	deco16SoundInit(DrvHucROM, DrvHucRAM, 4027500, 1, DrvYM2151WritePort, 0.45, 1006875, 0.75, 2013750, 0.60);
1760 	BurnYM2203SetAllRoutes(0, 0.60, BURN_SND_ROUTE_BOTH);
1761 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.45, BURN_SND_ROUTE_LEFT);
1762 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.45, BURN_SND_ROUTE_RIGHT);
1763 
1764 	GenericTilesInit();
1765 
1766 	DrvDoReset();
1767 
1768 	return 0;
1769 }
1770 
DrvExit()1771 static INT32 DrvExit()
1772 {
1773 	GenericTilesExit();
1774 	deco16Exit();
1775 
1776 	SekExit();
1777 
1778 	if (has_z80) {
1779 		ZetExit();
1780 		has_z80 = 0;
1781 		MSM6295Exit();
1782 		BurnYM2151Exit();
1783 	} else {
1784 		deco16SoundExit();
1785 	}
1786 
1787 	BurnFree (AllMem);
1788 
1789 	MSM6295ROM = NULL;
1790 
1791 	return 0;
1792 }
1793 
cninja_draw_sprites(int xoffset)1794 static void cninja_draw_sprites(int xoffset)
1795 {
1796 	UINT16 *buffered_spriteram = (UINT16*)DrvSprBuf;
1797 
1798 	for (INT32 offs = 0x400 - 4; offs >=0 ; offs -= 4)
1799 	{
1800 		INT32 x, y, sprite, color, multi, flipx, flipy, inc, flash, mult, pri = 0;
1801 		sprite = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 1]);
1802 		if (!sprite)
1803 			continue;
1804 
1805 		x = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 2]);
1806 
1807 		switch (x & 0xc000)
1808 		{
1809 			case 0x0000: pri = 0; break;
1810 			case 0x4000: pri = 0xf0; break;
1811 			case 0x8000: pri = 0xf0 | 0xcc; break;
1812 			case 0xc000: pri = 0xf0 | 0xcc; break;
1813 		}
1814 
1815 		y = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs]);
1816 		flash = y & 0x1000;
1817 		if (flash && (nCurrentFrame & 1))
1818 			continue;
1819 
1820 		color = (x >> 9) & 0x1f;
1821 
1822 		flipx = y & 0x2000;
1823 		flipy = y & 0x4000;
1824 		multi = (1 << ((y & 0x0600) >> 9)) - 1;
1825 
1826 		x = x & 0x01ff;
1827 		y = y & 0x01ff;
1828 		if (x >= nScreenWidth) x -= 512;
1829 		if (y >= 256) y -= 512;
1830 		x = 240 - x;
1831 		y = 240 - y;
1832 
1833 		sprite &= ~multi;
1834 		if (flipy)
1835 			inc = -1;
1836 		else
1837 		{
1838 			sprite += multi;
1839 			inc = 1;
1840 		}
1841 
1842 		if (*flipscreen)
1843 		{
1844 			y = 240 - y;
1845 			x = (nScreenWidth - 16) - x;
1846 			if (flipx) flipx = 0; else flipx = 1;
1847 			if (flipy) flipy = 0; else flipy = 1;
1848 			mult = 16;
1849 		}
1850 		else
1851 			mult = -16;
1852 
1853 		while (multi >= 0)
1854 		{
1855 			deco16_draw_prio_sprite(pTransDraw, DrvGfxROM3, sprite - multi * inc, (color << 4) + 0x300, x+xoffset, y + mult * multi, flipx, flipy, pri);
1856 
1857 			multi--;
1858 		}
1859 	}
1860 }
1861 
cninjabl_draw_sprites()1862 static void cninjabl_draw_sprites()
1863 {
1864 	UINT16 *buffered_spriteram = (UINT16*)DrvSprBuf;
1865 	INT32 offs;
1866 	INT32 endoffs;
1867 
1868 	endoffs = 0x400 - 4;
1869 	for (offs = 0; offs < 0x400 - 4 ; offs += 4)
1870 	{
1871 		INT32 y = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 1]);
1872 
1873 		if (y == 0x180)
1874 		{
1875 			endoffs = offs;
1876 			offs = 0x400 - 4;
1877 		}
1878 	}
1879 
1880 	for (offs = endoffs; offs >=0 ; offs -= 4)
1881 	{
1882 		INT32 x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri = 0;
1883 
1884 		sprite = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 0]);
1885 		y = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 1]);
1886 
1887 		if (!sprite)
1888 			continue;
1889 
1890 		x = BURN_ENDIAN_SWAP_INT16(buffered_spriteram[offs + 2]);
1891 
1892 		switch (x & 0xc000)
1893 		{
1894 			case 0x0000: pri = 0; break;
1895 			case 0x4000: pri = 0xf0; break;
1896 			case 0x8000: pri = 0xf0 | 0xcc; break;
1897 			case 0xc000: pri = 0xf0 | 0xcc; break;
1898 		}
1899 
1900 		flash = y & 0x1000;
1901 		if (flash && (nCurrentFrame & 1))
1902 			continue;
1903 
1904 		colour = (x >> 9) & 0x1f;
1905 
1906 		fx = y & 0x2000;
1907 		fy = y & 0x4000;
1908 
1909 		multi = (1 << ((y & 0x0600) >> 9)) - 1;
1910 
1911 		y -= multi * 16;
1912 		y += 4;
1913 
1914 		x = x & 0x01ff;
1915 		y = y & 0x01ff;
1916 		if (x >= 256) x -= 512;
1917 		if (y >= 256) y -= 512;
1918 		x = 240 - x;
1919 		y = 240 - y;
1920 
1921 		if (fy)
1922 			inc = -1;
1923 		else
1924 		{
1925 			sprite += multi;
1926 			inc = 1;
1927 		}
1928 
1929 		if (*flipscreen)
1930 		{
1931 			y = 240 - y;
1932 			x = 240 - x;
1933 			if (fx) fx = 0; else fx = 1;
1934 			if (fy) fy = 0; else fy = 1;
1935 			mult = 16;
1936 		}
1937 		else
1938 			mult = -16;
1939 
1940 		while (multi >= 0)
1941 		{
1942 			deco16_draw_prio_sprite(pTransDraw, DrvGfxROM3, sprite - multi * inc, (colour << 4) + 0x300, x, y + mult * multi, fx, fy, pri);
1943 
1944 			multi--;
1945 		}
1946 	}
1947 }
1948 
mutantf_draw_sprites(UINT8 * ram,UINT8 * gfx,INT32 colbank,INT32 gfxbank)1949 static void mutantf_draw_sprites(UINT8 *ram, UINT8 *gfx, INT32 colbank, INT32 gfxbank)
1950 {
1951 	UINT16 *spriteptr = (UINT16*)ram;
1952 
1953 	INT32 offs, end, inc;
1954 
1955 	if (gfxbank == 4)
1956 	{
1957 		offs = 0;
1958 		end = 0x400;
1959 		inc = 4;
1960 	}
1961 	else
1962 	{
1963 		offs = 0x3fc;
1964 		end = -4;
1965 		inc = -4;
1966 	}
1967 
1968 	while (offs != end)
1969 	{
1970 		INT32 x, y, sprite, colour, fx, fy, w, h, sx, sy, x_mult, y_mult;
1971 		INT32 alpha = 0xff;
1972 
1973 		sprite = BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 3]);
1974 		if (!sprite)
1975 		{
1976 			offs += inc;
1977 			continue;
1978 		}
1979 
1980 		sx = BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 1]);
1981 
1982 		h = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 2]) & 0xf000) >> 12;
1983 		w = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 2]) & 0x0f00) >>  8;
1984 
1985 		sy = BURN_ENDIAN_SWAP_INT16(spriteptr[offs]);
1986 		if ((sy & 0x2000) && (nCurrentFrame & 1))
1987 		{
1988 			offs += inc;
1989 			continue;
1990 		}
1991 
1992 		colour = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 2]) >> 0) & 0x1f;
1993 
1994 		if (gfxbank == 4)
1995 		{
1996 			alpha = 0x80;
1997 			colour &= 0xf;
1998 		}
1999 
2000 		fx = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 0]) & 0x4000);
2001 		fy = (BURN_ENDIAN_SWAP_INT16(spriteptr[offs + 0]) & 0x8000);
2002 
2003 		if (*flipscreen)
2004 		{
2005 			if (fx) fx = 0; else fx = 1;
2006 			if (fy) fy = 0; else fy = 1;
2007 
2008 			sx = sx & 0x01ff;
2009 			sy = sy & 0x01ff;
2010 			if (sx > 0x180) sx = -(0x200 - sx);
2011 			if (sy > 0x180) sy = -(0x200 - sy);
2012 
2013 			if (fx) { x_mult = -16; sx += 16 * w; } else { x_mult = 16; sx -= 16; }
2014 			if (fy) { y_mult = -16; sy += 16 * h; } else { y_mult = 16; sy -= 16; }
2015 		}
2016 		else
2017 		{
2018 			sx = sx & 0x01ff;
2019 			sy = sy & 0x01ff;
2020 			if (sx & 0x100) sx = -(0x100 - (sx & 0xff));
2021 			if (sy & 0x100) sy = -(0x100 - (sy & 0xff));
2022 			sx = 304 - sx;
2023 			sy = 240 - sy;
2024 			if (sx >= 432) sx -= 512;
2025 			if (sy >= 384) sy -= 512;
2026 			if (fx) { x_mult = -16; sx += 16; } else { x_mult = 16; sx -= 16*w; }
2027 			if (fy) { y_mult = -16; sy += 16; } else { y_mult = 16; sy -= 16*h; }
2028 		}
2029 
2030 		for (x = 0; x < w; x++)
2031 		{
2032 			for (y = 0; y < h; y++)
2033 			{
2034 				// needs alpha blending...
2035 				deco16_draw_prio_sprite(pTransDraw, gfx, sprite + y + h * x, (colour << 4) + colbank, sx + x_mult * (w-x), sy + y_mult * (h-y), fx, fy, 0);
2036 			}
2037 		}
2038 		offs += inc;
2039 	}
2040 }
2041 
CninjaDraw()2042 static INT32 CninjaDraw()
2043 {
2044 //	if (DrvRecalc) {
2045 		deco16_palette_recalculate(DrvPalette, DrvPalRAM);
2046 		DrvRecalc = 0;
2047 //	}
2048 
2049 	deco16_pf12_update();
2050 	deco16_pf34_update();
2051 
2052 	BurnTransferClear(0x200);
2053 
2054 	deco16_clear_prio_map();
2055 
2056 	if (nSpriteEnable &  1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x01) | DECO16_LAYER_OPAQUE);
2057 	if (nSpriteEnable &  2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02));
2058 	if (nSpriteEnable &  4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x02) | DECO16_LAYER_TRANSMASK1);
2059 	if (nSpriteEnable &  8) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04) | DECO16_LAYER_TRANSMASK0);
2060 
2061 	cninja_draw_sprites(0);
2062 
2063 	if (nSpriteEnable & 16) deco16_draw_layer(0, pTransDraw, 0);
2064 
2065 	BurnTransferCopy(DrvPalette);
2066 
2067 	return 0;
2068 }
2069 
CninjablDraw()2070 static INT32 CninjablDraw()
2071 {
2072 //	if (DrvRecalc) {
2073 		deco16_palette_recalculate(DrvPalette, DrvPalRAM);
2074 		DrvRecalc = 0;
2075 //	}
2076 
2077 	deco16_pf12_update();
2078 	deco16_pf34_update();
2079 
2080 	BurnTransferClear(0x200);
2081 
2082 	deco16_clear_prio_map();
2083 
2084 	if (nSpriteEnable &  1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_PRIORITY(0x01) | DECO16_LAYER_OPAQUE);
2085 	if (nSpriteEnable &  2) deco16_draw_layer(2, pTransDraw, DECO16_LAYER_PRIORITY(0x02));
2086 	if (nSpriteEnable &  4) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x02) | DECO16_LAYER_TRANSMASK1);
2087 	if (nSpriteEnable &  8) deco16_draw_layer(1, pTransDraw, DECO16_LAYER_PRIORITY(0x04) | DECO16_LAYER_TRANSMASK0);
2088 
2089 	cninjabl_draw_sprites();
2090 
2091 	if (nSpriteEnable & 16) deco16_draw_layer(0, pTransDraw, 0);
2092 
2093 	BurnTransferCopy(DrvPalette);
2094 
2095 	return 0;
2096 }
2097 
2098 static INT32 lastline;
2099 
EdrandyStartDraw()2100 static INT32 EdrandyStartDraw()
2101 {
2102 	deco16_clear_prio_map();
2103 
2104 	BurnTransferClear();
2105 
2106 	lastline = 0;
2107 
2108 	return 0;
2109 }
2110 
EdrandyDrawScanline(INT32 line)2111 static INT32 EdrandyDrawScanline(INT32 line)
2112 {
2113 	if (line > nScreenHeight) return 0;
2114 
2115 	deco16_pf12_update();
2116 	deco16_pf34_update();
2117 
2118 	if (nSpriteEnable &  1) deco16_draw_layer_by_line(lastline, line, 3, pTransDraw, DECO16_LAYER_PRIORITY(0x01) | DECO16_LAYER_OPAQUE);
2119 	if (nSpriteEnable &  2) deco16_draw_layer_by_line(lastline, line, 2, pTransDraw, DECO16_LAYER_PRIORITY(0x02));
2120 	if (nSpriteEnable &  4) deco16_draw_layer_by_line(lastline, line, 1, pTransDraw, DECO16_LAYER_PRIORITY(0x04));
2121 
2122 	lastline = line;
2123 
2124 	return 0;
2125 }
2126 
EdrandyDraw()2127 static INT32 EdrandyDraw()
2128 {
2129 //	if (DrvRecalc) {
2130 		deco16_palette_recalculate(DrvPalette, DrvPalRAM);
2131 		DrvRecalc = 0;
2132 //	}
2133 
2134 	if (nBurnLayer & 1) cninja_draw_sprites(0);
2135 
2136 	if (nSpriteEnable &  8) deco16_draw_layer(0, pTransDraw, 0);
2137 
2138 	BurnTransferCopy(DrvPalette);
2139 
2140 	return 0;
2141 }
2142 
Robocop2StartDraw()2143 static INT32 Robocop2StartDraw()
2144 {
2145 	deco16_clear_prio_map();
2146 
2147 	BurnTransferClear(0x200);
2148 
2149 	lastline = 0;
2150 
2151 	return 0;
2152 }
2153 
Robocop2DrawScanline(INT32 line)2154 static INT32 Robocop2DrawScanline(INT32 line)
2155 {
2156 	if (line > nScreenHeight) return 0;
2157 
2158 	deco16_pf12_update();
2159 	deco16_pf34_update();
2160 
2161 	INT32 layer_8bpp = 0;
2162 
2163 	if (deco16_priority & 4)
2164 	{
2165 		deco16_set_color_mask(2, 0);
2166 		deco16_set_color_mask(3, 0);
2167 		deco16_set_graphics(2, DrvGfxROM4, 0x100000, 16);
2168 		layer_8bpp = DECO16_LAYER_8BITSPERPIXEL;
2169 	}
2170 	else
2171 	{
2172 		deco16_set_color_mask(2, 0xf);
2173 		deco16_set_color_mask(3, 0xf);
2174 		deco16_set_graphics(2, DrvGfxROM2, 0x300000, 16);
2175 
2176 		if (nSpriteEnable &  1) deco16_draw_layer_by_line(lastline, line, 3, pTransDraw, DECO16_LAYER_OPAQUE | DECO16_LAYER_PRIORITY(0x01));
2177 	}
2178 
2179 	if (deco16_priority & 8) {
2180 		if (nSpriteEnable &  2) deco16_draw_layer_by_line(lastline, line, 1, pTransDraw, DECO16_LAYER_PRIORITY(0x02));
2181 		if (nSpriteEnable &  4) deco16_draw_layer_by_line(lastline, line, 2, pTransDraw, DECO16_LAYER_PRIORITY(0x04) | layer_8bpp);
2182 	} else {
2183 		if (nSpriteEnable &  2) deco16_draw_layer_by_line(lastline, line, 2, pTransDraw, DECO16_LAYER_PRIORITY(0x02) | layer_8bpp);
2184 		if (nSpriteEnable &  4) deco16_draw_layer_by_line(lastline, line, 1, pTransDraw, DECO16_LAYER_PRIORITY(0x04));
2185 	}
2186 
2187 	lastline = line;
2188 
2189 	return 0;
2190 }
2191 
Robocop2Draw()2192 static INT32 Robocop2Draw()
2193 {
2194 //	if (DrvRecalc) {
2195 		deco16_palette_recalculate(DrvPalette, DrvPalRAM);
2196 		DrvRecalc = 0;
2197 //	}
2198 
2199 	cninja_draw_sprites(64);
2200 
2201 	if (nSpriteEnable &  8) deco16_draw_layer(0, pTransDraw, 0);
2202 
2203 	BurnTransferCopy(DrvPalette);
2204 
2205 	return 0;
2206 }
2207 
2208 
MutantfDraw()2209 static INT32 MutantfDraw()
2210 {
2211 //	if (DrvRecalc) {
2212 		deco16_palette_recalculate(DrvPalette, DrvPalRAM);
2213 		DrvRecalc = 0;
2214 //	}
2215 
2216 	deco16_pf12_update();
2217 	deco16_pf34_update();
2218 
2219 	BurnTransferClear(0x400);
2220 
2221 	if (nSpriteEnable &  1) deco16_draw_layer(3, pTransDraw, DECO16_LAYER_OPAQUE);
2222 	if (nSpriteEnable &  2) deco16_draw_layer(1, pTransDraw, 0);
2223 	if (nSpriteEnable &  4) deco16_draw_layer(2, pTransDraw, 0);
2224 
2225 	if (deco16_priority & 1)
2226 	{
2227 		deco16_clear_prio_map();
2228 		mutantf_draw_sprites(DrvSprBuf,  DrvGfxROM3, 0x100, 3);
2229 		deco16_clear_prio_map();
2230 		mutantf_draw_sprites(DrvSprBuf1, DrvGfxROM4, 0x700, 4);
2231 	}
2232 	else
2233 	{
2234 		deco16_clear_prio_map();
2235 		mutantf_draw_sprites(DrvSprBuf1, DrvGfxROM4, 0x700, 4);
2236 		deco16_clear_prio_map();
2237 		mutantf_draw_sprites(DrvSprBuf,  DrvGfxROM3, 0x100, 3);
2238 	}
2239 
2240 	if (nSpriteEnable & 8) deco16_draw_layer(0, pTransDraw, 0);
2241 
2242 	BurnTransferCopy(DrvPalette);
2243 
2244 	return 0;
2245 }
2246 
CninjaFrame()2247 static INT32 CninjaFrame()
2248 {
2249 	if (DrvReset) {
2250 		DrvDoReset();
2251 	}
2252 
2253 	{
2254 		memset (DrvInputs, 0xff, 2 * sizeof(INT16));
2255 		for (INT32 i = 0; i < 16; i++) {
2256 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
2257 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
2258 		}
2259 		DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0);
2260 	}
2261 
2262 	INT32 nInterleave = 232; //58 * 4
2263 	INT32 nSoundBufferPos = 0;
2264 	INT32 nCyclesTotal[2] = { 12000000 / 58, 4027500 / 58 };
2265 	INT32 nCyclesDone[2] = { 0, 0 };
2266 
2267 	h6280NewFrame();
2268 
2269 	SekOpen(0);
2270 	h6280Open(0);
2271 
2272 	deco16_vblank = 0x00;
2273 
2274 	for (INT32 i = 0; i < nInterleave; i++)
2275 	{
2276 		nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave);
2277 		BurnTimerUpdate((i + 1) * nCyclesTotal[1] / nInterleave);
2278 
2279 		if (irq_timer == i) {
2280 			SekSetIRQLine((irq_mask & 0x10) ? 3 : 4, CPU_IRQSTATUS_ACK);
2281 			irq_timer = -1;
2282 		}
2283 		if (i == 206) deco16_vblank = 0x08;
2284 
2285 		if (pBurnSoundOut && i&1) {
2286 			INT32 nSegmentLength = nBurnSoundLen / (nInterleave / 2);
2287 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2288 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
2289 			nSoundBufferPos += nSegmentLength;
2290 		}
2291 	}
2292 
2293 	SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
2294 	BurnTimerEndFrame(nCyclesTotal[1]);
2295 
2296 	if (pBurnSoundOut) {
2297 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
2298 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2299 
2300 		if (nSegmentLength) {
2301 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
2302 		}
2303 
2304 		BurnYM2203Update(pBurnSoundOut, nBurnSoundLen);
2305 	}
2306 
2307 	h6280Close();
2308 	SekClose();
2309 
2310 	if (pBurnDraw) {
2311 		BurnDrvRedraw();
2312 	}
2313 
2314 	return 0;
2315 }
2316 
EdrandyFrame()2317 static INT32 EdrandyFrame()
2318 {
2319 	if (DrvReset) {
2320 		DrvDoReset();
2321 	}
2322 
2323 	{
2324 		memset (DrvInputs, 0xff, 2 * sizeof(INT16));
2325 		for (INT32 i = 0; i < 16; i++) {
2326 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
2327 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
2328 		}
2329 		DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0);
2330 	}
2331 
2332 	INT32 nInterleave = 256; // scanlines
2333 	INT32 nSoundBufferPos = 0;
2334 	INT32 nCyclesTotal[2] = { 12000000 / 58, 4027500 / 58 };
2335 	INT32 nCyclesDone[2] = { 0, 0 };
2336 
2337 	h6280NewFrame();
2338 
2339 	SekOpen(0);
2340 	h6280Open(0);
2341 
2342 	deco16_vblank = 0x00;
2343 	EdrandyStartDraw();
2344 
2345 	for (INT32 i = 0; i < nInterleave; i++)
2346 	{
2347 		if (irq_timer == i) {
2348 			if (i >= 8 && i < 248) EdrandyDrawScanline(i-8);
2349 			SekSetIRQLine((irq_mask & 0x10) ? 3 : 4, CPU_IRQSTATUS_ACK);
2350 			irq_timer = -1;
2351 		}
2352 		nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave);
2353 		BurnTimerUpdate((i + 1) * nCyclesTotal[1] / nInterleave);
2354 
2355 		if (i == 248) {
2356 			EdrandyDrawScanline(i-8);
2357 			SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
2358 			deco16_vblank = 0x08;
2359 		}
2360 
2361 		if (pBurnSoundOut && i%4 == 3) {
2362 			INT32 nSegmentLength = nBurnSoundLen / (nInterleave / 4);
2363 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2364 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
2365 			nSoundBufferPos += nSegmentLength;
2366 		}
2367 	}
2368 
2369 	BurnTimerEndFrame(nCyclesTotal[1]);
2370 
2371 	if (pBurnSoundOut) {
2372 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
2373 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2374 
2375 		if (nSegmentLength) {
2376 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
2377 		}
2378 
2379 		BurnYM2203Update(pBurnSoundOut, nBurnSoundLen);
2380 	}
2381 
2382 	h6280Close();
2383 	SekClose();
2384 
2385 	if (pBurnDraw) {
2386 		BurnDrvRedraw();
2387 	}
2388 
2389 	return 0;
2390 }
2391 
Robocop2Frame()2392 static INT32 Robocop2Frame()
2393 {
2394 	if (DrvReset) {
2395 		DrvDoReset();
2396 	}
2397 
2398 	{
2399 		memset (DrvInputs, 0xff, 2 * sizeof(INT16));
2400 		for (INT32 i = 0; i < 16; i++) {
2401 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
2402 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
2403 		}
2404 		DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0);
2405 	}
2406 
2407 	INT32 nInterleave = 256;	// scanlines
2408 	INT32 nSoundBufferPos = 0;
2409 	INT32 nCyclesTotal[2] = { 14000000 / 58, 4027500 / 58 };
2410 	INT32 nCyclesDone[2] = { 0, 0 };
2411 
2412 	h6280NewFrame();
2413 
2414 	SekOpen(0);
2415 	h6280Open(0);
2416 
2417 	deco16_vblank = 0x08;
2418 
2419 	Robocop2StartDraw();
2420 
2421 	for (INT32 i = 0; i < nInterleave; i++)
2422 	{
2423 		nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave);
2424 		BurnTimerUpdate((i + 1) * nCyclesTotal[1] / nInterleave);
2425 
2426 		if (irq_timer == i) {
2427 			if (i >= 8 && i < 248) Robocop2DrawScanline(i-8);
2428 			SekSetIRQLine((irq_mask & 0x10) ? 3 : 4, CPU_IRQSTATUS_ACK);
2429 			irq_timer = -1;
2430 		}
2431 
2432 		if (i >= 8) {
2433 			deco16_vblank = 0;
2434 		}
2435 
2436 		if (i == 248) {
2437 			Robocop2DrawScanline(i-8);
2438 			deco16_vblank = 0x08;
2439 		}
2440 
2441 		if (pBurnSoundOut && i%8 == 7) {
2442 			INT32 nSegmentLength = nBurnSoundLen / (nInterleave / 8);
2443 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2444 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
2445 			nSoundBufferPos += nSegmentLength;
2446 		}
2447 	}
2448 	SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
2449 
2450 	BurnTimerEndFrame(nCyclesTotal[1]);
2451 
2452 	if (pBurnSoundOut) {
2453 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
2454 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2455 
2456 		if (nSegmentLength) {
2457 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
2458 		}
2459 
2460 		BurnYM2203Update(pBurnSoundOut, nBurnSoundLen);
2461 	}
2462 
2463 	h6280Close();
2464 	SekClose();
2465 
2466 	if (pBurnDraw) {
2467 		BurnDrvRedraw();
2468 	}
2469 
2470 	return 0;
2471 }
2472 
MutantfFrame()2473 static INT32 MutantfFrame()
2474 {
2475 	if (DrvReset) {
2476 		DrvDoReset();
2477 	}
2478 
2479 	{
2480 		memset (DrvInputs, 0xff, 2 * sizeof(INT16));
2481 		for (INT32 i = 0; i < 16; i++) {
2482 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
2483 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
2484 		}
2485 		DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0);
2486 	}
2487 
2488 	INT32 nInterleave = 256;
2489 	INT32 nSoundBufferPos = 0;
2490 	INT32 nCyclesTotal[2] = { 14000000 / 58, 4027500 / 58 };
2491 	INT32 nCyclesDone[2] = { 0, 0 };
2492 
2493 	h6280NewFrame();
2494 
2495 	SekOpen(0);
2496 	h6280Open(0);
2497 
2498 	deco16_vblank = 0;
2499 
2500 	for (INT32 i = 0; i < nInterleave; i++)
2501 	{
2502 		nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave);
2503 		nCyclesDone[1] += h6280Run(nCyclesTotal[1] / nInterleave);
2504 
2505 		if (i == 240) deco16_vblank = 0x08;
2506 
2507 		if (pBurnSoundOut && i%4 == 3) {
2508 			INT32 nSegmentLength = nBurnSoundLen / (nInterleave / 4);
2509 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2510 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
2511 			nSoundBufferPos += nSegmentLength;
2512 		}
2513 	}
2514 
2515 	SekSetIRQLine(6, CPU_IRQSTATUS_AUTO);
2516 
2517 	if (pBurnSoundOut) {
2518 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
2519 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2520 
2521 		if (nSegmentLength) {
2522 			deco16SoundUpdate(pSoundBuf, nSegmentLength);
2523 		}
2524 	}
2525 
2526 	h6280Close();
2527 	SekClose();
2528 
2529 	if (pBurnDraw) {
2530 		MutantfDraw();
2531 	}
2532 
2533 	return 0;
2534 }
2535 
StoneageFrame()2536 static INT32 StoneageFrame()
2537 {
2538 	if (DrvReset) {
2539 		DrvDoReset();
2540 	}
2541 
2542 	{
2543 		memset (DrvInputs, 0xff, 2 * sizeof(INT16));
2544 		for (INT32 i = 0; i < 16; i++) {
2545 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
2546 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
2547 		}
2548 		DrvInputs[2] = (DrvDips[1] << 8) | (DrvDips[0] << 0);
2549 	}
2550 
2551 	INT32 nInterleave = 256;
2552 	INT32 nSoundBufferPos = 0;
2553 	INT32 nCyclesTotal[2] = { 12000000 / 58, 3579545 / 58 };
2554 	INT32 nCyclesDone[2] = { 0, 0 };
2555 
2556 	SekOpen(0);
2557 	ZetOpen(0);
2558 
2559 	deco16_vblank = 0;
2560 
2561 	for (INT32 i = 0; i < nInterleave; i++)
2562 	{
2563 		nCyclesDone[0] += SekRun(nCyclesTotal[0] / nInterleave);
2564 		nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave);
2565 
2566 		if (irq_timer == i) {
2567 			SekSetIRQLine((irq_mask & 0x10) ? 3 : 4, CPU_IRQSTATUS_ACK);
2568 			irq_timer = -1;
2569 		}
2570 		if (i == 248) deco16_vblank = 0x08;
2571 
2572 		if (pBurnSoundOut && i%4 == 3) {
2573 			INT32 nSegmentLength = nBurnSoundLen / (nInterleave / 4);
2574 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2575 			BurnYM2151Render(pSoundBuf, nSegmentLength);
2576 			MSM6295Render(pSoundBuf, nSegmentLength);
2577 			nSoundBufferPos += nSegmentLength;
2578 		}
2579 	}
2580 
2581 	SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
2582 
2583 	if (pBurnSoundOut) {
2584 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
2585 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2586 		if (nSegmentLength) {
2587 			BurnYM2151Render(pSoundBuf, nSegmentLength);
2588 			MSM6295Render(pSoundBuf, nSegmentLength);
2589 		}
2590 	}
2591 
2592 	ZetClose();
2593 	SekClose();
2594 
2595 	if (pBurnDraw) {
2596 		BurnDrvRedraw();
2597 	}
2598 
2599 	return 0;
2600 }
2601 
DrvScan(INT32 nAction,INT32 * pnMin)2602 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
2603 {
2604 	struct BurnArea ba;
2605 
2606 	if (pnMin != NULL) {
2607 		*pnMin = 0x029722;
2608 	}
2609 
2610 	if (nAction & ACB_MEMORY_RAM) {
2611 		memset(&ba, 0, sizeof(ba));
2612 		ba.Data	  = AllRam;
2613 		ba.nLen	  = RamEnd-AllRam;
2614 		ba.szName = "All Ram";
2615 		BurnAcb(&ba);
2616 	}
2617 
2618 	if (nAction & ACB_DRIVER_DATA) {
2619 		SekScan(nAction);
2620 
2621 		deco16SoundScan(nAction, pnMin);
2622 
2623 		deco16Scan();
2624 
2625 		SCAN_VAR(scanline);
2626 		SCAN_VAR(irq_mask);
2627 		SCAN_VAR(irq_timer);
2628 
2629 		SCAN_VAR(DrvOkiBank);
2630 		DrvYM2151WritePort(0, DrvOkiBank);
2631 	}
2632 
2633 	return 0;
2634 }
2635 
StoneageScan(INT32 nAction,INT32 * pnMin)2636 static INT32 StoneageScan(INT32 nAction, INT32 *pnMin)
2637 {
2638 	struct BurnArea ba;
2639 
2640 	if (pnMin != NULL) {
2641 		*pnMin = 0x029722;
2642 	}
2643 
2644 	if (nAction & ACB_MEMORY_RAM) {
2645 		memset(&ba, 0, sizeof(ba));
2646 		ba.Data	  = AllRam;
2647 		ba.nLen	  = RamEnd-AllRam;
2648 		ba.szName = "All Ram";
2649 		BurnAcb(&ba);
2650 	}
2651 
2652 	if (nAction & ACB_DRIVER_DATA) {
2653 		SekScan(nAction);
2654 		ZetScan(nAction);
2655 		BurnYM2151Scan(nAction, pnMin);
2656 		MSM6295Scan(nAction, pnMin);
2657 
2658 		deco16Scan();
2659 
2660 		SCAN_VAR(scanline);
2661 		SCAN_VAR(irq_mask);
2662 		SCAN_VAR(irq_timer);
2663 
2664 		SCAN_VAR(DrvOkiBank);
2665 	}
2666 
2667 	return 0;
2668 }
2669 
2670 
2671 // Caveman Ninja (World ver 4)
2672 
2673 static struct BurnRomInfo cninjaRomDesc[] = {
2674 	{ "gn-02-3.1k",		0x020000, 0x39aea12a, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2675 	{ "gn-05-2.3k",		0x020000, 0x0f4360ef, 1 | BRF_PRG | BRF_ESS }, //  1
2676 	{ "gn-01-2.1j",		0x020000, 0xf740ef7e, 1 | BRF_PRG | BRF_ESS }, //  2
2677 	{ "gn-04-2.3j",		0x020000, 0xc98fcb62, 1 | BRF_PRG | BRF_ESS }, //  3
2678 	{ "gn-00.1h",		0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, //  4
2679 	{ "gn-03.1k",		0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, //  5
2680 
2681 	{ "gl-07.13k",		0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, //  6 Huc6280 Code
2682 
2683 	{ "gl-08.6y",		0x010000, 0x33a2b400, 3 | BRF_GRA }, 	       //  7 Characters
2684 	{ "gl-09.6z",		0x010000, 0x5a2d4752, 3 | BRF_GRA }, 	       //  8
2685 
2686 	{ "mag-02.4z",		0x080000, 0xde89c69a, 4 | BRF_GRA }, 	       //  9 Foreground Tiles
2687 
2688 	{ "mag-00.1y",		0x080000, 0xa8f05d33, 5 | BRF_GRA }, 	       // 10 Background Tiles
2689 	{ "mag-01.1z",		0x080000, 0x5b399eed, 5 | BRF_GRA }, 	       // 11
2690 
2691 	{ "mag-03.9y",		0x080000, 0x2220eb9f, 6 | BRF_GRA }, 	       // 12 Sprites
2692 	{ "mag-05.12y",		0x080000, 0x56a53254, 6 | BRF_GRA }, 	       // 13
2693 	{ "mag-04.9z",		0x080000, 0x144b94cc, 6 | BRF_GRA }, 	       // 14
2694 	{ "mag-06.12z",		0x080000, 0x82d44749, 6 | BRF_GRA }, 	       // 15
2695 
2696 	{ "gl-06.13j",		0x020000, 0xd92e519d, 7 | BRF_SND }, 	       // 16 OKI M6295 Samples 0
2697 
2698 	{ "mag-07.13f",		0x080000, 0x08eb5264, 8 | BRF_SND }, 	       // 17 OKI M6295 Samples 1
2699 
2700 	{ "mb7122h.7v",		0x000400, 0xa1267336, 0 | BRF_OPT }, 	       // 18 Unused PROMs
2701 
2702 	{ "tj-00.9j",		0x000117, 0x46defe8f, 0 | BRF_OPT }, 	       // 19 PLDs
2703 	{ "tj-01.9h",		0x000117, 0x7a86902d, 0 | BRF_OPT }, 	       // 20
2704 	{ "tj-02.9h",		0x000117, 0xb476d59c, 0 | BRF_OPT }, 	       // 21
2705 	{ "tj-03.9e",		0x000117, 0xcfb6e4aa, 0 | BRF_OPT }, 	       // 22
2706 	{ "tj-04.5n",		0x000117, 0xbca07086, 0 | BRF_OPT }, 	       // 23
2707 	{ "tj-05.1r",		0x000117, 0x0dfc091b, 0 | BRF_OPT }, 	       // 24
2708 };
2709 
2710 STD_ROM_PICK(cninja)
2711 STD_ROM_FN(cninja)
2712 
2713 struct BurnDriver BurnDrvCninja = {
2714 	"cninja", NULL, NULL, NULL, "1991",
2715 	"Caveman Ninja (World ver 4)\0", NULL, "Data East Corporation", "DECO IC16",
2716 	NULL, NULL, NULL, NULL,
2717 	BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0,
2718 	NULL, cninjaRomInfo, cninjaRomName, NULL, NULL, NULL, NULL, DrvInputInfo, CninjaDIPInfo,
2719 	CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800,
2720 	256, 240, 4, 3
2721 };
2722 
2723 
2724 // Caveman Ninja (World ver 1)
2725 
2726 static struct BurnRomInfo cninja1RomDesc[] = {
2727 	{ "gn-02.1k",		0x020000, 0xa6c40959, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2728 	{ "gn-05.3k",		0x020000, 0xa002cbe4, 1 | BRF_PRG | BRF_ESS }, //  1
2729 	{ "gn-01.1j",		0x020000, 0x18f0527c, 1 | BRF_PRG | BRF_ESS }, //  2
2730 	{ "gn-04.3j",		0x020000, 0xea4b6d53, 1 | BRF_PRG | BRF_ESS }, //  3
2731 	{ "gn-00.1h",		0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, //  4
2732 	{ "gn-03.1k",		0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, //  5
2733 
2734 	{ "gl-07.13k",		0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, //  6 Huc6280 Code
2735 
2736 	{ "gl-08.6y",		0x010000, 0x33a2b400, 3 | BRF_GRA }, 	       //  7 Characters
2737 	{ "gl-09.6z",		0x010000, 0x5a2d4752, 3 | BRF_GRA }, 	       //  8
2738 
2739 	{ "mag-02.4z",		0x080000, 0xde89c69a, 4 | BRF_GRA }, 	       //  9 Foreground Tiles
2740 
2741 	{ "mag-00.1y",		0x080000, 0xa8f05d33, 5 | BRF_GRA }, 	       // 10 Background Tiles
2742 	{ "mag-01.1z",		0x080000, 0x5b399eed, 5 | BRF_GRA }, 	       // 11
2743 
2744 	{ "mag-03.9y",		0x080000, 0x2220eb9f, 6 | BRF_GRA }, 	       // 12 Sprites
2745 	{ "mag-05.12y",		0x080000, 0x56a53254, 6 | BRF_GRA }, 	       // 13
2746 	{ "mag-04.9z",		0x080000, 0x144b94cc, 6 | BRF_GRA }, 	       // 14
2747 	{ "mag-06.12z",		0x080000, 0x82d44749, 6 | BRF_GRA }, 	       // 15
2748 
2749 	{ "gl-06.13j",		0x020000, 0xd92e519d, 7 | BRF_SND }, 	       // 16 OKI M6295 Samples 0
2750 
2751 	{ "mag-07.13f",		0x080000, 0x08eb5264, 8 | BRF_SND }, 	       // 17 OKI M6295 Samples 1
2752 
2753 	{ "mb7122h.7v",		0x000400, 0xa1267336, 0 | BRF_OPT }, 	       // 18 Unused PROMs
2754 
2755 	{ "tj-00.9j",		0x000117, 0x46defe8f, 0 | BRF_OPT }, 	       // 19 PLDs
2756 	{ "tj-01.9h",		0x000117, 0x7a86902d, 0 | BRF_OPT }, 	       // 20
2757 	{ "tj-02.9h",		0x000117, 0xb476d59c, 0 | BRF_OPT }, 	       // 21
2758 	{ "tj-03.9e",		0x000117, 0xcfb6e4aa, 0 | BRF_OPT }, 	       // 22
2759 	{ "tj-04.5n",		0x000117, 0xbca07086, 0 | BRF_OPT }, 	       // 23
2760 	{ "tj-05.1r",		0x000117, 0x0dfc091b, 0 | BRF_OPT }, 	       // 24
2761 };
2762 
2763 STD_ROM_PICK(cninja1)
2764 STD_ROM_FN(cninja1)
2765 
2766 struct BurnDriver BurnDrvCninja1 = {
2767 	"cninja1", "cninja", NULL, NULL, "1991",
2768 	"Caveman Ninja (World ver 1)\0", NULL, "Data East Corporation", "DECO IC16",
2769 	NULL, NULL, NULL, NULL,
2770 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0,
2771 	NULL, cninja1RomInfo, cninja1RomName, NULL, NULL, NULL, NULL, DrvInputInfo, CninjaDIPInfo,
2772 	CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800,
2773 	256, 240, 4, 3
2774 };
2775 
2776 
2777 // Caveman Ninja (US ver 4)
2778 
2779 static struct BurnRomInfo cninjauRomDesc[] = {
2780 	{ "gm-02-3.1k",		0x020000, 0xd931c3b1, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2781 	{ "gm-05-2.3k",		0x020000, 0x7417d3fb, 1 | BRF_PRG | BRF_ESS }, //  1
2782 	{ "gm-01-2.1j",		0x020000, 0x72041f7e, 1 | BRF_PRG | BRF_ESS }, //  2
2783 	{ "gm-04-2.3j",		0x020000, 0x2104d005, 1 | BRF_PRG | BRF_ESS }, //  3
2784 	{ "gn-00.1h",		0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, //  4
2785 	{ "gn-03.1k",		0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, //  5
2786 
2787 	{ "gl-07.13k",		0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, //  6 Huc6280 Code
2788 
2789 	{ "gl-08.6y",		0x010000, 0x33a2b400, 3 | BRF_GRA }, 	       //  7 Characters
2790 	{ "gl-09.6z",		0x010000, 0x5a2d4752, 3 | BRF_GRA }, 	       //  8
2791 
2792 	{ "mag-02.4z",		0x080000, 0xde89c69a, 4 | BRF_GRA }, 	       //  9 Foreground Tiles
2793 
2794 	{ "mag-00.1y",		0x080000, 0xa8f05d33, 5 | BRF_GRA }, 	       // 10 Background Tiles
2795 	{ "mag-01.1z",		0x080000, 0x5b399eed, 5 | BRF_GRA }, 	       // 11
2796 
2797 	{ "mag-03.9y",		0x080000, 0x2220eb9f, 6 | BRF_GRA }, 	       // 12 Sprites
2798 	{ "mag-05.12y",		0x080000, 0x56a53254, 6 | BRF_GRA }, 	       // 13
2799 	{ "mag-04.9z",		0x080000, 0x144b94cc, 6 | BRF_GRA }, 	       // 14
2800 	{ "mag-06.12z",		0x080000, 0x82d44749, 6 | BRF_GRA }, 	       // 15
2801 
2802 	{ "gl-06.13j",		0x020000, 0xd92e519d, 7 | BRF_SND }, 	       // 16 OKI M6295 Samples 0
2803 
2804 	{ "mag-07.13f",		0x080000, 0x08eb5264, 8 | BRF_SND }, 	       // 17 OKI M6295 Samples 1
2805 
2806 	{ "mb7122h.7v",		0x000400, 0xa1267336, 0 | BRF_OPT }, 	       // 18 Unused PROMs
2807 
2808 	{ "tj-00.9j",		0x000117, 0x46defe8f, 0 | BRF_OPT }, 	       // 19 PLDs
2809 	{ "tj-01.9h",		0x000117, 0x7a86902d, 0 | BRF_OPT }, 	       // 20
2810 	{ "tj-02.9h",		0x000117, 0xb476d59c, 0 | BRF_OPT }, 	       // 21
2811 	{ "tj-03.9e",		0x000117, 0xcfb6e4aa, 0 | BRF_OPT }, 	       // 22
2812 	{ "tj-04.5n",		0x000117, 0xbca07086, 0 | BRF_OPT }, 	       // 23
2813 	{ "tj-05.1r",		0x000117, 0x0dfc091b, 0 | BRF_OPT }, 	       // 24
2814 };
2815 
2816 STD_ROM_PICK(cninjau)
2817 STD_ROM_FN(cninjau)
2818 
2819 struct BurnDriver BurnDrvCninjau = {
2820 	"cninjau", "cninja", NULL, NULL, "1991",
2821 	"Caveman Ninja (US ver 4)\0", NULL, "Data East Corporation", "DECO IC16",
2822 	NULL, NULL, NULL, NULL,
2823 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0,
2824 	NULL, cninjauRomInfo, cninjauRomName, NULL, NULL, NULL, NULL, DrvInputInfo, CninjauDIPInfo,
2825 	CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800,
2826 	256, 240, 4, 3
2827 };
2828 
2829 
2830 // Tatakae Genshizin Joe & Mac (Japan ver 1)
2831 
2832 static struct BurnRomInfo joemacRomDesc[] = {
2833 	{ "gl-02-2.1k",		0x020000, 0x80da12e2, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2834 	{ "gl-05-2.3k",		0x020000, 0xfe4dbbbb, 1 | BRF_PRG | BRF_ESS }, //  1
2835 	{ "gl-01-2.1j",		0x020000, 0x0b245307, 1 | BRF_PRG | BRF_ESS }, //  2
2836 	{ "gl-04-2.3j",		0x020000, 0x1b331f61, 1 | BRF_PRG | BRF_ESS }, //  3
2837 	{ "gn-00.1h",		0x020000, 0x0b110b16, 1 | BRF_PRG | BRF_ESS }, //  4
2838 	{ "gn-03.1k",		0x020000, 0x1e28e697, 1 | BRF_PRG | BRF_ESS }, //  5
2839 
2840 	{ "gl-07.13k",		0x010000, 0xca8bef96, 2 | BRF_PRG | BRF_ESS }, //  6 Huc6280 Code
2841 
2842 	{ "gl-08.6y",		0x010000, 0x33a2b400, 3 | BRF_GRA }, 	       //  7 Characters
2843 	{ "gl-09.6z",		0x010000, 0x5a2d4752, 3 | BRF_GRA }, 	       //  8
2844 
2845 	{ "mag-02.4z",		0x080000, 0xde89c69a, 4 | BRF_GRA }, 	       //  9 Foreground Tiles
2846 
2847 	{ "mag-00.1y",		0x080000, 0xa8f05d33, 5 | BRF_GRA }, 	       // 10 Background Tiles
2848 	{ "mag-01.1z",		0x080000, 0x5b399eed, 5 | BRF_GRA }, 	       // 11
2849 
2850 	{ "mag-03.9y",		0x080000, 0x2220eb9f, 6 | BRF_GRA }, 	       // 12 Sprites
2851 	{ "mag-05.12y",		0x080000, 0x56a53254, 6 | BRF_GRA }, 	       // 13
2852 	{ "mag-04.9z",		0x080000, 0x144b94cc, 6 | BRF_GRA }, 	       // 14
2853 	{ "mag-06.12z",		0x080000, 0x82d44749, 6 | BRF_GRA }, 	       // 15
2854 
2855 	{ "gl-06.13j",		0x020000, 0xd92e519d, 7 | BRF_SND }, 	       // 16 OKI M6295 Samples 0
2856 
2857 	{ "mag-07.13f",		0x080000, 0x08eb5264, 8 | BRF_SND }, 	       // 17 OKI M6295 Samples 1
2858 
2859 	{ "mb7122h.7v",		0x000400, 0xa1267336, 0 | BRF_OPT }, 	       // 18 Unused PROMs
2860 
2861 	{ "tj-00.9j",		0x000117, 0x46defe8f, 0 | BRF_OPT }, 	       // 19 PLDs
2862 	{ "tj-01.9h",		0x000117, 0x7a86902d, 0 | BRF_OPT }, 	       // 20
2863 	{ "tj-02.9h",		0x000117, 0xb476d59c, 0 | BRF_OPT }, 	       // 21
2864 	{ "tj-03.9e",		0x000117, 0xcfb6e4aa, 0 | BRF_OPT }, 	       // 22
2865 	{ "tj-04.5n",		0x000117, 0xbca07086, 0 | BRF_OPT }, 	       // 23
2866 	{ "tj-05.1r",		0x000117, 0x0dfc091b, 0 | BRF_OPT }, 	       // 24
2867 };
2868 
2869 STD_ROM_PICK(joemac)
2870 STD_ROM_FN(joemac)
2871 
2872 struct BurnDriver BurnDrvJoemac = {
2873 	"joemac", "cninja", NULL, NULL, "1991",
2874 	"Tatakae Genshizin Joe & Mac (Japan ver 1)\0", NULL, "Data East Corporation", "DECO IC16",
2875 	NULL, NULL, NULL, NULL,
2876 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0,
2877 	NULL, joemacRomInfo, joemacRomName, NULL, NULL, NULL, NULL, DrvInputInfo, CninjaDIPInfo,
2878 	CninjaInit, DrvExit, CninjaFrame, CninjaDraw, DrvScan, &DrvRecalc, 0x800,
2879 	256, 240, 4, 3
2880 };
2881 
2882 
2883 // Stoneage (bootleg of Caveman Ninja)
2884 
2885 static struct BurnRomInfo stoneageRomDesc[] = {
2886 	{ "sa_1_019.bin",	0x020000, 0x7fb8c44f, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2887 	{ "sa_1_033.bin",	0x020000, 0x961c752b, 1 | BRF_PRG | BRF_ESS }, //  1
2888 	{ "sa_1_018.bin",	0x020000, 0xa4043022, 1 | BRF_PRG | BRF_ESS }, //  2
2889 	{ "sa_1_032.bin",	0x020000, 0xf52a3286, 1 | BRF_PRG | BRF_ESS }, //  3
2890 	{ "sa_1_017.bin",	0x020000, 0x08d6397a, 1 | BRF_PRG | BRF_ESS }, //  4
2891 	{ "sa_1_031.bin",	0x020000, 0x103079f5, 1 | BRF_PRG | BRF_ESS }, //  5
2892 
2893 	{ "sa_1_012.bin",	0x010000, 0x56058934, 2 | BRF_PRG | BRF_ESS }, //  6 Huc6280 Code
2894 
2895 	{ "gl-08.rom",		0x010000, 0x33a2b400, 3 | BRF_GRA }, 	       //  7 Characters
2896 	{ "gl-09.rom",		0x010000, 0x5a2d4752, 3 | BRF_GRA }, 	       //  8
2897 
2898 	{ "mag-02.rom",		0x080000, 0xde89c69a, 4 | BRF_GRA }, 	       //  9 Foreground Tiles
2899 
2900 	{ "mag-00.rom",		0x080000, 0xa8f05d33, 5 | BRF_GRA }, 	       // 10 Background Tiles
2901 	{ "mag-01.rom",		0x080000, 0x5b399eed, 5 | BRF_GRA }, 	       // 11
2902 
2903 	{ "mag-03.rom",		0x080000, 0x2220eb9f, 6 | BRF_GRA }, 	       // 12 Sprites
2904 	{ "mag-05.rom",		0x080000, 0x56a53254, 6 | BRF_GRA }, 	       // 13
2905 	{ "mag-04.rom",		0x080000, 0x144b94cc, 6 | BRF_GRA }, 	       // 14
2906 	{ "mag-06.rom",		0x080000, 0x82d44749, 6 | BRF_GRA }, 	       // 15
2907 
2908 	{ "sa_1_069.bin",	0x040000, 0x2188f3ca, 7 | BRF_SND }, 	       // 16 OKI M6295 Samples
2909 };
2910 
2911 STD_ROM_PICK(stoneage)
2912 STD_ROM_FN(stoneage)
2913 
2914 struct BurnDriver BurnDrvStoneage = {
2915 	"stoneage", "cninja", NULL, NULL, "1991",
2916 	"Stoneage (bootleg of Caveman Ninja)\0", NULL, "bootleg", "DECO IC16",
2917 	NULL, NULL, NULL, NULL,
2918 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0,
2919 	NULL, stoneageRomInfo, stoneageRomName, NULL, NULL, NULL, NULL, DrvInputInfo, CninjaDIPInfo,
2920 	StoneageInit, DrvExit, StoneageFrame, CninjaDraw, StoneageScan, &DrvRecalc, 0x800,
2921 	256, 240, 4, 3
2922 };
2923 
2924 
2925 // Caveman Ninja (bootleg)
2926 
2927 static struct BurnRomInfo cninjablRomDesc[] = {
2928 	{ "joe mac 3.68k",		0x080000, 0xdc931d80, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2929 	{ "joe mac 4.68k",		0x080000, 0xe8dfe0b5, 1 | BRF_PRG | BRF_ESS }, //  1
2930 
2931 	{ "joe mac 5.z80",		0x010000, 0xd791b9d7, 2 | BRF_PRG | BRF_ESS }, //  2 Huc6280 Code
2932 
2933 	{ "joe mac 1.gfx",		0x200000, 0x17ea5931, 3 | BRF_GRA }, 	       //  3 Graphics (Expanded on init)
2934 	{ "joe mac 2.gfx",		0x200000, 0xcc95317b, 3 | BRF_GRA }, 	       //  4
2935 
2936 	{ "joe mac 6.samples",	0x080000, 0xdbecad83, 4 | BRF_SND }, 	       //  5 OKI M6295 Samples
2937 };
2938 
2939 STD_ROM_PICK(cninjabl)
2940 STD_ROM_FN(cninjabl)
2941 
2942 struct BurnDriver BurnDrvCninjabl = {
2943 	"cninjabl", "cninja", NULL, NULL, "1991",
2944 	"Caveman Ninja (bootleg)\0", NULL, "bootleg", "DECO IC16",
2945 	NULL, NULL, NULL, NULL,
2946 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_PREFIX_DATAEAST, GBF_PLATFORM, 0,
2947 	NULL, cninjablRomInfo, cninjablRomName, NULL, NULL, NULL, NULL, DrvInputInfo, CninjaDIPInfo,
2948 	CninjablInit, DrvExit, StoneageFrame, CninjablDraw, StoneageScan, &DrvRecalc, 0x800,
2949 	256, 240, 4, 3
2950 };
2951 
2952 
2953 // Mutant Fighter (World ver EM-5)
2954 
2955 static struct BurnRomInfo mutantfRomDesc[] = {
2956 	{ "hd-03-4.2c",		0x020000, 0x94859545, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
2957 	{ "hd-00-4.2a",		0x020000, 0x3cdb648f, 1 | BRF_PRG | BRF_ESS }, //  1
2958 	{ "hd-04-1.4c",		0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, //  2
2959 	{ "hd-01-1.4a",		0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, //  3
2960 
2961 	{ "hd-12.21j",		0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
2962 
2963 	{ "hd-06-1.8d",		0x010000, 0x8b7a558b, 3 | BRF_GRA }, 	       //  5 Characters
2964 	{ "hd-07-1.9d",		0x010000, 0xd2a3d449, 3 | BRF_GRA }, 	       //  6
2965 
2966 	{ "maf-00.8a",		0x080000, 0xe56f528d, 4 | BRF_GRA }, 	       //  7 Foreground Tiles
2967 
2968 	{ "maf-01.9a",		0x080000, 0xc3d5173d, 5 | BRF_GRA }, 	       //  8 Background Tiles
2969 	{ "maf-02.11a",		0x080000, 0x0b37d849, 5 | BRF_GRA }, 	       //  9
2970 
2971 	{ "maf-03.18a",		0x100000, 0xf4366d2c, 6 | BRF_GRA }, 	       // 10 Sprite Bank A
2972 	{ "maf-04.20a",		0x100000, 0x0c8f654e, 6 | BRF_GRA }, 	       // 11
2973 	{ "maf-05.21a",		0x080000, 0xb0cfeb80, 6 | BRF_GRA }, 	       // 12
2974 	{ "maf-06.18d",		0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, 	       // 13
2975 	{ "maf-07.20d",		0x100000, 0xfd6008a3, 6 | BRF_GRA }, 	       // 14
2976 	{ "maf-08.21d",		0x080000, 0xe41cf1e7, 6 | BRF_GRA }, 	       // 15
2977 
2978 	{ "hf-08.15a",		0x010000, 0x93b7279f, 7 | BRF_GRA }, 	       // 16 Sprite Bank B
2979 	{ "hf-09.17a",		0x010000, 0x05e2c074, 7 | BRF_GRA }, 	       // 17
2980 	{ "hf-10.15c",		0x010000, 0x9b06f418, 7 | BRF_GRA }, 	       // 18
2981 	{ "hf-11.17c",		0x010000, 0x3859a531, 7 | BRF_GRA }, 	       // 19
2982 
2983 	{ "maf-10.20l",		0x040000, 0x7c57f48b, 8 | BRF_SND }, 	       // 20 OKI M6295 Samples 0
2984 
2985 	{ "maf-09.18l",		0x080000, 0x28e7ed81, 9 | BRF_SND }, 	       // 21 OKI M6295 Samples 1
2986 };
2987 
2988 STD_ROM_PICK(mutantf)
2989 STD_ROM_FN(mutantf)
2990 
2991 struct BurnDriver BurnDrvMutantf = {
2992 	"mutantf", NULL, NULL, NULL, "1992",
2993 	"Mutant Fighter (World ver EM-5)\0", NULL, "Data East Corporation", "DECO IC16",
2994 	NULL, NULL, NULL, NULL,
2995 	BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0,
2996 	NULL, mutantfRomInfo, mutantfRomName, NULL, NULL, NULL, NULL, DrvInputInfo, MutantfDIPInfo,
2997 	MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800,
2998 	320, 240, 4, 3
2999 };
3000 
3001 
3002 // Mutant Fighter (World ver EM-4)
3003 
3004 static struct BurnRomInfo mutantf4RomDesc[] = {
3005 	{ "hd-03-3.2c",		0x020000, 0xe6f53574, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3006 	{ "hd-00-3.2a",		0x020000, 0xd3055454, 1 | BRF_PRG | BRF_ESS }, //  1
3007 	{ "hd-04-1.4c",		0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, //  2
3008 	{ "hd-01-1.4a",		0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, //  3
3009 
3010 	{ "hd-12.21j",		0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
3011 
3012 	{ "hd-06-1.8d",		0x010000, 0x8b7a558b, 3 | BRF_GRA }, 	       //  5 Characters
3013 	{ "hd-07-1.9d",		0x010000, 0xd2a3d449, 3 | BRF_GRA }, 	       //  6
3014 
3015 	{ "maf-00.8a",		0x080000, 0xe56f528d, 4 | BRF_GRA }, 	       //  7 Foreground Tiles
3016 
3017 	{ "maf-01.9a",		0x080000, 0xc3d5173d, 5 | BRF_GRA }, 	       //  8 Background Tiles
3018 	{ "maf-02.11a",		0x080000, 0x0b37d849, 5 | BRF_GRA }, 	       //  9
3019 
3020 	{ "maf-03.18a",		0x100000, 0xf4366d2c, 6 | BRF_GRA }, 	       // 10 Sprite Bank A
3021 	{ "maf-04.20a",		0x100000, 0x0c8f654e, 6 | BRF_GRA }, 	       // 11
3022 	{ "maf-05.21a",		0x080000, 0xb0cfeb80, 6 | BRF_GRA }, 	       // 12
3023 	{ "maf-06.18d",		0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, 	       // 13
3024 	{ "maf-07.20d",		0x100000, 0xfd6008a3, 6 | BRF_GRA }, 	       // 14
3025 	{ "maf-08.21d",		0x080000, 0xe41cf1e7, 6 | BRF_GRA }, 	       // 15
3026 
3027 	{ "hf-08.15a",		0x010000, 0x93b7279f, 7 | BRF_GRA }, 	       // 16 Sprite Bank B
3028 	{ "hf-09.17a",		0x010000, 0x05e2c074, 7 | BRF_GRA }, 	       // 17
3029 	{ "hf-10.15c",		0x010000, 0x9b06f418, 7 | BRF_GRA }, 	       // 18
3030 	{ "hf-11.17c",		0x010000, 0x3859a531, 7 | BRF_GRA }, 	       // 19
3031 
3032 	{ "maf-10.20l",		0x040000, 0x7c57f48b, 8 | BRF_SND }, 	       // 20 OKI M6295 Samples 0
3033 
3034 	{ "maf-09.18l",		0x080000, 0x28e7ed81, 9 | BRF_SND }, 	       // 21 OKI M6295 Samples 1
3035 };
3036 
3037 STD_ROM_PICK(mutantf4)
3038 STD_ROM_FN(mutantf4)
3039 
3040 struct BurnDriver BurnDrvMutantf4 = {
3041 	"mutantf4", "mutantf", NULL, NULL, "1992",
3042 	"Mutant Fighter (World ver EM-4)\0", NULL, "Data East Corporation", "DECO IC16",
3043 	NULL, NULL, NULL, NULL,
3044 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0,
3045 	NULL, mutantf4RomInfo, mutantf4RomName, NULL, NULL, NULL, NULL, DrvInputInfo, MutantfDIPInfo,
3046 	MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800,
3047 	320, 240, 4, 3
3048 };
3049 
3050 
3051 // Mutant Fighter (World ver EM-3)
3052 
3053 static struct BurnRomInfo mutantf3RomDesc[] = {
3054 	{ "hd-03-2.2c",		0x020000, 0x0586c4fa, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3055 	{ "hd-00-2.2a",		0x020000, 0x6f8ec48e, 1 | BRF_PRG | BRF_ESS }, //  1
3056 	{ "hd-04-1.4c",		0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, //  2
3057 	{ "hd-01-1.4a",		0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, //  3
3058 
3059 	{ "hd-12.21j",		0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
3060 
3061 	{ "hd-06-1.8d",		0x010000, 0x8b7a558b, 3 | BRF_GRA }, 	       //  5 Characters
3062 	{ "hd-07-1.9d",		0x010000, 0xd2a3d449, 3 | BRF_GRA }, 	       //  6
3063 
3064 	{ "maf-00.8a",		0x080000, 0xe56f528d, 4 | BRF_GRA }, 	       //  7 Foreground Tiles
3065 
3066 	{ "maf-01.9a",		0x080000, 0xc3d5173d, 5 | BRF_GRA }, 	       //  8 Background Tiles
3067 	{ "maf-02.11a",		0x080000, 0x0b37d849, 5 | BRF_GRA }, 	       //  9
3068 
3069 	{ "maf-03.18a",		0x100000, 0xf4366d2c, 6 | BRF_GRA }, 	       // 10 Sprite Bank A
3070 	{ "maf-04.20a",		0x100000, 0x0c8f654e, 6 | BRF_GRA }, 	       // 11
3071 	{ "maf-05.21a",		0x080000, 0xb0cfeb80, 6 | BRF_GRA }, 	       // 12
3072 	{ "maf-06.18d",		0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, 	       // 13
3073 	{ "maf-07.20d",		0x100000, 0xfd6008a3, 6 | BRF_GRA }, 	       // 14
3074 	{ "maf-08.21d",		0x080000, 0xe41cf1e7, 6 | BRF_GRA }, 	       // 15
3075 
3076 	{ "hf-08.15a",		0x010000, 0x93b7279f, 7 | BRF_GRA }, 	       // 16 Sprite Bank B
3077 	{ "hf-09.17a",		0x010000, 0x05e2c074, 7 | BRF_GRA }, 	       // 17
3078 	{ "hf-10.15c",		0x010000, 0x9b06f418, 7 | BRF_GRA }, 	       // 18
3079 	{ "hf-11.17c",		0x010000, 0x3859a531, 7 | BRF_GRA }, 	       // 19
3080 
3081 	{ "maf-10.20l",		0x040000, 0x7c57f48b, 8 | BRF_SND }, 	       // 20 OKI M6295 Samples 0
3082 
3083 	{ "maf-09.18l",		0x080000, 0x28e7ed81, 9 | BRF_SND }, 	       // 21 OKI M6295 Samples 1
3084 };
3085 
3086 STD_ROM_PICK(mutantf3)
3087 STD_ROM_FN(mutantf3)
3088 
3089 struct BurnDriver BurnDrvMutantf3 = {
3090 	"mutantf3", "mutantf", NULL, NULL, "1992",
3091 	"Mutant Fighter (World ver EM-3)\0", NULL, "Data East Corporation", "DECO IC16",
3092 	NULL, NULL, NULL, NULL,
3093 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0,
3094 	NULL, mutantf3RomInfo, mutantf3RomName, NULL, NULL, NULL, NULL, DrvInputInfo, MutantfDIPInfo,
3095 	MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800,
3096 	320, 240, 4, 3
3097 };
3098 
3099 
3100 // Mutant Fighter (World ver EM-2)
3101 
3102 static struct BurnRomInfo mutantf2RomDesc[] = {
3103 	{ "hd-03-1.2c",		0x020000, 0x7110cefc, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3104 	{ "hd-00-1.2a",		0x020000, 0xb279875b, 1 | BRF_PRG | BRF_ESS }, //  1
3105 	{ "hd-04-1.4c",		0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, //  2
3106 	{ "hd-01-1.4a",		0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, //  3
3107 
3108 	{ "hd-12.21j",		0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
3109 
3110 	{ "hd-06-1.8d",		0x010000, 0x8b7a558b, 3 | BRF_GRA }, 	       //  5 Characters
3111 	{ "hd-07-1.9d",		0x010000, 0xd2a3d449, 3 | BRF_GRA }, 	       //  6
3112 
3113 	{ "maf-00.8a",		0x080000, 0xe56f528d, 4 | BRF_GRA }, 	       //  7 Foreground Tiles
3114 
3115 	{ "maf-01.9a",		0x080000, 0xc3d5173d, 5 | BRF_GRA }, 	       //  8 Background Tiles
3116 	{ "maf-02.11a",		0x080000, 0x0b37d849, 5 | BRF_GRA }, 	       //  9
3117 
3118 	{ "maf-03.18a",		0x100000, 0xf4366d2c, 6 | BRF_GRA }, 	       // 10 Sprite Bank A
3119 	{ "maf-04.20a",		0x100000, 0x0c8f654e, 6 | BRF_GRA }, 	       // 11
3120 	{ "maf-05.21a",		0x080000, 0xb0cfeb80, 6 | BRF_GRA }, 	       // 12
3121 	{ "maf-06.18d",		0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, 	       // 13
3122 	{ "maf-07.20d",		0x100000, 0xfd6008a3, 6 | BRF_GRA }, 	       // 14
3123 	{ "maf-08.21d",		0x080000, 0xe41cf1e7, 6 | BRF_GRA }, 	       // 15
3124 
3125 	{ "hf-08.15a",		0x010000, 0x93b7279f, 7 | BRF_GRA }, 	       // 16 Sprite Bank B
3126 	{ "hf-09.17a",		0x010000, 0x05e2c074, 7 | BRF_GRA }, 	       // 17
3127 	{ "hf-10.15c",		0x010000, 0x9b06f418, 7 | BRF_GRA }, 	       // 18
3128 	{ "hf-11.17c",		0x010000, 0x3859a531, 7 | BRF_GRA }, 	       // 19
3129 
3130 	{ "maf-10.20l",		0x040000, 0x7c57f48b, 8 | BRF_SND }, 	       // 20 OKI M6295 Samples 0
3131 
3132 	{ "maf-09.18l",		0x080000, 0x28e7ed81, 9 | BRF_SND }, 	       // 21 OKI M6295 Samples 1
3133 };
3134 
3135 STD_ROM_PICK(mutantf2)
3136 STD_ROM_FN(mutantf2)
3137 
3138 struct BurnDriver BurnDrvMutantf2 = {
3139 	"mutantf2", "mutantf", NULL, NULL, "1992",
3140 	"Mutant Fighter (World ver EM-2)\0", NULL, "Data East Corporation", "DECO IC16",
3141 	NULL, NULL, NULL, NULL,
3142 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0,
3143 	NULL, mutantf2RomInfo, mutantf2RomName, NULL, NULL, NULL, NULL, DrvInputInfo, MutantfDIPInfo,
3144 	MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800,
3145 	320, 240, 4, 3
3146 };
3147 
3148 
3149 // Death Brade (Japan ver JM-3)
3150 
3151 static struct BurnRomInfo deathbrdRomDesc[] = {
3152 	{ "hf-03-2.2c",		0x020000, 0xfb86fff3, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3153 	{ "hf-00-2.2a",		0x020000, 0x099aa422, 1 | BRF_PRG | BRF_ESS }, //  1
3154 	{ "hd-04-1.4c",		0x020000, 0xfd2ea8d7, 1 | BRF_PRG | BRF_ESS }, //  2
3155 	{ "hd-01-1.4a",		0x020000, 0x48a247ac, 1 | BRF_PRG | BRF_ESS }, //  3
3156 
3157 	{ "hd-12.21j",		0x010000, 0x13d55f11, 2 | BRF_PRG | BRF_ESS }, //  4 Huc6280 Code
3158 
3159 	{ "hd-06-1.8d",		0x010000, 0x8b7a558b, 3 | BRF_GRA }, 	       //  5 Characters
3160 	{ "hd-07-1.9d",		0x010000, 0xd2a3d449, 3 | BRF_GRA }, 	       //  6
3161 
3162 	{ "maf-00.8a",		0x080000, 0xe56f528d, 4 | BRF_GRA }, 	       //  7 Foreground Tiles
3163 
3164 	{ "maf-01.9a",		0x080000, 0xc3d5173d, 5 | BRF_GRA }, 	       //  8 Background Tiles
3165 	{ "maf-02.11a",		0x080000, 0x0b37d849, 5 | BRF_GRA }, 	       //  9
3166 
3167 	{ "maf-03.18a",		0x100000, 0xf4366d2c, 6 | BRF_GRA }, 	       // 10 Sprite Bank A
3168 	{ "maf-04.20a",		0x100000, 0x0c8f654e, 6 | BRF_GRA }, 	       // 11
3169 	{ "maf-05.21a",		0x080000, 0xb0cfeb80, 6 | BRF_GRA }, 	       // 12
3170 	{ "maf-06.18d",		0x100000, 0xf5c7a9b5, 6 | BRF_GRA }, 	       // 13
3171 	{ "maf-07.20d",		0x100000, 0xfd6008a3, 6 | BRF_GRA }, 	       // 14
3172 	{ "maf-08.21d",		0x080000, 0xe41cf1e7, 6 | BRF_GRA }, 	       // 15
3173 
3174 	{ "hf-08.15a",		0x010000, 0x93b7279f, 7 | BRF_GRA }, 	       // 16 Sprite Bank B
3175 	{ "hf-09.17a",		0x010000, 0x05e2c074, 7 | BRF_GRA }, 	       // 17
3176 	{ "hf-10.15c",		0x010000, 0x9b06f418, 7 | BRF_GRA }, 	       // 18
3177 	{ "hf-11.17c",		0x010000, 0x3859a531, 7 | BRF_GRA }, 	       // 19
3178 
3179 	{ "maf-10.20l",		0x040000, 0x7c57f48b, 8 | BRF_SND }, 	       // 20 OKI M6295 Samples 0
3180 
3181 	{ "maf-09.18l",		0x080000, 0x28e7ed81, 9 | BRF_SND }, 	       // 21 OKI M6295 Samples 1
3182 };
3183 
3184 STD_ROM_PICK(deathbrd)
3185 STD_ROM_FN(deathbrd)
3186 
3187 struct BurnDriver BurnDrvDeathbrd = {
3188 	"deathbrd", "mutantf", NULL, NULL, "1992",
3189 	"Death Brade (Japan ver JM-3)\0", NULL, "Data East Corporation", "DECO IC16",
3190 	NULL, NULL, NULL, NULL,
3191 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_VSFIGHT, 0,
3192 	NULL, deathbrdRomInfo, deathbrdRomName, NULL, NULL, NULL, NULL, DrvInputInfo, MutantfDIPInfo,
3193 	MutantfInit, DrvExit, MutantfFrame, MutantfDraw, DrvScan, &DrvRecalc, 0x800,
3194 	320, 240, 4, 3
3195 };
3196 
3197 
3198 // The Cliffhanger - Edward Randy (World ver 3)
3199 
3200 static struct BurnRomInfo edrandyRomDesc[] = {
3201 	{ "gg-00-2.k1",		0x020000, 0xce1ba964, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3202 	{ "gg-04-2.k3",		0x020000, 0x24caed19, 1 | BRF_PRG | BRF_ESS }, //  1
3203 	{ "gg-01-2.j1",		0x020000, 0x33677b80, 1 | BRF_PRG | BRF_ESS }, //  2
3204 	{ "gg-05-2.j3",		0x020000, 0x79a68ca6, 1 | BRF_PRG | BRF_ESS }, //  3
3205 	{ "ge-02.h1",		0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, //  4
3206 	{ "ge-06.h3",		0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, //  5
3207 	{ "ge-03.f1",		0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, //  6
3208 	{ "ge-07.f3",		0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, //  7
3209 
3210 	{ "ge-09.k13",		0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, //  8 Huc6280 Code
3211 
3212 	{ "gg-10.y6",		0x010000, 0xb96c6cbe, 3 | BRF_GRA }, 	       //  9 Characters
3213 	{ "gg-11.z6",		0x010000, 0xee567448, 3 | BRF_GRA }, 	       // 10
3214 
3215 	{ "mad-02",			0x080000, 0x6c76face, 4 | BRF_GRA }, 	       // 11 Foreground Tiles
3216 
3217 	{ "mad-00",			0x080000, 0x3735b22d, 5 | BRF_GRA }, 	       // 12 Background Tiles
3218 	{ "mad-01",			0x080000, 0x7bb13e1c, 5 | BRF_GRA }, 	       // 13
3219 
3220 	{ "mad-03",			0x080000, 0xc0bff892, 6 | BRF_GRA }, 	       // 14 Sprites
3221 	{ "mad-05",			0x080000, 0x3f2ccf95, 6 | BRF_GRA }, 	       // 15
3222 	{ "mad-04",			0x080000, 0x464f3eb9, 6 | BRF_GRA }, 	       // 16
3223 	{ "mad-06",			0x080000, 0x60871f77, 6 | BRF_GRA }, 	       // 17
3224 	{ "mad-07",			0x080000, 0xac03466e, 6 | BRF_GRA }, 	       // 18
3225 	{ "mad-08",			0x080000, 0x1b420ec8, 6 | BRF_GRA }, 	       // 19
3226 	{ "mad-10",			0x080000, 0x42da8ef0, 6 | BRF_GRA }, 	       // 20
3227 	{ "mad-11",			0x080000, 0x03c1f982, 6 | BRF_GRA }, 	       // 21
3228 	{ "mad-09",			0x080000, 0x930f4900, 6 | BRF_GRA }, 	       // 22
3229 	{ "mad-12",			0x080000, 0xa0bd62b6, 6 | BRF_GRA }, 	       // 23
3230 
3231 	{ "ge-08.j13",		0x020000, 0xdfe28c7b, 7 | BRF_SND }, 	       // 24 OKI M6295 Samples 0
3232 
3233 	{ "mad-13",			0x080000, 0x6ab28eba, 8 | BRF_SND }, 	       // 25 OKI M6295 Samples 1
3234 
3235 	{ "ge-12.v7",		0x000400, 0x278f674f, 0 | BRF_OPT }, 	       // 26 Unused PROMs
3236 };
3237 
3238 STD_ROM_PICK(edrandy)
3239 STD_ROM_FN(edrandy)
3240 
3241 struct BurnDriver BurnDrvEdrandy = {
3242 	"edrandy", NULL, NULL, NULL, "1990",
3243 	"The Cliffhanger - Edward Randy (World ver 3)\0", NULL, "Data East Corporation", "DECO IC16",
3244 	NULL, NULL, NULL, NULL,
3245 	BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0,
3246 	NULL, edrandyRomInfo, edrandyRomName, NULL, NULL, NULL, NULL, DrvInputInfo, EdrandyDIPInfo,
3247 	EdrandyInit, DrvExit, EdrandyFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800,
3248 	256, 240, 4, 3
3249 };
3250 
3251 
3252 // The Cliffhanger - Edward Randy (World ver 2)
3253 
3254 static struct BurnRomInfo edrandy2RomDesc[] = {
3255 	{ "gg00-1.k1",		0x020000, 0xa029cc4a, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3256 	{ "gg04-1.k3",		0x020000, 0x8b7928a4, 1 | BRF_PRG | BRF_ESS }, //  1
3257 	{ "gg01-1.j1",		0x020000, 0x84360123, 1 | BRF_PRG | BRF_ESS }, //  2
3258 	{ "gg05-1.j3",		0x020000, 0x0bf85d9d, 1 | BRF_PRG | BRF_ESS }, //  3
3259 	{ "ge-02.h1",		0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, //  4
3260 	{ "ge-06.h3",		0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, //  5
3261 	{ "ge-03.f1",		0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, //  6
3262 	{ "ge-07.f3",		0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, //  7
3263 
3264 	{ "ge-09.k13",		0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, //  8 Huc6280 Code
3265 
3266 	{ "gg-10.y6",		0x010000, 0xb96c6cbe, 3 | BRF_GRA }, 	       //  9 Characters
3267 	{ "gg-11.z6",		0x010000, 0xee567448, 3 | BRF_GRA }, 	       // 10
3268 
3269 	{ "mad-02",			0x080000, 0x6c76face, 4 | BRF_GRA }, 	       // 11 Foreground Tiles
3270 
3271 	{ "mad-00",			0x080000, 0x3735b22d, 5 | BRF_GRA }, 	       // 12 Background Tiles
3272 	{ "mad-01",			0x080000, 0x7bb13e1c, 5 | BRF_GRA }, 	       // 13
3273 
3274 	{ "mad-03",			0x080000, 0xc0bff892, 6 | BRF_GRA }, 	       // 14 Sprites
3275 	{ "mad-05",			0x080000, 0x3f2ccf95, 6 | BRF_GRA }, 	       // 15
3276 	{ "mad-04",			0x080000, 0x464f3eb9, 6 | BRF_GRA }, 	       // 16
3277 	{ "mad-06",			0x080000, 0x60871f77, 6 | BRF_GRA }, 	       // 17
3278 	{ "mad-07",			0x080000, 0xac03466e, 6 | BRF_GRA }, 	       // 18
3279 	{ "mad-08",			0x080000, 0x1b420ec8, 6 | BRF_GRA }, 	       // 19
3280 	{ "mad-10",			0x080000, 0x42da8ef0, 6 | BRF_GRA }, 	       // 20
3281 	{ "mad-11",			0x080000, 0x03c1f982, 6 | BRF_GRA }, 	       // 21
3282 	{ "mad-09",			0x080000, 0x930f4900, 6 | BRF_GRA }, 	       // 22
3283 	{ "mad-12",			0x080000, 0xa0bd62b6, 6 | BRF_GRA }, 	       // 23
3284 
3285 	{ "ge-08.j13",		0x020000, 0xdfe28c7b, 7 | BRF_SND }, 	       // 24 OKI M6295 Samples 0
3286 
3287 	{ "mad-13",			0x080000, 0x6ab28eba, 8 | BRF_SND }, 	       // 25 OKI M6295 Samples 1
3288 
3289 	{ "ge-12.v7",		0x000400, 0x278f674f, 0 | BRF_OPT }, 	       // 26 Unused PROMs
3290 };
3291 
3292 STD_ROM_PICK(edrandy2)
3293 STD_ROM_FN(edrandy2)
3294 
3295 struct BurnDriver BurnDrvEdrandy2 = {
3296 	"edrandy2", "edrandy", NULL, NULL, "1990",
3297 	"The Cliffhanger - Edward Randy (World ver 2)\0", NULL, "Data East Corporation", "DECO IC16",
3298 	NULL, NULL, NULL, NULL,
3299 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0,
3300 	NULL, edrandy2RomInfo, edrandy2RomName, NULL, NULL, NULL, NULL, DrvInputInfo, EdrandcDIPInfo,
3301 	EdrandyInit, DrvExit, EdrandyFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800,
3302 	256, 240, 4, 3
3303 };
3304 
3305 
3306 // The Cliffhanger - Edward Randy (World ver 1)
3307 
3308 static struct BurnRomInfo edrandy1RomDesc[] = {
3309 	{ "1.k1",			0x020000, 0xf184cdaa, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3310 	{ "5.k3",			0x020000, 0x7e3a4b81, 1 | BRF_PRG | BRF_ESS }, //  1
3311 	{ "2.j1",			0x020000, 0x212cd593, 1 | BRF_PRG | BRF_ESS }, //  2
3312 	{ "6.j3",			0x020000, 0x4a96fb07, 1 | BRF_PRG | BRF_ESS }, //  3
3313 	{ "ge-02.h1",		0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, //  4
3314 	{ "ge-06.h3",		0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, //  5
3315 	{ "ge-03.f1",		0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, //  6
3316 	{ "ge-07.f3",		0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, //  7
3317 
3318 	{ "ge-09.k13",		0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, //  8 Huc6280 Code
3319 
3320 	{ "ge-10.y6",		0x010000, 0x2528d795, 3 | BRF_GRA }, 	       //  9 Characters
3321 	{ "ge-11.z6",		0x010000, 0xe34a931e, 3 | BRF_GRA }, 	       // 10
3322 
3323 	{ "mad-02",			0x080000, 0x6c76face, 4 | BRF_GRA }, 	       // 11 Foreground Tiles
3324 
3325 	{ "mad-00",			0x080000, 0x3735b22d, 5 | BRF_GRA }, 	       // 12 Background Tiles
3326 	{ "mad-01",			0x080000, 0x7bb13e1c, 5 | BRF_GRA }, 	       // 13
3327 
3328 	{ "mad-03",			0x080000, 0xc0bff892, 6 | BRF_GRA }, 	       // 14 Sprites
3329 	{ "mad-05",			0x080000, 0x3f2ccf95, 6 | BRF_GRA }, 	       // 15
3330 	{ "mad-04",			0x080000, 0x464f3eb9, 6 | BRF_GRA }, 	       // 16
3331 	{ "mad-06",			0x080000, 0x60871f77, 6 | BRF_GRA }, 	       // 17
3332 	{ "mad-07",			0x080000, 0xac03466e, 6 | BRF_GRA }, 	       // 18
3333 	{ "mad-08",			0x080000, 0x1b420ec8, 6 | BRF_GRA }, 	       // 19
3334 	{ "mad-10",			0x080000, 0x42da8ef0, 6 | BRF_GRA }, 	       // 20
3335 	{ "mad-11",			0x080000, 0x03c1f982, 6 | BRF_GRA }, 	       // 21
3336 	{ "mad-09",			0x080000, 0x930f4900, 6 | BRF_GRA }, 	       // 22
3337 	{ "mad-12",			0x080000, 0xa0bd62b6, 6 | BRF_GRA }, 	       // 23
3338 
3339 	{ "ge-08.j13",		0x020000, 0xdfe28c7b, 7 | BRF_SND }, 	       // 24 OKI M6295 Samples 0
3340 
3341 	{ "mad-13",			0x080000, 0x6ab28eba, 8 | BRF_SND }, 	       // 25 OKI M6295 Samples 1
3342 
3343 	{ "ge-12.v7",		0x000400, 0x278f674f, 0 | BRF_OPT }, 	       // 26 Unused PROMs
3344 };
3345 
3346 STD_ROM_PICK(edrandy1)
3347 STD_ROM_FN(edrandy1)
3348 
3349 struct BurnDriver BurnDrvEdrandy1 = {
3350 	"edrandy1", "edrandy", NULL, NULL, "1990",
3351 	"The Cliffhanger - Edward Randy (World ver 1)\0", NULL, "Data East Corporation", "DECO IC16",
3352 	NULL, NULL, NULL, NULL,
3353 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0,
3354 	NULL, edrandy1RomInfo, edrandy1RomName, NULL, NULL, NULL, NULL, DrvInputInfo, EdrandcDIPInfo,
3355 	EdrandyInit, DrvExit, EdrandyFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800,
3356 	256, 240, 4, 3
3357 };
3358 
3359 
3360 // The Cliffhanger - Edward Randy (Japan ver 3)
3361 
3362 static struct BurnRomInfo edrandyjRomDesc[] = {
3363 	{ "ge-00-2.k1",		0x020000, 0xb3d2403c, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3364 	{ "ge-04-2.k3",		0x020000, 0x8a9624d6, 1 | BRF_PRG | BRF_ESS }, //  1
3365 	{ "ge-01-2.j1",		0x020000, 0x84360123, 1 | BRF_PRG | BRF_ESS }, //  2
3366 	{ "ge-05-2.j3",		0x020000, 0x0bf85d9d, 1 | BRF_PRG | BRF_ESS }, //  3
3367 	{ "ge-02.h1",		0x020000, 0xc2969fbb, 1 | BRF_PRG | BRF_ESS }, //  4
3368 	{ "ge-06.h3",		0x020000, 0x5c2e6418, 1 | BRF_PRG | BRF_ESS }, //  5
3369 	{ "ge-03.f1",		0x020000, 0x5e7b19a8, 1 | BRF_PRG | BRF_ESS }, //  6
3370 	{ "ge-07.f3",		0x020000, 0x5eb819a1, 1 | BRF_PRG | BRF_ESS }, //  7
3371 
3372 	{ "ge-09.k13",		0x010000, 0x9f94c60b, 2 | BRF_PRG | BRF_ESS }, //  8 Huc6280 Code
3373 
3374 	{ "ge-10.y6",		0x010000, 0x2528d795, 3 | BRF_GRA }, 	       //  9 Characters
3375 	{ "ge-11.z6",		0x010000, 0xe34a931e, 3 | BRF_GRA }, 	       // 10
3376 
3377 	{ "mad-02",			0x080000, 0x6c76face, 4 | BRF_GRA }, 	       // 11 Foreground Tiles
3378 
3379 	{ "mad-00",			0x080000, 0x3735b22d, 5 | BRF_GRA }, 	       // 12 Background Tiles
3380 	{ "mad-01",			0x080000, 0x7bb13e1c, 5 | BRF_GRA }, 	       // 13
3381 
3382 	{ "mad-03",			0x080000, 0xc0bff892, 6 | BRF_GRA }, 	       // 14 Sprites
3383 	{ "mad-05",			0x080000, 0x3f2ccf95, 6 | BRF_GRA }, 	       // 15
3384 	{ "mad-04",			0x080000, 0x464f3eb9, 6 | BRF_GRA }, 	       // 16
3385 	{ "mad-06",			0x080000, 0x60871f77, 6 | BRF_GRA }, 	       // 17
3386 	{ "mad-07",			0x080000, 0xac03466e, 6 | BRF_GRA }, 	       // 18
3387 	{ "mad-08",			0x080000, 0x1b420ec8, 6 | BRF_GRA }, 	       // 19
3388 	{ "mad-10",			0x080000, 0x42da8ef0, 6 | BRF_GRA }, 	       // 20
3389 	{ "mad-11",			0x080000, 0x03c1f982, 6 | BRF_GRA }, 	       // 21
3390 	{ "mad-09",			0x080000, 0x930f4900, 6 | BRF_GRA }, 	       // 22
3391 	{ "mad-12",			0x080000, 0xa0bd62b6, 6 | BRF_GRA }, 	       // 23
3392 
3393 	{ "ge-08.j13",		0x020000, 0xdfe28c7b, 7 | BRF_SND }, 	       // 24 OKI M6295 Samples 0
3394 
3395 	{ "mad-13",			0x080000, 0x6ab28eba, 8 | BRF_SND }, 	       // 25 OKI M6295 Samples 1
3396 
3397 	{ "ge-12.v7",		0x000400, 0x278f674f, 0 | BRF_OPT }, 	       // 26 Unused PROMs
3398 };
3399 
3400 STD_ROM_PICK(edrandyj)
3401 STD_ROM_FN(edrandyj)
3402 
3403 struct BurnDriver BurnDrvEdrandyj = {
3404 	"edrandyj", "edrandy", NULL, NULL, "1990",
3405 	"The Cliffhanger - Edward Randy (Japan ver 3)\0", NULL, "Data East Corporation", "DECO IC16",
3406 	NULL, NULL, NULL, NULL,
3407 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_SCRFIGHT, 0,
3408 	NULL, edrandyjRomInfo, edrandyjRomName, NULL, NULL, NULL, NULL, DrvInputInfo, EdrandcDIPInfo,
3409 	EdrandyInit, DrvExit, EdrandyFrame, EdrandyDraw, DrvScan, &DrvRecalc, 0x800,
3410 	256, 240, 4, 3
3411 };
3412 
3413 
3414 // Robocop 2 (Euro/Asia v0.10)
3415 
3416 static struct BurnRomInfo robocop2RomDesc[] = {
3417 	{ "gq-03.k1",		0x020000, 0xa7e90c28, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3418 	{ "gq-07.k3",		0x020000, 0xd2287ec1, 1 | BRF_PRG | BRF_ESS }, //  1
3419 	{ "gq-02.j1",		0x020000, 0x6777b8a0, 1 | BRF_PRG | BRF_ESS }, //  2
3420 	{ "gq-06.j3",		0x020000, 0xe11e27b5, 1 | BRF_PRG | BRF_ESS }, //  3
3421 	{ "go-01-1.h1",		0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, //  4
3422 	{ "go-05-1.h3",		0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, //  5
3423 	{ "go-00.f1",		0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, //  6
3424 	{ "go-04.f3",		0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, //  7
3425 
3426 	{ "gp-09.k13",		0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, //  8 Huc6280 Code
3427 
3428 	{ "gp10-1.y6",		0x010000, 0xd25d719c, 3 | BRF_GRA }, 	       //  9 Characters
3429 	{ "gp11-1.z6",		0x010000, 0x030ded47, 3 | BRF_GRA }, 	       // 10
3430 
3431 	{ "mah-04.z4",		0x080000, 0x9b6ca18c, 4 | BRF_GRA }, 	       // 11 Foreground Tiles
3432 	{ "mah-03.y4",		0x080000, 0x37894ddc, 4 | BRF_GRA }, 	       // 12
3433 
3434 	{ "mah-01.z1",		0x080000, 0x26e0dfff, 5 | BRF_GRA }, 	       // 13 Background Tiles
3435 	{ "mah-00.y1",		0x080000, 0x7bd69e41, 5 | BRF_GRA }, 	       // 14
3436 	{ "mah-02.a1",		0x080000, 0x328a247d, 5 | BRF_GRA }, 	       // 15
3437 
3438 	{ "mah-05.y9",		0x080000, 0x6773e613, 6 | BRF_GRA }, 	       // 16 Sprites
3439 	{ "mah-08.y12",		0x080000, 0x88d310a5, 6 | BRF_GRA }, 	       // 17
3440 	{ "mah-06.z9",		0x080000, 0x27a8808a, 6 | BRF_GRA }, 	       // 18
3441 	{ "mah-09.z12",		0x080000, 0xa58c43a7, 6 | BRF_GRA }, 	       // 19
3442 	{ "mah-07.a9",		0x080000, 0x526f4190, 6 | BRF_GRA }, 	       // 20
3443 	{ "mah-10.a12",		0x080000, 0x14b770da, 6 | BRF_GRA }, 	       // 21
3444 
3445 	{ "gp-08.j13",		0x020000, 0x365183b1, 7 | BRF_SND }, 	       // 22 OKI M6295 Samples 0
3446 
3447 	{ "mah-11.f13",		0x080000, 0x642bc692, 8 | BRF_SND }, 	       // 23 OKI M6295 Samples 1
3448 
3449 	{ "go-12.v7",		0x000400, 0x278f674f, 0 | BRF_OPT }, 	       // 24 Unused PROMs
3450 };
3451 
3452 STD_ROM_PICK(robocop2)
3453 STD_ROM_FN(robocop2)
3454 
3455 struct BurnDriver BurnDrvRobocop2 = {
3456 	"robocop2", NULL, NULL, NULL, "1991",
3457 	"Robocop 2 (Euro/Asia v0.10)\0", NULL, "Data East Corporation", "DECO IC16",
3458 	NULL, NULL, NULL, NULL,
3459 	BDF_GAME_WORKING, 2, HARDWARE_PREFIX_DATAEAST, GBF_RUNGUN, 0,
3460 	NULL, robocop2RomInfo, robocop2RomName, NULL, NULL, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo,
3461 	Robocop2Init, DrvExit, Robocop2Frame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800,
3462 	320, 240, 4, 3
3463 };
3464 
3465 
3466 // Robocop 2 (US v0.10)
3467 
3468 static struct BurnRomInfo robocop2uRomDesc[] = {
3469 	{ "gp03-3.k1",		0x020000, 0xc016a84b, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3470 	{ "gp07-3.k3",		0x020000, 0x54c541ae, 1 | BRF_PRG | BRF_ESS }, //  1
3471 	{ "gp02-3.j1",		0x020000, 0x6777b8a0, 1 | BRF_PRG | BRF_ESS }, //  2 // == gq-02.j1 in 'robocop2'
3472 	{ "gp06-3.j3",		0x020000, 0x73b8cf96, 1 | BRF_PRG | BRF_ESS }, //  3
3473 	{ "gp01-.h1",		0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, //  4 // no '-1' but matches other '-1' roms we have
3474 	{ "gp05-.h3",		0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, //  5
3475 	{ "gp00-.f1",		0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, //  6
3476 	{ "gp04-.f3",		0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, //  7
3477 
3478 	{ "gp-09.k13",		0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, //  8 Huc6280 Code
3479 
3480 	{ "gp10-1.y6",		0x010000, 0xd25d719c, 3 | BRF_GRA }, 	       //  9 Characters
3481 	{ "gp11-1.z6",		0x010000, 0x030ded47, 3 | BRF_GRA }, 	       // 10
3482 
3483 	{ "mah-04.z4",		0x080000, 0x9b6ca18c, 4 | BRF_GRA }, 	       // 11 Foreground Tiles
3484 	{ "mah-03.y4",		0x080000, 0x37894ddc, 4 | BRF_GRA }, 	       // 12
3485 
3486 	{ "mah-01.z1",		0x080000, 0x26e0dfff, 5 | BRF_GRA }, 	       // 13 Background Tiles
3487 	{ "mah-00.y1",		0x080000, 0x7bd69e41, 5 | BRF_GRA }, 	       // 14
3488 	{ "mah-02.a1",		0x080000, 0x328a247d, 5 | BRF_GRA }, 	       // 15
3489 
3490 	{ "mah-05.y9",		0x080000, 0x6773e613, 6 | BRF_GRA }, 	       // 16 Sprites
3491 	{ "mah-08.y12",		0x080000, 0x88d310a5, 6 | BRF_GRA }, 	       // 17
3492 	{ "mah-06.z9",		0x080000, 0x27a8808a, 6 | BRF_GRA }, 	       // 18
3493 	{ "mah-09.z12",		0x080000, 0xa58c43a7, 6 | BRF_GRA }, 	       // 19
3494 	{ "mah-07.a9",		0x080000, 0x526f4190, 6 | BRF_GRA }, 	       // 20
3495 	{ "mah-10.a12",		0x080000, 0x14b770da, 6 | BRF_GRA }, 	       // 21
3496 
3497 	{ "gp-08.j13",		0x020000, 0x365183b1, 7 | BRF_SND }, 	       // 22 OKI M6295 Samples 0
3498 
3499 	{ "mah-11.f13",		0x080000, 0x642bc692, 8 | BRF_SND }, 	       // 23 OKI M6295 Samples 1
3500 
3501 	{ "go-12.v7",		0x000400, 0x278f674f, 0 | BRF_OPT }, 	       // 24 Unused PROMs
3502 };
3503 
3504 STD_ROM_PICK(robocop2u)
3505 STD_ROM_FN(robocop2u)
3506 
3507 struct BurnDriver BurnDrvRobocop2u = {
3508 	"robocop2u", "robocop2", NULL, NULL, "1991",
3509 	"Robocop 2 (US v0.10)\0", NULL, "Data East Corporation", "DECO IC16",
3510 	NULL, NULL, NULL, NULL,
3511 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_RUNGUN, 0,
3512 	NULL, robocop2uRomInfo, robocop2uRomName, NULL, NULL, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo,
3513 	Robocop2Init, DrvExit, Robocop2Frame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800,
3514 	320, 240, 4, 3
3515 };
3516 
3517 
3518 // Robocop 2 (US v0.05)
3519 
3520 static struct BurnRomInfo robocop2uaRomDesc[] = {
3521 	{ "robo03.k1",		0x020000, 0xf4c96cc9, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3522 	{ "robo07.k3",		0x020000, 0x11e53a7c, 1 | BRF_PRG | BRF_ESS }, //  1
3523 	{ "robo02.j1",		0x020000, 0xfa086a0d, 1 | BRF_PRG | BRF_ESS }, //  2
3524 	{ "robo06.j3",		0x020000, 0x703b49d0, 1 | BRF_PRG | BRF_ESS }, //  3
3525 	{ "go-01-1.h1",		0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, //  4
3526 	{ "go-05-1.h3",		0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, //  5
3527 	{ "go-00.f1",		0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, //  6
3528 	{ "go-04.f3",		0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, //  7
3529 
3530 	{ "gp-09.k13",		0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, //  8 Huc6280 Code
3531 
3532 	{ "gp10-1.y6",		0x010000, 0xd25d719c, 3 | BRF_GRA }, 	       //  9 Characters
3533 	{ "gp11-1.z6",		0x010000, 0x030ded47, 3 | BRF_GRA }, 	       // 10
3534 
3535 	{ "mah-04.z4",		0x080000, 0x9b6ca18c, 4 | BRF_GRA }, 	       // 11 Foreground Tiles
3536 	{ "mah-03.y4",		0x080000, 0x37894ddc, 4 | BRF_GRA }, 	       // 12
3537 
3538 	{ "mah-01.z1",		0x080000, 0x26e0dfff, 5 | BRF_GRA }, 	       // 13 Background Tiles
3539 	{ "mah-00.y1",		0x080000, 0x7bd69e41, 5 | BRF_GRA }, 	       // 14
3540 	{ "mah-02.a1",		0x080000, 0x328a247d, 5 | BRF_GRA }, 	       // 15
3541 
3542 	{ "mah-05.y9",		0x080000, 0x6773e613, 6 | BRF_GRA }, 	       // 16 Sprites
3543 	{ "mah-08.y12",		0x080000, 0x88d310a5, 6 | BRF_GRA }, 	       // 17
3544 	{ "mah-06.z9",		0x080000, 0x27a8808a, 6 | BRF_GRA }, 	       // 18
3545 	{ "mah-09.z12",		0x080000, 0xa58c43a7, 6 | BRF_GRA }, 	       // 19
3546 	{ "mah-07.a9",		0x080000, 0x526f4190, 6 | BRF_GRA }, 	       // 20
3547 	{ "mah-10.a12",		0x080000, 0x14b770da, 6 | BRF_GRA }, 	       // 21
3548 
3549 	{ "gp-08.j13",		0x020000, 0x365183b1, 7 | BRF_SND }, 	       // 22 OKI M6295 Samples 0
3550 
3551 	{ "mah-11.f13",		0x080000, 0x642bc692, 8 | BRF_SND }, 	       // 23 OKI M6295 Samples 1
3552 
3553 	{ "go-12.v7",		0x000400, 0x278f674f, 0 | BRF_OPT }, 	       // 24 Unused PROMs
3554 };
3555 
3556 STD_ROM_PICK(robocop2ua)
3557 STD_ROM_FN(robocop2ua)
3558 
3559 struct BurnDriver BurnDrvRobocop2ua = {
3560 	"robocop2ua", "robocop2", NULL, NULL, "1991",
3561 	"Robocop 2 (US v0.05)\0", NULL, "Data East Corporation", "DECO IC16",
3562 	NULL, NULL, NULL, NULL,
3563 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_RUNGUN, 0,
3564 	NULL, robocop2uaRomInfo, robocop2uaRomName, NULL, NULL, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo,
3565 	Robocop2Init, DrvExit, Robocop2Frame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800,
3566 	320, 240, 4, 3
3567 };
3568 
3569 
3570 // Robocop 2 (Japan v0.11)
3571 
3572 static struct BurnRomInfo robocop2jRomDesc[] = {
3573 	{ "go-03-1.k1",		0x020000, 0x52506608, 1 | BRF_PRG | BRF_ESS }, //  0 68k Code
3574 	{ "go-07-1.k3",		0x020000, 0x739cda17, 1 | BRF_PRG | BRF_ESS }, //  1
3575 	{ "go-02-1.j1",		0x020000, 0x48c0ace9, 1 | BRF_PRG | BRF_ESS }, //  2
3576 	{ "go-06-1.j3",		0x020000, 0x41abec87, 1 | BRF_PRG | BRF_ESS }, //  3
3577 	{ "go-01-1.h1",		0x020000, 0xab5356c0, 1 | BRF_PRG | BRF_ESS }, //  4
3578 	{ "go-05-1.h3",		0x020000, 0xce21bda5, 1 | BRF_PRG | BRF_ESS }, //  5
3579 	{ "go-00.f1",		0x020000, 0xa93369ea, 1 | BRF_PRG | BRF_ESS }, //  6
3580 	{ "go-04.f3",		0x020000, 0xee2f6ad9, 1 | BRF_PRG | BRF_ESS }, //  7
3581 
3582 	{ "gp-09.k13",		0x010000, 0x4a4e0f8d, 2 | BRF_PRG | BRF_ESS }, //  8 Huc6280 Code
3583 
3584 	{ "gp10-1.y6",		0x010000, 0xd25d719c, 3 | BRF_GRA }, 	       //  9 Characters
3585 	{ "gp11-1.z6",		0x010000, 0x030ded47, 3 | BRF_GRA }, 	       // 10
3586 
3587 	{ "mah-04.z4",		0x080000, 0x9b6ca18c, 4 | BRF_GRA }, 	       // 11 Foreground Tiles
3588 	{ "mah-03.y4",		0x080000, 0x37894ddc, 4 | BRF_GRA }, 	       // 12
3589 
3590 	{ "mah-01.z1",		0x080000, 0x26e0dfff, 5 | BRF_GRA }, 	       // 13 Background Tiles
3591 	{ "mah-00.y1",		0x080000, 0x7bd69e41, 5 | BRF_GRA }, 	       // 14
3592 	{ "mah-02.a1",		0x080000, 0x328a247d, 5 | BRF_GRA }, 	       // 15
3593 
3594 	{ "mah-05.y9",		0x080000, 0x6773e613, 6 | BRF_GRA }, 	       // 16 Sprites
3595 	{ "mah-08.y12",		0x080000, 0x88d310a5, 6 | BRF_GRA }, 	       // 17
3596 	{ "mah-06.z9",		0x080000, 0x27a8808a, 6 | BRF_GRA }, 	       // 18
3597 	{ "mah-09.z12",		0x080000, 0xa58c43a7, 6 | BRF_GRA }, 	       // 19
3598 	{ "mah-07.a9",		0x080000, 0x526f4190, 6 | BRF_GRA }, 	       // 20
3599 	{ "mah-10.a12",		0x080000, 0x14b770da, 6 | BRF_GRA }, 	       // 21
3600 
3601 	{ "gp-08.j13",		0x020000, 0x365183b1, 7 | BRF_SND }, 	       // 22 OKI M6295 Samples 0
3602 
3603 	{ "mah-11.f13",		0x080000, 0x642bc692, 8 | BRF_SND }, 	       // 23 OKI M6295 Samples 1
3604 
3605 	{ "go-12.v7",		0x000400, 0x278f674f, 0 | BRF_OPT }, 	       // 24 Unused PROMs
3606 };
3607 
3608 STD_ROM_PICK(robocop2j)
3609 STD_ROM_FN(robocop2j)
3610 
3611 struct BurnDriver BurnDrvRobocop2j = {
3612 	"robocop2j", "robocop2", NULL, NULL, "1991",
3613 	"Robocop 2 (Japan v0.11)\0", NULL, "Data East Corporation", "DECO IC16",
3614 	NULL, NULL, NULL, NULL,
3615 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_PREFIX_DATAEAST, GBF_RUNGUN, 0,
3616 	NULL, robocop2jRomInfo, robocop2jRomName, NULL, NULL, NULL, NULL, Robocop2InputInfo, Robocop2DIPInfo,
3617 	Robocop2Init, DrvExit, Robocop2Frame, Robocop2Draw, DrvScan, &DrvRecalc, 0x800,
3618 	320, 240, 4, 3
3619 };
3620