1 // FB Alpha Williams Games driver module
2 // Based on MAME driver by Aaron Giles
3 
4 // Works:
5 //  Defender
6 //  Stargate
7 //  Joust
8 //  Robotron 2084
9 //  Bubbles
10 //  Colony 7
11 //  Mayday
12 //  Jin
13 //  Splat
14 //  Alien Area - no sound (there is none)
15 //  Sinistar
16 //  Blaster
17 //  Speed Ball
18 
19 // todo / tofix:
20 //  Lottofun - memory protect sw. error
21 
22 #include "tiles_generic.h"
23 #include "m6809_intf.h"
24 #include "m6800_intf.h"
25 #include "dac.h"
26 #include "hc55516.h"
27 #include "watchdog.h"
28 #include "6821pia.h"
29 
30 static UINT8 *AllMem;
31 static UINT8 *MemEnd;
32 static UINT8 *AllRam;
33 static UINT8 *RamEnd;
34 static UINT8 *DrvM6809ROM0;
35 static UINT8 *DrvM6800ROM0;
36 static UINT8 *DrvM6800ROM1;
37 static UINT8 *DrvGfxROM;
38 static UINT8 *DrvColPROM;
39 static UINT8 *DrvNVRAM;
40 static UINT8 *DrvM6809RAM0;
41 static UINT8 *DrvM6800RAM0;
42 static UINT8 *DrvM6800RAM1;
43 static UINT8 *DrvVidRAM;
44 static UINT8 *DrvPalRAM;
45 
46 static UINT8 *DrvBlitRAM; // 8 bytes
47 static UINT8 *blitter_remap; // 256*256
48 
49 static UINT32 *Palette;
50 static UINT32 *DrvPalette;
51 static UINT8 DrvRecalc;
52 
53 static INT32 nExtraCycles[3];
54 
55 static UINT8 blitter_xor = 0;
56 static INT32 blitter_window_enable = 0;
57 static INT32 blitter_clip_address = ~0;
58 static INT32 blitter_remap_index = 0;
59 
60 static UINT8 blaster_video_control = 0;
61 static INT32 blaster_color0 = 0;
62 
63 static UINT8 cocktail = 0;
64 static UINT8 bankselect = 0;
65 static UINT8 vram_select = 0;
66 static UINT8 port_select = 0;
67 static UINT8 rom_bank = 0;
68 
69 static INT32 screen_x_adjust;
70 static INT32 scanline;
71 
72 static UINT8 DrvJoy1[8];
73 static UINT8 DrvJoy2[8];
74 static UINT8 DrvJoy3[8];
75 static UINT8 DrvJoy4[8];
76 static UINT8 DrvJoy5[8];
77 static UINT8 DrvJoy6[8];
78 static UINT8 DrvJoy7[8];
79 static UINT8 DrvInputs[7];
80 static UINT8 DrvDips[3] = { 0, 0, 0 };
81 static UINT8 DrvReset;
82 static INT16 DrvAnalogPort0 = 0;
83 static INT16 DrvAnalogPort1 = 0;
84 static INT16 DrvAnalogPort2 = 0;
85 static INT16 DrvAnalogPort3 = 0;
86 static INT32 TrackX[2] = { 0, 0 };
87 static INT32 TrackY[2] = { 0, 0 };
88 
89 static INT32 defender_control_hack = 0;
90 static INT32 defender = 0;
91 static INT32 mayday = 0;
92 static INT32 splat = 0;
93 static INT32 blaster = 0;
94 static INT32 spdball = 0;
95 
96 static INT32 uses_hc55516 = 0;
97 static INT32 uses_colprom = 0;
98 
99 // dc-blocking filter for DAC
100 static INT16 dac_lastin_r;
101 static INT16 dac_lastout_r;
102 static INT16 dac_lastin_l;
103 static INT16 dac_lastout_l;
104 
105 // raster update helpers
106 static INT32 lastline;
107 static void (*pStartDraw)() = NULL;
108 static void (*pDrawScanline)() = NULL;
109 
110 static INT32 nCyclesDone[3];
111 
112 static struct BurnInputInfo DefenderInputList[] = {
113 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
114 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p1 start"	},
115 	{"P1 Up",					BIT_DIGITAL,	DrvJoy2 + 0,	"p1 up"		},
116 	{"P1 Down",					BIT_DIGITAL,	DrvJoy1 + 7,	"p1 down"	},
117 	{"P1 Left",					BIT_DIGITAL,	DrvJoy7 + 6,	"p1 left"	},
118 	{"P1 Right",				BIT_DIGITAL,	DrvJoy7 + 1,	"p1 right"	},
119 	{"Fire",					BIT_DIGITAL,	DrvJoy1 + 0,	"p1 fire 1"	},
120 	{"Smart Bomb",				BIT_DIGITAL,	DrvJoy1 + 2,	"p1 fire 2"	},
121 	{"Hyperspace",				BIT_DIGITAL,	DrvJoy1 + 3,	"p1 fire 3"	},
122 	{"Thrust",					BIT_DIGITAL,	DrvJoy1 + 1,	"p1 fire 4"	},
123 	{"Reverse",					BIT_DIGITAL,	DrvJoy1 + 6,	"p1 fire 5"	},
124 
125 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
126 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
127 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
128 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"	},
129 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
130 };
131 
132 STDINPUTINFO(Defender)
133 
134 static struct BurnInputInfo MaydayInputList[] = {
135 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
136 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p1 start"	},
137 	{"P1 Up",					BIT_DIGITAL,	DrvJoy2 + 0,	"p1 up"		},
138 	{"P1 Down",					BIT_DIGITAL,	DrvJoy1 + 7,	"p1 down"	},
139 	{"P1 Right",				BIT_DIGITAL,	DrvJoy1 + 1,	"p1 right"	},
140 	{"Fire",					BIT_DIGITAL,	DrvJoy1 + 0,	"p1 fire 1"	},
141 	{"Mayday",					BIT_DIGITAL,	DrvJoy1 + 2,	"p1 fire 2"	},
142 	{"Back Fire",				BIT_DIGITAL,	DrvJoy1 + 3,	"p1 fire 3"	},
143 
144 	{"P2 Coin",					BIT_DIGITAL,	DrvJoy3 + 5,	"p2 coin"	},
145 	{"P2 Start",				BIT_DIGITAL,	DrvJoy1 + 4,	"p2 start"	},
146 
147 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
148 	{"Test Credit",				BIT_DIGITAL,	DrvJoy3 + 2,	"service"	},
149 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
150 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service3"	},
151 };
152 
153 STDINPUTINFO(Mayday)
154 
155 static struct BurnInputInfo Colony7InputList[] = {
156 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
157 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p1 start"	},
158 	{"P1 Up",					BIT_DIGITAL,	DrvJoy1 + 3,	"p1 up"		},
159 	{"P1 Down",					BIT_DIGITAL,	DrvJoy1 + 0,	"p1 down"	},
160 	{"P1 Left",					BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
161 	{"P1 Right",				BIT_DIGITAL,	DrvJoy1 + 1,	"p1 right"	},
162 	{"P1 Button 1",				BIT_DIGITAL,	DrvJoy1 + 6,	"p1 fire 1"	},
163 	{"P1 Button 2",				BIT_DIGITAL,	DrvJoy1 + 7,	"p1 fire 2"	},
164 	{"P1 Button 3",				BIT_DIGITAL,	DrvJoy2 + 0,	"p1 fire 3"	},
165 
166 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
167 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 5,	"tilt"		},
168 	{"Dip A",					BIT_DIPSWITCH,	DrvDips + 0,	"dip"		}, // b
169 	{"Dip B",					BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
170 	{"Dip C",					BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
171 };
172 
173 STDINPUTINFO(Colony7)
174 
175 static struct BurnInputInfo JinInputList[] = {
176 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 2,	"p1 coin"	},
177 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p1 start"	},
178 	{"P1 Up",					BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
179 	{"P1 Down",					BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
180 	{"P1 Left",					BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
181 	{"P1 Right",				BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
182 	{"P1 Button 1",				BIT_DIGITAL,	DrvJoy1 + 6,	"p1 fire 1"	},
183 	{"P1 Button 2",				BIT_DIGITAL,	DrvJoy1 + 7,	"p1 fire 2"	},
184 
185 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
186 	{"Dip A",					BIT_DIPSWITCH,	DrvDips + 0,	"dip"		}, // 9
187 	{"Dip B",					BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
188 	{"Dip C",					BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
189 };
190 
191 STDINPUTINFO(Jin)
192 
193 static struct BurnInputInfo StargateInputList[] = {
194 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
195 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p1 start"	},
196 	{"P1 Up",					BIT_DIGITAL,	DrvJoy2 + 0,	"p1 up"		},
197 	{"P1 Down",					BIT_DIGITAL,	DrvJoy1 + 7,	"p1 down"	},
198 	{"P1 Left",					BIT_DIGITAL,	DrvJoy7 + 6,	"p1 left"	},
199 	{"P1 Right",				BIT_DIGITAL,	DrvJoy7 + 1,	"p1 right"	},
200 	{"Fire",					BIT_DIGITAL,	DrvJoy1 + 0,	"p1 fire 1"	},
201 	{"Smart Bomb",				BIT_DIGITAL,	DrvJoy1 + 2,	"p1 fire 2"	},
202 	{"Inviso",					BIT_DIGITAL,	DrvJoy2 + 1,	"p1 fire 3"	},
203 	{"Hyperspace",				BIT_DIGITAL,	DrvJoy1 + 3,	"p1 fire 4"	},
204 	{"Thrust",					BIT_DIGITAL,	DrvJoy1 + 1,	"p1 fire 5"	},
205 	{"Reverse",					BIT_DIGITAL,	DrvJoy1 + 6,	"p1 fire 6"	},
206 
207 	{"P2 Coin",					BIT_DIGITAL,	DrvJoy3 + 5,	"p2 coin"	},
208 	{"P2 Start",				BIT_DIGITAL,	DrvJoy1 + 4,	"p2 start"	},
209 	{"P3 Coin",					BIT_DIGITAL,	DrvJoy3 + 2,	"p3 coin"	},
210 
211 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
212 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
213 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
214 	{"High Score reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"diag"		},
215 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
216 };
217 
218 STDINPUTINFO(Stargate)
219 
220 static struct BurnInputInfo RobotronInputList[] = {
221 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
222 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 4,	"p1 start"	},
223 	{"Move Up",					BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
224 	{"Move Down",				BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
225 	{"Move Left",				BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
226 	{"Move Right",				BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
227 	{"Fire Up",					BIT_DIGITAL,	DrvJoy1 + 6,	"p2 up"		},
228 	{"Fire Down",				BIT_DIGITAL,	DrvJoy1 + 7,	"p2 down"	},
229 	{"Fire Left",				BIT_DIGITAL,	DrvJoy2 + 0,	"p2 left"	},
230 	{"Fire Right",				BIT_DIGITAL,	DrvJoy2 + 1,	"p2 right"	},
231 
232 	{"P2 Coin",					BIT_DIGITAL,	DrvJoy3 + 5,	"p2 coin"	},
233 	{"P2 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p2 start"	},
234 	{"P3 Coin",					BIT_DIGITAL,	DrvJoy3 + 2,	"p3 coin"	},
235 
236 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
237 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
238 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
239 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"		},
240 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
241 };
242 
243 STDINPUTINFO(Robotron)
244 
245 static struct BurnInputInfo BubblesInputList[] = {
246 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
247 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p1 start"	},
248 	{"Up",						BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
249 	{"Down",					BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
250 	{"Left",					BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
251 	{"Right",					BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
252 
253 	{"P2 Coin",					BIT_DIGITAL,	DrvJoy3 + 5,	"p2 coin"	},
254 	{"P2 Start",				BIT_DIGITAL,	DrvJoy1 + 4,	"p2 start"	},
255 	{"P3 Coin",					BIT_DIGITAL,	DrvJoy3 + 2,	"p3 coin"	},
256 
257 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
258 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
259 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
260 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"	},
261 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
262 };
263 
264 STDINPUTINFO(Bubbles)
265 
266 static struct BurnInputInfo SplatInputList[] = {
267 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
268 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 4,	"p1 start"	},
269 
270 	{"P1 Left Stick Up",		BIT_DIGITAL,	DrvJoy5 + 0,	"p1 up"		},
271 	{"P1 Left Stick Down",		BIT_DIGITAL,	DrvJoy5 + 1,	"p1 down"	},
272 	{"P1 Left Stick Left",		BIT_DIGITAL,	DrvJoy5 + 2,	"p1 left"	},
273 	{"P1 Left Stick Right",     BIT_DIGITAL,	DrvJoy5 + 3,	"p1 right"	},
274 	{"P1 Right Stick Up",		BIT_DIGITAL,	DrvJoy5 + 6,	"p3 up"		},
275 	{"P1 Right Stick Down",		BIT_DIGITAL,	DrvJoy5 + 7,	"p3 down"	},
276 	{"P1 Right Stick Left",		BIT_DIGITAL,	DrvJoy7 + 0,	"p3 left"	},
277 	{"P1 Right Stick Right",	BIT_DIGITAL,	DrvJoy7 + 1,	"p3 right"	},
278 
279 	{"P2 Coin",					BIT_DIGITAL,	DrvJoy3 + 5,	"p2 coin"	},
280 	{"P2 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p2 start"	},
281 	{"P2 Left Stick Up",		BIT_DIGITAL,	DrvJoy4 + 0,	"p2 up"		},
282 	{"P2 Left Stick Down",		BIT_DIGITAL,	DrvJoy4 + 1,	"p2 down"	},
283 	{"P2 Left Stick Left",		BIT_DIGITAL,	DrvJoy4 + 2,	"p2 left"	},
284 	{"P2 Left Stick Right",	    BIT_DIGITAL,	DrvJoy4 + 3,	"p2 right"	},
285 	{"P2 Right Stick Up",		BIT_DIGITAL,	DrvJoy4 + 6,	"p4 up"		},
286 	{"P2 Right Stick Down",		BIT_DIGITAL,	DrvJoy4 + 7,	"p4 down"	},
287 	{"P2 Right Stick Left",		BIT_DIGITAL,	DrvJoy6 + 0,	"p4 left"	},
288 	{"P2 Right Stick Right",	BIT_DIGITAL,	DrvJoy6 + 1,	"p4 right"	},
289 
290 	{"P3 Coin",					BIT_DIGITAL,	DrvJoy3 + 2,	"p3 coin"	},
291 
292 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
293 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
294 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
295 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"	},
296 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
297 };
298 
299 STDINPUTINFO(Splat)
300 
301 static struct BurnInputInfo JoustInputList[] = {
302 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
303 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p1 start"	},
304 	{"P1 Left",					BIT_DIGITAL,	DrvJoy5 + 0,	"p1 left"	},
305 	{"P1 Right",				BIT_DIGITAL,	DrvJoy5 + 1,	"p1 right"	},
306 	{"P1 Button 1",				BIT_DIGITAL,	DrvJoy5 + 2,	"p1 fire 1"	},
307 
308 	{"P2 Coin",					BIT_DIGITAL,	DrvJoy3 + 5,	"p2 coin"	},
309 	{"P2 Start",				BIT_DIGITAL,	DrvJoy1 + 4,	"p2 start"	},
310 	{"P2 Left",					BIT_DIGITAL,	DrvJoy4 + 0,	"p2 left"	},
311 	{"P2 Right",				BIT_DIGITAL,	DrvJoy4 + 1,	"p2 right"	},
312 	{"P2 Button 1",				BIT_DIGITAL,	DrvJoy4 + 2,	"p2 fire 1"	},
313 
314 	{"P3 Coin",					BIT_DIGITAL,	DrvJoy3 + 2,	"p3 coin"	},
315 
316 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
317 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
318 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
319 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"	},
320 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
321 };
322 
323 STDINPUTINFO(Joust)
324 
325 #define A(a, b, c, d) {a, b, (UINT8*)(c), d}
326 static struct BurnInputInfo SpdballInputList[] = {
327 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
328 	{"P1 Start",				BIT_DIGITAL,	DrvJoy5 + 6,	"p1 start"	},
329 	{"P1 Up",					BIT_DIGITAL,	DrvJoy4 + 0,	"p1 up"		},
330 	{"P1 Down",					BIT_DIGITAL,	DrvJoy4 + 1,	"p1 down"	},
331 	{"P1 Left",					BIT_DIGITAL,	DrvJoy5 + 0,	"p1 left"	},
332 	{"P1 Right",				BIT_DIGITAL,	DrvJoy5 + 1,	"p1 right"	},
333 	{"P1 Button 1",				BIT_DIGITAL,	DrvJoy4 + 4,	"p1 fire 1"	},
334 
335 	A("P1 Stick X",             BIT_ANALOG_REL, &DrvAnalogPort0,"p1 x-axis"),
336 	A("P1 Stick Y",             BIT_ANALOG_REL, &DrvAnalogPort1,"p1 y-axis"),
337 
338 	{"P2 Coin",					BIT_DIGITAL,	DrvJoy3 + 5,	"p2 coin"	},
339 	{"P2 Start",				BIT_DIGITAL,	DrvJoy5 + 7,	"p2 start"	},
340 	{"P2 Up",					BIT_DIGITAL,	DrvJoy4 + 2,	"p2 up"		},
341 	{"P2 Down",					BIT_DIGITAL,	DrvJoy4 + 3,	"p2 down"	},
342 	{"P2 Left",					BIT_DIGITAL,	DrvJoy5 + 2,	"p2 left"	},
343 	{"P2 Right",				BIT_DIGITAL,	DrvJoy5 + 3,	"p2 right"	},
344 	{"P2 Button 1",				BIT_DIGITAL,	DrvJoy4 + 6,	"p2 fire 1"	},
345 
346 	A("P2 Stick X",             BIT_ANALOG_REL, &DrvAnalogPort2,"p2 x-axis"),
347 	A("P2 Stick Y",             BIT_ANALOG_REL, &DrvAnalogPort3,"p2 y-axis"),
348 
349 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
350 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
351 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
352 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"	},
353 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
354 };
355 #undef A
356 STDINPUTINFO(Spdball)
357 
358 static struct BurnInputInfo AlienarInputList[] = {
359 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
360 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 4,	"p1 start"	},
361 	{"P1 Up",					BIT_DIGITAL,	DrvJoy5 + 0,	"p1 up"		},
362 	{"P1 Down",					BIT_DIGITAL,	DrvJoy5 + 1,	"p1 down"	},
363 	{"P1 Left",					BIT_DIGITAL,	DrvJoy5 + 2,	"p1 left"	},
364 	{"P1 Right",				BIT_DIGITAL,	DrvJoy5 + 3,	"p1 right"	},
365 	{"P1 Button 1",				BIT_DIGITAL,	DrvJoy5 + 6,	"p1 fire 1"	},
366 	{"P1 Button 2",				BIT_DIGITAL,	DrvJoy5 + 7,	"p1 fire 2"	},
367 
368 	{"P2 Coin",					BIT_DIGITAL,	DrvJoy3 + 5,	"p2 coin"	},
369 	{"P2 Start",				BIT_DIGITAL,	DrvJoy1 + 5,	"p2 start"	},
370 	{"P2 Up",					BIT_DIGITAL,	DrvJoy4 + 0,	"p2 up"		},
371 	{"P2 Down",					BIT_DIGITAL,	DrvJoy4 + 1,	"p2 down"	},
372 	{"P2 Left",					BIT_DIGITAL,	DrvJoy4 + 2,	"p2 left"	},
373 	{"P2 Right",				BIT_DIGITAL,	DrvJoy4 + 3,	"p2 right"	},
374 	{"P2 Button 1",				BIT_DIGITAL,	DrvJoy4 + 6,	"p2 fire 1"	},
375 	{"P2 Button 2",				BIT_DIGITAL,	DrvJoy4 + 7,	"p2 fire 2"	},
376 
377 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
378 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
379 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
380 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"	},
381 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
382 };
383 
384 STDINPUTINFO(Alienar)
385 
386 #define A(a, b, c, d) {a, b, (UINT8*)(c), d}
387 static struct BurnInputInfo SinistarInputList[] = {
388 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
389 	{"P1 Start",				BIT_DIGITAL,	DrvJoy2 + 4,	"p1 start"	},
390 	{"P1 Button 1",				BIT_DIGITAL,	DrvJoy2 + 0,	"p1 fire 1"	},
391 	{"P1 Button 2",				BIT_DIGITAL,	DrvJoy2 + 1,	"p1 fire 2"	},
392 
393 	A("P1 Stick X",             BIT_ANALOG_REL, &DrvAnalogPort0,"p1 x-axis"),
394 	A("P1 Stick Y",             BIT_ANALOG_REL, &DrvAnalogPort1,"p1 y-axis"),
395 
396 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
397 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
398 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
399 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"	},
400 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
401 };
402 #undef A
403 
404 STDINPUTINFO(Sinistar)
405 
406 #define A(a, b, c, d) {a, b, (UINT8*)(c), d}
407 static struct BurnInputInfo BlasterInputList[] = {
408 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
409 	{"P1 Start",				BIT_DIGITAL,	DrvJoy2 + 4,	"p1 start"	},
410 	{"P1 Button 1",				BIT_DIGITAL,	DrvJoy2 + 1,	"p1 fire 1"	},
411 	{"P1 Button 2",				BIT_DIGITAL,	DrvJoy2 + 0,	"p1 fire 2"	},
412 	{"P1 Button 3",				BIT_DIGITAL,	DrvJoy2 + 2,	"p1 fire 3"	},
413 
414 	A("P1 Stick X",             BIT_ANALOG_REL, &DrvAnalogPort0,"p1 x-axis"),
415 	A("P1 Stick Y",             BIT_ANALOG_REL, &DrvAnalogPort1,"p1 y-axis"),
416 
417 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
418 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
419 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
420 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"	},
421 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
422 };
423 #undef A
424 
425 STDINPUTINFO(Blaster)
426 
427 static struct BurnInputInfo LottofunInputList[] = {
428 	{"P1 Coin",					BIT_DIGITAL,	DrvJoy3 + 4,	"p1 coin"	},
429 	{"P1 Start",				BIT_DIGITAL,	DrvJoy1 + 4,	"p1 start"	},
430 	{"Up",						BIT_DIGITAL,	DrvJoy1 + 0,	"p1 up"		},
431 	{"Down",					BIT_DIGITAL,	DrvJoy1 + 1,	"p1 down"	},
432 	{"Left",					BIT_DIGITAL,	DrvJoy1 + 2,	"p1 left"	},
433 	{"Right",					BIT_DIGITAL,	DrvJoy1 + 3,	"p1 right"	},
434 
435 	{"P2 Coin",					BIT_DIGITAL,	DrvJoy3 + 2,	"p2 coin"	},
436 
437 	{"Reset",					BIT_DIGITAL,	&DrvReset,		"reset"		},
438 	{"Auto Up / Manual Down",	BIT_DIGITAL,	DrvJoy3 + 0,	"service"	},
439 	{"Advance",					BIT_DIGITAL,	DrvJoy3 + 1,	"service2"	},
440 	{"High Score Reset",		BIT_DIGITAL,	DrvJoy3 + 3,	"service3"	},
441 	{"Tilt",					BIT_DIGITAL,	DrvJoy3 + 6,	"tilt"		},
442 };
443 
444 STDINPUTINFO(Lottofun)
445 
446 static struct BurnDIPInfo Colony7DIPList[]=
447 {
448 	{0x0b, 0xff, 0xff, 0x00, NULL					},
449 	{0x0c, 0xff, 0xff, 0x00, NULL					},
450 	{0x0d, 0xff, 0xff, 0x01, NULL					},
451 
452 	{0   , 0xfe, 0   ,    2, "Lives"				},
453 	{0x0d, 0x01, 0x01, 0x00, "2"					},
454 	{0x0d, 0x01, 0x01, 0x01, "3"					},
455 
456 	{0   , 0xfe, 0   ,    4, "Bonus At"				},
457 	{0x0d, 0x01, 0x02, 0x00, "20k/40k"				},
458 	{0x0d, 0x01, 0x02, 0x02, "30k/50k"				},
459 	{0x0d, 0x01, 0x02, 0x00, "30k/50k"				},
460 	{0x0d, 0x01, 0x02, 0x02, "40k/70k"				},
461 };
462 
463 STDDIPINFO(Colony7)
464 
465 static struct BurnDIPInfo JinDIPList[]=
466 {
467 	{0x09, 0xff, 0xff, 0x00, NULL					},
468 	{0x0a, 0xff, 0xff, 0x60, NULL					},
469 	{0x0b, 0xff, 0xff, 0x00, NULL					},
470 
471 	{0   , 0xfe, 0   ,    8, "Coinage"				},
472 	{0x0a, 0x01, 0x07, 0x07, "A 2C/1C B 1C/3C"		},
473 	{0x0a, 0x01, 0x07, 0x06, "A 2C/1C B 1C/1C"		},
474 	{0x0a, 0x01, 0x07, 0x05, "A 1C/3C B 1C/3C"		},
475 	{0x0a, 0x01, 0x07, 0x04, "A 1C/3C B 1C/1C"		},
476 	{0x0a, 0x01, 0x07, 0x03, "A 1C/2C B 1C/3C"		},
477 	{0x0a, 0x01, 0x07, 0x02, "A 1C/2C B 1C/1C"		},
478 	{0x0a, 0x01, 0x07, 0x01, "A 1C/1C B 1C/3C"		},
479 	{0x0a, 0x01, 0x07, 0x00, "A 1C/1C B 1C/1C"		},
480 
481 	{0   , 0xfe, 0   ,    2, "Lives"				},
482 	{0x0a, 0x01, 0x08, 0x08, "4"					},
483 	{0x0a, 0x01, 0x08, 0x00, "3"					},
484 
485 	{0   , 0xfe, 0   ,    4, "Level completed"		},
486 	{0x0a, 0x01, 0x60, 0x60, "85%"					},
487 	{0x0a, 0x01, 0x60, 0x40, "75%"					},
488 	{0x0a, 0x01, 0x60, 0x20, "65%"					},
489 	{0x0a, 0x01, 0x60, 0x00, "55%"					},
490 };
491 
492 STDDIPINFO(Jin)
493 
494 enum
495 {
496 	//controlbyte (0xCA00) bit definitions
497 	WMS_BLITTER_CONTROLBYTE_NO_EVEN = 0x80,
498 	WMS_BLITTER_CONTROLBYTE_NO_ODD = 0x40,
499 	WMS_BLITTER_CONTROLBYTE_SHIFT = 0x20,
500 	WMS_BLITTER_CONTROLBYTE_SOLID = 0x10,
501 	WMS_BLITTER_CONTROLBYTE_FOREGROUND_ONLY = 0x08,
502 	WMS_BLITTER_CONTROLBYTE_SLOW = 0x04, //2us blits instead of 1us
503 	WMS_BLITTER_CONTROLBYTE_DST_STRIDE_256 = 0x02,
504 	WMS_BLITTER_CONTROLBYTE_SRC_STRIDE_256 = 0x01
505 };
506 
blit_pixel(INT32 dstaddr,INT32 srcdata,INT32 controlbyte)507 static void blit_pixel(INT32 dstaddr, INT32 srcdata, INT32 controlbyte)
508 {
509 	INT32 curpix = (dstaddr < 0xc000) ? DrvVidRAM[dstaddr] : M6809ReadByte(dstaddr);   //current pixel values at dest
510 
511 	INT32 solid = DrvBlitRAM[1];
512 	UINT8 keepmask = 0xff;
513 
514 	if((controlbyte & WMS_BLITTER_CONTROLBYTE_FOREGROUND_ONLY) && !(srcdata & 0xf0))
515 	{
516 		if(controlbyte & WMS_BLITTER_CONTROLBYTE_NO_EVEN)
517 			keepmask &= 0x0f;
518 	}
519 	else
520 	{
521 		if(!(controlbyte & WMS_BLITTER_CONTROLBYTE_NO_EVEN))
522 			keepmask &= 0x0f;
523 	}
524 
525 	if((controlbyte & WMS_BLITTER_CONTROLBYTE_FOREGROUND_ONLY) && !(srcdata & 0x0f))
526 	{
527 		if(controlbyte & WMS_BLITTER_CONTROLBYTE_NO_ODD)
528 			keepmask &= 0xf0;
529 	}
530 	else
531 	{
532 		if(!(controlbyte & WMS_BLITTER_CONTROLBYTE_NO_ODD))
533 			keepmask &= 0xf0;
534 	}
535 
536 	curpix &= keepmask;
537 	if(controlbyte & WMS_BLITTER_CONTROLBYTE_SOLID)
538 		curpix |= (solid & ~keepmask);
539 	else
540 		curpix |= (srcdata & ~keepmask);
541 
542 	if (!blitter_window_enable || dstaddr < blitter_clip_address || dstaddr >= 0xc000)
543 	{
544 		M6809WriteByte(dstaddr, curpix);
545 	}
546 }
547 
blitter_core(UINT16 sstart,UINT16 dstart,UINT8 w,UINT8 h,UINT8 controlbyte)548 static INT32 blitter_core(UINT16 sstart, UINT16 dstart, UINT8 w, UINT8 h, UINT8 controlbyte)
549 {
550 	INT32 source, sxadv, syadv;
551 	INT32 dest, dxadv, dyadv;
552 	INT32 x, y;
553 	INT32 accesses = 0;
554 	UINT8 *remap_ptr = blitter_remap + blitter_remap_index * 256;
555 
556 	sxadv = (controlbyte & WMS_BLITTER_CONTROLBYTE_SRC_STRIDE_256) ? 0x100 : 1;
557 	syadv = (controlbyte & WMS_BLITTER_CONTROLBYTE_SRC_STRIDE_256) ? 1 : w;
558 	dxadv = (controlbyte & WMS_BLITTER_CONTROLBYTE_DST_STRIDE_256) ? 0x100 : 1;
559 	dyadv = (controlbyte & WMS_BLITTER_CONTROLBYTE_DST_STRIDE_256) ? 1 : w;
560 
561 	INT32 pixdata=0;
562 
563 	for (y = 0; y < h; y++)
564 	{
565 		source = sstart & 0xffff;
566 		dest = dstart & 0xffff;
567 
568 		for (x = 0; x < w; x++)
569 		{
570 			if (!(controlbyte & WMS_BLITTER_CONTROLBYTE_SHIFT)) //no shift
571 			{
572 				blit_pixel(dest, remap_ptr[M6809ReadByte(source)], controlbyte);
573 			}
574 			else
575 			{   //shift one pixel right
576 				pixdata = (pixdata << 8) | remap_ptr[M6809ReadByte(source)];
577 				blit_pixel(dest, (pixdata >> 4) & 0xff, controlbyte);
578 			}
579 			accesses += 2;
580 
581 			source = (source + sxadv) & 0xffff;
582 			dest   = (dest + dxadv) & 0xffff;
583 		}
584 
585 		if (controlbyte & WMS_BLITTER_CONTROLBYTE_DST_STRIDE_256)
586 			dstart = (dstart & 0xff00) | ((dstart + dyadv) & 0xff);
587 		else
588 			dstart += dyadv;
589 
590 		if (controlbyte & WMS_BLITTER_CONTROLBYTE_SRC_STRIDE_256)
591 			sstart = (sstart & 0xff00) | ((sstart + syadv) & 0xff);
592 		else
593 			sstart += syadv;
594 	}
595 	return accesses;
596 }
597 
williams_blitter_write(INT32 offset,UINT8 data)598 static void williams_blitter_write(INT32 offset, UINT8 data)
599 {
600 	offset &= 7;
601 
602 	INT32 sstart, dstart, w, h, accesses;
603 	INT32 estimated_clocks_at_4MHz;
604 
605 	DrvBlitRAM[offset] = data;
606 
607 	if (offset != 0)
608 		return;
609 
610 	sstart = (DrvBlitRAM[2] << 8) + DrvBlitRAM[3];
611 	dstart = (DrvBlitRAM[4] << 8) + DrvBlitRAM[5];
612 
613 	w = DrvBlitRAM[6] ^ blitter_xor;
614 	h = DrvBlitRAM[7] ^ blitter_xor;
615 
616 	if (w == 0) w = 1;
617 	if (h == 0) h = 1;
618 
619 	//bprintf(0, _T("blit: sstart %X  dstart %X  w %X  h %X  data %X.\n"), sstart, dstart, w, h, data);
620 	accesses = blitter_core(sstart, dstart, w, h, data);
621 
622 	if(data & WMS_BLITTER_CONTROLBYTE_SLOW)
623 	{
624 		estimated_clocks_at_4MHz = 4 + 4 * (accesses + 2);
625 	}
626 	else
627 	{
628 		estimated_clocks_at_4MHz = 4 + 2 * (accesses + 3);
629 	}
630 
631 //	m6809_eat_cycles(-((estimated_clocks_at_4MHz + 3) / 4));
632 }
633 
defender_bank_write(UINT16 address,UINT8 data)634 static void defender_bank_write(UINT16 address, UINT8 data)
635 {
636 	//bprintf (0, _T("BW: %4.4x %2.2x\n"), address, data);
637 
638 	if (address == 0x03ff) {
639 		if (data == 0x39) {
640 			BurnWatchdogWrite();
641 			bprintf(0, _T("Watchdog Write.    **\n"));
642 		}
643 		return;
644 	}
645 
646 	if ((address & 0xfc10) == 0x0000) {
647 		DrvPalRAM[address & 0x0f] = data;
648 		return;
649 	}
650 
651 	if ((address & 0xfc10) == 0x0010) {
652 		cocktail = data & 0x01;
653 		return;
654 	}
655 
656 	if ((address & 0xfc00) == 0x0400) {
657 		DrvNVRAM[address & 0xff] = data | 0xf0;
658 		return;
659 	}
660 
661 	if ((address & 0xfc1c) == 0x0c00) {
662 		pia_write(1, address & 0x3, data);
663 		return;
664 	}
665 
666 	if ((address & 0xfc1c) == 0x0c04) {
667 		pia_write(0, address & 0x3, data);
668 		return;
669 	}
670 
671 	bprintf (0, _T("BW: %4.4x %2.2x\n"), address, data);
672 
673 	if (address >= 0xa000) return; // nop
674 }
675 
defender_bank_read(UINT16 address)676 static UINT8 defender_bank_read(UINT16 address)
677 {
678 //	bprintf (0, _T("BR: %4.4x\n"), address);
679 
680 	if ((address & 0xfc00) == 0x0400) {
681 		return DrvNVRAM[address & 0xff];
682 	}
683 
684 	if ((address & 0xfc00) == 0x0800) {
685 		return (scanline < 0x100) ? (scanline & 0xfc) : 0xfc;
686 	}
687 
688 	if ((address & 0xfc1c) == 0x0c00) {
689 		return pia_read(1, address & 3);
690 	}
691 
692 	if ((address & 0xfc1c) == 0x0c04) {
693 		return pia_read(0, address & 3);
694 	}
695 
696 	if (address >= 0x1000 && address <= 0x9fff) {
697 		return DrvM6809ROM0[0x10000 + address];
698 	}
699 
700 	if (address >= 0xa000) {
701 		return 0;
702 	}
703 
704 	bprintf (0, _T("BR: %4.4x\n"), address);
705 
706 	return 0;
707 }
708 
bankswitch()709 static void bankswitch()
710 {
711 	if (bankselect >= 1 && bankselect <= 9) {
712 		M6809MapMemory(DrvM6809ROM0 + 0x10000 + (bankselect - 1) * 0x1000, 0xc000, 0xcfff, MAP_ROM);
713 	} else {
714 		M6809UnmapMemory(0xc000, 0xcfff, MAP_RAM);
715 	}
716 }
717 
defender_main_write(UINT16 address,UINT8 data)718 static void defender_main_write(UINT16 address, UINT8 data)
719 {
720 	if ((address & 0xf000) == 0xc000) {
721 		defender_bank_write((address & 0xfff) + (bankselect * 0x1000), data);
722 		return;
723 	}
724 
725 	if ((address & 0xf000) == 0xd000) {
726 		bankselect = data & 0xf;
727 		bankswitch();
728 
729 		// mayday
730 		if (DrvM6809ROM0[0xf7b5] == 0xff && DrvM6809ROM0[0xf7b6] == 0xff) {
731 		   // bprintf (0, _T("Mayday prot: %3.3x, %2.2x\n"), address & 0xfff, data);
732 			//if (data == 0x01) {
733 			//	memset (DrvM6809ROM0 + 0xf7ad, 0, 6);
734 			//}
735 			// else {
736 			//	static const UINT8 test_data[8] = {
737 			//		0x31, 0x62, 0xE2, 0xA1, 0x91, 0x09, 0xC0, 0x00
738 			//	};
739 			//	memcpy (DrvM6809ROM0 + 0xf7ad, test_data, 2);
740 			//}
741 		}
742 		return;
743 	}
744 }
745 
defender_main_read(UINT16 address)746 static UINT8 defender_main_read(UINT16 address)
747 {
748 	if (address >= 0x0000 && address <= 0xbfff) { // Mayday prot
749 		if (mayday && address >= 0xa190 && address <= 0xa191) { // Mayday prot
750 			bprintf(0, _T("read mayday prot: %X.\n"), address);
751 			return DrvVidRAM[address + 3];
752 		}
753 		return DrvVidRAM[address];
754 	}
755 
756 	if ((address & 0xf000) == 0xc000) {
757 		return defender_bank_read((address & 0xfff) + (bankselect * 0x1000));
758 	}
759 
760 	return 0;
761 }
762 
williams_bank()763 static void williams_bank()
764 {
765 	if (vram_select == 0)
766 	{
767 		M6809MapMemory(DrvVidRAM,				0x0000, 0x8fff, MAP_RAM);
768 	}
769 	else
770 	{
771 		M6809MapMemory(DrvM6809ROM0 + 0x10000,	0x0000, 0x8fff, MAP_ROM);
772 	}
773 }
774 
williams_main_write(UINT16 address,UINT8 data)775 static void williams_main_write(UINT16 address, UINT8 data)
776 {
777 	if ((address & 0xfc00) == 0xc000) {
778 		DrvPalRAM[address & 0xf] = data;
779 		return;
780 	}
781 
782 	if ((address & 0xfc00) == 0xcc00) {
783 		DrvNVRAM[address & 0x3ff] = data | 0xf0;
784 		return;
785 	}
786 
787 	if ((address & 0xff00) == 0xc900) {
788 		vram_select = data & 1;
789 		cocktail = data & 2;
790 		if (blitter_clip_address == 0x7400) blitter_window_enable = data & 4; // sinistar
791 		williams_bank();
792 		return;
793 	}
794 
795 	if ((address & 0xff0c) == 0xc804) {
796 		pia_write(0, address & 0x3, data);
797 		return;
798 	}
799 
800 	if ((address & 0xff0c) == 0xc808) { // spdball
801 		pia_write(3, address & 0x3, data);
802 		return;
803 	}
804 
805 	if ((address & 0xff0c) == 0xc80c) {
806 		pia_write(1, address & 0x3, data);
807 		return;
808 	}
809 
810 	if ((address & 0xff00) == 0xca00) {
811 		williams_blitter_write(address, data);
812 		return;
813 	}
814 
815 	switch (address)
816 	{
817 		case 0xcbff:
818 			if (data == 0x39) {
819 				BurnWatchdogWrite();
820 			}
821 		return;
822 	}
823 
824 	// sinistar debug derp spew writes @ 0xe000 - 0xffff
825 	if ((address & 0xe000) != 0xe000) bprintf (0, _T("MW: %4.4x, %2.2x\n"), address, data);
826 }
827 
williams_main_read(UINT16 address)828 static UINT8 williams_main_read(UINT16 address)
829 {
830 	if ((address & 0xfffc) == 0xc800) {
831 		switch (address & 0x03) {
832 			case 0: return TrackY[0]&0xff;
833 			case 1: return TrackX[0]&0xff;
834 			case 2: return TrackY[1]&0xff;
835 			case 3: return TrackX[1]&0xff;
836 		}
837 
838 		return 0; // spdball analog input read
839 	}
840 
841 	if ((address & 0xff0c) == 0xc804) {
842 		return pia_read(0, address & 3);
843 	}
844 
845 	if ((address & 0xff0c) == 0xc808) { // spdball
846 		return pia_read(3, address & 3);
847 	}
848 
849 	if ((address & 0xff0c) == 0xc80c) {
850 		return pia_read(1, address & 3);
851 	}
852 
853 	if ((address & 0xff00) == 0xca00) {
854 		return DrvBlitRAM[address & 7];
855 	}
856 
857 	if ((address & 0xff00) == 0xcb00) {
858 		return (scanline < 0x100) ? (scanline & 0xfc) : 0xfc;
859 	}
860 
861 	if ((address & 0xfc00) == 0xc000) { // palette read, maybe? (sinistar)
862 		return DrvPalRAM[address & 0xf];
863 	}
864 
865 	if ((address & 0xff00) == 0xc900) return 0; // NOP
866 
867 	bprintf (0, _T("MR: %4.4x\n"), address);
868 
869 	return 0;
870 }
871 
blaster_bankswitch()872 static void blaster_bankswitch()
873 {
874 	if (vram_select == 0)
875 	{
876 		M6809MapMemory(DrvVidRAM,		0x0000, 0x8fff, MAP_RAM);
877 	}
878 	else
879 	{
880 		M6809MapMemory(DrvM6809ROM0 + 0x18000 + rom_bank * 0x4000, 0x0000, 0x3fff, MAP_ROM);
881 		M6809MapMemory(DrvM6809ROM0 + 0x10000, 0x4000, 0x8fff, MAP_ROM);
882 	}
883 }
884 
blaster_main_write(UINT16 address,UINT8 data)885 static void blaster_main_write(UINT16 address, UINT8 data)
886 {
887 		if ((address & 0xffc0) == 0xc900) {
888 			vram_select = data & 0x01;
889 			cocktail = data & 0x02;
890 			blitter_window_enable = data & 0x04;
891 			blaster_bankswitch();
892 			return;
893 		}
894 
895 		if ((address & 0xffc0) == 0xc940) {
896 			blitter_remap_index = data;
897 			return;
898 		}
899 
900 		if ((address & 0xffc0) == 0xc980) {
901 			rom_bank = data & 0x0f;
902 			blaster_bankswitch();
903 			return;
904 		}
905 
906 		if ((address & 0xffc0) == 0xc9c0) {
907 			blaster_video_control = data;
908 			return;
909 		}
910 
911 		williams_main_write(address, data);
912 }
913 
defender_sound_write(UINT16 address,UINT8 data)914 static void defender_sound_write(UINT16 address, UINT8 data)
915 {
916 	if ((address & 0x7ffc) == 0x0400) {
917 		pia_write(2, address & 0x3, data);
918 		return;
919 	}
920 }
921 
defender_sound_read(UINT16 address)922 static UINT8 defender_sound_read(UINT16 address)
923 {
924 	if ((address & 0x7ffc) == 0x0400) {
925 		return pia_read(2, address & 3);
926 	}
927 
928 	return 0;
929 }
930 
blaster_sound_write(UINT16 address,UINT8 data)931 static void blaster_sound_write(UINT16 address, UINT8 data)
932 {
933 	if ((address & 0x7ffc) == 0x0400) {
934 		pia_write(4, address & 0x3, data);
935 		return;
936 	}
937 }
938 
blaster_sound_read(UINT16 address)939 static UINT8 blaster_sound_read(UINT16 address)
940 {
941 	if ((address & 0x7ffc) == 0x0400) {
942 		return pia_read(4, address & 3);
943 	}
944 
945 	return 0;
946 }
947 
pia0_in_a(UINT16)948 static UINT8 pia0_in_a(UINT16 )
949 {
950 	return DrvInputs[0];
951 }
952 
pia0_in_b(UINT16)953 static UINT8 pia0_in_b(UINT16 )
954 {
955 	return DrvInputs[1];
956 }
957 
pia1_in_a(UINT16)958 static UINT8 pia1_in_a(UINT16 )
959 {
960 	return DrvInputs[2];
961 }
962 
pia0_muxed_out_b2(UINT16,UINT8 data)963 static void pia0_muxed_out_b2(UINT16 , UINT8 data)
964 {
965 	port_select = data;
966 }
967 
pia0_muxed_joust_in_a(UINT16)968 static UINT8 pia0_muxed_joust_in_a(UINT16 )
969 {
970 	return (DrvInputs[0] & 0x30) | ((port_select == 0) ? (DrvInputs[3] & ~0x30) : (DrvInputs[4] & ~0x30));
971 }
972 
pia0_muxed_joust_in_b(UINT16)973 static UINT8 pia0_muxed_joust_in_b(UINT16 )
974 {
975 	return (DrvInputs[1] & 0xfc) | ((port_select == 0) ? (DrvInputs[5] & 0x3) : (DrvInputs[6] & 0x3));
976 }
977 
pia0_49way_in_a(UINT16)978 static UINT8 pia0_49way_in_a(UINT16 )
979 {
980 	static const UINT8 translate49[7] = { 0x0, 0x4, 0x6, 0x7, 0xb, 0x9, 0x8 };
981 	INT16 x = ProcessAnalog(DrvAnalogPort0, 0, 1, 0x00, 0x6f);
982 	INT16 y = ProcessAnalog(DrvAnalogPort1, 1, 1, 0x00, 0x6f);
983 	return (translate49[x >> 4] << 4) | translate49[y >> 4];
984 }
985 
sync_sound(INT32 num)986 static void sync_sound(INT32 num)
987 {
988 	INT32 cyc = (INT32)(((double)((double)M6809TotalCycles() * 894886) / 1000000)+0.5);
989 	INT32 todo = cyc - M6800TotalCycles();
990 	//bprintf(0, _T("m6809 cyc: %d  m6800 cyc: %d.    cyc: %d  todo %d.\n"), M6809TotalCycles(), M6800TotalCycles(), cyc, todo);
991 	// Adding in a couple cycles to prevent lost soundcommands.  This is OK since we lose a few cycles/frame due to division & rounding loss.
992 	if (todo < 1) todo = 15;
993 	nCyclesDone[num + 1] += M6800Run(todo + 10);
994 }
995 
pia1_out_b(UINT16,UINT8 data)996 static void pia1_out_b(UINT16 , UINT8 data)
997 {
998 	if (!blaster) { // defender, williams HW
999 		M6800Open(0);
1000 		sync_sound(0);
1001 		data |= 0xc0;
1002 		pia_set_input_b(2, data);
1003 		pia_set_input_cb1(2, (data == 0xff) ? 0 : 1);
1004 		M6800Close();
1005 	} else {        // Blaster HW
1006 		UINT8 l_data = data | 0x80;
1007 		UINT8 r_data = (data >> 1 & 0x40) | (data & 0x3f) | 0x80;
1008 
1009 		M6800Open(0);
1010 		//bprintf(0, _T("0) "));
1011 		sync_sound(0);
1012 		pia_set_input_b(2, l_data);
1013 		pia_set_input_cb1(2, (l_data == 0xff) ? 0 : 1);
1014 		M6800Close();
1015 
1016 		M6800Open(1);
1017 		//bprintf(0, _T("1) "));
1018 		sync_sound(1);
1019 		pia_set_input_b(4, r_data);
1020 		pia_set_input_cb1(4, (r_data == 0xff) ? 0 : 1);
1021 		M6800Close();
1022 	}
1023 }
1024 
pia2_out_b(UINT16,UINT8 data)1025 static void pia2_out_b(UINT16 , UINT8 data)
1026 {
1027 	DACWrite(0, data);
1028 }
1029 
pia2_out_b2(UINT16,UINT8 data)1030 static void pia2_out_b2(UINT16 , UINT8 data)
1031 {
1032 	DACWrite(1, data);
1033 }
1034 
hc55516_digit_out(UINT16,UINT8 data)1035 static void hc55516_digit_out(UINT16 , UINT8 data)
1036 {
1037 	hc55516_digit_w(data);
1038 }
1039 
hc55516_clock_out(UINT16,UINT8 data)1040 static void hc55516_clock_out(UINT16 , UINT8 data)
1041 {
1042 	hc55516_clock_w(data);
1043 }
1044 
pia1_main_irq(INT32 state)1045 static void pia1_main_irq(INT32 state)
1046 {
1047 	M6809SetIRQLine(M6809_IRQ_LINE, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
1048 }
1049 
pia2_sound_irq(INT32 state)1050 static void pia2_sound_irq(INT32 state)
1051 {
1052 	M6800SetIRQLine(M6800_IRQ_LINE, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
1053 }
1054 
pia4_sound_irq(INT32 state)1055 static void pia4_sound_irq(INT32 state)
1056 {
1057 	M6800SetIRQLine(M6800_IRQ_LINE, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
1058 }
1059 
1060 static pia6821_interface pia_0 = {
1061 	pia0_in_a, pia0_in_b,
1062 	NULL, NULL, NULL, NULL,
1063 	NULL, NULL, NULL, NULL,
1064 	NULL, NULL
1065 };
1066 
1067 static pia6821_interface pia_muxed_joust_0 = {
1068 	pia0_muxed_joust_in_a, pia0_muxed_joust_in_b,
1069 	NULL, NULL, NULL, NULL,
1070 	NULL, NULL, NULL, pia0_muxed_out_b2,
1071 	NULL, NULL
1072 };
1073 
1074 static pia6821_interface pia_49way_0 = {
1075 	pia0_49way_in_a, pia0_in_b,
1076 	NULL, NULL, NULL, NULL,
1077 	NULL, NULL, NULL, NULL,
1078 	NULL, NULL
1079 };
1080 
1081 static pia6821_interface pia_1 = {
1082 	pia1_in_a, NULL,
1083 	NULL, NULL, NULL, NULL,
1084 	NULL, pia1_out_b, NULL, NULL,
1085 	pia1_main_irq, pia1_main_irq
1086 };
1087 
1088 static pia6821_interface pia_2 = {
1089 	NULL, NULL,
1090 	NULL, NULL, NULL, NULL,
1091 	pia2_out_b, NULL, NULL, NULL,
1092 	pia2_sound_irq, pia2_sound_irq
1093 };
1094 
1095 static pia6821_interface pia_4 = { // blaster 2nd soundchip
1096 	NULL, NULL,
1097 	NULL, NULL, NULL, NULL,
1098 	pia2_out_b2, NULL, NULL, NULL,
1099 	pia4_sound_irq, pia4_sound_irq
1100 };
1101 
1102 static pia6821_interface pia_2_sinistar = {
1103 	NULL, NULL,
1104 	NULL, NULL, NULL, NULL,
1105 	pia2_out_b, NULL, hc55516_digit_out, hc55516_clock_out,
1106 	pia2_sound_irq, pia2_sound_irq
1107 };
1108 
pia3_in_a(UINT16)1109 static UINT8 pia3_in_a(UINT16 )
1110 {
1111 	return DrvInputs[3];
1112 }
1113 
pia3_in_b(UINT16)1114 static UINT8 pia3_in_b(UINT16 )
1115 {
1116 	return DrvInputs[4];
1117 }
1118 
1119 static pia6821_interface pia_3 = {
1120 	pia3_in_a, pia3_in_b,
1121 	NULL, NULL, NULL, NULL,
1122 	NULL, NULL, NULL, NULL,
1123 	NULL, NULL
1124 };
1125 
DrvDoReset(INT32 clear_mem)1126 static INT32 DrvDoReset(INT32 clear_mem)
1127 {
1128 	if (clear_mem) {
1129 		memset (AllRam, 0, RamEnd - AllRam);
1130 	}
1131 
1132 	M6809Open(0);
1133 	M6809Reset();
1134 	M6809Close();
1135 
1136 	M6800Open(0);
1137 	M6800Reset();
1138 	M6800Close();
1139 
1140 	if (blaster) {
1141 		M6800Open(1);
1142 		M6800Reset();
1143 		M6800Close();
1144 	}
1145 
1146 	pia_reset();
1147 
1148 	BurnWatchdogReset();
1149 
1150 	DACReset();
1151 
1152 	if (uses_hc55516)
1153 		hc55516_reset();
1154 
1155 	cocktail = 0;
1156 	bankselect = 0;
1157 	vram_select = 0;
1158 	port_select = 0;
1159 	rom_bank = 0;
1160 	blaster_video_control = 0;
1161 	blaster_color0 = 0;
1162 
1163 	dac_lastin_r = 0;
1164 	dac_lastout_r = 0;
1165 	dac_lastin_l = 0;
1166 	dac_lastout_l = 0;
1167 
1168 	TrackX[0] = TrackX[1] = 0;
1169 	TrackY[0] = TrackY[1] = 0;
1170 
1171 	nExtraCycles[0] = nExtraCycles[1] = nExtraCycles[2] = 0;
1172 
1173 	return 0;
1174 }
1175 
MemIndex()1176 static INT32 MemIndex()
1177 {
1178 	UINT8 *Next; Next = AllMem;
1179 
1180 	DrvM6809ROM0		= Next; Next += 0x050000;
1181 	DrvM6800ROM0		= Next; Next += 0x010000;
1182 	DrvM6800ROM1		= Next; Next += 0x010000;
1183 
1184 	DrvGfxROM			= Next; Next += 0x018000;
1185 
1186 	DrvColPROM			= Next; Next += 0x001000;
1187 
1188 	Palette				= (UINT32*)Next; Next += 0x0100 * sizeof(UINT32);
1189 	DrvPalette			= (UINT32*)Next; Next += (0x0010 + 0x0100) * sizeof(UINT32);
1190 
1191 	DrvNVRAM			= Next; Next += 0x000400;
1192 
1193 	blitter_remap		= Next; Next += 0x010000;
1194 
1195 	AllRam				= Next;
1196 
1197 	DrvM6809RAM0		= Next; Next += 0x004000;
1198 	DrvM6800RAM0		= Next; Next += 0x000100;
1199 	DrvM6800RAM1		= Next; Next += 0x000100;
1200 	DrvVidRAM			= Next; Next += 0x00c000;
1201 	DrvPalRAM			= Next; Next += 0x000010;
1202 	DrvBlitRAM			= Next; Next += 0x000008;
1203 
1204 	RamEnd				= Next;
1205 
1206 	MemEnd				= Next;
1207 
1208 	return 0;
1209 }
1210 
DrvRomLoad(INT32 type)1211 static INT32 DrvRomLoad(INT32 type) // 1-defender, 2-mysticm, 3-tshoot, 4-sinistar, 0-blaster
1212 {
1213 	char* pRomName;
1214 	struct BurnRomInfo ri;
1215 	UINT8 *mLoad = DrvM6809ROM0 + 0xd000;
1216 	UINT8 *cLoad = DrvColPROM;
1217 	UINT8 *gLoad = DrvGfxROM;
1218 
1219 	if (type == 4) mLoad += 0x1000;
1220 
1221 	for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++)
1222 	{
1223 		BurnDrvGetRomInfo(&ri, i);
1224 
1225 		if ((ri.nType & 7) == 1) {
1226 			INT32 offset = mLoad - DrvM6809ROM0;
1227 
1228 			// blaster
1229 			if (ri.nLen == 0x4000 && offset == 0x15000) mLoad += 0x3000; // gap
1230 			if (type == 2) {
1231 				if (offset == 0x18000) mLoad += 0x8000;
1232 				if (offset == 0x24000) mLoad += 0xc000;
1233 				if (offset == 0x38000) mLoad += 0x8000;
1234 			}
1235 			if (type == 3) {
1236 				if (offset == 0x18000) mLoad += 0x8000;
1237 				if (offset == 0x26000) mLoad += 0xa000;
1238 				if (offset == 0x38000) mLoad += 0x8000;
1239 			}
1240 			//bprintf(0, _T("loading main ROM @ %04X (%X bytes)\n"), offset, ri.nLen);
1241 			if (BurnLoadRom(mLoad, i, 1)) return 1;
1242 			mLoad += ri.nLen;
1243 
1244 			// defender
1245 			if (type == 1 && (offset + ri.nLen) == 0x13000) mLoad += 0x3000; // gap
1246 			continue;
1247 		}
1248 
1249 		if ((ri.nType & 7) == 2) {
1250 			memmove (DrvM6800ROM0, DrvM6800ROM0 + ri.nLen, 0x10000 - ri.nLen); // move back
1251 			if (BurnLoadRom(DrvM6800ROM0 + 0x10000 - ri.nLen, i, 1)) return 1;
1252 			continue;
1253 		}
1254 
1255 		if ((ri.nType & 7) == 3) {
1256 			memmove (DrvM6800ROM1, DrvM6800ROM1 + ri.nLen, 0x10000 - ri.nLen); // move back
1257 			if (BurnLoadRom(DrvM6800ROM1 + 0x10000 - ri.nLen, i, 1)) return 1;
1258 			continue;
1259 		}
1260 
1261 		if ((ri.nType & 7) == 4) {
1262 			if (BurnLoadRom(cLoad, i, 1)) return 1;
1263 			cLoad += ri.nLen;
1264 			uses_colprom = 1;
1265 			continue;
1266 		}
1267 
1268 		if ((ri.nType & 7) == 5) {
1269 			if (BurnLoadRom(gLoad, i, 1)) return 1;
1270 			gLoad += ri.nLen;
1271 			continue;
1272 		}
1273 	}
1274 
1275 	// colony
1276 	if ((mLoad - DrvM6809ROM0) == 0x12800) memcpy (DrvM6809ROM0 + 0x12800, DrvM6809ROM0 + 0x12000, 0x0800);
1277 
1278 	return 0;
1279 }
1280 
blitter_init(INT32 blitter_config,UINT8 * prom)1281 static void blitter_init(INT32 blitter_config, UINT8 *prom)
1282 {
1283 	static UINT8 dummy_table[16] = { STEP16(0,1) };
1284 
1285 	if (prom) bprintf(0, _T(" ** Using DrvColPROM.\n"));
1286 
1287 	blitter_window_enable = 0;
1288 	blitter_xor = (blitter_config == 1) ? 4 : 0;
1289 	blitter_remap_index = 0;
1290 
1291 	for (INT32 i = 0; i < 256; i++)
1292 	{
1293 		UINT8 *table = prom ? (prom + (i & 0x7f) * 16) : dummy_table;
1294 
1295 		for (INT32 j = 0; j < 256; j++)
1296 			blitter_remap[i * 256 + j] = (table[j >> 4] << 4) | table[j & 0x0f];
1297 	}
1298 }
1299 //DrvInit(0, 1, 12, -1, 0);
DrvInit(INT32 maptype,INT32 loadtype,INT32 x_adjust,INT32 blitter_config,INT32 blitter_clip_addr)1300 static INT32 DrvInit(INT32 maptype, INT32 loadtype, INT32 x_adjust, INT32 blitter_config, INT32 blitter_clip_addr)
1301 {
1302 	AllMem = NULL;
1303 	MemIndex();
1304 	INT32 nLen = MemEnd - (UINT8 *)0;
1305 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1306 	memset(AllMem, 0, nLen);
1307 	MemIndex();
1308 
1309 	{
1310 		if (DrvRomLoad(loadtype)) return 1;
1311 	}
1312 
1313 	// sound HW
1314 	M6800Init(0);
1315 	M6800Open(0);
1316 	M6800MapMemory(DrvM6800RAM0,				0x0000, 0x00ff, MAP_RAM);
1317 	M6800MapMemory(DrvM6800ROM0 + 0xb000,		0xb000, 0xffff, MAP_ROM);
1318 	M6800SetWriteHandler(defender_sound_write);
1319 	M6800SetReadHandler(defender_sound_read);
1320 	M6800Close();
1321 
1322 	if (maptype == 2) // blaster
1323 	{
1324 		M6809Init(0);
1325 		M6809Open(0);
1326 		M6809MapMemory(DrvVidRAM,				0x0000, 0xbfff, MAP_RAM); // banked
1327 		M6809MapMemory(DrvNVRAM,				0xcc00, 0xcfff, MAP_ROM);
1328 		M6809MapMemory(DrvM6809ROM0 + 0xd000,	0xd000, 0xffff, MAP_ROM);
1329 		M6809SetWriteHandler(blaster_main_write);
1330 		M6809SetReadHandler(williams_main_read);
1331 		M6809Close();
1332 
1333 		M6800Init(1);
1334 		M6800Open(1);
1335 		M6800MapMemory(DrvM6800RAM1,				0x0000, 0x00ff, MAP_RAM);
1336 		M6800MapMemory(DrvM6800ROM1 + 0xb000,		0xb000, 0xffff, MAP_ROM);
1337 		M6800SetWriteHandler(blaster_sound_write);
1338 		M6800SetReadHandler(blaster_sound_read);
1339 		M6800Close();
1340 	}
1341 	else if (maptype == 1) // williams
1342 	{
1343 		M6809Init(0);
1344 		M6809Open(0);
1345 		M6809MapMemory(DrvVidRAM,				0x0000, 0xbfff, MAP_RAM); // banked
1346 		M6809MapMemory(DrvNVRAM,				0xcc00, 0xcfff, MAP_ROM); // handler
1347 		M6809MapMemory(DrvM6809ROM0 + 0xd000,	0xd000, 0xffff, MAP_ROM);
1348 		M6809SetWriteHandler(williams_main_write);
1349 		M6809SetReadHandler(williams_main_read);
1350 		M6809Close();
1351 	}
1352 	else if (maptype == 0) // defender
1353 	{
1354 		defender = 1;
1355 		M6809Init(0);
1356 		M6809Open(0);
1357 		if (mayday) {
1358 			M6809MapMemory(DrvVidRAM,				0x0000, 0xbfff, MAP_WRITE); // read -> handler
1359 		} else {
1360 			M6809MapMemory(DrvVidRAM,				0x0000, 0xbfff, MAP_RAM);
1361 		}
1362 		M6809MapMemory(DrvM6809ROM0 + 0xd000,	0xd000, 0xffff, MAP_ROM);
1363 		M6809SetWriteHandler(defender_main_write);
1364 		M6809SetReadHandler(defender_main_read);
1365 		M6809Close();
1366 	}
1367 
1368 	pia_init();
1369 	pia_config(0, 0, &pia_0);
1370 	pia_config(1, 0, &pia_1);
1371 	pia_config(2, 0, &pia_2);
1372 	pia_config(3, 0, &pia_3);
1373 
1374 	BurnWatchdogInit(DrvDoReset, 180);
1375 
1376 	DACInit(0, 0, 0, M6800TotalCycles, 894886);
1377 	DACSetRoute(0, 0.35, BURN_SND_ROUTE_BOTH);
1378 
1379 	if (maptype == 2) // blaster, pia config & l+r dac
1380 	{
1381 		pia_init();
1382 		pia_config(0, 0, &pia_49way_0);
1383 		pia_config(1, 0, &pia_1);
1384 		pia_config(2, 0, &pia_2);
1385 		pia_config(3, 0, &pia_3);
1386 		pia_config(4, 0, &pia_4); // 2nd soundboard
1387 
1388 		DACSetRoute(0, 0.35, BURN_SND_ROUTE_LEFT);
1389 
1390 		DACInit(1, 0, 0, M6800TotalCycles, 894886);
1391 		DACSetRoute(1, 0.35, BURN_SND_ROUTE_RIGHT);
1392 	}
1393 
1394 	blitter_clip_address = blitter_clip_addr;
1395 	blitter_init(blitter_config, (uses_colprom) ? DrvColPROM : NULL);
1396 
1397 	GenericTilesInit();
1398 
1399 	screen_x_adjust = x_adjust;
1400 
1401 	DrvDoReset(1);
1402 
1403 	return 0;
1404 }
1405 
DrvExit()1406 static INT32 DrvExit()
1407 {
1408 	GenericTilesExit();
1409 
1410 	M6809Exit();
1411 	M6800Exit();
1412 	pia_exit();
1413 
1414 	DACExit();
1415 
1416 	if (uses_hc55516)
1417 		hc55516_exit();
1418 
1419 	BurnFree(AllMem);
1420 
1421 	memset (DrvDips, 0, 3);
1422 
1423 	mayday = 0;
1424 	splat = 0;
1425 	blaster = 0;
1426 	defender_control_hack = 0;
1427 	defender = 0;
1428 	spdball = 0;
1429 
1430 	uses_hc55516 = 0;
1431 	uses_colprom = 0;
1432 
1433 	pStartDraw = NULL;
1434 	pDrawScanline = NULL;
1435 
1436 	return 0;
1437 }
1438 
DrvPaletteInit()1439 static void DrvPaletteInit()
1440 {
1441 	for (INT32 i = 0; i < 0x100; i++)
1442 	{
1443 		INT32 bit0 = (i & 0x01) >> 0;
1444 		INT32 bit1 = (i & 0x02) >> 1;
1445 		INT32 bit2 = (i & 0x04) >> 2;
1446 
1447 		UINT8 r = ((bit2 * 1200 + bit1 * 560 + bit0 * 330) * 255) / 2090;
1448 
1449 		bit0 = (i & 0x08) >> 3;
1450 		bit1 = (i & 0x10) >> 4;
1451 		bit2 = (i & 0x20) >> 5;
1452 
1453 		UINT8 g = ((bit2 * 1200 + bit1 * 560 + bit0 * 330) * 255) / 2090;
1454 
1455 		bit0 = (i & 0x40) >> 6;
1456 		bit1 = (i & 0x80) >> 7;
1457 
1458 		UINT8 b = ((bit1 * 560 + bit0 * 330) * 255) / 890;
1459 
1460 		Palette[i] = BurnHighCol(r,g,b,0);
1461 		DrvPalette[i + 0x10] = Palette[i];
1462 	}
1463 }
1464 
DrvPaletteUpdate()1465 static void DrvPaletteUpdate()
1466 {
1467 	for (INT32 i = 0; i < 16; i++) {
1468 		DrvPalette[i] = Palette[DrvPalRAM[i]];
1469 	}
1470 }
1471 
draw_bitmap(INT32 starty,INT32 endy)1472 static void draw_bitmap(INT32 starty, INT32 endy)
1473 {
1474 	for (INT32 y = starty; y < endy; y++)
1475 	{
1476 		UINT16 *dst = pTransDraw + (y * nScreenWidth);
1477 		UINT8 *src = DrvVidRAM + y + 7;
1478 
1479 		if (y >= 240) return;
1480 
1481 		for (INT32 x = 0; x < nScreenWidth; x += 2)
1482 		{
1483 			UINT8 pix = src[((x + screen_x_adjust) / 2) * 256];
1484 
1485 			dst[x + 0] = pix >> 4;
1486 			dst[x + 1] = pix & 0x0f;
1487 		}
1488 	}
1489 }
1490 
blaster_draw_bitmap(INT32 starty,INT32 endy)1491 static void blaster_draw_bitmap(INT32 starty, INT32 endy)
1492 {
1493 	const UINT8 YOFFS = 7;
1494 	UINT8 *palette_control = DrvVidRAM + 0xbb00 + YOFFS;
1495 	UINT8 *scanline_control = DrvVidRAM + 0xbc00 + YOFFS;
1496 
1497 	if (starty == 0 || !(blaster_video_control & 1))
1498 		blaster_color0 = 0x10 + (palette_control[0 - YOFFS] ^ 0xff);
1499 
1500 	for (INT32 y = starty; y < endy; y++)
1501 	{
1502 		INT32 erase_behind = blaster_video_control & scanline_control[y] & 2;
1503 		UINT8 *source = DrvVidRAM + y + YOFFS;
1504 		UINT16 *dest = pTransDraw + (y * nScreenWidth);
1505 
1506 		if (y >= 240) return;
1507 
1508 		if (blaster_video_control & scanline_control[y] & 1)
1509 			blaster_color0 = 0x10 + (palette_control[y] ^ 0xff);
1510 
1511 		for (INT32 x = 0; x < nScreenWidth; x += 2)
1512 		{
1513 			INT32 pix = source[(x/2) * 256];
1514 
1515 			if (erase_behind)
1516 				source[(x/2) * 256] = 0;
1517 
1518 			dest[x+0] = (pix & 0xf0) ? (pix >> 4) : blaster_color0;
1519 			dest[x+1] = (pix & 0x0f) ? (pix & 0x0f) : blaster_color0;
1520 		}
1521 	}
1522 }
1523 
DrvDrawBegin()1524 static void DrvDrawBegin()
1525 {
1526 	if (DrvRecalc) {
1527 		DrvPaletteInit();
1528 		DrvRecalc = 0;
1529 	}
1530 
1531 	lastline = 0;
1532 
1533 	DrvPaletteUpdate();
1534 }
1535 
DrvDrawLine()1536 static void DrvDrawLine()
1537 {
1538 	if (scanline > nScreenHeight || !pBurnDraw) return;
1539 
1540 	DrvPaletteUpdate();
1541 
1542 	draw_bitmap(lastline, scanline);
1543 
1544 	lastline = scanline;
1545 }
1546 
BlasterDrawLine()1547 static void BlasterDrawLine()
1548 {
1549 	if (scanline > nScreenHeight || !pBurnDraw) return;
1550 
1551 	DrvPaletteUpdate();
1552 
1553 	blaster_draw_bitmap(lastline, scanline);
1554 
1555 	lastline = scanline;
1556 }
1557 
DrvDrawEnd()1558 static void DrvDrawEnd()
1559 {
1560 	if (!pBurnDraw) return;
1561 	BurnTransferCopy(DrvPalette);
1562 }
1563 
DrvDraw()1564 static INT32 DrvDraw()
1565 {
1566 	if (DrvRecalc) {
1567 		DrvPaletteInit();
1568 		DrvRecalc = 0;
1569 	}
1570 
1571 	DrvPaletteUpdate();
1572 
1573 	draw_bitmap(0, nScreenHeight);
1574 
1575 	BurnTransferCopy(DrvPalette);
1576 
1577 	return 0;
1578 }
1579 
BlasterDraw()1580 static INT32 BlasterDraw()
1581 {
1582 	if (DrvRecalc) {
1583 		DrvPaletteInit();
1584 		DrvRecalc = 0;
1585 	}
1586 
1587 	DrvPaletteUpdate();
1588 
1589 	blaster_draw_bitmap(0, nScreenHeight);
1590 
1591 	BurnTransferCopy(DrvPalette);
1592 
1593 	return 0;
1594 }
1595 
dcfilter_dac()1596 static void dcfilter_dac()
1597 {
1598 	for (INT32 i = 0; i < nBurnSoundLen; i++) {
1599 		INT16 r = pBurnSoundOut[i*2+0];
1600 		INT16 l = pBurnSoundOut[i*2+1];
1601 
1602 		INT16 outr = r - dac_lastin_r + 0.995 * dac_lastout_r;
1603 		INT16 outl = l - dac_lastin_l + 0.995 * dac_lastout_l;
1604 
1605 		dac_lastin_r = r;
1606 		dac_lastout_r = outr;
1607 		dac_lastin_l = l;
1608 		dac_lastout_l = outl;
1609 		pBurnSoundOut[i*2+0] = outr;
1610 		pBurnSoundOut[i*2+1] = outl;
1611 	}
1612 }
1613 
DrvFrame()1614 static INT32 DrvFrame()
1615 {
1616 	BurnWatchdogUpdate();
1617 
1618 	if (DrvReset) {
1619 		DrvDoReset(1);
1620 	}
1621 
1622 	M6809NewFrame();
1623 	M6800NewFrame();
1624 
1625 	{
1626 		DrvInputs[0] = DrvDips[0];
1627 		DrvInputs[1] = DrvDips[1];
1628 		DrvInputs[2] = DrvDips[2];
1629 
1630 		memset (DrvInputs + 3, 0, 7-3);
1631 
1632 		for (INT32 i = 0; i < 8; i++) {
1633 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
1634 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
1635 			DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
1636 			DrvInputs[3] ^= (DrvJoy4[i] & 1) << i;
1637 			DrvInputs[4] ^= (DrvJoy5[i] & 1) << i;
1638 			DrvInputs[5] ^= (DrvJoy6[i] & 1) << i;
1639 			DrvInputs[6] ^= (DrvJoy7[i] & 1) << i;
1640 		}
1641 
1642 		if ( defender_control_hack && (DrvInputs[6] & 0x42) ) {
1643 			// This kludge gives Defender and Stargate proper L/R joystick ability
1644 			DrvInputs[0] |= DrvInputs[6] & 0x42;
1645 
1646 			M6809Open(0);
1647 			if (defender_control_hack && M6809ReadByte(defender_control_hack) == 0xfd) {
1648 				if (DrvInputs[0] & 0x02)
1649 					DrvInputs[0] = (DrvInputs[0] & 0xfd) | 0x40;
1650 				else if (DrvInputs[0] & 0x40)
1651 					DrvInputs[0] = (DrvInputs[0] & 0xbf) | 0x02;
1652 			}
1653 			M6809Close();
1654 		}
1655 
1656 		if (spdball) {
1657 			UINT8 xy = 0;
1658 
1659 			xy = ProcessAnalog(DrvAnalogPort1, 1, 1, 0x00, 0xff);
1660 			if (xy > (0x80+0x10)) TrackY[0]+=12;
1661 			if (xy < (0x80-0x10)) TrackY[0]-=12;
1662 			xy = ProcessAnalog(DrvAnalogPort0, 0, 1, 0x00, 0xff);
1663 			if (xy > (0x80+0x10)) TrackX[0]+=12;
1664 			if (xy < (0x80-0x10)) TrackX[0]-=12;
1665 
1666 			xy = ProcessAnalog(DrvAnalogPort3, 1, 1, 0x00, 0xff);
1667 			if (xy > (0x80+0x10)) TrackY[1]+=12;
1668 			if (xy < (0x80-0x10)) TrackY[1]-=12;
1669 			xy = ProcessAnalog(DrvAnalogPort2, 0, 1, 0x00, 0xff);
1670 			if (xy > (0x80+0x10)) TrackX[1]+=12;
1671 			if (xy < (0x80-0x10)) TrackX[1]-=12;
1672 
1673 		}
1674 	}
1675 
1676 	INT32 nInterleave = 256;
1677 	INT32 nCyclesTotal[3] = { 1000000 / 60, 894886 / 60, 894886 / 60 };
1678 	//INT32 nCyclesDone[3] = { nExtraCycles[0], nExtraCycles[1], nExtraCycles[2] };
1679 	nCyclesDone[0] = nExtraCycles[0]; nCyclesDone[1] = nExtraCycles[1]; nCyclesDone[2] = nExtraCycles[2];
1680 
1681 	M6809Open(0);
1682 
1683 	if (pStartDraw) pStartDraw();
1684 
1685 	for (INT32 i = 0; i < nInterleave; i++)
1686 	{
1687 		scanline = i;
1688 
1689 		nCyclesDone[0] += M6809Run(((i + 1) * nCyclesTotal[0] / nInterleave) - nCyclesDone[0]);
1690 
1691 		if (scanline % 8 == 0) {
1692 			pia_set_input_cb1(1, scanline & 0x20);
1693 			if (pDrawScanline) pDrawScanline();
1694 		}
1695 
1696 		if (scanline == 0 || scanline == 240)
1697 			pia_set_input_ca1(1, scanline >= 240 ? 1 : 0);
1698 
1699 		M6800Open(0);
1700 		nCyclesDone[1] += M6800Run(((i + 1) * nCyclesTotal[1] / nInterleave) - nCyclesDone[1]);
1701 		M6800Close();
1702 
1703 		if (blaster) {
1704 			M6800Open(1);
1705 			nCyclesDone[2] += M6800Run(((i + 1) * nCyclesTotal[2] / nInterleave) - nCyclesDone[2]);
1706 			M6800Close();
1707 		}
1708 	}
1709 
1710 	if (pBurnSoundOut) {
1711 		M6800Open(0);
1712 		DACUpdate(pBurnSoundOut, nBurnSoundLen);
1713 		dcfilter_dac();
1714 		if (uses_hc55516)
1715 			hc55516_update(pBurnSoundOut, nBurnSoundLen);
1716 		M6800Close();
1717 	}
1718 
1719 	M6809Close();
1720 
1721 	nExtraCycles[0] = nCyclesDone[0] - nCyclesTotal[0];
1722 	nExtraCycles[1] = nCyclesDone[1] - nCyclesTotal[1];
1723 	nExtraCycles[2] = nCyclesDone[2] - nCyclesTotal[2];
1724 
1725 	if (pBurnDraw) {
1726 		if (pStartDraw)
1727 			DrvDrawEnd();
1728 		else
1729 			BurnDrvRedraw();
1730 	}
1731 
1732 	return 0;
1733 }
1734 
DrvScan(INT32 nAction,INT32 * pnMin)1735 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
1736 {
1737 	struct BurnArea ba;
1738 
1739 	if (pnMin) {
1740 		*pnMin = 0x029702;
1741 	}
1742 
1743 	if (nAction & ACB_VOLATILE) {
1744 		memset(&ba, 0, sizeof(ba));
1745 
1746 		ba.Data	  = AllRam;
1747 		ba.nLen	  = RamEnd - AllRam;
1748 		ba.szName = "All Ram";
1749 		BurnAcb(&ba);
1750 
1751 		M6809Scan(nAction);
1752 		M6800Scan(nAction);
1753 
1754 		pia_scan(nAction, pnMin);
1755 
1756 		DACScan(nAction, pnMin);
1757 		if (uses_hc55516)
1758 			hc55516_scan(nAction, pnMin);
1759 
1760 		SCAN_VAR(cocktail);
1761 		SCAN_VAR(bankselect);
1762 		SCAN_VAR(vram_select);
1763 		SCAN_VAR(rom_bank);
1764 		SCAN_VAR(blaster_video_control);
1765 		SCAN_VAR(blaster_color0);
1766 
1767 		SCAN_VAR(nExtraCycles);
1768 
1769 		if (spdball) {
1770 			SCAN_VAR(TrackX);
1771 			SCAN_VAR(TrackY);
1772 		}
1773 	}
1774 
1775 	if (nAction & ACB_NVRAM) {
1776 		ba.Data		= DrvNVRAM;
1777 		ba.nLen		= 0x00400;
1778 		ba.nAddress	= 0;
1779 		ba.szName	= "NVRAM";
1780 		BurnAcb(&ba);
1781 	}
1782 
1783 	if (nAction & ACB_WRITE) {
1784 		M6809Open(0);
1785 		if (blaster) {
1786 			blaster_bankswitch();
1787 		}
1788 		else if (defender) {
1789 			bankswitch();
1790 		} else {
1791 			williams_bank();
1792 		}
1793 		M6809Close();
1794 	}
1795 
1796 	return 0;
1797 }
1798 
1799 
1800 // Defender (Red label)
1801 
1802 static struct BurnRomInfo defenderRomDesc[] = {
1803 	{ "defend.1",			0x0800, 0xc3e52d7e, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
1804 	{ "defend.4",			0x0800, 0x9a72348b, 1 | BRF_PRG | BRF_ESS }, //  1
1805 	{ "defend.2",			0x1000, 0x89b75984, 1 | BRF_PRG | BRF_ESS }, //  2
1806 	{ "defend.3",			0x1000, 0x94f51e9b, 1 | BRF_PRG | BRF_ESS }, //  3
1807 	{ "defend.9",			0x0800, 0x6870e8a5, 1 | BRF_PRG | BRF_ESS }, //  4
1808 	{ "defend.12",			0x0800, 0xf1f88938, 1 | BRF_PRG | BRF_ESS }, //  5
1809 	{ "defend.8",			0x0800, 0xb649e306, 1 | BRF_PRG | BRF_ESS }, //  6
1810 	{ "defend.11",			0x0800, 0x9deaf6d9, 1 | BRF_PRG | BRF_ESS }, //  7
1811 	{ "defend.7",			0x0800, 0x339e092e, 1 | BRF_PRG | BRF_ESS }, //  8
1812 	{ "defend.10",			0x0800, 0xa543b167, 1 | BRF_PRG | BRF_ESS }, //  9
1813 	{ "defend.6",			0x0800, 0x65f4efd1, 1 | BRF_PRG | BRF_ESS }, // 10
1814 
1815 	{ "defend.snd",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, // 11 M6808 Code
1816 
1817 	{ "decoder.2",			0x0200, 0x8dd98da5, 0 | BRF_OPT },           // 12 Address Decoder
1818 	{ "decoder.3",			0x0200, 0xc3f45f70, 0 | BRF_OPT },           // 13
1819 };
1820 
1821 STD_ROM_PICK(defender)
STD_ROM_FN(defender)1822 STD_ROM_FN(defender)
1823 
1824 static INT32 DefenderCommInit()
1825 {
1826 	return DrvInit(0, 1, 12, -1, 0);
1827 }
1828 
DefenderInit()1829 static INT32 DefenderInit()
1830 {
1831 	defender_control_hack = 0xa0bb;
1832 
1833 	return DefenderCommInit();
1834 }
1835 
DefenderBGInit()1836 static INT32 DefenderBGInit()
1837 {
1838 	defender_control_hack = 0xa096;
1839 
1840 	return DefenderCommInit();
1841 }
1842 
DefenderWhiteInit()1843 static INT32 DefenderWhiteInit()
1844 {
1845 	defender_control_hack = 0xa093;
1846 
1847 	return DefenderCommInit();
1848 }
1849 
DefenceInit()1850 static INT32 DefenceInit()
1851 {
1852 	defender_control_hack = 0xa0d0;
1853 
1854 	return DefenderCommInit();
1855 }
1856 
1857 struct BurnDriver BurnDrvDefender = {
1858 	"defender", NULL, NULL, NULL, "1980",
1859 	"Defender (Red label)\0", NULL, "Williams", "Miscellaneous",
1860 	NULL, NULL, NULL, NULL,
1861 	BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
1862 	NULL, defenderRomInfo, defenderRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
1863 	DefenderInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
1864 	292, 240, 4, 3
1865 };
1866 
1867 
1868 // Defender (Green label)
1869 
1870 static struct BurnRomInfo defendergRomDesc[] = {
1871 	{ "defeng01.bin",		0x0800, 0x6111d74d, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
1872 	{ "defeng04.bin",		0x0800, 0x3cfc04ce, 1 | BRF_PRG | BRF_ESS }, //  1
1873 	{ "defeng02.bin",		0x1000, 0xd184ab6b, 1 | BRF_PRG | BRF_ESS }, //  2
1874 	{ "defeng03.bin",		0x1000, 0x788b76d7, 1 | BRF_PRG | BRF_ESS }, //  3
1875 	{ "defeng09.bin",		0x0800, 0xf57caa62, 1 | BRF_PRG | BRF_ESS }, //  4
1876 	{ "defeng12.bin",		0x0800, 0x33db686f, 1 | BRF_PRG | BRF_ESS }, //  5
1877 	{ "defeng08.bin",		0x0800, 0x9a9eb3d2, 1 | BRF_PRG | BRF_ESS }, //  6
1878 	{ "defeng11.bin",		0x0800, 0x5ca4e860, 1 | BRF_PRG | BRF_ESS }, //  7
1879 	{ "defeng07.bin",		0x0800, 0x545c3326, 1 | BRF_PRG | BRF_ESS }, //  8
1880 	{ "defeng10.bin",		0x0800, 0x941cf34e, 1 | BRF_PRG | BRF_ESS }, //  9
1881 	{ "defeng06.bin",		0x0800, 0x3af34c05, 1 | BRF_PRG | BRF_ESS }, // 10
1882 
1883 	{ "defend.snd",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, // 10 M6808 Code
1884 
1885 	{ "decoder.1",			0x0200, 0x8dd98da5, 0 | BRF_OPT },           // 11 Address Decoder
1886 };
1887 
1888 STD_ROM_PICK(defenderg)
1889 STD_ROM_FN(defenderg)
1890 
1891 struct BurnDriver BurnDrvDefenderg = {
1892 	"defenderg", "defender", NULL, NULL, "1980",
1893 	"Defender (Green label)\0", NULL, "Williams", "6809 System",
1894 	NULL, NULL, NULL, NULL,
1895 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1896 	NULL, defendergRomInfo, defendergRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
1897 	DefenderBGInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
1898 	292, 240, 4, 3
1899 };
1900 
1901 
1902 // Defender (Blue label)
1903 
1904 static struct BurnRomInfo defenderbRomDesc[] = {
1905 	{ "wb01.bin",			0x1000, 0x0ee1019d, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
1906 	{ "defeng02.bin",		0x1000, 0xd184ab6b, 1 | BRF_PRG | BRF_ESS }, //  1
1907 	{ "wb03.bin",			0x1000, 0xa732d649, 1 | BRF_PRG | BRF_ESS }, //  2
1908 	{ "defeng09.bin",		0x0800, 0xf57caa62, 1 | BRF_PRG | BRF_ESS }, //  3
1909 	{ "defeng12.bin",		0x0800, 0x33db686f, 1 | BRF_PRG | BRF_ESS }, //  4
1910 	{ "defeng08.bin",		0x0800, 0x9a9eb3d2, 1 | BRF_PRG | BRF_ESS }, //  5
1911 	{ "defeng11.bin",		0x0800, 0x5ca4e860, 1 | BRF_PRG | BRF_ESS }, //  6
1912 	{ "defeng07.bin",		0x0800, 0x545c3326, 1 | BRF_PRG | BRF_ESS }, //  7
1913 	{ "defeng10.bin",		0x0800, 0x941cf34e, 1 | BRF_PRG | BRF_ESS }, //  8
1914 	{ "defeng06.bin",		0x0800, 0x3af34c05, 1 | BRF_PRG | BRF_ESS }, //  9
1915 
1916 	{ "defend.snd",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, // 10 M6808 Code
1917 
1918 	{ "decoder.1",			0x0200, 0x8dd98da5, 0 | BRF_OPT },           // 11 Address Decoder
1919 };
1920 
1921 STD_ROM_PICK(defenderb)
1922 STD_ROM_FN(defenderb)
1923 
1924 struct BurnDriver BurnDrvDefenderb = {
1925 	"defenderb", "defender", NULL, NULL, "1980",
1926 	"Defender (Blue label)\0", NULL, "Williams", "6809 System",
1927 	NULL, NULL, NULL, NULL,
1928 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1929 	NULL, defenderbRomInfo, defenderbRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
1930 	DefenderBGInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
1931 	292, 240, 4, 3
1932 };
1933 
1934 
1935 // Defender (White label)
1936 
1937 static struct BurnRomInfo defenderwRomDesc[] = {
1938 	{ "rom1.bin",			0x1000, 0x5af871e3, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
1939 	{ "rom2.bin",			0x1000, 0x1126adc9, 1 | BRF_PRG | BRF_ESS }, //  1
1940 	{ "rom3.bin",			0x1000, 0x4097b46b, 1 | BRF_PRG | BRF_ESS }, //  2
1941 	{ "rom9.bin",			0x0800, 0x93012991, 1 | BRF_PRG | BRF_ESS }, //  3
1942 	{ "rom12.bin",			0x0800, 0x4bdd8dc4, 1 | BRF_PRG | BRF_ESS }, //  4
1943 	{ "rom8.bin",			0x0800, 0x5227fc0b, 1 | BRF_PRG | BRF_ESS }, //  5
1944 	{ "rom11.bin",			0x0800, 0xd068f0c5, 1 | BRF_PRG | BRF_ESS }, //  6
1945 	{ "rom7.bin",			0x0800, 0xfef4cb77, 1 | BRF_PRG | BRF_ESS }, //  7
1946 	{ "rom10.bin",			0x0800, 0x49b50b40, 1 | BRF_PRG | BRF_ESS }, //  8
1947 	{ "rom6.bin",			0x0800, 0x43d42a1b, 1 | BRF_PRG | BRF_ESS }, //  9
1948 
1949 	{ "defend.snd",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, // 10 M6808 Code
1950 
1951 	{ "decoder.1",			0x0200, 0x8dd98da5, 0 | BRF_OPT },           // 11 Address Decoder
1952 };
1953 
1954 STD_ROM_PICK(defenderw)
1955 STD_ROM_FN(defenderw)
1956 
1957 struct BurnDriver BurnDrvDefenderw = {
1958 	"defenderw", "defender", NULL, NULL, "1980",
1959 	"Defender (White label)\0", NULL, "Williams", "6809 System",
1960 	NULL, NULL, NULL, NULL,
1961 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1962 	NULL, defenderwRomInfo, defenderwRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
1963 	DefenderWhiteInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
1964 	292, 240, 4, 3
1965 };
1966 
1967 
1968 // T.T Defender
1969 
1970 static struct BurnRomInfo defenderjRomDesc[] = {
1971 	{ "df1-1.e3",			0x1000, 0x8c04602b, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
1972 	{ "df2-1.e2",			0x1000, 0x89b75984, 1 | BRF_PRG | BRF_ESS }, //  1
1973 	{ "df3-1.e1",			0x1000, 0x94f51e9b, 1 | BRF_PRG | BRF_ESS }, //  2
1974 	{ "df10-1.a1",			0x0800, 0x12e2bd1c, 1 | BRF_PRG | BRF_ESS }, //  3
1975 	{ "df7-1.b1",			0x0800, 0xf1f88938, 1 | BRF_PRG | BRF_ESS }, //  4
1976 	{ "df9-1.a2",			0x0800, 0xb649e306, 1 | BRF_PRG | BRF_ESS }, //  5
1977 	{ "df6-1.b2",			0x0800, 0x9deaf6d9, 1 | BRF_PRG | BRF_ESS }, //  6
1978 	{ "df8-1.a3",			0x0800, 0x339e092e, 1 | BRF_PRG | BRF_ESS }, //  7
1979 	{ "df5-1.b3",			0x0800, 0xa543b167, 1 | BRF_PRG | BRF_ESS }, //  8
1980 	{ "df4-1.c1",			0x0800, 0x65f4efd1, 1 | BRF_PRG | BRF_ESS }, //  9
1981 
1982 	{ "df12.i3",			0x0800, 0xf122d9c9, 2 | BRF_PRG | BRF_ESS }, // 10 M6808 Code
1983 };
1984 
1985 STD_ROM_PICK(defenderj)
1986 STD_ROM_FN(defenderj)
1987 
1988 struct BurnDriver BurnDrvDefenderj = {
1989 	"defenderj", "defender", NULL, NULL, "1980",
1990 	"T.T Defender\0", NULL, "Williams (Taito Corporation license)", "6809 System",
1991 	NULL, NULL, NULL, NULL,
1992 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1993 	NULL, defenderjRomInfo, defenderjRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
1994 	DefenderInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
1995 	292, 240, 4, 3
1996 };
1997 
1998 
1999 // Defender (bootleg)
2000 
2001 static struct BurnRomInfo defndjeuRomDesc[] = {
2002 	{ "15",					0x1000, 0x706a24bd, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2003 	{ "16",					0x1000, 0x03201532, 1 | BRF_PRG | BRF_ESS }, //  1
2004 	{ "17",					0x1000, 0x25287eca, 1 | BRF_PRG | BRF_ESS }, //  2
2005 	{ "21",					0x1000, 0xbddb71a3, 1 | BRF_PRG | BRF_ESS }, //  3
2006 	{ "20",					0x1000, 0x12fa0788, 1 | BRF_PRG | BRF_ESS }, //  4
2007 	{ "19",					0x1000, 0x769f5984, 1 | BRF_PRG | BRF_ESS }, //  5
2008 	{ "18",					0x1000, 0xe99d5679, 1 | BRF_PRG | BRF_ESS }, //  6
2009 
2010 	{ "s",					0x0800, 0xcb79ae42, 2 | BRF_PRG | BRF_ESS }, //  7 M6808 Code
2011 };
2012 
2013 STD_ROM_PICK(defndjeu)
2014 STD_ROM_FN(defndjeu)
2015 
2016 struct BurnDriverD BurnDrvDefndjeu = {
2017 	"defndjeu", "defender", NULL, NULL, "1980",
2018 	"Defender (bootleg)\0", NULL, "bootleg (Jeutel)", "6809 System",
2019 	NULL, NULL, NULL, NULL,
2020 	BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2021 	NULL, defndjeuRomInfo, defndjeuRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2022 	DefenderInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2023 	292, 240, 4, 3
2024 };
2025 
2026 
2027 // Tornado (set 1, Defender bootleg)
2028 
2029 static struct BurnRomInfo tornado1RomDesc[] = {
2030 	{ "torna1.bin",			0x1000, 0x706a24bd, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2031 	{ "torna3.bin",			0x1000, 0xa79213b2, 1 | BRF_PRG | BRF_ESS }, //  1
2032 	{ "torna4.bin",			0x1000, 0xf96d3d26, 1 | BRF_PRG | BRF_ESS }, //  2
2033 	{ "tornc4.bin",			0x1000, 0xe30f4c00, 1 | BRF_PRG | BRF_ESS }, //  3
2034 	{ "tornb3.bin",			0x1000, 0x0e3fef55, 1 | BRF_PRG | BRF_ESS }, //  4
2035 	{ "tornb1.bin",			0x1000, 0xf2bef850, 1 | BRF_PRG | BRF_ESS }, //  5
2036 	{ "tornb4.bin",			0x1000, 0xe99d5679, 1 | BRF_PRG | BRF_ESS }, //  6
2037 
2038 	{ "tornb6.bin",			0x1000, 0x3685e033, 2 | BRF_PRG | BRF_ESS }, //  7 M6808 Code
2039 };
2040 
2041 STD_ROM_PICK(tornado1)
2042 STD_ROM_FN(tornado1)
2043 
2044 struct BurnDriver BurnDrvTornado1 = {
2045 	"tornado1", "defender", NULL, NULL, "1980",
2046 	"Tornado (set 1, Defender bootleg)\0", NULL, "bootleg (Jeutel)", "6809 System",
2047 	NULL, NULL, NULL, NULL,
2048 	BDF_GAME_NOT_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2049 	NULL, tornado1RomInfo, tornado1RomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2050 	DefenderWhiteInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2051 	292, 240, 4, 3
2052 };
2053 
2054 
2055 // Tornado (set 2, Defender bootleg)
2056 
2057 static struct BurnRomInfo tornado2RomDesc[] = {
2058 	{ "tto15.bin",			0x1000, 0x910ac603, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2059 	{ "to16.bin",			0x1000, 0x46ccd582, 1 | BRF_PRG | BRF_ESS }, //  1
2060 	{ "tto17.bin",			0x1000, 0xfaa3613c, 1 | BRF_PRG | BRF_ESS }, //  2
2061 	{ "to21.bin",			0x1000, 0xe30f4c00, 1 | BRF_PRG | BRF_ESS }, //  3
2062 	{ "to20.bin",			0x1000, 0xe90bdcb2, 1 | BRF_PRG | BRF_ESS }, //  4
2063 	{ "to19.bin",			0x1000, 0x42885b4f, 1 | BRF_PRG | BRF_ESS }, //  5
2064 	{ "to18.bin",			0x1000, 0xc15ffc03, 1 | BRF_PRG | BRF_ESS }, //  6
2065 
2066 	{ "to_s.bin",			0x0800, 0xcb79ae42, 2 | BRF_PRG | BRF_ESS }, //  7 M6808 Code
2067 };
2068 
2069 STD_ROM_PICK(tornado2)
2070 STD_ROM_FN(tornado2)
2071 
2072 struct BurnDriverD BurnDrvTornado2 = {
2073 	"tornado2", "defender", NULL, NULL, "1980",
2074 	"Tornado (set 2, Defender bootleg)\0", NULL, "bootleg (Jeutel)", "6809 System",
2075 	NULL, NULL, NULL, NULL,
2076 	BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2077 	NULL, tornado2RomInfo, tornado2RomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2078 	DefenderWhiteInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2079 	292, 240, 4, 3
2080 };
2081 
2082 
2083 // Zero (set 1, Defender bootleg)
2084 
2085 static struct BurnRomInfo zeroRomDesc[] = {
2086 	{ "zero-15",			0x1000, 0x706a24bd, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2087 	{ "zero-16",			0x1000, 0xa79213b2, 1 | BRF_PRG | BRF_ESS }, //  1
2088 	{ "zero-17",			0x1000, 0x25287eca, 1 | BRF_PRG | BRF_ESS }, //  2
2089 	{ "zero-21",			0x1000, 0x7ca35cfd, 1 | BRF_PRG | BRF_ESS }, //  3
2090 	{ "zero-20",			0x1000, 0x0757967f, 1 | BRF_PRG | BRF_ESS }, //  4
2091 	{ "zero-19",			0x1000, 0xf2bef850, 1 | BRF_PRG | BRF_ESS }, //  5
2092 	{ "zero-18",			0x1000, 0xe99d5679, 1 | BRF_PRG | BRF_ESS }, //  6
2093 
2094 	{ "defend.snd",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, //  7 M6808 Code
2095 };
2096 
2097 STD_ROM_PICK(zero)
2098 STD_ROM_FN(zero)
2099 
2100 struct BurnDriver BurnDrvZero = {
2101 	"zero", "defender", NULL, NULL, "1980",
2102 	"Zero (set 1, Defender bootleg)\0", NULL, "bootleg (Jeutel)", "6809 System",
2103 	NULL, NULL, NULL, NULL,
2104 	BDF_GAME_NOT_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2105 	NULL, zeroRomInfo, zeroRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2106 	DefenderWhiteInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2107 	292, 240, 4, 3
2108 };
2109 
2110 
2111 // Zero (set 2, Defender bootleg)
2112 
2113 static struct BurnRomInfo zero2RomDesc[] = {
2114 	{ "15me.1a",			0x1000, 0x9323eee5, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2115 	{ "to16.3a",			0x1000, 0xa79213b2, 1 | BRF_PRG | BRF_ESS }, //  1
2116 	{ "17m5.4a",			0x1000, 0x16a3c0dd, 1 | BRF_PRG | BRF_ESS }, //  2
2117 	{ "21.4c",				0x1000, 0x7ca35cfd, 1 | BRF_PRG | BRF_ESS }, //  3
2118 	{ "20m5.3b",			0x1000, 0x7473955b, 1 | BRF_PRG | BRF_ESS }, //  4
2119 	{ "to19.1b",			0x1000, 0xf2bef850, 1 | BRF_PRG | BRF_ESS }, //  5
2120 	{ "18m5.4b",			0x1000, 0x7e4afe43, 1 | BRF_PRG | BRF_ESS }, //  6
2121 
2122 	{ "to4.6b",				0x0800, 0xcb79ae42, 2 | BRF_PRG | BRF_ESS }, //  7 M6808 Code
2123 };
2124 
2125 STD_ROM_PICK(zero2)
2126 STD_ROM_FN(zero2)
2127 
2128 struct BurnDriver BurnDrvZero2 = {
2129 	"zero2", "defender", NULL, NULL, "1980",
2130 	"Zero (set 2, Defender bootleg)\0", NULL, "bootleg (Amtec)", "6809 System",
2131 	NULL, NULL, NULL, NULL,
2132 	BDF_GAME_NOT_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2133 	NULL, zero2RomInfo, zero2RomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2134 	DefenderWhiteInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2135 	292, 240, 4, 3
2136 };
2137 
2138 
2139 // Defense Command (Defender bootleg)
2140 
2141 static struct BurnRomInfo defcmndRomDesc[] = {
2142 	{ "defcmnda.1",			0x1000, 0x68effc1d, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2143 	{ "defcmnda.2",			0x1000, 0x1126adc9, 1 | BRF_PRG | BRF_ESS }, //  1
2144 	{ "defcmnda.3",			0x1000, 0x7340209d, 1 | BRF_PRG | BRF_ESS }, //  2
2145 	{ "defcmnda.10",		0x0800, 0x3dddae75, 1 | BRF_PRG | BRF_ESS }, //  3
2146 	{ "defcmnda.7",			0x0800, 0x3f1e7cf8, 1 | BRF_PRG | BRF_ESS }, //  4
2147 	{ "defcmnda.9",			0x0800, 0x8882e1ff, 1 | BRF_PRG | BRF_ESS }, //  5
2148 	{ "defcmnda.6",			0x0800, 0xd068f0c5, 1 | BRF_PRG | BRF_ESS }, //  6
2149 	{ "defcmnda.8",			0x0800, 0xfef4cb77, 1 | BRF_PRG | BRF_ESS }, //  7
2150 	{ "defcmnda.5",			0x0800, 0x49b50b40, 1 | BRF_PRG | BRF_ESS }, //  8
2151 	{ "defcmnda.4",			0x0800, 0x43d42a1b, 1 | BRF_PRG | BRF_ESS }, //  9
2152 
2153 	{ "defcmnda.snd",		0x0800, 0xf122d9c9, 2 | BRF_PRG | BRF_ESS }, // 10 M6808 Code
2154 };
2155 
2156 STD_ROM_PICK(defcmnd)
2157 STD_ROM_FN(defcmnd)
2158 
2159 struct BurnDriver BurnDrvDefcmnd = {
2160 	"defcmnd", "defender", NULL, NULL, "1980",
2161 	"Defense Command (Defender bootleg)\0", NULL, "bootleg", "6809 System",
2162 	NULL, NULL, NULL, NULL,
2163 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2164 	NULL, defcmndRomInfo, defcmndRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2165 	DefenderWhiteInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2166 	292, 240, 4, 3
2167 };
2168 
2169 
2170 // Star Trek (Defender bootleg)
2171 
2172 static struct BurnRomInfo startrkdRomDesc[] = {
2173 	{ "st_rom8.bin",		0x1000, 0x5af871e3, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2174 	{ "st_rom9.bin",		0x1000, 0x1126adc9, 1 | BRF_PRG | BRF_ESS }, //  1
2175 	{ "st_rom10.bin",		0x1000, 0x4097b46b, 1 | BRF_PRG | BRF_ESS }, //  2
2176 	{ "st_rom6.bin",		0x0800, 0x93012991, 1 | BRF_PRG | BRF_ESS }, //  3
2177 	{ "st_rom5.bin",		0x0800, 0xc6f0c004, 1 | BRF_PRG | BRF_ESS }, //  4
2178 	{ "st_rom4.bin",		0x0800, 0xb48430bf, 1 | BRF_PRG | BRF_ESS }, //  5
2179 	{ "st_rom3.bin",		0x0800, 0xd068f0c5, 1 | BRF_PRG | BRF_ESS }, //  6
2180 	{ "st_rom2.bin",		0x0800, 0xfef4cb77, 1 | BRF_PRG | BRF_ESS }, //  7
2181 	{ "st_rom1.bin",		0x0800, 0xd23d6cdb, 1 | BRF_PRG | BRF_ESS }, //  8
2182 	{ "st_rom7.bin",		0x0800, 0x43d42a1b, 1 | BRF_PRG | BRF_ESS }, //  9
2183 
2184 	{ "defend.snd",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, // 10 M6808 Code
2185 };
2186 
2187 STD_ROM_PICK(startrkd)
2188 STD_ROM_FN(startrkd)
2189 
2190 struct BurnDriver BurnDrvStartrkd = {
2191 	"startrkd", "defender", NULL, NULL, "1981",
2192 	"Star Trek (Defender bootleg)\0", NULL, "bootleg", "6809 System",
2193 	NULL, NULL, NULL, NULL,
2194 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2195 	NULL, startrkdRomInfo, startrkdRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2196 	DefenderWhiteInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2197 	292, 240, 4, 3
2198 };
2199 
2200 
2201 // Defence Command (Defender bootleg)
2202 
2203 static struct BurnRomInfo defenceRomDesc[] = {
2204 	{ "1",					0x1000, 0xebc93622, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2205 	{ "2",					0x1000, 0x2a4f4f44, 1 | BRF_PRG | BRF_ESS }, //  1
2206 	{ "3",					0x1000, 0xa4112f91, 1 | BRF_PRG | BRF_ESS }, //  2
2207 	{ "0",					0x0800, 0x7a1e5998, 1 | BRF_PRG | BRF_ESS }, //  3
2208 	{ "7",					0x0800, 0x4c2616a3, 1 | BRF_PRG | BRF_ESS }, //  4
2209 	{ "9",					0x0800, 0x7b146003, 1 | BRF_PRG | BRF_ESS }, //  5
2210 	{ "6",					0x0800, 0x6d748030, 1 | BRF_PRG | BRF_ESS }, //  6
2211 	{ "8",					0x0800, 0x52d5438b, 1 | BRF_PRG | BRF_ESS }, //  7
2212 	{ "5",					0x0800, 0x4a270340, 1 | BRF_PRG | BRF_ESS }, //  8
2213 	{ "4",					0x0800, 0xe13f457c, 1 | BRF_PRG | BRF_ESS }, //  9
2214 
2215 	{ "defcmnda.snd",		0x0800, 0xf122d9c9, 2 | BRF_PRG | BRF_ESS }, // 10 M6808 Code
2216 };
2217 
2218 STD_ROM_PICK(defence)
2219 STD_ROM_FN(defence)
2220 
2221 struct BurnDriver BurnDrvDefence = {
2222 	"defence", "defender", NULL, NULL, "1981",
2223 	"Defence Command (Defender bootleg)\0", NULL, "bootleg (Outer Limits)", "6809 System",
2224 	NULL, NULL, NULL, NULL,
2225 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2226 	NULL, defenceRomInfo, defenceRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2227 	DefenceInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2228 	292, 240, 4, 3
2229 };
2230 
2231 
2232 // Attack (Defender bootleg)
2233 
2234 static struct BurnRomInfo attackfRomDesc[] = {
2235 	{ "002-1.ic1",		0x1000, 0x0ee1019d, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2236 	{ "002-2.ic2",		0x1000, 0xd184ab6b, 1 | BRF_PRG | BRF_ESS }, //  1
2237 	{ "002-3.ic3",		0x1000, 0xa732d649, 1 | BRF_PRG | BRF_ESS }, //  2
2238 	{ "002-9.ic12",		0x0800, 0xf57caa62, 1 | BRF_PRG | BRF_ESS }, //  3
2239 	{ "002-12.ic9",		0x0800, 0xeb73d8a1, 1 | BRF_PRG | BRF_ESS }, //  4
2240 	{ "002-8.ic11",		0x0800, 0x17f7abde, 1 | BRF_PRG | BRF_ESS }, //  5
2241 	{ "002-11.ic8",		0x0800, 0x5ca4e860, 1 | BRF_PRG | BRF_ESS }, //  6
2242 	{ "002-7.ic10",		0x0800, 0x545c3326, 1 | BRF_PRG | BRF_ESS }, //  7
2243 	{ "002-10.ic7",		0x0800, 0x3940d731, 1 | BRF_PRG | BRF_ESS }, //  8
2244 	{ "002-6.ic6",		0x0800, 0x3af34c05, 1 | BRF_PRG | BRF_ESS }, //  9
2245 
2246 	{ "003-13.ic12",	0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, // 10 M6808 Code
2247 
2248 	{ "001-14.g1",		0x0200, 0x8dd98da5, 0 | BRF_OPT },           // 11 Address Decoder
2249 };
2250 
2251 STD_ROM_PICK(attackf)
2252 STD_ROM_FN(attackf)
2253 
2254 struct BurnDriver BurnDrvAttackf = {
2255 	"attackf", "defender", NULL, NULL, "1980",
2256 	"Attack (Defender bootleg)\0", NULL, "bootleg (Famare SA)", "6809 System",
2257 	NULL, NULL, NULL, NULL,
2258 	BDF_GAME_NOT_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2259 	NULL, attackfRomInfo, attackfRomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2260 	DefenderInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2261 	292, 240, 4, 3
2262 };
2263 
2264 
2265 // Galaxy Wars II (Defender bootleg)
2266 
2267 static struct BurnRomInfo galwars2RomDesc[] = {
2268 	{ "9d-1-2532.bin",		0x1000, 0xebc93622, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2269 	{ "9c-2-2532.bin",		0x1000, 0x2a4f4f44, 1 | BRF_PRG | BRF_ESS }, //  1
2270 	{ "8d-3-2532.bin",		0x1000, 0xa4112f91, 1 | BRF_PRG | BRF_ESS }, //  2
2271 	{ "4c-10-2716.bin",		0x0800, 0x7a1e5998, 1 | BRF_PRG | BRF_ESS }, //  3
2272 	{ "5d-7-2716.bin",		0x0800, 0xa9bdacdc, 1 | BRF_PRG | BRF_ESS }, //  4
2273 	{ "4d-9-2716.bin",		0x0800, 0x906dca8f, 1 | BRF_PRG | BRF_ESS }, //  5
2274 	{ "6c-6-2716.bin",		0x0800, 0x6d748030, 1 | BRF_PRG | BRF_ESS }, //  6
2275 	{ "5c-8-2716.bin",		0x0800, 0x52d5438b, 1 | BRF_PRG | BRF_ESS }, //  7
2276 	{ "6d-5-2716.bin",		0x0800, 0x4a270340, 1 | BRF_PRG | BRF_ESS }, //  8
2277 	{ "7c-4-2716.bin",		0x0800, 0xe13f457c, 1 | BRF_PRG | BRF_ESS }, //  9
2278 
2279 	{ "3f-11-2716.bin",		0x0800, 0xf122d9c9, 2 | BRF_PRG | BRF_ESS }, // 10 M6808 Code
2280 
2281 	{ "1l-13-8516.bin",		0x0800, 0x7e113979, 0 | BRF_OPT },           // 11 Unknown
2282 	{ "1a-12-8516.bin",		0x0800, 0xa562c506, 0 | BRF_OPT },           // 12
2283 };
2284 
2285 STD_ROM_PICK(galwars2)
2286 STD_ROM_FN(galwars2)
2287 
2288 struct BurnDriver BurnDrvGalwars2 = {
2289 	"galwars2", "defender", NULL, NULL, "1981",
2290 	"Galaxy Wars II (Defender bootleg)\0", NULL, "bootleg (Sonic)", "6809 System",
2291 	NULL, NULL, NULL, NULL,
2292 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2293 	NULL, galwars2RomInfo, galwars2RomName, NULL, NULL, NULL, NULL, DefenderInputInfo, NULL,
2294 	DefenceInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2295 	292, 240, 4, 3
2296 };
2297 
2298 
2299 // Mayday (set 1)
2300 
2301 static struct BurnRomInfo maydayRomDesc[] = {
2302 	{ "ic03-3.bin",			0x1000, 0xa1ff6e62, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2303 	{ "ic02-2.bin",			0x1000, 0x62183aea, 1 | BRF_PRG | BRF_ESS }, //  1
2304 	{ "ic01-1.bin",			0x1000, 0x5dcb113f, 1 | BRF_PRG | BRF_ESS }, //  2
2305 	{ "ic04-4.bin",			0x1000, 0xea6a4ec8, 1 | BRF_PRG | BRF_ESS }, //  3
2306 	{ "ic05-5.bin",			0x1000, 0x0d797a3e, 1 | BRF_PRG | BRF_ESS }, //  4
2307 	{ "ic06-6.bin",			0x1000, 0xee8bfcd6, 1 | BRF_PRG | BRF_ESS }, //  5
2308 	{ "ic07-7d.bin",		0x1000, 0xd9c065e7, 1 | BRF_PRG | BRF_ESS }, //  6
2309 
2310 	{ "ic28-8.bin",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, //  7 M6808 Code
2311 };
2312 
2313 STD_ROM_PICK(mayday)
STD_ROM_FN(mayday)2314 STD_ROM_FN(mayday)
2315 
2316 static INT32 MaydayInit()
2317 {
2318 	mayday = 1;
2319 
2320 	return DrvInit(0, 1, 12, -1, 0);
2321 }
2322 
2323 struct BurnDriver BurnDrvMayday = {
2324 	"mayday", NULL, NULL, NULL, "1980",
2325 	"Mayday (set 1)\0", NULL, "Hoei", "6809 System",
2326 	NULL, NULL, NULL, NULL,
2327 	BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2328 	NULL, maydayRomInfo, maydayRomName, NULL, NULL, NULL, NULL, MaydayInputInfo, NULL,
2329 	MaydayInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2330 	292, 240, 4, 3
2331 };
2332 
2333 
2334 // Mayday (set 2)
2335 
2336 static struct BurnRomInfo maydayaRomDesc[] = {
2337 	{ "mayday.c",			0x1000, 0x872a2f2d, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2338 	{ "mayday.b",			0x1000, 0xc4ab5e22, 1 | BRF_PRG | BRF_ESS }, //  1
2339 	{ "mayday.a",			0x1000, 0x329a1318, 1 | BRF_PRG | BRF_ESS }, //  2
2340 	{ "mayday.d",			0x1000, 0xc2ae4716, 1 | BRF_PRG | BRF_ESS }, //  3
2341 	{ "mayday.e",			0x1000, 0x41225666, 1 | BRF_PRG | BRF_ESS }, //  4
2342 	{ "mayday.f",			0x1000, 0xc39be3c0, 1 | BRF_PRG | BRF_ESS }, //  5
2343 	{ "mayday.g",			0x1000, 0x2bd0f106, 1 | BRF_PRG | BRF_ESS }, //  6
2344 
2345 	{ "ic28-8.bin",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, //  7 M6808 Code
2346 };
2347 
2348 STD_ROM_PICK(maydaya)
2349 STD_ROM_FN(maydaya)
2350 
2351 struct BurnDriver BurnDrvMaydaya = {
2352 	"maydaya", "mayday", NULL, NULL, "1980",
2353 	"Mayday (set 2)\0", NULL, "Hoei", "6809 System",
2354 	NULL, NULL, NULL, NULL,
2355 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2356 	NULL, maydayaRomInfo, maydayaRomName, NULL, NULL, NULL, NULL, MaydayInputInfo, NULL,
2357 	MaydayInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2358 	292, 240, 4, 3
2359 };
2360 
2361 
2362 // Mayday (set 3)
2363 
2364 static struct BurnRomInfo maydaybRomDesc[] = {
2365 	{ "ic03-3.bin",			0x1000, 0xa1ff6e62, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2366 	{ "ic02-2.bin",			0x1000, 0x62183aea, 1 | BRF_PRG | BRF_ESS }, //  1
2367 	{ "ic01-1.bin",			0x1000, 0x5dcb113f, 1 | BRF_PRG | BRF_ESS }, //  2
2368 	{ "rom7.bin",			0x1000, 0x0c3ca687, 1 | BRF_PRG | BRF_ESS }, //  3
2369 	{ "ic05-5.bin",			0x1000, 0x0d797a3e, 1 | BRF_PRG | BRF_ESS }, //  4
2370 	{ "ic06-6.bin",			0x1000, 0xee8bfcd6, 1 | BRF_PRG | BRF_ESS }, //  5
2371 	{ "ic07-7d.bin",		0x1000, 0xd9c065e7, 1 | BRF_PRG | BRF_ESS }, //  6
2372 
2373 	{ "ic28-8.bin",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, //  7 M6808 Code
2374 
2375 	{ "rom11.bin",			0x0800, 0x7e113979, 0 | BRF_OPT },           //  8 user1
2376 	{ "rom12.bin",			0x0800, 0xa562c506, 0 | BRF_OPT },           //  9
2377 	{ "rom6a.bin",			0x0800, 0x8e4e981f, 0 | BRF_OPT },           // 10
2378 	{ "rom8-sos.bin",		0x0800, 0x6a9b383f, 0 | BRF_OPT },           // 11
2379 };
2380 
2381 STD_ROM_PICK(maydayb)
2382 STD_ROM_FN(maydayb)
2383 
2384 struct BurnDriver BurnDrvMaydayb = {
2385 	"maydayb", "mayday", NULL, NULL, "1980",
2386 	"Mayday (set 3)\0", NULL, "Hoei", "6809 System",
2387 	NULL, NULL, NULL, NULL,
2388 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2389 	NULL, maydaybRomInfo, maydaybRomName, NULL, NULL, NULL, NULL, MaydayInputInfo, NULL,
2390 	MaydayInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2391 	292, 240, 4, 3
2392 };
2393 
2394 
2395 // Battle Zone (bootleg of Mayday)
2396 
2397 static struct BurnRomInfo batlzoneRomDesc[] = {
2398 	{ "43-2732.rom.bin",	0x1000, 0x244334f8, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2399 	{ "42-2732.rom.bin",	0x1000, 0x62183aea, 1 | BRF_PRG | BRF_ESS }, //  1
2400 	{ "41-2732.rom.bin",	0x1000, 0xa7e9093e, 1 | BRF_PRG | BRF_ESS }, //  2
2401 	{ "44-8532.rom.bin",	0x1000, 0xbba3e626, 1 | BRF_PRG | BRF_ESS }, //  3
2402 	{ "45-8532.rom.bin",	0x1000, 0x43b3a0de, 1 | BRF_PRG | BRF_ESS }, //  4
2403 	{ "46-8532.rom.bin",	0x1000, 0x3df9b901, 1 | BRF_PRG | BRF_ESS }, //  5
2404 	{ "47-8532.rom.bin",	0x1000, 0x55a27e02, 1 | BRF_PRG | BRF_ESS }, //  6
2405 
2406 	{ "48-2716.rom.bin",	0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, //  7 M6808 Code
2407 };
2408 
2409 STD_ROM_PICK(batlzone)
2410 STD_ROM_FN(batlzone)
2411 
2412 struct BurnDriver BurnDrvBatlzone = {
2413 	"batlzone", "mayday", NULL, NULL, "1980",
2414 	"Battle Zone (bootleg of Mayday)\0", NULL, "bootleg (Video Game)", "6809 System",
2415 	NULL, NULL, NULL, NULL,
2416 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2417 	NULL, batlzoneRomInfo, batlzoneRomName, NULL, NULL, NULL, NULL, MaydayInputInfo, NULL,
2418 	MaydayInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2419 	292, 240, 4, 3
2420 };
2421 
2422 
2423 // Colony 7 (set 1)
2424 
2425 static struct BurnRomInfo colony7RomDesc[] = {
2426 	{ "cs03.bin",			0x1000, 0x7ee75ae5, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2427 	{ "cs02.bin",			0x1000, 0xc60b08cb, 1 | BRF_PRG | BRF_ESS }, //  1
2428 	{ "cs01.bin",			0x1000, 0x1bc97436, 1 | BRF_PRG | BRF_ESS }, //  2
2429 	{ "cs06.bin",			0x0800, 0x318b95af, 1 | BRF_PRG | BRF_ESS }, //  3
2430 	{ "cs04.bin",			0x0800, 0xd740faee, 1 | BRF_PRG | BRF_ESS }, //  4
2431 	{ "cs07.bin",			0x0800, 0x0b23638b, 1 | BRF_PRG | BRF_ESS }, //  5
2432 	{ "cs05.bin",			0x0800, 0x59e406a8, 1 | BRF_PRG | BRF_ESS }, //  6
2433 	{ "cs08.bin",			0x0800, 0x3bfde87a, 1 | BRF_PRG | BRF_ESS }, //  7
2434 
2435 	{ "cs11.bin",			0x0800, 0x6032293c, 2 | BRF_PRG | BRF_ESS }, //  8 M6808 Code
2436 
2437 	{ "cs10.bin",			0x0200, 0x25de5d85, 0 | BRF_OPT },           //  9 Address Decoder?
2438 	{ "decoder.3",			0x0200, 0xc3f45f70, 0 | BRF_OPT },           // 10
2439 };
2440 
2441 STD_ROM_PICK(colony7)
STD_ROM_FN(colony7)2442 STD_ROM_FN(colony7)
2443 
2444 static INT32 Colony7Init()
2445 {
2446 	return DrvInit(0, 0, 14, -1, 0);
2447 }
2448 
2449 struct BurnDriver BurnDrvColony7 = {
2450 	"colony7", NULL, NULL, NULL, "1981",
2451 	"Colony 7 (set 1)\0", NULL, "Taito", "6809 System",
2452 	NULL, NULL, NULL, NULL,
2453 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
2454 	NULL, colony7RomInfo, colony7RomName, NULL, NULL, NULL, NULL, Colony7InputInfo, Colony7DIPInfo,
2455 	Colony7Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2456 	240, 292, 3, 4
2457 };
2458 
2459 
2460 // Colony 7 (set 2)
2461 
2462 static struct BurnRomInfo colony7aRomDesc[] = {
2463 	{ "cs03a.bin",			0x1000, 0xe0b0d23b, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2464 	{ "cs02a.bin",			0x1000, 0x370c6f41, 1 | BRF_PRG | BRF_ESS }, //  1
2465 	{ "cs01a.bin",			0x1000, 0xba299946, 1 | BRF_PRG | BRF_ESS }, //  2
2466 	{ "cs06.bin",			0x0800, 0x318b95af, 1 | BRF_PRG | BRF_ESS }, //  3
2467 	{ "cs04.bin",			0x0800, 0xd740faee, 1 | BRF_PRG | BRF_ESS }, //  4
2468 	{ "cs07.bin",			0x0800, 0x0b23638b, 1 | BRF_PRG | BRF_ESS }, //  5
2469 	{ "cs05.bin",			0x0800, 0x59e406a8, 1 | BRF_PRG | BRF_ESS }, //  6
2470 	{ "cs08.bin",			0x0800, 0x3bfde87a, 1 | BRF_PRG | BRF_ESS }, //  7
2471 
2472 	{ "cs11.bin",			0x0800, 0x6032293c, 2 | BRF_PRG | BRF_ESS }, //  8 M6808 Code
2473 
2474 	{ "cs10.bin",			0x0200, 0x25de5d85, 0 | BRF_OPT },           //  9 Address Decoder?
2475 	{ "decoder.3",			0x0200, 0xc3f45f70, 0 | BRF_OPT },           // 10
2476 };
2477 
2478 STD_ROM_PICK(colony7a)
2479 STD_ROM_FN(colony7a)
2480 
2481 struct BurnDriver BurnDrvColony7a = {
2482 	"colony7a", "colony7", NULL, NULL, "1981",
2483 	"Colony 7 (set 2)\0", NULL, "Taito", "6809 System",
2484 	NULL, NULL, NULL, NULL,
2485 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
2486 	NULL, colony7aRomInfo, colony7aRomName, NULL, NULL, NULL, NULL, Colony7InputInfo, Colony7DIPInfo,
2487 	Colony7Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2488 	240, 292, 3, 4
2489 };
2490 
2491 
2492 // Jin
2493 
2494 static struct BurnRomInfo jinRomDesc[] = {
2495 	{ "jin11.6c",			0x1000, 0xc4b9e93f, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2496 	{ "jin12.7c",			0x1000, 0xa8bc9fdd, 1 | BRF_PRG | BRF_ESS }, //  1
2497 	{ "jin13.6d",			0x1000, 0x79779b85, 1 | BRF_PRG | BRF_ESS }, //  2
2498 	{ "jin14.4c",			0x1000, 0x6a4df97e, 1 | BRF_PRG | BRF_ESS }, //  3
2499 
2500 	{ "jin15.3f",			0x0800, 0xfefd5b48, 2 | BRF_PRG | BRF_ESS }, //  4 M6808 Code
2501 
2502 	{ "jin.1a",				0x0200, 0x8dd98da5, 0 | BRF_OPT },           //  5 Address Decoder?
2503 	{ "jin.1l",				0x0200, 0xc3f45f70, 0 | BRF_OPT },           //  6
2504 };
2505 
2506 STD_ROM_PICK(jin)
STD_ROM_FN(jin)2507 STD_ROM_FN(jin)
2508 
2509 static INT32 JinInit()
2510 {
2511 	return DrvInit(0, 0, 0, -1, 0);
2512 }
2513 
2514 struct BurnDriver BurnDrvJin = {
2515 	"jin", NULL, NULL, NULL, "1982",
2516 	"Jin\0", NULL, "Falcon", "6809 System",
2517 	NULL, NULL, NULL, NULL,
2518 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_PUZZLE, 0,
2519 	NULL, jinRomInfo, jinRomName, NULL, NULL, NULL, NULL, JinInputInfo, JinDIPInfo,
2520 	JinInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2521 	240, 316, 3, 4
2522 };
2523 
2524 
2525 // Stargate
2526 
2527 static struct BurnRomInfo stargateRomDesc[] = {
2528 	{ "10",					0x1000, 0x60b07ff7, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2529 	{ "11",					0x1000, 0x7d2c5daf, 1 | BRF_PRG | BRF_ESS }, //  1
2530 	{ "12",					0x1000, 0xa0396670, 1 | BRF_PRG | BRF_ESS }, //  2
2531 	{ "01",					0x1000, 0x88824d18, 1 | BRF_PRG | BRF_ESS }, //  3
2532 	{ "02",					0x1000, 0xafc614c5, 1 | BRF_PRG | BRF_ESS }, //  4
2533 	{ "03",					0x1000, 0x15077a9d, 1 | BRF_PRG | BRF_ESS }, //  5
2534 	{ "04",					0x1000, 0xa8b4bf0f, 1 | BRF_PRG | BRF_ESS }, //  6
2535 	{ "05",					0x1000, 0x2d306074, 1 | BRF_PRG | BRF_ESS }, //  7
2536 	{ "06",					0x1000, 0x53598dde, 1 | BRF_PRG | BRF_ESS }, //  8
2537 	{ "07",					0x1000, 0x23606060, 1 | BRF_PRG | BRF_ESS }, //  9
2538 	{ "08",					0x1000, 0x4ec490c7, 1 | BRF_PRG | BRF_ESS }, // 10
2539 	{ "09",					0x1000, 0x88187b64, 1 | BRF_PRG | BRF_ESS }, // 11
2540 
2541 	{ "sg.snd",				0x0800, 0x2fcf6c4d, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2542 
2543 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2544 	{ "decoder.5",			0x0200, 0xf921c5fe, 0 | BRF_OPT },           // 14
2545 };
2546 
2547 STD_ROM_PICK(stargate)
STD_ROM_FN(stargate)2548 STD_ROM_FN(stargate)
2549 
2550 static INT32 StargateInit()
2551 {
2552 	defender_control_hack = 0x9c92;
2553 
2554 	return DrvInit(1, 0, 6, -1, 0);
2555 }
2556 
2557 struct BurnDriver BurnDrvStargate = {
2558 	"stargate", NULL, NULL, NULL, "1981",
2559 	"Stargate\0", NULL, "Williams / Vid Kidz", "6809 System",
2560 	NULL, NULL, NULL, NULL,
2561 	BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
2562 	NULL, stargateRomInfo, stargateRomName, NULL, NULL, NULL, NULL, StargateInputInfo, NULL,
2563 	StargateInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2564 	292, 240, 4, 3
2565 };
2566 
2567 
2568 // Robotron: 2084 (Solid Blue label)
2569 
2570 static struct BurnRomInfo robotronRomDesc[] = {
2571 	{ "robotron.sba",		0x1000, 0x13797024, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2572 	{ "robotron.sbb",		0x1000, 0x7e3c1b87, 1 | BRF_PRG | BRF_ESS }, //  1
2573 	{ "robotron.sbc",		0x1000, 0x645d543e, 1 | BRF_PRG | BRF_ESS }, //  2
2574 	{ "robotron.sb1",		0x1000, 0x66c7d3ef, 1 | BRF_PRG | BRF_ESS }, //  3
2575 	{ "robotron.sb2",		0x1000, 0x5bc6c614, 1 | BRF_PRG | BRF_ESS }, //  4
2576 	{ "robotron.sb3",		0x1000, 0xe99a82be, 1 | BRF_PRG | BRF_ESS }, //  5
2577 	{ "robotron.sb4",		0x1000, 0xafb1c561, 1 | BRF_PRG | BRF_ESS }, //  6
2578 	{ "robotron.sb5",		0x1000, 0x62691e77, 1 | BRF_PRG | BRF_ESS }, //  7
2579 	{ "robotron.sb6",		0x1000, 0xbd2c853d, 1 | BRF_PRG | BRF_ESS }, //  8
2580 	{ "robotron.sb7",		0x1000, 0x49ac400c, 1 | BRF_PRG | BRF_ESS }, //  9
2581 	{ "robotron.sb8",		0x1000, 0x3a96e88c, 1 | BRF_PRG | BRF_ESS }, // 10
2582 	{ "robotron.sb9",		0x1000, 0xb124367b, 1 | BRF_PRG | BRF_ESS }, // 11
2583 
2584 	{ "robotron.snd",		0x1000, 0xc56c1d28, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2585 
2586 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2587 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2588 };
2589 
2590 STD_ROM_PICK(robotron)
STD_ROM_FN(robotron)2591 STD_ROM_FN(robotron)
2592 
2593 static INT32 RobotronInit()
2594 {
2595 	return DrvInit(1, 0, 6, 1, 0xc000);
2596 }
2597 
2598 struct BurnDriver BurnDrvRobotron = {
2599 	"robotron", NULL, NULL, NULL, "1982",
2600 	"Robotron: 2084 (Solid Blue label)\0", NULL, "Williams / Vid Kidz", "6809 System",
2601 	NULL, NULL, NULL, NULL,
2602 	BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
2603 	NULL, robotronRomInfo, robotronRomName, NULL, NULL, NULL, NULL, RobotronInputInfo, NULL,
2604 	RobotronInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2605 	292, 240, 4, 3
2606 };
2607 
2608 
2609 // Robotron: 2084 (Yellow/Orange label)
2610 
2611 static struct BurnRomInfo robotronyoRomDesc[] = {
2612 	{ "robotron.yoa",		0x1000, 0x4a9d5f52, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2613 	{ "robotron.yob",		0x1000, 0x2afc5e7f, 1 | BRF_PRG | BRF_ESS }, //  1
2614 	{ "robotron.yoc",		0x1000, 0x45da9202, 1 | BRF_PRG | BRF_ESS }, //  2
2615 	{ "robotron.sb1",		0x1000, 0x66c7d3ef, 1 | BRF_PRG | BRF_ESS }, //  3
2616 	{ "robotron.sb2",		0x1000, 0x5bc6c614, 1 | BRF_PRG | BRF_ESS }, //  4
2617 	{ "robotron.yo3",		0x1000, 0x67a369bc, 1 | BRF_PRG | BRF_ESS }, //  5
2618 	{ "robotron.yo4",		0x1000, 0xb0de677a, 1 | BRF_PRG | BRF_ESS }, //  6
2619 	{ "robotron.yo5",		0x1000, 0x24726007, 1 | BRF_PRG | BRF_ESS }, //  7
2620 	{ "robotron.yo6",		0x1000, 0x028181a6, 1 | BRF_PRG | BRF_ESS }, //  8
2621 	{ "robotron.yo7",		0x1000, 0x4dfcceae, 1 | BRF_PRG | BRF_ESS }, //  9
2622 	{ "robotron.sb8",		0x1000, 0x3a96e88c, 1 | BRF_PRG | BRF_ESS }, // 10
2623 	{ "robotron.sb9",		0x1000, 0xb124367b, 1 | BRF_PRG | BRF_ESS }, // 11
2624 
2625 	{ "robotron.snd",		0x1000, 0xc56c1d28, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2626 
2627 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2628 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2629 };
2630 
2631 STD_ROM_PICK(robotronyo)
2632 STD_ROM_FN(robotronyo)
2633 
2634 struct BurnDriver BurnDrvRobotronyo = {
2635 	"robotronyo", "robotron", NULL, NULL, "1982",
2636 	"Robotron: 2084 (Yellow/Orange label)\0", NULL, "Williams / Vid Kidz", "6809 System",
2637 	NULL, NULL, NULL, NULL,
2638 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
2639 	NULL, robotronyoRomInfo, robotronyoRomName, NULL, NULL, NULL, NULL, RobotronInputInfo, NULL,
2640 	RobotronInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2641 	292, 240, 4, 3
2642 };
2643 
2644 
2645 // Robotron: 2084 (1987 'shot-in-the-corner' bugfix)
2646 
2647 static struct BurnRomInfo robotron87RomDesc[] = {
2648 	{ "robotron.sba",		0x1000, 0x13797024, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2649 	{ "fixrobo.sbb",		0x1000, 0xe83a2eda, 1 | BRF_PRG | BRF_ESS }, //  1
2650 	{ "robotron.sbc",		0x1000, 0x645d543e, 1 | BRF_PRG | BRF_ESS }, //  2
2651 	{ "robotron.sb1",		0x1000, 0x66c7d3ef, 1 | BRF_PRG | BRF_ESS }, //  3
2652 	{ "robotron.sb2",		0x1000, 0x5bc6c614, 1 | BRF_PRG | BRF_ESS }, //  4
2653 	{ "robotron.sb3",		0x1000, 0xe99a82be, 1 | BRF_PRG | BRF_ESS }, //  5
2654 	{ "robotron.sb4",		0x1000, 0xafb1c561, 1 | BRF_PRG | BRF_ESS }, //  6
2655 	{ "fixrobo.sb5",		0x1000, 0x827cb5c9, 1 | BRF_PRG | BRF_ESS }, //  7
2656 	{ "robotron.sb6",		0x1000, 0xbd2c853d, 1 | BRF_PRG | BRF_ESS }, //  8
2657 	{ "robotron.sb7",		0x1000, 0x49ac400c, 1 | BRF_PRG | BRF_ESS }, //  9
2658 	{ "robotron.sb8",		0x1000, 0x3a96e88c, 1 | BRF_PRG | BRF_ESS }, // 10
2659 	{ "robotron.sb9",		0x1000, 0xb124367b, 1 | BRF_PRG | BRF_ESS }, // 11
2660 
2661 	{ "robotron.snd",		0x1000, 0xc56c1d28, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2662 
2663 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2664 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2665 };
2666 
2667 STD_ROM_PICK(robotron87)
2668 STD_ROM_FN(robotron87)
2669 
2670 struct BurnDriver BurnDrvRobotron87 = {
2671 	"robotron87", "robotron", NULL, NULL, "1987",
2672 	"Robotron: 2084 (1987 'shot-in-the-corner' bugfix)\0", NULL, "hack", "6809 System",
2673 	NULL, NULL, NULL, NULL,
2674 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
2675 	NULL, robotron87RomInfo, robotron87RomName, NULL, NULL, NULL, NULL, RobotronInputInfo, NULL,
2676 	RobotronInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2677 	292, 240, 4, 3
2678 };
2679 
2680 
2681 // Robotron: 2084 (2012 'wave 201 start' hack)
2682 
2683 static struct BurnRomInfo robotron12RomDesc[] = {
2684 	{ "robotron.sba",		0x1000, 0x13797024, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2685 	{ "fixrobo.sbb",		0x1000, 0xe83a2eda, 1 | BRF_PRG | BRF_ESS }, //  1
2686 	{ "robotron.sbc",		0x1000, 0x645d543e, 1 | BRF_PRG | BRF_ESS }, //  2
2687 	{ "robotron.sb1",		0x1000, 0x66c7d3ef, 1 | BRF_PRG | BRF_ESS }, //  3
2688 	{ "robotron.sb2",		0x1000, 0x5bc6c614, 1 | BRF_PRG | BRF_ESS }, //  4
2689 	{ "wave201.sb3",		0x1000, 0x85eb583e, 1 | BRF_PRG | BRF_ESS }, //  5
2690 	{ "robotron.sb4",		0x1000, 0xafb1c561, 1 | BRF_PRG | BRF_ESS }, //  6
2691 	{ "fixrobo.sb5",		0x1000, 0x827cb5c9, 1 | BRF_PRG | BRF_ESS }, //  7
2692 	{ "robotron.sb6",		0x1000, 0xbd2c853d, 1 | BRF_PRG | BRF_ESS }, //  8
2693 	{ "robotron.sb7",		0x1000, 0x49ac400c, 1 | BRF_PRG | BRF_ESS }, //  9
2694 	{ "robotron.sb8",		0x1000, 0x3a96e88c, 1 | BRF_PRG | BRF_ESS }, // 10
2695 	{ "robotron.sb9",		0x1000, 0xb124367b, 1 | BRF_PRG | BRF_ESS }, // 11
2696 
2697 	{ "robotron.snd",		0x1000, 0xc56c1d28, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2698 
2699 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2700 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2701 };
2702 
2703 STD_ROM_PICK(robotron12)
2704 STD_ROM_FN(robotron12)
2705 
2706 struct BurnDriver BurnDrvRobotron12 = {
2707 	"robotron12", "robotron", NULL, NULL, "2012",
2708 	"Robotron: 2084 (2012 'wave 201 start' hack)\0", NULL, "hack", "6809 System",
2709 	NULL, NULL, NULL, NULL,
2710 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0,
2711 	NULL, robotron12RomInfo, robotron12RomName, NULL, NULL, NULL, NULL, RobotronInputInfo, NULL,
2712 	RobotronInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2713 	292, 240, 4, 3
2714 };
2715 
2716 
2717 // Robotron: 2084 (2015 'tie-die V2' hack)
2718 
2719 static struct BurnRomInfo robotrontdRomDesc[] = {
2720 	{ "tiedie.sba",			0x1000, 0x952bea55, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2721 	{ "tiedie.sbb",			0x1000, 0x4c05fd3c, 1 | BRF_PRG | BRF_ESS }, //  1
2722 	{ "robotron.sbc",		0x1000, 0x645d543e, 1 | BRF_PRG | BRF_ESS }, //  2
2723 	{ "robotron.sb1",		0x1000, 0x66c7d3ef, 1 | BRF_PRG | BRF_ESS }, //  3
2724 	{ "robotron.sb2",		0x1000, 0x5bc6c614, 1 | BRF_PRG | BRF_ESS }, //  4
2725 	{ "robotron.sb3",		0x1000, 0xe99a82be, 1 | BRF_PRG | BRF_ESS }, //  5
2726 	{ "tiedie.sb4",			0x1000, 0xe8238019, 1 | BRF_PRG | BRF_ESS }, //  6
2727 	{ "fixrobo.sb5",		0x1000, 0x827cb5c9, 1 | BRF_PRG | BRF_ESS }, //  7
2728 	{ "robotron.sb6",		0x1000, 0xbd2c853d, 1 | BRF_PRG | BRF_ESS }, //  8
2729 	{ "tiedie.sb7",			0x1000, 0x3ecf4620, 1 | BRF_PRG | BRF_ESS }, //  9
2730 	{ "tiedie.sb8",			0x1000, 0x752d7a46, 1 | BRF_PRG | BRF_ESS }, // 10
2731 	{ "robotron.sb9",		0x1000, 0xb124367b, 1 | BRF_PRG | BRF_ESS }, // 11
2732 
2733 	{ "robotron.snd",		0x1000, 0xc56c1d28, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2734 
2735 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2736 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2737 };
2738 
2739 STD_ROM_PICK(robotrontd)
2740 STD_ROM_FN(robotrontd)
2741 
2742 struct BurnDriver BurnDrvRobotrontd = {
2743 	"robotrontd", "robotron", NULL, NULL, "2015",
2744 	"Robotron: 2084 (2015 'tie-die V2' hack)\0", NULL, "hack", "6809 System",
2745 	NULL, NULL, NULL, NULL,
2746 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0,
2747 	NULL, robotrontdRomInfo, robotrontdRomName, NULL, NULL, NULL, NULL, RobotronInputInfo, NULL,
2748 	RobotronInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2749 	292, 240, 4, 3
2750 };
2751 
2752 
2753 // Joust (White/Green label)
2754 
2755 static struct BurnRomInfo joustRomDesc[] = {
2756 	{ "3006-22.10b",		0x1000, 0x3f1c4f89, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2757 	{ "3006-23.11b",		0x1000, 0xea48b359, 1 | BRF_PRG | BRF_ESS }, //  1
2758 	{ "3006-24.12b",		0x1000, 0xc710717b, 1 | BRF_PRG | BRF_ESS }, //  2
2759 	{ "3006-13.1b",			0x1000, 0xfe41b2af, 1 | BRF_PRG | BRF_ESS }, //  3
2760 	{ "3006-14.2b",			0x1000, 0x501c143c, 1 | BRF_PRG | BRF_ESS }, //  4
2761 	{ "3006-15.3b",			0x1000, 0x43f7161d, 1 | BRF_PRG | BRF_ESS }, //  5
2762 	{ "3006-16.4b",			0x1000, 0xdb5571b6, 1 | BRF_PRG | BRF_ESS }, //  6
2763 	{ "3006-17.5b",			0x1000, 0xc686bb6b, 1 | BRF_PRG | BRF_ESS }, //  7
2764 	{ "3006-18.6b",			0x1000, 0xfac5f2cf, 1 | BRF_PRG | BRF_ESS }, //  8
2765 	{ "3006-19.7b",			0x1000, 0x81418240, 1 | BRF_PRG | BRF_ESS }, //  9
2766 	{ "3006-20.8b",			0x1000, 0xba5359ba, 1 | BRF_PRG | BRF_ESS }, // 10
2767 	{ "3006-21.9b",			0x1000, 0x39643147, 1 | BRF_PRG | BRF_ESS }, // 11
2768 
2769 	{ "joust.snd",			0x1000, 0xf1835bdd, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2770 
2771 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2772 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2773 };
2774 
2775 STD_ROM_PICK(joust)
STD_ROM_FN(joust)2776 STD_ROM_FN(joust)
2777 
2778 static INT32 JoustInit()
2779 {
2780 	INT32 nRet = DrvInit(1, 0, 6, 1, 0xc000);
2781 
2782 	if (nRet == 0)
2783 	{
2784 		pia_config(0, 0, &pia_muxed_joust_0);
2785 		pStartDraw = DrvDrawBegin;
2786 		pDrawScanline = DrvDrawLine;
2787 	}
2788 
2789 	return nRet;
2790 }
2791 
2792 struct BurnDriver BurnDrvJoust = {
2793 	"joust", NULL, NULL, NULL, "1982",
2794 	"Joust (White/Green label)\0", NULL, "Williams", "6809 System",
2795 	NULL, NULL, NULL, NULL,
2796 	BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
2797 	NULL, joustRomInfo, joustRomName, NULL, NULL, NULL, NULL, JoustInputInfo, NULL,
2798 	JoustInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2799 	292, 240, 4, 3
2800 };
2801 
2802 
2803 // Joust (White/Red label)
2804 
2805 static struct BurnRomInfo joustwrRomDesc[] = {
2806 	{ "joust.wra",			0x1000, 0x2039014a, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2807 	{ "joust.wgb",			0x1000, 0xea48b359, 1 | BRF_PRG | BRF_ESS }, //  1
2808 	{ "joust.wgc",			0x1000, 0xc710717b, 1 | BRF_PRG | BRF_ESS }, //  2
2809 	{ "joust.wg1",			0x1000, 0xfe41b2af, 1 | BRF_PRG | BRF_ESS }, //  3
2810 	{ "joust.wg2",			0x1000, 0x501c143c, 1 | BRF_PRG | BRF_ESS }, //  4
2811 	{ "joust.wg3",			0x1000, 0x43f7161d, 1 | BRF_PRG | BRF_ESS }, //  5
2812 	{ "joust.wg4",			0x1000, 0xdb5571b6, 1 | BRF_PRG | BRF_ESS }, //  6
2813 	{ "joust.wg5",			0x1000, 0xc686bb6b, 1 | BRF_PRG | BRF_ESS }, //  7
2814 	{ "joust.wg6",			0x1000, 0xfac5f2cf, 1 | BRF_PRG | BRF_ESS }, //  8
2815 	{ "joust.wr7",			0x1000, 0xe6f439c4, 1 | BRF_PRG | BRF_ESS }, //  9
2816 	{ "joust.wg8",			0x1000, 0xba5359ba, 1 | BRF_PRG | BRF_ESS }, // 10
2817 	{ "joust.wg9",			0x1000, 0x39643147, 1 | BRF_PRG | BRF_ESS }, // 11
2818 
2819 	{ "joust.snd",			0x1000, 0xf1835bdd, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2820 
2821 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2822 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2823 };
2824 
2825 STD_ROM_PICK(joustwr)
2826 STD_ROM_FN(joustwr)
2827 
2828 struct BurnDriver BurnDrvJoustwr = {
2829 	"joustwr", "joust", NULL, NULL, "1982",
2830 	"Joust (White/Red label)\0", NULL, "Williams", "6809 System",
2831 	NULL, NULL, NULL, NULL,
2832 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
2833 	NULL, joustwrRomInfo, joustwrRomName, NULL, NULL, NULL, NULL, JoustInputInfo, NULL,
2834 	JoustInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2835 	292, 240, 4, 3
2836 };
2837 
2838 
2839 // Joust (Solid Red label)
2840 
2841 static struct BurnRomInfo joustrRomDesc[] = {
2842 	{ "joust.sra",			0x1000, 0xc0c6e52a, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2843 	{ "joust.srb",			0x1000, 0xab11bcf9, 1 | BRF_PRG | BRF_ESS }, //  1
2844 	{ "joust.src",			0x1000, 0xea14574b, 1 | BRF_PRG | BRF_ESS }, //  2
2845 	{ "joust.wg1",			0x1000, 0xfe41b2af, 1 | BRF_PRG | BRF_ESS }, //  3
2846 	{ "joust.wg2",			0x1000, 0x501c143c, 1 | BRF_PRG | BRF_ESS }, //  4
2847 	{ "joust.wg3",			0x1000, 0x43f7161d, 1 | BRF_PRG | BRF_ESS }, //  5
2848 	{ "joust.sr4",			0x1000, 0xab347170, 1 | BRF_PRG | BRF_ESS }, //  6
2849 	{ "joust.wg5",			0x1000, 0xc686bb6b, 1 | BRF_PRG | BRF_ESS }, //  7
2850 	{ "joust.sr6",			0x1000, 0x3d9a6fac, 1 | BRF_PRG | BRF_ESS }, //  8
2851 	{ "joust.sr7",			0x1000, 0x0a70b3d1, 1 | BRF_PRG | BRF_ESS }, //  9
2852 	{ "joust.sr8",			0x1000, 0xa7f01504, 1 | BRF_PRG | BRF_ESS }, // 10
2853 	{ "joust.sr9",			0x1000, 0x978687ad, 1 | BRF_PRG | BRF_ESS }, // 11
2854 
2855 	{ "joust.snd",			0x1000, 0xf1835bdd, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2856 
2857 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2858 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2859 };
2860 
2861 STD_ROM_PICK(joustr)
2862 STD_ROM_FN(joustr)
2863 
2864 struct BurnDriver BurnDrvJoustr = {
2865 	"joustr", "joust", NULL, NULL, "1982",
2866 	"Joust (Solid Red label)\0", NULL, "Williams", "6809 System",
2867 	NULL, NULL, NULL, NULL,
2868 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
2869 	NULL, joustrRomInfo, joustrRomName, NULL, NULL, NULL, NULL, JoustInputInfo, NULL,
2870 	JoustInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2871 	292, 240, 4, 3
2872 };
2873 
2874 
2875 // Bubbles
2876 
2877 static struct BurnRomInfo bubblesRomDesc[] = {
2878 	{ "bubbles.10b",		0x1000, 0x26e7869b, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2879 	{ "bubbles.11b",		0x1000, 0x5a5b572f, 1 | BRF_PRG | BRF_ESS }, //  1
2880 	{ "bubbles.12b",		0x1000, 0xce22d2e2, 1 | BRF_PRG | BRF_ESS }, //  2
2881 	{ "bubbles.1b",			0x1000, 0x8234f55c, 1 | BRF_PRG | BRF_ESS }, //  3
2882 	{ "bubbles.2b",			0x1000, 0x4a188d6a, 1 | BRF_PRG | BRF_ESS }, //  4
2883 	{ "bubbles.3b",			0x1000, 0x7728f07f, 1 | BRF_PRG | BRF_ESS }, //  5
2884 	{ "bubbles.4b",			0x1000, 0x040be7f9, 1 | BRF_PRG | BRF_ESS }, //  6
2885 	{ "bubbles.5b",			0x1000, 0x0b5f29e0, 1 | BRF_PRG | BRF_ESS }, //  7
2886 	{ "bubbles.6b",			0x1000, 0x4dd0450d, 1 | BRF_PRG | BRF_ESS }, //  8
2887 	{ "bubbles.7b",			0x1000, 0xe0a26ec0, 1 | BRF_PRG | BRF_ESS }, //  9
2888 	{ "bubbles.8b",			0x1000, 0x4fd23d8d, 1 | BRF_PRG | BRF_ESS }, // 10
2889 	{ "bubbles.9b",			0x1000, 0xb48559fb, 1 | BRF_PRG | BRF_ESS }, // 11
2890 
2891 	{ "bubbles.snd",		0x1000, 0x689ce2aa, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2892 
2893 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2894 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2895 };
2896 
2897 STD_ROM_PICK(bubbles)
STD_ROM_FN(bubbles)2898 STD_ROM_FN(bubbles)
2899 
2900 static INT32 BubblesInit()
2901 {
2902 	INT32 nRet = DrvInit(1, 0, 6, 1, 0xc000);
2903 
2904 	if (nRet == 0) {
2905 		M6809Open(0);
2906 		M6809MapMemory(DrvNVRAM,		0xcc00, 0xcfff, MAP_RAM); // 8 bit
2907 		M6809Close();
2908 	}
2909 
2910 	return nRet;
2911 }
2912 
2913 struct BurnDriver BurnDrvBubbles = {
2914 	"bubbles", NULL, NULL, NULL, "1982",
2915 	"Bubbles\0", NULL, "Williams", "6809 System",
2916 	NULL, NULL, NULL, NULL,
2917 	BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0,
2918 	NULL, bubblesRomInfo, bubblesRomName, NULL, NULL, NULL, NULL, BubblesInputInfo, NULL,
2919 	BubblesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2920 	292, 240, 4, 3
2921 };
2922 
2923 
2924 // Bubbles (Solid Red label)
2925 
2926 static struct BurnRomInfo bubblesrRomDesc[] = {
2927 	{ "bubblesr.10b",		0x1000, 0x8b396db0, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2928 	{ "bubblesr.11b",		0x1000, 0x096af43e, 1 | BRF_PRG | BRF_ESS }, //  1
2929 	{ "bubblesr.12b",		0x1000, 0x5c1244ef, 1 | BRF_PRG | BRF_ESS }, //  2
2930 	{ "bubblesr.1b",		0x1000, 0xdda4e782, 1 | BRF_PRG | BRF_ESS }, //  3
2931 	{ "bubblesr.2b",		0x1000, 0x3c8fa7f5, 1 | BRF_PRG | BRF_ESS }, //  4
2932 	{ "bubblesr.3b",		0x1000, 0xf869bb9c, 1 | BRF_PRG | BRF_ESS }, //  5
2933 	{ "bubblesr.4b",		0x1000, 0x0c65eaab, 1 | BRF_PRG | BRF_ESS }, //  6
2934 	{ "bubblesr.5b",		0x1000, 0x7ece4e13, 1 | BRF_PRG | BRF_ESS }, //  7
2935 	{ "bubbles.6b",			0x1000, 0x4dd0450d, 1 | BRF_PRG | BRF_ESS }, //  8
2936 	{ "bubbles.7b",			0x1000, 0xe0a26ec0, 1 | BRF_PRG | BRF_ESS }, //  9
2937 	{ "bubblesr.8b",		0x1000, 0x598b9bd6, 1 | BRF_PRG | BRF_ESS }, // 10
2938 	{ "bubbles.9b",			0x1000, 0xb48559fb, 1 | BRF_PRG | BRF_ESS }, // 11
2939 
2940 	{ "bubbles.snd",		0x1000, 0x689ce2aa, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2941 
2942 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2943 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2944 };
2945 
2946 STD_ROM_PICK(bubblesr)
2947 STD_ROM_FN(bubblesr)
2948 
2949 struct BurnDriver BurnDrvBubblesr = {
2950 	"bubblesr", "bubbles", NULL, NULL, "1982",
2951 	"Bubbles (Solid Red label)\0", NULL, "Williams", "6809 System",
2952 	NULL, NULL, NULL, NULL,
2953 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0,
2954 	NULL, bubblesrRomInfo, bubblesrRomName, NULL, NULL, NULL, NULL, BubblesInputInfo, NULL,
2955 	BubblesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2956 	292, 240, 4, 3
2957 };
2958 
2959 
2960 // Bubbles (prototype version)
2961 
2962 static struct BurnRomInfo bubblespRomDesc[] = {
2963 	{ "bub_prot.10b",		0x1000, 0x89a565df, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
2964 	{ "bub_prot.11b",		0x1000, 0x5a0c36a7, 1 | BRF_PRG | BRF_ESS }, //  1
2965 	{ "bub_prot.12b",		0x1000, 0x2bfd3438, 1 | BRF_PRG | BRF_ESS }, //  2
2966 	{ "bub_prot.1b",		0x1000, 0x6466a746, 1 | BRF_PRG | BRF_ESS }, //  3
2967 	{ "bub_prot.2b",		0x1000, 0xcca04357, 1 | BRF_PRG | BRF_ESS }, //  4
2968 	{ "bub_prot.3b",		0x1000, 0x7aaff9e5, 1 | BRF_PRG | BRF_ESS }, //  5
2969 	{ "bub_prot.4b",		0x1000, 0x4e264f01, 1 | BRF_PRG | BRF_ESS }, //  6
2970 	{ "bub_prot.5b",		0x1000, 0x121b0be6, 1 | BRF_PRG | BRF_ESS }, //  7
2971 	{ "bub_prot.6b",		0x1000, 0x80e90b25, 1 | BRF_PRG | BRF_ESS }, //  8
2972 	{ "bubbles.7b",			0x1000, 0xe0a26ec0, 1 | BRF_PRG | BRF_ESS }, //  9
2973 	{ "bub_prot.8b",		0x1000, 0x96fb19c8, 1 | BRF_PRG | BRF_ESS }, // 10
2974 	{ "bub_prot.9b",		0x1000, 0xbe7e1028, 1 | BRF_PRG | BRF_ESS }, // 11
2975 
2976 	{ "bubbles.snd",		0x1000, 0x689ce2aa, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
2977 
2978 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
2979 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
2980 };
2981 
2982 STD_ROM_PICK(bubblesp)
2983 STD_ROM_FN(bubblesp)
2984 
2985 struct BurnDriver BurnDrvBubblesp = {
2986 	"bubblesp", "bubbles", NULL, NULL, "1982",
2987 	"Bubbles (prototype version)\0", NULL, "Williams", "6809 System",
2988 	NULL, NULL, NULL, NULL,
2989 	BDF_GAME_WORKING | BDF_CLONE | BDF_PROTOTYPE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0,
2990 	NULL, bubblespRomInfo, bubblespRomName, NULL, NULL, NULL, NULL, BubblesInputInfo, NULL,
2991 	BubblesInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
2992 	292, 240, 4, 3
2993 };
2994 
2995 
2996 // Splat!
2997 
2998 static struct BurnRomInfo splatRomDesc[] = {
2999 	{ "splat.10",			0x1000, 0xd1a1f632, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
3000 	{ "splat.11",			0x1000, 0xca8cde95, 1 | BRF_PRG | BRF_ESS }, //  1
3001 	{ "splat.12",			0x1000, 0x5bee3e60, 1 | BRF_PRG | BRF_ESS }, //  2
3002 	{ "splat.01",			0x1000, 0x1cf26e48, 1 | BRF_PRG | BRF_ESS }, //  3
3003 	{ "splat.02",			0x1000, 0xac0d4276, 1 | BRF_PRG | BRF_ESS }, //  4
3004 	{ "splat.03",			0x1000, 0x74873e59, 1 | BRF_PRG | BRF_ESS }, //  5
3005 	{ "splat.04",			0x1000, 0x70a7064e, 1 | BRF_PRG | BRF_ESS }, //  6
3006 	{ "splat.05",			0x1000, 0xc6895221, 1 | BRF_PRG | BRF_ESS }, //  7
3007 	{ "splat.06",			0x1000, 0xea4ab7fd, 1 | BRF_PRG | BRF_ESS }, //  8
3008 	{ "splat.07",			0x1000, 0x82fd8713, 1 | BRF_PRG | BRF_ESS }, //  9
3009 	{ "splat.08",			0x1000, 0x7dded1b4, 1 | BRF_PRG | BRF_ESS }, // 10
3010 	{ "splat.09",			0x1000, 0x71cbfe5a, 1 | BRF_PRG | BRF_ESS }, // 11
3011 
3012 	{ "splat.snd",			0x1000, 0xa878d5f3, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
3013 
3014 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
3015 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
3016 };
3017 
3018 STD_ROM_PICK(splat)
STD_ROM_FN(splat)3019 STD_ROM_FN(splat)
3020 
3021 static INT32 SplatInit()
3022 {
3023 	splat = 1;
3024 
3025 	INT32 nRet = DrvInit(1, 0, 6, 2, 0xc000);
3026 
3027 	if (nRet == 0)
3028 	{
3029 		pia_config(0, 0, &pia_muxed_joust_0);
3030 		pStartDraw = DrvDrawBegin;
3031 		pDrawScanline = DrvDrawLine;
3032 	}
3033 
3034 	return nRet;
3035 }
3036 
3037 struct BurnDriver BurnDrvSplat = {
3038 	"splat", NULL, NULL, NULL, "1982",
3039 	"Splat!\0", NULL, "Williams", "6809 System",
3040 	NULL, NULL, NULL, NULL,
3041 	BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
3042 	NULL, splatRomInfo, splatRomName, NULL, NULL, NULL, NULL, SplatInputInfo, NULL,
3043 	SplatInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
3044 	292, 240, 4, 3
3045 };
3046 
3047 
3048 // Speed Ball - Contest at Neonworld (prototype)
3049 
3050 static struct BurnRomInfo spdballRomDesc[] = {
3051 	{ "speedbal.10",		0x1000, 0x4a3add93, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
3052 	{ "speedbal.11",		0x1000, 0x1fbcfaa5, 1 | BRF_PRG | BRF_ESS }, //  1
3053 	{ "speedbal.12",		0x1000, 0xf3458f41, 1 | BRF_PRG | BRF_ESS }, //  2
3054 	{ "speedbal.01",		0x1000, 0x7f4801bb, 1 | BRF_PRG | BRF_ESS }, //  3
3055 	{ "speedbal.02",		0x1000, 0x5cd5e489, 1 | BRF_PRG | BRF_ESS }, //  4
3056 	{ "speedbal.03",		0x1000, 0x280e11a4, 1 | BRF_PRG | BRF_ESS }, //  5
3057 	{ "speedbal.04",		0x1000, 0x3469cbbf, 1 | BRF_PRG | BRF_ESS }, //  6
3058 	{ "speedbal.05",		0x1000, 0x87373c89, 1 | BRF_PRG | BRF_ESS }, //  7
3059 	{ "speedbal.06",		0x1000, 0x48779a0d, 1 | BRF_PRG | BRF_ESS }, //  8
3060 	{ "speedbal.07",		0x1000, 0x2e5d8db6, 1 | BRF_PRG | BRF_ESS }, //  9
3061 	{ "speedbal.08",		0x1000, 0xc173cedf, 1 | BRF_PRG | BRF_ESS }, // 10
3062 	{ "speedbal.09",		0x1000, 0x415f424b, 1 | BRF_PRG | BRF_ESS }, // 11
3063 
3064 	{ "speedbal.snd",		0x1000, 0x78de20e2, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
3065 
3066 	{ "mystery.rom",		0x1000, 0xdcb6a070, 0 | BRF_OPT },           // 13 ??
3067 };
3068 
3069 STD_ROM_PICK(spdball)
STD_ROM_FN(spdball)3070 STD_ROM_FN(spdball)
3071 
3072 static INT32 SpdballInit()
3073 {
3074 	INT32 nRet = DrvInit(1, 0, 6, 1, 0xc000);
3075 
3076 	if (nRet == 0) // raster draw
3077 	{
3078 		spdball = 1;
3079 		pStartDraw = DrvDrawBegin;
3080 		pDrawScanline = DrvDrawLine;
3081 	}
3082 
3083 	return nRet;
3084 }
3085 
3086 struct BurnDriver BurnDrvSpdball = {
3087 	"spdball", NULL, NULL, NULL, "1985",
3088 	"Speed Ball - Contest at Neonworld (prototype)\0", NULL, "Williams", "6809 System",
3089 	NULL, NULL, NULL, NULL,
3090 	BDF_GAME_WORKING | BDF_PROTOTYPE, 2, HARDWARE_MISC_PRE90S, GBF_SPORTSMISC, 0,
3091 	NULL, spdballRomInfo, spdballRomName, NULL, NULL, NULL, NULL, SpdballInputInfo, NULL,
3092 	SpdballInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
3093 	292, 240, 4, 3
3094 };
3095 
3096 
3097 // Alien Arena
3098 
3099 static struct BurnRomInfo alienarRomDesc[] = {
3100 	{ "aarom10",			0x1000, 0x6feb0314, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
3101 	{ "aarom11",			0x1000, 0xae3a270e, 1 | BRF_PRG | BRF_ESS }, //  1
3102 	{ "aarom12",			0x1000, 0x6be9f09e, 1 | BRF_PRG | BRF_ESS }, //  2
3103 	{ "aarom01",			0x1000, 0xbb0c21be, 1 | BRF_PRG | BRF_ESS }, //  3
3104 	{ "aarom02",			0x1000, 0x165acd37, 1 | BRF_PRG | BRF_ESS }, //  4
3105 	{ "aarom03",			0x1000, 0xe5d51d92, 1 | BRF_PRG | BRF_ESS }, //  5
3106 	{ "aarom04",			0x1000, 0x24f6feb8, 1 | BRF_PRG | BRF_ESS }, //  6
3107 	{ "aarom05",			0x1000, 0x5b1ac59b, 1 | BRF_PRG | BRF_ESS }, //  7
3108 	{ "aarom06",			0x1000, 0xda7195a2, 1 | BRF_PRG | BRF_ESS }, //  8
3109 	{ "aarom07",			0x1000, 0xf9812be4, 1 | BRF_PRG | BRF_ESS }, //  9
3110 	{ "aarom08",			0x1000, 0xcd7f3a87, 1 | BRF_PRG | BRF_ESS }, // 10
3111 	{ "aarom09",			0x1000, 0xe6ce77b4, 1 | BRF_PRG | BRF_ESS }, // 11
3112 };
3113 
3114 STD_ROM_PICK(alienar)
STD_ROM_FN(alienar)3115 STD_ROM_FN(alienar)
3116 
3117 static INT32 AlienarInit()
3118 {
3119 	INT32 nRet = DrvInit(1, 0, 6, 2, 0xc000);
3120 
3121 	if (nRet == 0)
3122 	{
3123 		pia_config(0, 0, &pia_muxed_joust_0);
3124 	}
3125 
3126 	return nRet;
3127 }
3128 
3129 struct BurnDriver BurnDrvAlienar = {
3130 	"alienar", NULL, NULL, NULL, "1985",
3131 	"Alien Arena\0", "Game has no sound", "Duncan Brown", "6809 System",
3132 	NULL, NULL, NULL, NULL,
3133 	BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0,
3134 	NULL, alienarRomInfo, alienarRomName, NULL, NULL, NULL, NULL, AlienarInputInfo, NULL,
3135 	AlienarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
3136 	292, 240, 4, 3
3137 };
3138 
3139 
3140 // Alien Arena (Stargate upgrade)
3141 
3142 static struct BurnRomInfo alienaruRomDesc[] = {
3143 	{ "aarom10",			0x1000, 0x6feb0314, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
3144 	{ "aarom11",			0x1000, 0xae3a270e, 1 | BRF_PRG | BRF_ESS }, //  1
3145 	{ "aarom12",			0x1000, 0x6be9f09e, 1 | BRF_PRG | BRF_ESS }, //  2
3146 	{ "aarom01",			0x1000, 0xbb0c21be, 1 | BRF_PRG | BRF_ESS }, //  3
3147 	{ "aarom02",			0x1000, 0x165acd37, 1 | BRF_PRG | BRF_ESS }, //  4
3148 	{ "aarom03",			0x1000, 0xe5d51d92, 1 | BRF_PRG | BRF_ESS }, //  5
3149 	{ "aarom04",			0x1000, 0x24f6feb8, 1 | BRF_PRG | BRF_ESS }, //  6
3150 	{ "aarom05",			0x1000, 0x5b1ac59b, 1 | BRF_PRG | BRF_ESS }, //  7
3151 	{ "aarom06",			0x1000, 0xda7195a2, 1 | BRF_PRG | BRF_ESS }, //  8
3152 	{ "aarom07",			0x1000, 0xf9812be4, 1 | BRF_PRG | BRF_ESS }, //  9
3153 	{ "aarom08",			0x1000, 0xcd7f3a87, 1 | BRF_PRG | BRF_ESS }, // 10
3154 	{ "aarom09",			0x1000, 0xe6ce77b4, 1 | BRF_PRG | BRF_ESS }, // 11
3155 
3156 	{ "sg.snd",				0x0800, 0x2fcf6c4d, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
3157 
3158 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 13 Address Decoder
3159 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 14
3160 };
3161 
3162 STD_ROM_PICK(alienaru)
3163 STD_ROM_FN(alienaru)
3164 
3165 struct BurnDriver BurnDrvAlienaru = {
3166 	"alienaru", "alienar", NULL, NULL, "1985",
3167 	"Alien Arena (Stargate upgrade)\0", NULL, "Duncan Brown", "6809 System",
3168 	NULL, NULL, NULL, NULL,
3169 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0,
3170 	NULL, alienaruRomInfo, alienaruRomName, NULL, NULL, NULL, NULL, AlienarInputInfo, NULL,
3171 	AlienarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
3172 	292, 240, 4, 3
3173 };
3174 
3175 
3176 // Sinistar (revision 3)
3177 
3178 static struct BurnRomInfo sinistarRomDesc[] = {
3179 	{ "sinistar.10",		0x1000, 0x3d670417, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
3180 	{ "sinistar.11",		0x1000, 0x3162bc50, 1 | BRF_PRG | BRF_ESS }, //  1
3181 	{ "sinistar.01",		0x1000, 0xf6f3a22c, 1 | BRF_PRG | BRF_ESS }, //  2
3182 	{ "sinistar.02",		0x1000, 0xcab3185c, 1 | BRF_PRG | BRF_ESS }, //  3
3183 	{ "sinistar.03",		0x1000, 0x1ce1b3cc, 1 | BRF_PRG | BRF_ESS }, //  4
3184 	{ "sinistar.04",		0x1000, 0x6da632ba, 1 | BRF_PRG | BRF_ESS }, //  5
3185 	{ "sinistar.05",		0x1000, 0xb662e8fc, 1 | BRF_PRG | BRF_ESS }, //  6
3186 	{ "sinistar.06",		0x1000, 0x2306183d, 1 | BRF_PRG | BRF_ESS }, //  7
3187 	{ "sinistar.07",		0x1000, 0xe5dd918e, 1 | BRF_PRG | BRF_ESS }, //  8
3188 	{ "sinistar.08",		0x1000, 0x4785a787, 1 | BRF_PRG | BRF_ESS }, //  9
3189 	{ "sinistar.09",		0x1000, 0x50cb63ad, 1 | BRF_PRG | BRF_ESS }, // 10
3190 
3191 	{ "speech.ic7",			0x1000, 0xe1019568, 2 | BRF_PRG | BRF_ESS }, // 11 M6800 Code
3192 	{ "speech.ic5",			0x1000, 0xcf3b5ffd, 2 | BRF_PRG | BRF_ESS }, // 12
3193 	{ "speech.ic6",			0x1000, 0xff8d2645, 2 | BRF_PRG | BRF_ESS }, // 13
3194 	{ "speech.ic4",			0x1000, 0x4b56a626, 2 | BRF_PRG | BRF_ESS }, // 14
3195 	{ "sinistar.snd",		0x1000, 0xb82f4ddb, 2 | BRF_PRG | BRF_ESS }, // 15
3196 
3197 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 16 Address Decoder
3198 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 17
3199 };
3200 
3201 STD_ROM_PICK(sinistar)
STD_ROM_FN(sinistar)3202 STD_ROM_FN(sinistar)
3203 
3204 static INT32 SinistarInit()
3205 {
3206 	INT32 nRet = DrvInit(1, 4, 6, 1, 0x7400);
3207 
3208 	if (nRet == 0)
3209 	{
3210 		hc55516_init(M6800TotalCycles, 894886);
3211 		uses_hc55516 = 1;
3212 
3213 		pStartDraw = DrvDrawBegin;
3214 		pDrawScanline = DrvDrawLine;
3215 
3216 		pia_init();
3217 		pia_config(0, 0, &pia_49way_0);
3218 		pia_config(1, 0, &pia_1);
3219 		pia_config(2, 0, &pia_2_sinistar);
3220 		pia_config(3, 0, &pia_3);
3221 
3222 		M6809Open(0);
3223 		M6809MapMemory(DrvM6809RAM0,		0xd000, 0xdfff, MAP_RAM);
3224 		M6809Close();
3225 	}
3226 
3227 	return nRet;
3228 }
3229 
3230 struct BurnDriver BurnDrvSinistar = {
3231 	"sinistar", NULL, NULL, NULL, "1982",
3232 	"Sinistar (revision 3)\0", NULL, "Williams", "6809 System",
3233 	NULL, NULL, NULL, NULL,
3234 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
3235 	NULL, sinistarRomInfo, sinistarRomName, NULL, NULL, NULL, NULL, SinistarInputInfo, NULL,
3236 	SinistarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
3237 	240, 292, 3, 4
3238 };
3239 
3240 
3241 // Sinistar (prototype version)
3242 
3243 static struct BurnRomInfo sinistar1RomDesc[] = {
3244 	{ "sinrev1.10",			0x1000, 0xea87a53f, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
3245 	{ "sinrev1.11",			0x1000, 0x88d36e80, 1 | BRF_PRG | BRF_ESS }, //  1
3246 	{ "sinrev1.01",			0x1000, 0x3810d7b8, 1 | BRF_PRG | BRF_ESS }, //  2
3247 	{ "sinistar.02",		0x1000, 0xcab3185c, 1 | BRF_PRG | BRF_ESS }, //  3
3248 	{ "sinrev1.03",			0x1000, 0x7c984ca9, 1 | BRF_PRG | BRF_ESS }, //  4
3249 	{ "sinrev1.04",			0x1000, 0xcc6c4f24, 1 | BRF_PRG | BRF_ESS }, //  5
3250 	{ "sinrev1.05",			0x1000, 0x12285bfe, 1 | BRF_PRG | BRF_ESS }, //  6
3251 	{ "sinrev1.06",			0x1000, 0x7a675f35, 1 | BRF_PRG | BRF_ESS }, //  7
3252 	{ "sinrev1.07",			0x1000, 0xb0463243, 1 | BRF_PRG | BRF_ESS }, //  8
3253 	{ "sinrev1.08",			0x1000, 0x909040d4, 1 | BRF_PRG | BRF_ESS }, //  9
3254 	{ "sinrev1.09",			0x1000, 0xcc949810, 1 | BRF_PRG | BRF_ESS }, // 10
3255 
3256 	{ "speech.ic7",			0x1000, 0xe1019568, 2 | BRF_PRG | BRF_ESS }, // 11 M6800 Code
3257 	{ "speech.ic5",			0x1000, 0xcf3b5ffd, 2 | BRF_PRG | BRF_ESS }, // 12
3258 	{ "speech.ic6",			0x1000, 0xff8d2645, 2 | BRF_PRG | BRF_ESS }, // 13
3259 	{ "speech.ic4",			0x1000, 0x4b56a626, 2 | BRF_PRG | BRF_ESS }, // 14
3260 	{ "sinistar.snd",		0x1000, 0xb82f4ddb, 2 | BRF_PRG | BRF_ESS }, // 15
3261 
3262 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 16 Address Decoder
3263 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 17
3264 };
3265 
3266 STD_ROM_PICK(sinistar1)
3267 STD_ROM_FN(sinistar1)
3268 
3269 struct BurnDriver BurnDrvSinistar1 = {
3270 	"sinistar1", "sinistar", NULL, NULL, "1982",
3271 	"Sinistar (prototype version)\0", NULL, "Williams", "6809 System",
3272 	NULL, NULL, NULL, NULL,
3273 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
3274 	NULL, sinistar1RomInfo, sinistar1RomName, NULL, NULL, NULL, NULL, SinistarInputInfo, NULL,
3275 	SinistarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
3276 	240, 292, 3, 4
3277 };
3278 
3279 
3280 // Sinistar (revision 2)
3281 
3282 static struct BurnRomInfo sinistar2RomDesc[] = {
3283 	{ "sinistar.10",		0x1000, 0x3d670417, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
3284 	{ "sinrev2.11",			0x1000, 0x792c8b00, 1 | BRF_PRG | BRF_ESS }, //  1
3285 	{ "sinistar.01",		0x1000, 0xf6f3a22c, 1 | BRF_PRG | BRF_ESS }, //  2
3286 	{ "sinistar.02",		0x1000, 0xcab3185c, 1 | BRF_PRG | BRF_ESS }, //  3
3287 	{ "sinistar.03",		0x1000, 0x1ce1b3cc, 1 | BRF_PRG | BRF_ESS }, //  4
3288 	{ "sinistar.04",		0x1000, 0x6da632ba, 1 | BRF_PRG | BRF_ESS }, //  5
3289 	{ "sinistar.05",		0x1000, 0xb662e8fc, 1 | BRF_PRG | BRF_ESS }, //  6
3290 	{ "sinistar.06",		0x1000, 0x2306183d, 1 | BRF_PRG | BRF_ESS }, //  7
3291 	{ "sinistar.07",		0x1000, 0xe5dd918e, 1 | BRF_PRG | BRF_ESS }, //  8
3292 	{ "sinrev2.08",			0x1000, 0xd7ecee45, 1 | BRF_PRG | BRF_ESS }, //  9
3293 	{ "sinistar.09",		0x1000, 0x50cb63ad, 1 | BRF_PRG | BRF_ESS }, // 10
3294 
3295 	{ "speech.ic7",			0x1000, 0xe1019568, 2 | BRF_PRG | BRF_ESS }, // 11 M6800 Code
3296 	{ "speech.ic5",			0x1000, 0xcf3b5ffd, 2 | BRF_PRG | BRF_ESS }, // 12
3297 	{ "speech.ic6",			0x1000, 0xff8d2645, 2 | BRF_PRG | BRF_ESS }, // 13
3298 	{ "speech.ic4",			0x1000, 0x4b56a626, 2 | BRF_PRG | BRF_ESS }, // 14
3299 	{ "sinistar.snd",		0x1000, 0xb82f4ddb, 2 | BRF_PRG | BRF_ESS }, // 15
3300 
3301 	{ "decoder.4",			0x0200, 0xe6631c23, 0 | BRF_OPT },           // 16 Address Decoder
3302 	{ "decoder.6",			0x0200, 0x83faf25e, 0 | BRF_OPT },           // 17
3303 };
3304 
3305 STD_ROM_PICK(sinistar2)
3306 STD_ROM_FN(sinistar2)
3307 
3308 struct BurnDriver BurnDrvSinistar2 = {
3309 	"sinistar2", "sinistar", NULL, NULL, "1982",
3310 	"Sinistar (revision 2)\0", NULL, "Williams", "6809 System",
3311 	NULL, NULL, NULL, NULL,
3312 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
3313 	NULL, sinistar2RomInfo, sinistar2RomName, NULL, NULL, NULL, NULL, SinistarInputInfo, NULL,
3314 	SinistarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
3315 	240, 292, 3, 4
3316 };
3317 
3318 
3319 // Lotto Fun
3320 
3321 static struct BurnRomInfo lottofunRomDesc[] = {
3322 	{ "vl7a.dat",			0x1000, 0xfb2aec2c, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
3323 	{ "vl7c.dat",			0x1000, 0x9a496519, 1 | BRF_PRG | BRF_ESS }, //  1
3324 	{ "vl7e.dat",			0x1000, 0x032cab4b, 1 | BRF_PRG | BRF_ESS }, //  2
3325 	{ "vl4e.dat",			0x1000, 0x5e9af236, 1 | BRF_PRG | BRF_ESS }, //  3
3326 	{ "vl4c.dat",			0x1000, 0x4b134ae2, 1 | BRF_PRG | BRF_ESS }, //  4
3327 	{ "vl4a.dat",			0x1000, 0xb2f1f95a, 1 | BRF_PRG | BRF_ESS }, //  5
3328 	{ "vl5e.dat",			0x1000, 0xc8681c55, 1 | BRF_PRG | BRF_ESS }, //  6
3329 	{ "vl5c.dat",			0x1000, 0xeb9351e0, 1 | BRF_PRG | BRF_ESS }, //  7
3330 	{ "vl5a.dat",			0x1000, 0x534f2fa1, 1 | BRF_PRG | BRF_ESS }, //  8
3331 	{ "vl6e.dat",			0x1000, 0xbefac592, 1 | BRF_PRG | BRF_ESS }, //  9
3332 	{ "vl6c.dat",			0x1000, 0xa73d7f13, 1 | BRF_PRG | BRF_ESS }, // 10
3333 	{ "vl6a.dat",			0x1000, 0x5730a43d, 1 | BRF_PRG | BRF_ESS }, // 11
3334 
3335 	{ "vl2532.snd",			0x1000, 0x214b8a04, 2 | BRF_PRG | BRF_ESS }, // 12 M6800 Code
3336 };
3337 
3338 STD_ROM_PICK(lottofun)
STD_ROM_FN(lottofun)3339 STD_ROM_FN(lottofun)
3340 
3341 static INT32 LottofunInit()
3342 {
3343 	return DrvInit(1, 0, 6, 1, 0xc000);
3344 }
3345 
3346 struct BurnDriver BurnDrvLottofun = {
3347 	"lottofun", NULL, NULL, NULL, "1987",
3348 	"Lotto Fun\0", NULL, "H.A.R. Management", "6809 System",
3349 	NULL, NULL, NULL, NULL,
3350 	BDF_GAME_NOT_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
3351 	NULL, lottofunRomInfo, lottofunRomName, NULL, NULL, NULL, NULL, LottofunInputInfo, NULL,
3352 	LottofunInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10,
3353 	292, 240, 4, 3
3354 };
3355 
3356 
3357 // Blaster
3358 
3359 static struct BurnRomInfo blasterRomDesc[] = {
3360 	{ "16.ic39",			0x1000, 0x54a40b21, 1 | BRF_PRG | BRF_ESS }, //  0 M6809 Code
3361 	{ "13.ic27",			0x2000, 0xf4dae4c8, 1 | BRF_PRG | BRF_ESS }, //  1
3362 	{ "11.ic25",			0x2000, 0x6371e62f, 1 | BRF_PRG | BRF_ESS }, //  2
3363 	{ "12.ic26",			0x2000, 0x9804faac, 1 | BRF_PRG | BRF_ESS }, //  3
3364 	{ "17.ic41",			0x1000, 0xbf96182f, 1 | BRF_PRG | BRF_ESS }, //  4
3365 	{ "15.ic38",			0x4000, 0x1ad146a4, 1 | BRF_PRG | BRF_ESS }, //  5
3366 	{ "8.ic20",				0x4000, 0xf110bbb0, 1 | BRF_PRG | BRF_ESS }, //  6
3367 	{ "9.ic22",				0x4000, 0x5c5b0f8a, 1 | BRF_PRG | BRF_ESS }, //  7
3368 	{ "10.ic24",			0x4000, 0xd47eb67f, 1 | BRF_PRG | BRF_ESS }, //  8
3369 	{ "6.ic13",				0x4000, 0x47fc007e, 1 | BRF_PRG | BRF_ESS }, //  9
3370 	{ "5.ic11",				0x4000, 0x15c1b94d, 1 | BRF_PRG | BRF_ESS }, // 10
3371 	{ "14.ic35",			0x4000, 0xaea6b846, 1 | BRF_PRG | BRF_ESS }, // 11
3372 	{ "7.ic15",				0x4000, 0x7a101181, 1 | BRF_PRG | BRF_ESS }, // 12
3373 	{ "1.ic1",				0x4000, 0x8d0ea9e7, 1 | BRF_PRG | BRF_ESS }, // 13
3374 	{ "2.ic3",				0x4000, 0x03c4012c, 1 | BRF_PRG | BRF_ESS }, // 14
3375 	{ "4.ic7",				0x4000, 0xfc9d39fb, 1 | BRF_PRG | BRF_ESS }, // 15
3376 	{ "3.ic6",				0x4000, 0x253690fb, 1 | BRF_PRG | BRF_ESS }, // 16
3377 
3378 	{ "18.sb13",			0x1000, 0xc33a3145, 2 | BRF_PRG | BRF_ESS }, // 17 M6800 #0 Code
3379 
3380 	{ "18.sb10",			0x1000, 0xc33a3145, 3 | BRF_PRG | BRF_ESS }, // 18 M6800 #1 Code
3381 
3382 	{ "4.u42",				0x0200, 0xe6631c23, 0 | BRF_OPT },           // 19 proms
3383 	{ "6.u23",				0x0200, 0x83faf25e, 0 | BRF_OPT },           // 20
3384 	{ "blaster.col",		0x0800, 0xbac50bc4, 4 | BRF_GRA },           // 21
3385 };
3386 
3387 STD_ROM_PICK(blaster)
STD_ROM_FN(blaster)3388 STD_ROM_FN(blaster)
3389 
3390 static INT32 BlasterInit()
3391 {
3392 	blaster = 1;
3393 
3394 	INT32 nRet = DrvInit(2, 0, 6, 2, 0x9700);
3395 
3396 	if (nRet == 0)
3397 	{
3398 		pStartDraw = DrvDrawBegin;
3399 		pDrawScanline = BlasterDrawLine;
3400 	}
3401 
3402 	return nRet;
3403 }
3404 
3405 struct BurnDriver BurnDrvBlaster = {
3406 	"blaster", NULL, NULL, NULL, "1983",
3407 	"Blaster\0", NULL, "Williams / Vid Kidz", "Miscellaneous",
3408 	NULL, NULL, NULL, NULL,
3409 	BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
3410 	NULL, blasterRomInfo, blasterRomName, NULL, NULL, NULL, NULL, BlasterInputInfo, NULL,
3411 	BlasterInit, DrvExit, DrvFrame, BlasterDraw, DrvScan, &DrvRecalc, 0x110,
3412 	292, 240, 4, 3
3413 };
3414 
3415 
3416 
3417 
3418 
3419 #if 0
3420 
3421 GAME( 1983, playball,   0,        playball,       playball, williams_state, init_playball, ROT270, "Williams", "PlayBall! (prototype)", MACHINE_SUPPORTS_SAVE )
3422 
3423 GAME( 1983, blaster,    0,        blaster,        blaster,  blaster_state,  init_blaster,  ROT0,   "Williams / Vid Kidz", "Blaster", MACHINE_SUPPORTS_SAVE )
3424 GAME( 1983, blastero,   blaster,  blaster,        blaster,  blaster_state,  init_blaster,  ROT0,   "Williams / Vid Kidz", "Blaster (location test)", MACHINE_SUPPORTS_SAVE )
3425 GAME( 1983, blasterkit, blaster,  blastkit,       blastkit, blaster_state,  init_blaster,  ROT0,   "Williams / Vid Kidz", "Blaster (conversion kit)", MACHINE_SUPPORTS_SAVE ) // mono sound
3426 
3427 GAME( 1983, mysticm,    0,        mysticm,        mysticm, williams2_state, init_mysticm,  ROT0,   "Williams", "Mystic Marathon", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE)
3428 GAME( 1983, mysticmp,   mysticm,  mysticm,        mysticm, williams2_state, init_mysticm,  ROT0,   "Williams", "Mystic Marathon (prototype)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // newest roms are 'proto 6' ?
3429 
3430 GAME( 1984, tshoot,     0,        tshoot,         tshoot,  tshoot_state,    init_tshoot,   ROT0,   "Williams", "Turkey Shoot (prototype)", MACHINE_SUPPORTS_SAVE )
3431 
3432 GAME( 1984, inferno,    0,        inferno,        inferno, williams2_state, init_inferno,  ROT0,   "Williams", "Inferno (Williams)", MACHINE_SUPPORTS_SAVE )
3433 
3434 GAME( 1986, joust2,     0,        joust2,         joust2,  joust2_state,    init_joust2,   ROT270, "Williams", "Joust 2 - Survival of the Fittest (revision 2)", MACHINE_SUPPORTS_SAVE )
3435 GAME( 1986, joust2r1,   joust2,   joust2,         joust2,  joust2_state,    init_joust2,   ROT270, "Williams", "Joust 2 - Survival of the Fittest (revision 1)", MACHINE_SUPPORTS_SAVE )
3436 
3437 #endif
3438