1 // FB Alpha Atari Vindicators Driver Module
2 // Based on MAME driver by Aaron Giles
3 
4 #include "tiles_generic.h"
5 #include "m68000_intf.h"
6 #include "m6502_intf.h"
7 #include "watchdog.h"
8 #include "atariic.h"
9 #include "atarimo.h"
10 #include "atarijsa.h"
11 
12 static UINT8 *AllMem;
13 static UINT8 *MemEnd;
14 static UINT8 *AllRam;
15 static UINT8 *RamEnd;
16 static UINT8 *Drv68KROM;
17 static UINT8 *DrvM6502ROM;
18 static UINT8 *DrvGfxROM0;
19 static UINT8 *DrvGfxROM1;
20 static UINT8 *DrvPalRAM;
21 static UINT8 *DrvVidRAM;
22 static UINT8 *DrvMobRAM;
23 static UINT8 *DrvAlphaRAM;
24 static UINT8 *Drv68KRAM;
25 
26 static UINT32 *DrvPalette;
27 static UINT8 DrvRecalc;
28 
29 static INT32 mob_scroll_x;
30 static INT32 mob_scroll_y;
31 static INT32 bg_scroll_x;
32 static INT32 bg_scroll_y;
33 static INT32 playfield_tile_bank;
34 static INT32 scanline_int_state;
35 
36 static INT32 vblank, scanline;
37 
38 static UINT8 DrvJoy1[16];
39 static UINT8 DrvJoy2[16];
40 static UINT8 DrvJoy3[16];
41 static UINT8 DrvJoy4[16];
42 static UINT8 DrvJoy5f[16];
43 static UINT8 DrvJoy6f[16];
44 static UINT16 DrvInputs[6];
45 static UINT8 DrvDips[1];
46 static UINT8 DrvReset;
47 
48 static struct BurnInputInfo VindictrInputList[] = {
49 	{"P1 Coin",				BIT_DIGITAL,	DrvJoy4 + 0,	"p1 coin"	},
50 
51 	{"P1 Start",			BIT_DIGITAL,	DrvJoy3 + 8,	"p1 start"	},
52 	{"P1 Left Stick Up",	BIT_DIGITAL,	DrvJoy1 + 12,	"p1 up_alt"		},
53 	{"P1 Left Stick Down",	BIT_DIGITAL,	DrvJoy1 + 14,	"p1 down_alt"	},
54 	{"P1 Right Stick Up",	BIT_DIGITAL,	DrvJoy1 + 13,	"p3 up_alt"		},
55 	{"P1 Right Stick Down",	BIT_DIGITAL,	DrvJoy1 + 15,	"p3 down_alt"	},
56 	{"P1 Left Stick Fire",	BIT_DIGITAL,	DrvJoy1 + 8,	"p1 fire 1"	},
57 	{"P1 Right Stick Fire",	BIT_DIGITAL,	DrvJoy1 + 9,	"p1 fire 2"	},
58 	{"P1 Left Stick Thumb",	BIT_DIGITAL,	DrvJoy1 + 10,	"p1 fire 3"	},
59 	{"P1 Right Stick Thumb",BIT_DIGITAL,	DrvJoy1 + 11,	"p1 fire 4"	},
60 	{"P1 -- Alt. Input --", BIT_DIGITAL,    DrvJoy5f + 10,  "p1 altcontrol" },
61 	{"P1 Up",			    BIT_DIGITAL,	DrvJoy5f + 0,	"p1 up"		},
62 	{"P1 Down",			    BIT_DIGITAL,	DrvJoy5f + 1,	"p1 down"	},
63 	{"P1 Left",			    BIT_DIGITAL,	DrvJoy5f + 2,	"p1 left"	},
64 	{"P1 Right",		    BIT_DIGITAL,	DrvJoy5f + 3,	"p1 right"	},
65 
66 	{"P2 Coin",				BIT_DIGITAL,	DrvJoy4 + 1,	"p2 coin"	},
67 	{"P2 Start",			BIT_DIGITAL,	DrvJoy3 + 9,	"p2 start"	},
68 	{"P2 Left Stick Up",	BIT_DIGITAL,	DrvJoy2 + 12,	"p2 up_alt"		},
69 	{"P2 Left Stick Down",	BIT_DIGITAL,	DrvJoy2 + 14,	"p2 down_alt"	},
70 	{"P2 Right Stick Up",	BIT_DIGITAL,	DrvJoy2 + 13,	"p4 up_alt"		},
71 	{"P2 Right Stick Down",	BIT_DIGITAL,	DrvJoy2 + 15,	"p4 down_alt"	},
72 	{"P2 Left Stick Fire",	BIT_DIGITAL,	DrvJoy2 + 8,	"p2 fire 1"	},
73 	{"P2 Right Stick Fire",	BIT_DIGITAL,	DrvJoy2 + 9,	"p2 fire 2"	},
74 	{"P2 Left Stick Thumb",	BIT_DIGITAL,	DrvJoy2 + 10,	"p2 fire 3"	},
75 	{"P2 Right Stick Thumb",BIT_DIGITAL,	DrvJoy2 + 11,	"p2 fire 4"	},
76 	{"P2 -- Alt. Input --", BIT_DIGITAL,    DrvJoy6f + 10,  "p2 altcontrol" },
77 	{"P2 Up",			    BIT_DIGITAL,	DrvJoy6f + 0,	"p2 up"		},
78 	{"P2 Down",			    BIT_DIGITAL,	DrvJoy6f + 1,	"p2 down"	},
79 	{"P2 Left",			    BIT_DIGITAL,	DrvJoy6f + 2,	"p2 left"	},
80 	{"P2 Right",		    BIT_DIGITAL,	DrvJoy6f + 3,	"p2 right"	},
81 
82 	{"P3 Coin",				BIT_DIGITAL,	DrvJoy4 + 2,	"p3 coin"	},
83 
84 	{"Reset",				BIT_DIGITAL,	&DrvReset,		"reset"		},
85 	{"Dip A",				BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
86 };
87 
88 STDINPUTINFO(Vindictr)
89 
90 static struct BurnDIPInfo VindictrDIPList[]=
91 {
92 	{0x20, 0xff, 0xff, 0x02, NULL			},
93 
94 	{0   , 0xfe, 0   ,    2, "Service Mode"	},
95 	{0x20, 0x01, 0x02, 0x02, "Off"			},
96 	{0x20, 0x01, 0x02, 0x00, "On"			},
97 };
98 
STDDIPINFO(Vindictr)99 STDDIPINFO(Vindictr)
100 
101 static void update_interrupts()
102 {
103 	INT32 state = 0;
104 	if (scanline_int_state) state |= 4;
105 	if (atarijsa_int_state) state |= 6;
106 
107 	if (state) {
108 		SekSetIRQLine(state, CPU_IRQSTATUS_ACK);
109 	} else {
110 		SekSetIRQLine(7, CPU_IRQSTATUS_NONE);
111 	}
112 }
113 
vindictr_write_word(UINT32 address,UINT16 data)114 static void __fastcall vindictr_write_word(UINT32 address, UINT16 data)
115 {
116 	if (address & 0xc00000) {
117 		SekWriteWord(address & 0x3fffff, data);
118 		return;
119 	}
120 
121 	if ((address & 0xff0000) == 0x1f0000) {
122 		AtariEEPROMUnlockWrite();
123 		return;
124 	}
125 
126 	if ((address & 0xff6000) == 0x3f2000) {
127 		*((UINT16*)(DrvMobRAM + (address & 0x1ffe))) = BURN_ENDIAN_SWAP_INT16(data);
128 		AtariMoWrite(0, ((address & 0x1fff) / 2) & 0xfff, data);
129 		return;
130 	}
131 
132 	switch (address)
133 	{
134 		case 0x2e0000:
135 			BurnWatchdogWrite();
136 		return;
137 
138 		case 0x360000:
139 			scanline_int_state = 0;
140 			update_interrupts();
141 		return;
142 
143 		case 0x360010:
144 			// nop
145 		return;
146 
147 		case 0x360020:
148 			AtariJSAResetWrite(0);
149 		return;
150 
151 		case 0x360030:
152 			AtariJSAWrite(data);
153 		return;
154 	}
155 }
156 
vindictr_write_byte(UINT32 address,UINT8 data)157 static void __fastcall vindictr_write_byte(UINT32 address, UINT8 data)
158 {
159 	if (address & 0xc00000) {
160 		SekWriteByte(address & 0x3fffff, data);
161 		return;
162 	}
163 
164 	if ((address & 0xff0000) == 0x1f0000) {
165 		AtariEEPROMUnlockWrite();
166 		return;
167 	}
168 
169 	if ((address & 0xff6000) == 0x3f2000) {
170 		DrvMobRAM[(address & 0x1fff)^1] = data;
171 		AtariMoWrite(0, ((address & 0x1fff) / 2) & 0xfff, BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvMobRAM + (address & 0x1ffe)))));
172 		return;
173 	}
174 
175 	switch (address)
176 	{
177 		case 0x2e0000:
178 		case 0x2e0001:
179 			BurnWatchdogWrite();
180 		return;
181 
182 		case 0x360000:
183 		case 0x360001:
184 			scanline_int_state = 0;
185 			update_interrupts();
186 		return;
187 
188 		case 0x360010:
189 		case 0x360011:
190 			// nop
191 		return;
192 
193 		case 0x360020:
194 		case 0x360021:
195 			AtariJSAResetWrite(0);
196 		return;
197 
198 		case 0x360031:
199 		case 0x360030:
200 			AtariJSAWrite(data);
201 		return;
202 	}
203 }
204 
special_read()205 static inline UINT16 special_read()
206 {
207 	UINT16 ret = (DrvInputs[1] & ~1) | (vblank^1);
208 	if (atarigen_cpu_to_sound_ready) ret ^= 0x0008;
209 	if (atarigen_sound_to_cpu_ready) ret ^= 0x0004;
210 	return ret;
211 }
212 
vindictr_read_word(UINT32 address)213 static UINT16 __fastcall vindictr_read_word(UINT32 address)
214 {
215 	if (address & 0xc00000) {
216 		return SekReadWord(address & 0x3fffff);
217 	}
218 
219 	switch (address & ~0xf)
220 	{
221 		case 0x260000:
222 			return DrvInputs[0];
223 
224 		case 0x260010:
225 			return special_read();
226 
227 		case 0x260020:
228 			return DrvInputs[2];
229 
230 		case 0x260030:
231 			return AtariJSARead();
232 	}
233 
234 	return 0;
235 }
236 
vindictr_read_byte(UINT32 address)237 static UINT8 __fastcall vindictr_read_byte(UINT32 address)
238 {
239 	if (address & 0xc00000) {
240 		return SekReadByte(address & 0x3fffff);
241 	}
242 
243 	switch (address & ~0xf)
244 	{
245 		case 0x260000:
246 			return DrvInputs[0] >> ((~address & 1) * 8);
247 
248 		case 0x260010:
249 			return special_read() >> ((~address & 1) * 8);
250 
251 		case 0x260020:
252 			return DrvInputs[2] >> ((~address & 1) * 8);
253 
254 		case 0x260030:
255 			return AtariJSARead() >> ((~address & 1) * 8);
256 	}
257 
258 	return 0;
259 }
260 
tilemap_callback(bg)261 static tilemap_callback( bg )
262 {
263 	UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvVidRAM + offs * 2)));
264 
265 	INT32 code = (data & 0xfff) | (playfield_tile_bank * 0x1000);
266 	INT32 color = (data & 0x7000) >> 11;
267 
268 	TILE_SET_INFO(0, code, color, TILE_FLIPYX(data >> 15));
269 }
270 
tilemap_callback(alpha)271 static tilemap_callback( alpha )
272 {
273 	UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvAlphaRAM + offs * 2)));
274 
275 	INT32 color = ((data >> 10) & 0xf) | ((data >> 9) & 0x20);
276 
277 	TILE_SET_INFO(1, data, color, (data & 0x8000) ? TILE_OPAQUE : 0);
278 }
279 
DrvDoReset(INT32 clear_mem)280 static INT32 DrvDoReset(INT32 clear_mem)
281 {
282 	if (clear_mem) {
283 		memset (AllRam, 0, RamEnd - AllRam);
284 	}
285 
286 	SekOpen(0);
287 	SekReset();
288 	SekClose();
289 
290 	BurnWatchdogReset();
291 	AtariEEPROMReset();
292 	AtariJSAReset();
293 
294 	playfield_tile_bank = 0;
295 	mob_scroll_x = 0;
296 	mob_scroll_y = 0;
297 	bg_scroll_x = 0;
298 	bg_scroll_y = 0;
299 	scanline_int_state = 0;
300 
301 	return 0;
302 }
303 
MemIndex()304 static INT32 MemIndex()
305 {
306 	UINT8 *Next; Next = AllMem;
307 
308 	Drv68KROM			= Next; Next += 0x060000;
309 	DrvM6502ROM			= Next; Next += 0x010000;
310 
311 	DrvGfxROM0			= Next; Next += 0x200000;
312 	DrvGfxROM1			= Next; Next += 0x010000;
313 
314 	DrvPalette			= (UINT32*)Next; Next += 0x4000 * sizeof(UINT32);
315 
316 	AllRam				= Next;
317 
318 	DrvPalRAM			= Next; Next += 0x001000;
319 	DrvVidRAM			= Next; Next += 0x002000;
320 	DrvMobRAM			= Next; Next += 0x002000;
321 	DrvAlphaRAM			= Next; Next += 0x001000;
322 	Drv68KRAM			= Next; Next += 0x003000;
323 
324 	atarimo_0_slipram 	= (UINT16*)(DrvAlphaRAM + 0xf80);
325 
326 	RamEnd				= Next;
327 
328 	MemEnd				= Next;
329 
330 	return 0;
331 }
332 
DrvGfxDecode()333 static INT32 DrvGfxDecode()
334 {
335 	INT32 Plane0[4] = { STEP4(0, 0x40000*8) };
336 	INT32 XOffs0[8] = { STEP8(0,1) };
337 	INT32 YOffs0[8] = { STEP8(0,8) };
338 
339 	INT32 Plane1[3] = { 0, 4 };
340 	INT32 XOffs1[8] = { STEP4(0,1), STEP4(8,1) };
341 	INT32 YOffs1[8] = { STEP8(0,16) };
342 
343 	UINT8 *tmp = (UINT8*)BurnMalloc(0x100000);
344 	if (tmp == NULL) {
345 		return 1;
346 	}
347 
348 	for (INT32 i = 0; i < 0x100000; i++) tmp[i] = DrvGfxROM0[i] ^ 0xff;
349 
350 	GfxDecode(0x8000, 4, 8, 8, Plane0, XOffs0, YOffs0, 0x040, tmp, DrvGfxROM0);
351 
352 	memcpy (tmp, DrvGfxROM1, 0x004000);
353 
354 	GfxDecode(0x0400, 2, 8, 8, Plane1, XOffs1, YOffs1, 0x080, tmp, DrvGfxROM1);
355 
356 	BurnFree(tmp);
357 
358 	return 0;
359 }
360 
DrvInit()361 static INT32 DrvInit()
362 {
363 	static const struct atarimo_desc modesc =
364 	{
365 		0,					// index to which gfx system
366 		1,					// number of motion object banks
367 		1,					// are the entries linked?
368 		0,					// are the entries split?
369 		0,					// render in reverse order?
370 		0,					// render in swapped X/Y order?
371 		0,					// does the neighbor bit affect the next object?
372 		8,					// pixels per SLIP entry (0 for no-slip)
373 		0,					// pixel offset for SLIPs
374 		0,					// maximum number of links to visit/scanline (0=all)
375 
376 		0x100,				// base palette entry
377 		0x100,				// maximum number of colors
378 		0,					// transparent pen index
379 
380 		{{ 0,0,0,0x03ff }},	// mask for the link
381 		{{ 0 }},			// mask for the graphics bank
382 		{{ 0x7fff,0,0,0 }},	// mask for the code index
383 		{{ 0 }},			// mask for the upper code index
384 		{{ 0,0x000f,0,0 }},	// mask for the color
385 		{{ 0,0xff80,0,0 }},	// mask for the X position
386 		{{ 0,0,0xff80,0 }},	// mask for the Y position
387 		{{ 0,0,0x0038,0 }},	// mask for the width, in tiles*/
388 		{{ 0,0,0x0007,0 }},	// mask for the height, in tiles
389 		{{ 0,0,0x0040,0 }},	// mask for the horizontal flip
390 		{{ 0 }},			// mask for the vertical flip
391 		{{ 0,0x0070,0,0 }},	// mask for the priority
392 		{{ 0 }},			// mask for the neighbor
393 		{{ 0 }},			// mask for absolute coordinates
394 
395 		{{ 0 }},			// mask for the special value
396 		0,					// resulting value to indicate "special"
397 		NULL				// callback routine for special entries
398 	};
399 
400 	AllMem = NULL;
401 	MemIndex();
402 	INT32 nLen = MemEnd - (UINT8 *)0;
403 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
404 	memset(AllMem, 0, nLen);
405 	MemIndex();
406 
407 	{
408 		INT32 k = 0;
409 		if (BurnLoadRom(Drv68KROM  + 0x000001, k++, 2)) return 1;
410 		if (BurnLoadRom(Drv68KROM  + 0x000000, k++, 2)) return 1;
411 		if (BurnLoadRom(Drv68KROM  + 0x020001, k++, 2)) return 1;
412 		if (BurnLoadRom(Drv68KROM  + 0x020000, k++, 2)) return 1;
413 		if (BurnLoadRom(Drv68KROM  + 0x040001, k++, 2)) return 1;
414 		if (BurnLoadRom(Drv68KROM  + 0x040000, k++, 2)) return 1;
415 
416 		if (BurnLoadRom(DrvM6502ROM+ 0x000000, k++, 1)) return 1;
417 
418 		if (BurnLoadRom(DrvGfxROM0 + 0x000000, k++, 1)) return 1;
419 		if (BurnLoadRom(DrvGfxROM0 + 0x020000, k++, 1)) return 1;
420 		memcpy (DrvGfxROM0 + 0x30000, DrvGfxROM0 + 0x20000, 0x10000);
421 		if (BurnLoadRom(DrvGfxROM0 + 0x040000, k++, 1)) return 1;
422 		if (BurnLoadRom(DrvGfxROM0 + 0x060000, k++, 1)) return 1;
423 		memcpy (DrvGfxROM0 + 0x70000, DrvGfxROM0 + 0x60000, 0x10000);
424 		if (BurnLoadRom(DrvGfxROM0 + 0x080000, k++, 1)) return 1;
425 		if (BurnLoadRom(DrvGfxROM0 + 0x0a0000, k++, 1)) return 1;
426 		memcpy (DrvGfxROM0 + 0xb0000, DrvGfxROM0 + 0xa0000, 0x10000);
427 		if (BurnLoadRom(DrvGfxROM0 + 0x0c0000, k++, 1)) return 1;
428 		if (BurnLoadRom(DrvGfxROM0 + 0x0e0000, k++, 1)) return 1;
429 		memcpy (DrvGfxROM0 + 0xf0000, DrvGfxROM0 + 0xe0000, 0x10000);
430 
431 		if (BurnLoadRom(DrvGfxROM1 + 0x000000, k++, 1)) return 1;
432 
433 		DrvGfxDecode();
434 	}
435 
436 	SekInit(0, 0x68010);
437 	SekOpen(0);
438 	SekMapMemory(Drv68KROM,			0x000000, 0x05ffff, MAP_ROM);
439 	SekMapMemory(DrvPalRAM,			0x3e0000, 0x3e0fff, MAP_RAM);
440 	SekMapMemory(DrvVidRAM,			0x3f0000, 0x3f1fff, MAP_RAM);
441 	SekMapMemory(DrvMobRAM,			0x3f2000, 0x3f3fff, MAP_ROM);
442 	SekMapMemory(DrvAlphaRAM,		0x3f4000, 0x3f4fff, MAP_RAM);
443 	SekMapMemory(Drv68KRAM,			0x3f5000, 0x3f7fff, MAP_RAM);
444 	SekMapMemory(DrvVidRAM,			0x3f8000, 0x3f9fff, MAP_RAM); // mirroring
445 	SekMapMemory(DrvMobRAM,			0x3fa000, 0x3fbfff, MAP_ROM);
446 	SekMapMemory(DrvAlphaRAM,		0x3fc000, 0x3fcfff, MAP_RAM);
447 	SekMapMemory(Drv68KRAM,			0x3fd000, 0x3fffff, MAP_RAM);
448 	SekSetWriteWordHandler(0,		vindictr_write_word);
449 	SekSetWriteByteHandler(0,		vindictr_write_byte);
450 	SekSetReadWordHandler(0,		vindictr_read_word);
451 	SekSetReadByteHandler(0,		vindictr_read_byte);
452 
453 	AtariEEPROMInit(0x1000);
454 	AtariEEPROMInstallMap(1, 0x0e0000, 0x0e0fff);
455 	SekClose();
456 
457 	BurnWatchdogInit(DrvDoReset, 180);
458 
459 	AtariJSAInit(DrvM6502ROM, &update_interrupts, NULL, NULL);
460 
461 	GenericTilesInit();
462 	GenericTilemapInit(0, TILEMAP_SCAN_COLS, bg_map_callback, 8, 8, 64, 64);
463 	GenericTilemapInit(1, TILEMAP_SCAN_ROWS, alpha_map_callback, 8, 8, 64, 32);
464 	GenericTilemapSetGfx(0, DrvGfxROM0, 4, 8, 8, 0x200000, 0x200, 0x0f);
465 	GenericTilemapSetGfx(1, DrvGfxROM1, 2, 8, 8, 0x010000, 0x000, 0x3f);
466 	GenericTilemapSetTransparent(1, 0);
467 
468 	AtariMoInit(0, &modesc);
469 
470 	DrvDoReset(1);
471 
472 	return 0;
473 }
474 
DrvExit()475 static INT32 DrvExit()
476 {
477 	GenericTilesExit();
478 	SekExit();
479 
480 	AtariJSAExit();
481 	AtariMoExit();
482 	AtariEEPROMExit();
483 
484 	BurnFree(AllMem);
485 
486 	return 0;
487 }
488 
copy_sprites_step1()489 static void copy_sprites_step1()
490 {
491 	INT32 minx, maxx, miny, maxy;
492 	GenericTilesGetClip(&minx, &maxx, &miny, &maxy);
493 
494 	for (INT32 y = miny; y < maxy; y++)
495 	{
496 		UINT16 *mo = BurnBitmapGetPosition(31, 0, y);
497 		UINT16 *pf = BurnBitmapGetPosition(0, 0, y);
498 
499 		for (INT32 x = minx; x < maxx; x++)
500 		{
501 			if (mo[x] != 0xffff)
502 			{
503 				INT32 mopriority = mo[x] >> 12;
504 
505 				if (mopriority & 4)
506 					continue;
507 
508 				if ((mo[x] & 0x0f) == 1)
509 				{
510 					if ((mo[x] & 0xf0) != 0)
511 						pf[x] |= 0x100;
512 				}
513 				else
514 					pf[x] = mo[x] & 0x7ff;
515 			}
516 		}
517 	}
518 }
519 
copy_sprites_step2()520 static void copy_sprites_step2()
521 {
522 	INT32 minx, maxx, miny, maxy;
523 	GenericTilesGetClip(&minx, &maxx, &miny, &maxy);
524 
525 	for (INT32 y = miny; y < maxy; y++)
526 	{
527 		UINT16 *mo = BurnBitmapGetPosition(31, 0, y);
528 		UINT16 *pf = BurnBitmapGetPosition(0, 0, y);
529 
530 		for (INT32 x = minx; x < maxx; x++)
531 		{
532 			if (mo[x] != 0xffff)
533 			{
534 				INT32 mopriority = mo[x] >> 12;
535 
536 				if (mopriority & 4)
537 				{
538 					if (mo[x] & 2)
539 						AtariMoApplyStain(pf, mo, x);
540 
541 					if (mo[x] & 8)
542 						pf[x] |= (~mo[x] & 0xe0) << 6;
543 				}
544 
545 				mo[x] = 0xffff;
546 			}
547 		}
548 	}
549 }
550 
551 static void partial_update_sprite(INT32 line);
552 static void partial_update(INT32 line);
553 
scanline_update()554 static void scanline_update()
555 {
556 	INT32 offset = ((scanline - 8) / 8) * 64 + 42;
557 	if (offset < 0)	offset += 0x7c0;
558 	else if (offset >= 0x7c0)
559 		return;
560 
561 	partial_update(scanline);
562 
563 	for (INT32 x = 42; x < 64; x++, offset++)
564 	{
565 		UINT16 data = BURN_ENDIAN_SWAP_INT16(*((UINT16*)(DrvAlphaRAM + offset * 2)));
566 
567 		switch ((data >> 9) & 7)
568 		{
569 			case 2:
570 				playfield_tile_bank = data & 7;
571 			break;
572 
573 			case 3:
574 				bg_scroll_x = data & 0x1ff;
575 				GenericTilemapSetScrollX(0, bg_scroll_x);
576 			break;
577 
578 			case 4:
579 				mob_scroll_x = data & 0x1ff;
580 				atarimo_set_xscroll(0, mob_scroll_x);
581 			break;
582 
583 			case 6:
584 				partial_update_sprite(scanline);
585 				scanline_int_state = 1;
586 				update_interrupts();
587 			break;
588 
589 			case 7:
590 			{
591 				INT32 sl = scanline;
592 				if (sl >= nScreenHeight) sl -= nScreenHeight;
593 				bg_scroll_y = (data - sl) & 0x1ff;
594 				GenericTilemapSetScrollY(0, bg_scroll_y);
595 				atarimo_set_yscroll(0, bg_scroll_y);
596 			}
597 			break;
598 		}
599 	}
600 }
601 
602 static INT32 lastline_sprite = 0;
603 static INT32 lastline = 0;
604 
DrvDrawBegin()605 static void DrvDrawBegin()
606 {
607 	lastline = 0;
608 	lastline_sprite = 0;
609 	if (pBurnDraw) BurnTransferClear();
610 }
611 
partial_update_sprite(INT32 line)612 static void partial_update_sprite(INT32 line)
613 {
614 	if (line >= 240 || !pBurnDraw) return;
615 	//bprintf(0, _T("%08X: (tmap) partial %d - %d\n"), nCurrentFrame, lastline, line);
616 	GenericTilesSetClip(0, nScreenWidth, lastline_sprite, line+1);
617 	if (nSpriteEnable & 4) AtariMoRender(0);
618 	GenericTilesClearClip();
619 
620 	lastline_sprite = line+1;
621 }
622 
partial_update(INT32 line)623 static void partial_update(INT32 line)
624 {
625 	if (line >= 240 || !pBurnDraw) return;
626 	//bprintf(0, _T("%08X: (spr) partial %d - %d\n"), nCurrentFrame, lastline, line);
627 	GenericTilesSetClip(0, nScreenWidth, lastline, line+1);
628 
629 	if (nBurnLayer & 1) GenericTilemapDraw(0, pTransDraw, 0);
630 	if (nSpriteEnable & 1) copy_sprites_step1();
631 	if (nBurnLayer & 2) GenericTilemapDraw(1, pTransDraw, 1);
632 	if (nSpriteEnable & 1) copy_sprites_step2();
633 
634 	GenericTilesClearClip();
635 
636 	lastline = line+1;
637 }
638 
DrvDraw()639 static INT32 DrvDraw()
640 {
641 	if (DrvRecalc) {
642 		AtariPaletteUpdate4IRGB(DrvPalRAM, DrvPalette, 0x1000);
643 		DrvRecalc = 1; // force!!
644 	}
645 
646 	partial_update_sprite(239);
647 	partial_update(239);
648 
649 	BurnTransferCopy(DrvPalette);
650 
651 	return 0;
652 }
653 
udlr(UINT8 real_port,UINT8 fake_port)654 static UINT16 udlr(UINT8 real_port, UINT8 fake_port)
655 {
656 	UINT16 result = DrvInputs[real_port];
657 	UINT16 fake = DrvInputs[fake_port];
658 
659 	if (fake & 0x01)			// up
660 	{
661 		if (fake & 0x04)		// up and left
662 			result &= ~0x2000;
663 		else if (fake & 0x08)	// up and right
664 			result &= ~0x1000;
665 		else					// up only
666 			result &= ~0x3000;
667 	}
668 	else if (fake & 0x02)		// down
669 	{
670 		if (fake & 0x04)		// down and left
671 			result &= ~0x8000;
672 		else if (fake & 0x08)	// down and right
673 			result &= ~0x4000;
674 		else					// down only
675 			result &= ~0xc000;
676 	}
677 	else if (fake & 0x04)		// left only
678 		result &= ~0x6000;
679 	else if (fake & 0x08)		// right only
680 		result &= ~0x9000;
681 
682 	return result;
683 }
684 
DrvFrame()685 static INT32 DrvFrame()
686 {
687 	BurnWatchdogUpdate();
688 
689 	if (DrvReset) {
690 		DrvDoReset(1);
691 	}
692 
693 	SekNewFrame();
694 	M6502NewFrame();
695 
696 	{
697 		DrvInputs[0] = 0xffff;
698 		DrvInputs[1] = 0xfffe;
699 		DrvInputs[2] = 0xffff;
700 		DrvInputs[3] = 0x0040;
701 		DrvInputs[4] = 0x0000; // fake udlr
702 		DrvInputs[5] = 0x0000; // fake udlr
703 
704 		for (INT32 i = 0; i < 16; i++) {
705 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
706 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
707 			DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
708 			DrvInputs[3] ^= (DrvJoy4[i] & 1) << i;
709 			DrvInputs[4] ^= (DrvJoy5f[i] & 1) << i;
710 			DrvInputs[5] ^= (DrvJoy6f[i] & 1) << i;
711 		}
712 
713 		DrvInputs[0] = udlr(0, 4);
714 		DrvInputs[1] = udlr(1, 5);
715 
716 		DrvInputs[1] = (DrvInputs[1] & ~2) | (DrvDips[0] & 2);
717 
718 		atarijsa_input_port = DrvInputs[3];
719 		atarijsa_test_mask = 0x02;
720 		atarijsa_test_port = DrvDips[0] & atarijsa_test_mask;
721 	}
722 
723 	INT32 nSoundBufferPos = 0;
724 	INT32 nInterleave = 262;
725 	INT32 nCyclesTotal[2] = { (INT32)(7159090 / 59.92), (INT32)(1789773 / 59.92) };
726 	INT32 nCyclesDone[2] = { 0, 0 };
727 
728 	SekOpen(0);
729 	M6502Open(0);
730 
731 	vblank = 0;
732 	DrvDrawBegin();
733 
734 	for (INT32 i = 0; i < nInterleave; i++)
735 	{
736 		scanline = i;
737 
738 		CPU_RUN(0, Sek);
739 		CPU_RUN(1, M6502);
740 
741 		if ((i & 0x3f) == 0x3f) partial_update_sprite(i); // sprite update every 64 lines
742 		if ((i % 8) == 0) scanline_update(); // every 8th line
743 
744 		if (i == 239) {
745 			vblank = 1;
746 
747 			if (pBurnDraw) {
748 				BurnDrvRedraw();
749 			}
750 		}
751 
752 		AtariJSAInterruptUpdate(nInterleave);
753 
754 		if (pBurnSoundOut) {
755 			INT32 nSegment = nBurnSoundLen / nInterleave;
756 			AtariJSAUpdate(pBurnSoundOut + (nSoundBufferPos << 1), nSegment);
757 			nSoundBufferPos += nSegment;
758 		}
759 	}
760 
761 	if (pBurnSoundOut) {
762 		INT32 nSegment = nBurnSoundLen - nSoundBufferPos;
763 		if (nSegment > 0) {
764 			AtariJSAUpdate(pBurnSoundOut + (nSoundBufferPos << 1), nSegment);
765 		}
766 	}
767 
768 	SekClose();
769 	M6502Close();
770 
771 	return 0;
772 }
773 
774 
DrvScan(INT32 nAction,INT32 * pnMin)775 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
776 {
777 	struct BurnArea ba;
778 
779 	if (pnMin) {
780 		*pnMin = 0x029702;
781 	}
782 
783 	if (nAction & ACB_VOLATILE) {
784 		memset(&ba, 0, sizeof(ba));
785 
786 		ba.Data	  = AllRam;
787 		ba.nLen	  = RamEnd - AllRam;
788 		ba.szName = "All Ram";
789 		BurnAcb(&ba);
790 
791 		SekScan(nAction);
792 
793 		AtariJSAScan(nAction, pnMin);
794 		AtariMoScan(nAction, pnMin);
795 
796 		BurnWatchdogScan(nAction);
797 
798 		SCAN_VAR(playfield_tile_bank);
799 		SCAN_VAR(mob_scroll_x);
800 		SCAN_VAR(mob_scroll_y);
801 		SCAN_VAR(bg_scroll_x);
802 		SCAN_VAR(bg_scroll_y);
803 		SCAN_VAR(scanline_int_state);
804 	}
805 
806 	AtariEEPROMScan(nAction, pnMin);
807 
808 	return 0;
809 }
810 
811 
812 // Vindicators (rev 5)
813 
814 static struct BurnRomInfo vindictrRomDesc[] = {
815 	{ "136059-5117.d1",				0x10000, 0x2e5135e4, 1 | BRF_PRG | BRF_ESS }, //  0 68K Code
816 	{ "136059-5118.d3",				0x10000, 0xe357fa79, 1 | BRF_PRG | BRF_ESS }, //  1
817 	{ "136059-5119.f1",				0x10000, 0x0deb7330, 1 | BRF_PRG | BRF_ESS }, //  2
818 	{ "136059-5120.f3",				0x10000, 0xa6ae4753, 1 | BRF_PRG | BRF_ESS }, //  3
819 	{ "136059-5121.k1",				0x10000, 0x96b150c5, 1 | BRF_PRG | BRF_ESS }, //  4
820 	{ "136059-5122.k3",				0x10000, 0x6415d312, 1 | BRF_PRG | BRF_ESS }, //  5
821 
822 	{ "136059-1124.2k",				0x10000, 0xd2212c0a, 2 | BRF_PRG | BRF_ESS }, //  6 M6502 Code (JSA)
823 
824 	{ "136059-1104.12p",			0x20000, 0x062f8e52, 3 | BRF_GRA },           //  7 Background Tiles and Sprites
825 	{ "136059-1116.19p",			0x10000, 0x0e4366fa, 3 | BRF_GRA },           //  8
826 	{ "136059-1103.8p",				0x20000, 0x09123b57, 3 | BRF_GRA },           //  9
827 	{ "136059-1115.2p",				0x10000, 0x6b757bca, 3 | BRF_GRA },           // 10
828 	{ "136059-1102.12r",			0x20000, 0xa5268c4f, 3 | BRF_GRA },           // 11
829 	{ "136059-1114.19r",			0x10000, 0x609f619e, 3 | BRF_GRA },           // 12
830 	{ "136059-1101.8r",				0x20000, 0x2d07fdaa, 3 | BRF_GRA },           // 13
831 	{ "136059-1113.2r",				0x10000, 0x0a2aba63, 3 | BRF_GRA },           // 14
832 
833 	{ "136059-1123.16n",			0x04000, 0xf99b631a, 4 | BRF_GRA },           // 15 Characters
834 
835 	{ "pal16l8a-136059-1150.c3",	0x00104, 0x09d02b00, 5 | BRF_OPT },           // 16 PLDs
836 	{ "pal16l8a-136059-1151.d17",	0x00104, 0x797dcde7, 5 | BRF_OPT },           // 17
837 	{ "pal16l8a-136059-1152.e17",	0x00104, 0x56634c58, 5 | BRF_OPT },           // 18
838 	{ "pal16r6a-136059-1153.n7",	0x00104, 0x61076033, 5 | BRF_OPT },           // 19
839 };
840 
841 STD_ROM_PICK(vindictr)
842 STD_ROM_FN(vindictr)
843 
844 struct BurnDriver BurnDrvVindictr = {
845 	"vindictr", NULL, NULL, NULL, "1988",
846 	"Vindicators (rev 5)\0", NULL, "Atari Games", "Miscellaneous",
847 	NULL, NULL, NULL, NULL,
848 	BDF_GAME_WORKING, 4, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
849 	NULL, vindictrRomInfo, vindictrRomName, NULL, NULL, NULL, NULL, VindictrInputInfo, VindictrDIPInfo,
850 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4000,
851 	336, 240, 4, 3
852 };
853 
854 
855 // Vindicators (Europe, rev 5)
856 
857 static struct BurnRomInfo vindictreRomDesc[] = {
858 	{ "136059-5717.d1",				0x10000, 0xaf5ba4a8, 1 | BRF_PRG | BRF_ESS }, //  0 68K Code
859 	{ "136059-5718.d3",				0x10000, 0xc87b0581, 1 | BRF_PRG | BRF_ESS }, //  1
860 	{ "136059-5719.f1",				0x10000, 0x1e5f94e1, 1 | BRF_PRG | BRF_ESS }, //  2
861 	{ "136059-5720.f3",				0x10000, 0xcace40d7, 1 | BRF_PRG | BRF_ESS }, //  3
862 	{ "136059-5721.k1",				0x10000, 0x96b150c5, 1 | BRF_PRG | BRF_ESS }, //  4
863 	{ "136059-5722.k3",				0x10000, 0x6415d312, 1 | BRF_PRG | BRF_ESS }, //  5
864 
865 	{ "136059-1124.2k",				0x10000, 0xd2212c0a, 2 | BRF_PRG | BRF_ESS }, //  6 M6502 Code (JSA)
866 
867 	{ "136059-1104.12p",			0x20000, 0x062f8e52, 3 | BRF_GRA },           //  7 Background Tiles and Sprites
868 	{ "136059-1116.19p",			0x10000, 0x0e4366fa, 3 | BRF_GRA },           //  8
869 	{ "136059-1103.8p",				0x20000, 0x09123b57, 3 | BRF_GRA },           //  9
870 	{ "136059-1115.2p",				0x10000, 0x6b757bca, 3 | BRF_GRA },           // 10
871 	{ "136059-1102.12r",			0x20000, 0xa5268c4f, 3 | BRF_GRA },           // 11
872 	{ "136059-1114.19r",			0x10000, 0x609f619e, 3 | BRF_GRA },           // 12
873 	{ "136059-1101.8r",				0x20000, 0x2d07fdaa, 3 | BRF_GRA },           // 13
874 	{ "136059-1113.2r",				0x10000, 0x0a2aba63, 3 | BRF_GRA },           // 14
875 
876 	{ "136059-1123.16n",			0x04000, 0xf99b631a, 4 | BRF_GRA },           // 15 Characters
877 
878 	{ "pal16l8a-136059-1150.c3",	0x00104, 0x09d02b00, 5 | BRF_OPT },           // 16 PLDs
879 	{ "pal16l8a-136059-1151.d17",	0x00104, 0x797dcde7, 5 | BRF_OPT },           // 17
880 	{ "pal16l8a-136059-1152.e17",	0x00104, 0x56634c58, 5 | BRF_OPT },           // 18
881 	{ "pal16r6a-136059-1153.n7",	0x00104, 0x61076033, 5 | BRF_OPT },           // 19
882 };
883 
884 STD_ROM_PICK(vindictre)
885 STD_ROM_FN(vindictre)
886 
887 struct BurnDriver BurnDrvVindictre = {
888 	"vindictre", "vindictr", NULL, NULL, "1988",
889 	"Vindicators (Europe, rev 5)\0", NULL, "Atari Games", "Miscellaneous",
890 	NULL, NULL, NULL, NULL,
891 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
892 	NULL, vindictreRomInfo, vindictreRomName, NULL, NULL, NULL, NULL, VindictrInputInfo, VindictrDIPInfo,
893 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4000,
894 	336, 240, 4, 3
895 };
896 
897 
898 // Vindicators (German, rev 1)
899 
900 static struct BurnRomInfo vindictrgRomDesc[] = {
901 	{ "136059-1217.d1",				0x10000, 0x0a589e9a, 1 | BRF_PRG | BRF_ESS }, //  0 68K Code
902 	{ "136059-1218.d3",				0x10000, 0xe8b7959a, 1 | BRF_PRG | BRF_ESS }, //  1
903 	{ "136059-1219.f1",				0x10000, 0x2534fcbc, 1 | BRF_PRG | BRF_ESS }, //  2
904 	{ "136059-1220.f3",				0x10000, 0xd0947780, 1 | BRF_PRG | BRF_ESS }, //  3
905 	{ "136059-1221.k1",				0x10000, 0xee1b1014, 1 | BRF_PRG | BRF_ESS }, //  4
906 	{ "136059-1222.k3",				0x10000, 0x517b33f0, 1 | BRF_PRG | BRF_ESS }, //  5
907 
908 	{ "136059-1124.2k",				0x10000, 0xd2212c0a, 2 | BRF_PRG | BRF_ESS }, //  6 M6502 Code (JSA)
909 
910 	{ "136059-1104.12p",			0x20000, 0x062f8e52, 3 | BRF_GRA },           //  7 Background Tiles and Sprites
911 	{ "136059-1116.19p",			0x10000, 0x0e4366fa, 3 | BRF_GRA },           //  8
912 	{ "136059-1103.8p",				0x20000, 0x09123b57, 3 | BRF_GRA },           //  9
913 	{ "136059-1115.2p",				0x10000, 0x6b757bca, 3 | BRF_GRA },           // 10
914 	{ "136059-1102.12r",			0x20000, 0xa5268c4f, 3 | BRF_GRA },           // 11
915 	{ "136059-1114.19r",			0x10000, 0x609f619e, 3 | BRF_GRA },           // 12
916 	{ "136059-1101.8r",				0x20000, 0x2d07fdaa, 3 | BRF_GRA },           // 13
917 	{ "136059-1113.2r",				0x10000, 0x0a2aba63, 3 | BRF_GRA },           // 14
918 
919 	{ "136059-1223.16n",			0x04000, 0xd27975bb, 4 | BRF_GRA },           // 15 Characters
920 
921 	{ "pal16l8a-136059-1150.c3",	0x00104, 0x09d02b00, 5 | BRF_OPT },           // 16 PLDs
922 	{ "pal16l8a-136059-1151.d17",	0x00104, 0x797dcde7, 5 | BRF_OPT },           // 17
923 	{ "pal16l8a-136059-1152.e17",	0x00104, 0x56634c58, 5 | BRF_OPT },           // 18
924 	{ "pal16r6a-136059-1153.n7",	0x00104, 0x61076033, 5 | BRF_OPT },           // 19
925 };
926 
927 STD_ROM_PICK(vindictrg)
928 STD_ROM_FN(vindictrg)
929 
930 struct BurnDriver BurnDrvVindictrg = {
931 	"vindictrg", "vindictr", NULL, NULL, "1988",
932 	"Vindicators (German, rev 1)\0", NULL, "Atari Games", "Miscellaneous",
933 	NULL, NULL, NULL, NULL,
934 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
935 	NULL, vindictrgRomInfo, vindictrgRomName, NULL, NULL, NULL, NULL, VindictrInputInfo, VindictrDIPInfo,
936 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4000,
937 	336, 240, 4, 3
938 };
939 
940 
941 // Vindicators (Europe, rev 4)
942 
943 static struct BurnRomInfo vindictre4RomDesc[] = {
944 	{ "136059-1117.d1",				0x10000, 0x2e5135e4, 1 | BRF_PRG | BRF_ESS }, //  0 68K Code
945 	{ "136059-1118.d3",				0x10000, 0xe357fa79, 1 | BRF_PRG | BRF_ESS }, //  1
946 	{ "136059-4719.f1",				0x10000, 0x3b27ab80, 1 | BRF_PRG | BRF_ESS }, //  2
947 	{ "136059-4720.f3",				0x10000, 0xe5ac9933, 1 | BRF_PRG | BRF_ESS }, //  3
948 	{ "136059-4121.k1",				0x10000, 0x9a0444ee, 1 | BRF_PRG | BRF_ESS }, //  4
949 	{ "136059-4122.k3",				0x10000, 0xd5022d78, 1 | BRF_PRG | BRF_ESS }, //  5
950 
951 	{ "136059-1124.2k",				0x10000, 0xd2212c0a, 2 | BRF_PRG | BRF_ESS }, //  6 M6502 Code (JSA)
952 
953 	{ "136059-1104.12p",			0x20000, 0x062f8e52, 3 | BRF_GRA },           //  7 Background Tiles and Sprites
954 	{ "136059-1116.19p",			0x10000, 0x0e4366fa, 3 | BRF_GRA },           //  8
955 	{ "136059-1103.8p",				0x20000, 0x09123b57, 3 | BRF_GRA },           //  9
956 	{ "136059-1115.2p",				0x10000, 0x6b757bca, 3 | BRF_GRA },           // 10
957 	{ "136059-1102.12r",			0x20000, 0xa5268c4f, 3 | BRF_GRA },           // 11
958 	{ "136059-1114.19r",			0x10000, 0x609f619e, 3 | BRF_GRA },           // 12
959 	{ "136059-1101.8r",				0x20000, 0x2d07fdaa, 3 | BRF_GRA },           // 13
960 	{ "136059-1113.2r",				0x10000, 0x0a2aba63, 3 | BRF_GRA },           // 14
961 
962 	{ "136059-1123.16n",			0x04000, 0xf99b631a, 4 | BRF_GRA },           // 15 Characters
963 
964 	{ "pal16l8a-136059-1150.c3",	0x00104, 0x09d02b00, 5 | BRF_OPT },           // 16 PLDs
965 	{ "pal16l8a-136059-1151.d17",	0x00104, 0x797dcde7, 5 | BRF_OPT },           // 17
966 	{ "pal16l8a-136059-1152.e17",	0x00104, 0x56634c58, 5 | BRF_OPT },           // 18
967 	{ "pal16r6a-136059-1153.n7",	0x00104, 0x61076033, 5 | BRF_OPT },           // 19
968 };
969 
970 STD_ROM_PICK(vindictre4)
971 STD_ROM_FN(vindictre4)
972 
973 struct BurnDriver BurnDrvVindictre4 = {
974 	"vindictre4", "vindictr", NULL, NULL, "1988",
975 	"Vindicators (Europe, rev 4)\0", NULL, "Atari Games", "Miscellaneous",
976 	NULL, NULL, NULL, NULL,
977 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
978 	NULL, vindictre4RomInfo, vindictre4RomName, NULL, NULL, NULL, NULL, VindictrInputInfo, VindictrDIPInfo,
979 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4000,
980 	336, 240, 4, 3
981 };
982 
983 
984 // Vindicators (rev 4)
985 
986 static struct BurnRomInfo vindictr4RomDesc[] = {
987 	{ "136059-1117.d1",				0x10000, 0x2e5135e4, 1 | BRF_PRG | BRF_ESS }, //  0 68K Code
988 	{ "136059-1118.d3",				0x10000, 0xe357fa79, 1 | BRF_PRG | BRF_ESS }, //  1
989 	{ "136059-4119.f1",				0x10000, 0x44c77ee0, 1 | BRF_PRG | BRF_ESS }, //  2
990 	{ "136059-4120.f3",				0x10000, 0x4deaa77f, 1 | BRF_PRG | BRF_ESS }, //  3
991 	{ "136059-4121.k1",				0x10000, 0x9a0444ee, 1 | BRF_PRG | BRF_ESS }, //  4
992 	{ "136059-4122.k3",				0x10000, 0xd5022d78, 1 | BRF_PRG | BRF_ESS }, //  5
993 
994 	{ "136059-1124.2k",				0x10000, 0xd2212c0a, 2 | BRF_PRG | BRF_ESS }, //  6 M6502 Code (JSA)
995 
996 	{ "136059-1104.12p",			0x20000, 0x062f8e52, 3 | BRF_GRA },           //  7 Background Tiles and Sprites
997 	{ "136059-1116.19p",			0x10000, 0x0e4366fa, 3 | BRF_GRA },           //  8
998 	{ "136059-1103.8p",				0x20000, 0x09123b57, 3 | BRF_GRA },           //  9
999 	{ "136059-1115.2p",				0x10000, 0x6b757bca, 3 | BRF_GRA },           // 10
1000 	{ "136059-1102.12r",			0x20000, 0xa5268c4f, 3 | BRF_GRA },           // 11
1001 	{ "136059-1114.19r",			0x10000, 0x609f619e, 3 | BRF_GRA },           // 12
1002 	{ "136059-1101.8r",				0x20000, 0x2d07fdaa, 3 | BRF_GRA },           // 13
1003 	{ "136059-1113.2r",				0x10000, 0x0a2aba63, 3 | BRF_GRA },           // 14
1004 
1005 	{ "136059-1123.16n",			0x04000, 0xf99b631a, 4 | BRF_GRA },           // 15 Characters
1006 
1007 	{ "pal16l8a-136059-1150.c3",	0x00104, 0x09d02b00, 5 | BRF_OPT },           // 16 PLDs
1008 	{ "pal16l8a-136059-1151.d17",	0x00104, 0x797dcde7, 5 | BRF_OPT },           // 17
1009 	{ "pal16l8a-136059-1152.e17",	0x00104, 0x56634c58, 5 | BRF_OPT },           // 18
1010 	{ "pal16r6a-136059-1153.n7",	0x00104, 0x61076033, 5 | BRF_OPT },           // 19
1011 };
1012 
1013 STD_ROM_PICK(vindictr4)
1014 STD_ROM_FN(vindictr4)
1015 
1016 struct BurnDriver BurnDrvVindictr4 = {
1017 	"vindictr4", "vindictr", NULL, NULL, "1988",
1018 	"Vindicators (rev 4)\0", NULL, "Atari Games", "Miscellaneous",
1019 	NULL, NULL, NULL, NULL,
1020 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
1021 	NULL, vindictr4RomInfo, vindictr4RomName, NULL, NULL, NULL, NULL, VindictrInputInfo, VindictrDIPInfo,
1022 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4000,
1023 	336, 240, 4, 3
1024 };
1025 
1026 
1027 // Vindicators (Europe, rev 3)
1028 
1029 static struct BurnRomInfo vindictre3RomDesc[] = {
1030 	{ "136059-3117.d1",				0x10000, 0xaf5ba4a8, 1 | BRF_PRG | BRF_ESS }, //  0 68K Code
1031 	{ "136059-3118.d3",				0x10000, 0xc87b0581, 1 | BRF_PRG | BRF_ESS }, //  1
1032 	{ "136059-3119.f1",				0x10000, 0xf0516142, 1 | BRF_PRG | BRF_ESS }, //  2
1033 	{ "136059-3120.f3",				0x10000, 0x32a3729f, 1 | BRF_PRG | BRF_ESS }, //  3
1034 	{ "136059-2121.k1",				0x10000, 0x9b6111e0, 1 | BRF_PRG | BRF_ESS }, //  4
1035 	{ "136059-2122.k3",				0x10000, 0x8d029a28, 1 | BRF_PRG | BRF_ESS }, //  5
1036 
1037 	{ "136059-1124.2k",				0x10000, 0xd2212c0a, 2 | BRF_PRG | BRF_ESS }, //  6 M6502 Code (JSA)
1038 
1039 	{ "136059-1104.12p",			0x20000, 0x062f8e52, 3 | BRF_GRA },           //  7 Background Tiles and Sprites
1040 	{ "136059-1116.19p",			0x10000, 0x0e4366fa, 3 | BRF_GRA },           //  8
1041 	{ "136059-1103.8p",				0x20000, 0x09123b57, 3 | BRF_GRA },           //  9
1042 	{ "136059-1115.2p",				0x10000, 0x6b757bca, 3 | BRF_GRA },           // 10
1043 	{ "136059-1102.12r",			0x20000, 0xa5268c4f, 3 | BRF_GRA },           // 11
1044 	{ "136059-1114.19r",			0x10000, 0x609f619e, 3 | BRF_GRA },           // 12
1045 	{ "136059-1101.8r",				0x20000, 0x2d07fdaa, 3 | BRF_GRA },           // 13
1046 	{ "136059-1113.2r",				0x10000, 0x0a2aba63, 3 | BRF_GRA },           // 14
1047 
1048 	{ "136059-1123.16n",			0x04000, 0xf99b631a, 4 | BRF_GRA },           // 15 Characters
1049 
1050 	{ "pal16l8a-136059-1150.c3",	0x00104, 0x09d02b00, 5 | BRF_OPT },           // 16 PLDs
1051 	{ "pal16l8a-136059-1151.d17",	0x00104, 0x797dcde7, 5 | BRF_OPT },           // 17
1052 	{ "pal16l8a-136059-1152.e17",	0x00104, 0x56634c58, 5 | BRF_OPT },           // 18
1053 	{ "pal16r6a-136059-1153.n7",	0x00104, 0x61076033, 5 | BRF_OPT },           // 19
1054 };
1055 
1056 STD_ROM_PICK(vindictre3)
1057 STD_ROM_FN(vindictre3)
1058 
1059 struct BurnDriver BurnDrvVindictre3 = {
1060 	"vindictre3", "vindictr", NULL, NULL, "1988",
1061 	"Vindicators (Europe, rev 3)\0", NULL, "Atari Games", "Miscellaneous",
1062 	NULL, NULL, NULL, NULL,
1063 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
1064 	NULL, vindictre3RomInfo, vindictre3RomName, NULL, NULL, NULL, NULL, VindictrInputInfo, VindictrDIPInfo,
1065 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4000,
1066 	336, 240, 4, 3
1067 };
1068 
1069 
1070 // Vindicators (rev 2)
1071 
1072 static struct BurnRomInfo vindictr2RomDesc[] = {
1073 	{ "136059-1117.d1",				0x10000, 0x2e5135e4, 1 | BRF_PRG | BRF_ESS }, //  0 68K Code
1074 	{ "136059-1118.d3",				0x10000, 0xe357fa79, 1 | BRF_PRG | BRF_ESS }, //  1
1075 	{ "136059-2119.f1",				0x10000, 0x7f8c044e, 1 | BRF_PRG | BRF_ESS }, //  2
1076 	{ "136059-2120.f3",				0x10000, 0x4260cd3b, 1 | BRF_PRG | BRF_ESS }, //  3
1077 	{ "136059-2121.k1",				0x10000, 0x9b6111e0, 1 | BRF_PRG | BRF_ESS }, //  4
1078 	{ "136059-2122.k3",				0x10000, 0x8d029a28, 1 | BRF_PRG | BRF_ESS }, //  5
1079 
1080 	{ "136059-1124.2k",				0x10000, 0xd2212c0a, 2 | BRF_PRG | BRF_ESS }, //  6 M6502 Code (JSA)
1081 
1082 	{ "136059-1104.12p",			0x20000, 0x062f8e52, 3 | BRF_GRA },           //  7 Background Tiles and Sprites
1083 	{ "136059-1116.19p",			0x10000, 0x0e4366fa, 3 | BRF_GRA },           //  8
1084 	{ "136059-1103.8p",				0x20000, 0x09123b57, 3 | BRF_GRA },           //  9
1085 	{ "136059-1115.2p",				0x10000, 0x6b757bca, 3 | BRF_GRA },           // 10
1086 	{ "136059-1102.12r",			0x20000, 0xa5268c4f, 3 | BRF_GRA },           // 11
1087 	{ "136059-1114.19r",			0x10000, 0x609f619e, 3 | BRF_GRA },           // 12
1088 	{ "136059-1101.8r",				0x20000, 0x2d07fdaa, 3 | BRF_GRA },           // 13
1089 	{ "136059-1113.2r",				0x10000, 0x0a2aba63, 3 | BRF_GRA },           // 14
1090 
1091 	{ "136059-1123.16n",			0x04000, 0xf99b631a, 4 | BRF_GRA },           // 15 Characters
1092 
1093 	{ "pal16l8a-136059-1150.c3",	0x00104, 0x09d02b00, 5 | BRF_OPT },           // 16 PLDs
1094 	{ "pal16l8a-136059-1151.d17",	0x00104, 0x797dcde7, 5 | BRF_OPT },           // 17
1095 	{ "pal16l8a-136059-1152.e17",	0x00104, 0x56634c58, 5 | BRF_OPT },           // 18
1096 	{ "pal16r6a-136059-1153.n7",	0x00104, 0x61076033, 5 | BRF_OPT },           // 19
1097 };
1098 
1099 STD_ROM_PICK(vindictr2)
1100 STD_ROM_FN(vindictr2)
1101 
1102 struct BurnDriver BurnDrvVindictr2 = {
1103 	"vindictr2", "vindictr", NULL, NULL, "1988",
1104 	"Vindicators (rev 2)\0", NULL, "Atari Games", "Miscellaneous",
1105 	NULL, NULL, NULL, NULL,
1106 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
1107 	NULL, vindictr2RomInfo, vindictr2RomName, NULL, NULL, NULL, NULL, VindictrInputInfo, VindictrDIPInfo,
1108 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4000,
1109 	336, 240, 4, 3
1110 };
1111 
1112 
1113 // Vindicators (rev 1)
1114 
1115 static struct BurnRomInfo vindictr1RomDesc[] = {
1116 	{ "136059-1117.d1",				0x10000, 0x2e5135e4, 1 | BRF_PRG | BRF_ESS }, //  0 68K Code
1117 	{ "136059-1118.d3",				0x10000, 0xe357fa79, 1 | BRF_PRG | BRF_ESS }, //  1
1118 	{ "136059-1119.f1",				0x10000, 0x48938c95, 1 | BRF_PRG | BRF_ESS }, //  2
1119 	{ "136059-1120.f3",				0x10000, 0xed1de5e3, 1 | BRF_PRG | BRF_ESS }, //  3
1120 	{ "136059-1121.k1",				0x10000, 0x9b6111e0, 1 | BRF_PRG | BRF_ESS }, //  4
1121 	{ "136059-1122.k3",				0x10000, 0xa94773f1, 1 | BRF_PRG | BRF_ESS }, //  5
1122 
1123 	{ "136059-1124.2k",				0x10000, 0xd2212c0a, 2 | BRF_PRG | BRF_ESS }, //  6 M6502 Code (JSA)
1124 
1125 	{ "136059-1104.12p",			0x20000, 0x062f8e52, 3 | BRF_GRA },           //  7 Background Tiles and Sprites
1126 	{ "136059-1116.19p",			0x10000, 0x0e4366fa, 3 | BRF_GRA },           //  8
1127 	{ "136059-1103.8p",				0x20000, 0x09123b57, 3 | BRF_GRA },           //  9
1128 	{ "136059-1115.2p",				0x10000, 0x6b757bca, 3 | BRF_GRA },           // 10
1129 	{ "136059-1102.12r",			0x20000, 0xa5268c4f, 3 | BRF_GRA },           // 11
1130 	{ "136059-1114.19r",			0x10000, 0x609f619e, 3 | BRF_GRA },           // 12
1131 	{ "136059-1101.8r",				0x20000, 0x2d07fdaa, 3 | BRF_GRA },           // 13
1132 	{ "136059-1113.2r",				0x10000, 0x0a2aba63, 3 | BRF_GRA },           // 14
1133 
1134 	{ "136059-1123.16n",			0x04000, 0xf99b631a, 4 | BRF_GRA },           // 15 Characters
1135 
1136 	{ "pal16l8a-136059-1150.c3",	0x00104, 0x09d02b00, 5 | BRF_OPT },           // 16 PLDs
1137 	{ "pal16l8a-136059-1151.d17",	0x00104, 0x797dcde7, 5 | BRF_OPT },           // 17
1138 	{ "pal16l8a-136059-1152.e17",	0x00104, 0x56634c58, 5 | BRF_OPT },           // 18
1139 	{ "pal16r6a-136059-1153.n7",	0x00104, 0x61076033, 5 | BRF_OPT },           // 19
1140 };
1141 
1142 STD_ROM_PICK(vindictr1)
1143 STD_ROM_FN(vindictr1)
1144 
1145 struct BurnDriver BurnDrvVindictr1 = {
1146 	"vindictr1", "vindictr", NULL, NULL, "1988",
1147 	"Vindicators (rev 1)\0", NULL, "Atari Games", "Miscellaneous",
1148 	NULL, NULL, NULL, NULL,
1149 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
1150 	NULL, vindictr1RomInfo, vindictr1RomName, NULL, NULL, NULL, NULL, VindictrInputInfo, VindictrDIPInfo,
1151 	DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x4000,
1152 	336, 240, 4, 3
1153 };
1154