1 // FB Alpha Taito SJ system driver module
2 // Based on MAME driver by Nicola Salmoria
3 
4 #include "tiles_generic.h"
5 #include "z80_intf.h"
6 #include "m6805_intf.h"
7 #include "watchdog.h"
8 #include "ay8910.h"
9 #include "dac.h"
10 #include "math.h" // abs()
11 
12 static UINT8 *AllMem;
13 static UINT8 *RamEnd;
14 static UINT8 *AllRam;
15 static UINT8 *MemEnd;
16 static UINT8 *DrvZ80ROM0;
17 static UINT8 *DrvZ80ROM1;
18 static UINT8 *DrvMCUROM;
19 static UINT8 *DrvGfxExp;
20 static UINT8 *DrvSprExp;
21 static UINT8 *DrvGfxROM;
22 static UINT8 *DrvZ80RAMA;
23 static UINT8 *DrvZ80RAMB;
24 static UINT8 *DrvZ80RAMC;
25 static UINT8 *DrvVidRAM1;
26 static UINT8 *DrvVidRAM2;
27 static UINT8 *DrvVidRAM3;
28 static UINT8 *DrvColScroll;
29 static UINT8 *DrvSprRAM;
30 static UINT8 *DrvCharRAM;
31 static UINT8 *DrvPalRAM;
32 static UINT8 *DrvZ80RAM1;
33 static UINT8 *DrvMCURAM;
34 
35 static UINT32 *DrvPalette;
36 static UINT8 DrvRecalc;
37 
38 static UINT16 *bitmap[9];
39 
40 static UINT8 video_priority;
41 static UINT8 scroll[8];
42 static UINT8 color_bank[2];
43 static UINT8 gfxpointer[2];
44 static UINT8 soundlatch;
45 static UINT8 video_mode;
46 static UINT8 collision_reg[4];
47 static UINT8 rom_bank;
48 static UINT8 sound_nmi_disable;
49 static UINT8 input_port_data;
50 static UINT8 protection_value;
51 static UINT8 dac_volume;
52 static INT8 dac_out_data;
53 
54 static INT32 sound_irq_timer;
55 
56 static UINT8 toz80;
57 static UINT8 fromz80;
58 static UINT16 mcu_address;
59 static UINT8 portA_in;
60 static UINT8 portA_out;
61 static UINT8 zready;
62 static UINT8 zaccept;
63 static UINT8 busreq;
64 
65 static INT32 spriteram_bank;
66 static INT32 global_flipx;
67 static INT32 global_flipy;
68 static INT32 draw_order[32][4];
69 static INT32 coin_state = 0;
70 static UINT8 charram_xor = 0; // junglhbr
71 static INT32 input2_xor = 0;
72 static INT32 has_mcu = 0;
73 static INT32 is_alpine = 0;
74 static INT32 is_kikstart = 0;
75 
76 static UINT8 DrvJoy1[8];
77 static UINT8 DrvJoy2[8];
78 static UINT8 DrvJoy3[8];
79 static UINT8 DrvJoy4[8];
80 static UINT8 DrvJoy5[8];
81 static UINT8 DrvJoyF0[8];
82 static UINT8 DrvJoyF1[8];
83 static UINT8 DrvDips[4];
84 static UINT8 DrvReset;
85 static UINT8 DrvInputs[7];
86 static UINT8 kikstart_gears[2];
87 
88 static struct BurnInputInfo TwoButtonInputList[] = {
89 	{"P1 Coin",				BIT_DIGITAL,	DrvJoy3 + 5,	"p1 coin"	},
90 	{"P1 Start",			BIT_DIGITAL,	DrvJoy3 + 6,	"p1 start"	},
91 	{"P1 Up",				BIT_DIGITAL,	DrvJoy1 + 3,	"p1 up"		},
92 	{"P1 Down",				BIT_DIGITAL,	DrvJoy1 + 2,	"p1 down"	},
93 	{"P1 Left",				BIT_DIGITAL,	DrvJoy1 + 0,	"p1 left"	},
94 	{"P1 Right",			BIT_DIGITAL,	DrvJoy1 + 1,	"p1 right"	},
95 	{"P1 Button 1",			BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
96 	{"P1 Button 2",			BIT_DIGITAL,	DrvJoy1 + 5,	"p1 fire 2"	},
97 
98 	{"P2 Coin",				BIT_DIGITAL,	DrvJoy3 + 4,	"p2 coin"	},
99 	{"P2 Start",			BIT_DIGITAL,	DrvJoy3 + 7,	"p2 start"	},
100 	{"P2 Up",				BIT_DIGITAL,	DrvJoy2 + 3,	"p2 up"		},
101 	{"P2 Down",				BIT_DIGITAL,	DrvJoy2 + 2,	"p2 down"	},
102 	{"P2 Left",				BIT_DIGITAL,	DrvJoy2 + 0,	"p2 left"	},
103 	{"P2 Right",			BIT_DIGITAL,	DrvJoy2 + 1,	"p2 right"	},
104 	{"P2 Button 1",			BIT_DIGITAL,	DrvJoy2 + 4,	"p2 fire 1"	},
105 	{"P2 Button 2",			BIT_DIGITAL,	DrvJoy2 + 5,	"p2 fire 2"	},
106 
107 	{"Reset",				BIT_DIGITAL,	&DrvReset,		"reset"		},
108 	{"Tilt",				BIT_DIGITAL,	DrvJoy4 + 5,	"tilt"		},
109 	{"Dip A",				BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
110 	{"Dip B",				BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
111 	{"Dip C",				BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
112 };
113 
114 STDINPUTINFO(TwoButton)
115 
116 static struct BurnInputInfo TwoButtonLRInputList[] = {
117 	{"P1 Coin",				BIT_DIGITAL,	DrvJoy3 + 5,	"p1 coin"	},
118 	{"P1 Start",			BIT_DIGITAL,	DrvJoy3 + 6,	"p1 start"	},
119 	{"P1 Left",				BIT_DIGITAL,	DrvJoy1 + 0,	"p1 left"	},
120 	{"P1 Right",			BIT_DIGITAL,	DrvJoy1 + 1,	"p1 right"	},
121 	{"P1 Button 1",			BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
122 	{"P1 Button 2",			BIT_DIGITAL,	DrvJoy1 + 5,	"p1 fire 2"	},
123 
124 	{"P2 Coin",				BIT_DIGITAL,	DrvJoy3 + 4,	"p2 coin"	},
125 	{"P2 Start",			BIT_DIGITAL,	DrvJoy3 + 7,	"p2 start"	},
126 	{"P2 Left",				BIT_DIGITAL,	DrvJoy2 + 0,	"p2 left"	},
127 	{"P2 Right",			BIT_DIGITAL,	DrvJoy2 + 1,	"p2 right"	},
128 	{"P2 Button 1",			BIT_DIGITAL,	DrvJoy2 + 4,	"p2 fire 1"	},
129 	{"P2 Button 2",			BIT_DIGITAL,	DrvJoy2 + 5,	"p2 fire 2"	},
130 
131 	{"Reset",				BIT_DIGITAL,	&DrvReset,		"reset"		},
132 	{"Tilt",				BIT_DIGITAL,	DrvJoy4 + 5,	"tilt"		},
133 	{"Dip A",				BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
134 	{"Dip B",				BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
135 	{"Dip C",				BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
136 };
137 
138 STDINPUTINFO(TwoButtonLR)
139 
140 static struct BurnInputInfo OneButtonInputList[] = {
141 	{"P1 Coin",				BIT_DIGITAL,	DrvJoy3 + 5,	"p1 coin"	},
142 	{"P1 Start",			BIT_DIGITAL,	DrvJoy3 + 6,	"p1 start"	},
143 	{"P1 Up",				BIT_DIGITAL,	DrvJoy1 + 3,	"p1 up"		},
144 	{"P1 Down",				BIT_DIGITAL,	DrvJoy1 + 2,	"p1 down"	},
145 	{"P1 Left",				BIT_DIGITAL,	DrvJoy1 + 0,	"p1 left"	},
146 	{"P1 Right",			BIT_DIGITAL,	DrvJoy1 + 1,	"p1 right"	},
147 	{"P1 Button 1",			BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
148 
149 	{"P2 Coin",				BIT_DIGITAL,	DrvJoy3 + 4,	"p2 coin"	},
150 	{"P2 Start",			BIT_DIGITAL,	DrvJoy3 + 7,	"p2 start"	},
151 	{"P2 Up",				BIT_DIGITAL,	DrvJoy2 + 3,	"p2 up"		},
152 	{"P2 Down",				BIT_DIGITAL,	DrvJoy2 + 2,	"p2 down"	},
153 	{"P2 Left",				BIT_DIGITAL,	DrvJoy2 + 0,	"p2 left"	},
154 	{"P2 Right",			BIT_DIGITAL,	DrvJoy2 + 1,	"p2 right"	},
155 	{"P2 Button 1",			BIT_DIGITAL,	DrvJoy2 + 4,	"p2 fire 1"	},
156 
157 	{"Reset",				BIT_DIGITAL,	&DrvReset,		"reset"		},
158 	{"Tilt",				BIT_DIGITAL,	DrvJoy4 + 5,	"tilt"		},
159 	{"Dip A",				BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
160 	{"Dip B",				BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
161 	{"Dip C",				BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
162 };
163 
164 STDINPUTINFO(OneButton)
165 
166 static struct BurnInputInfo AlpineInputList[] = {
167 	{"P1 Coin",				BIT_DIGITAL,	DrvJoy3 + 5,	"p1 coin"	},
168 	{"P1 Start",			BIT_DIGITAL,	DrvJoy3 + 6,	"p1 start"	},
169 	{"P1 Left",				BIT_DIGITAL,	DrvJoy2 + 0,	"p1 left"	},
170 	{"P1 Right",			BIT_DIGITAL,	DrvJoy2 + 1,	"p1 right"	},
171 	{"P1 Button 1",			BIT_DIGITAL,	DrvJoy2 + 4,	"p1 fire 1"	},
172 
173 	{"P2 Coin",				BIT_DIGITAL,	DrvJoy3 + 0,	"p2 coin"	},
174 	{"P2 Start",			BIT_DIGITAL,	DrvJoy3 + 7,	"p2 start"	},
175 	{"P2 Left",				BIT_DIGITAL,	DrvJoy1 + 0,	"p2 left"	},
176 	{"P2 Right",			BIT_DIGITAL,	DrvJoy1 + 1,	"p2 right"	},
177 	{"P2 Button 1",			BIT_DIGITAL,	DrvJoy1 + 4,	"p2 fire 1"	},
178 
179 	{"Reset",				BIT_DIGITAL,	&DrvReset,		"reset"		},
180 	{"Tilt",				BIT_DIGITAL,	DrvJoy4 + 5,	"tilt"		},
181 	{"Dip A",				BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
182 	{"Dip B",				BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
183 	{"Dip C",				BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
184 };
185 
186 STDINPUTINFO(Alpine)
187 
188 static struct BurnInputInfo TimetunlInputList[] = {
189 	{"P1 Coin",				BIT_DIGITAL,	DrvJoy3 + 5,	"p1 coin"	},
190 	{"P1 Start",			BIT_DIGITAL,	DrvJoy3 + 6,	"p1 start"	},
191 	{"P1 Up",				BIT_DIGITAL,	DrvJoy1 + 3,	"p1 up"		},
192 	{"P1 Down",				BIT_DIGITAL,	DrvJoy1 + 2,	"p1 down"	},
193 	{"P1 Button 1",			BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
194 
195 	{"P2 Coin",				BIT_DIGITAL,	DrvJoy3 + 4,	"p2 coin"	},
196 	{"P2 Start",			BIT_DIGITAL,	DrvJoy3 + 7,	"p2 start"	},
197 	{"P2 Up",				BIT_DIGITAL,	DrvJoy2 + 3,	"p2 up"		},
198 	{"P2 Down",				BIT_DIGITAL,	DrvJoy2 + 2,	"p2 down"	},
199 	{"P2 Button 1",			BIT_DIGITAL,	DrvJoy2 + 4,	"p2 fire 1"	},
200 
201 	{"Reset",				BIT_DIGITAL,	&DrvReset,		"reset"		},
202 	{"Tilt",				BIT_DIGITAL,	DrvJoy4 + 5,	"tilt"		},
203 	{"Dip A",				BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
204 	{"Dip B",				BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
205 	{"Dip C",				BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
206 };
207 
208 STDINPUTINFO(Timetunl)
209 
210 static struct BurnInputInfo DualStickInputList[] = {
211 	{"Coin 1",				BIT_DIGITAL,	DrvJoy3 + 5,	"p1 coin"	},
212 	{"Coin 2",				BIT_DIGITAL,	DrvJoy3 + 0,	"p2 coin"	},
213 	{"Coin 3",				BIT_DIGITAL,	DrvJoy4 + 4,	"p3 coin"	},
214 	{"P1 Start",			BIT_DIGITAL,	DrvJoy3 + 6,	"p1 start"	},
215 	{"P1 Leftstick Up",		BIT_DIGITAL,	DrvJoy4 + 3,	"p1 up"		},
216 	{"P1 Leftstick Down",	BIT_DIGITAL,	DrvJoy4 + 2,	"p1 down"	},
217 	{"P1 Leftstick Left",	BIT_DIGITAL,	DrvJoy4 + 0,	"p1 left"	},
218 	{"P1 Leftstick Right",	BIT_DIGITAL,	DrvJoy4 + 1,	"p1 right"	},
219 	{"P1 Rightstick Up",	BIT_DIGITAL,	DrvJoy1 + 3,	"p3 up"		},
220 	{"P1 Rightstick Down",	BIT_DIGITAL,	DrvJoy1 + 2,	"p3 down"	},
221 	{"P1 Rightstick Left",	BIT_DIGITAL,	DrvJoy1 + 0,	"p3 left"	},
222 	{"P1 Rightstick Right",	BIT_DIGITAL,	DrvJoy1 + 1,	"p3 right"	},
223 	{"P1 Button 1",			BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
224 	{"P1 Button 2",			BIT_DIGITAL,	DrvJoy1 + 5,	"p1 fire 2"	},
225 
226 	{"P2 Start",			BIT_DIGITAL,	DrvJoy3 + 7,	"p2 start"	},
227 	{"P2 Leftstick Up",		BIT_DIGITAL,	DrvJoy5 + 3,	"p2 up"		},
228 	{"P2 Leftstick Down",	BIT_DIGITAL,	DrvJoy5 + 2,	"p2 down"	},
229 	{"P2 Leftstick Left",	BIT_DIGITAL,	DrvJoy5 + 0,	"p2 left"	},
230 	{"P2 Leftstick Right",	BIT_DIGITAL,	DrvJoy5 + 1,	"p2 right"	},
231 	{"P2 Rightstick Up",	BIT_DIGITAL,	DrvJoy2 + 3,	"p4 up"		},
232 	{"P2 Rightstick Down",	BIT_DIGITAL,	DrvJoy2 + 2,	"p4 down"	},
233 	{"P2 Rightstick Left",	BIT_DIGITAL,	DrvJoy2 + 0,	"p4 left"	},
234 	{"P2 Rightstick Right",	BIT_DIGITAL,	DrvJoy2 + 1,	"p4 right"	},
235 	{"P2 Button 1",			BIT_DIGITAL,	DrvJoy2 + 4,	"p2 fire 1"	},
236 	{"P2 Button 2",			BIT_DIGITAL,	DrvJoy2 + 5,	"p2 fire 2"	},
237 
238 	{"Reset",				BIT_DIGITAL,	&DrvReset,		"reset"		},
239 	{"Tilt",				BIT_DIGITAL,	DrvJoy4 + 5,	"tilt"		},
240 	{"Dip A",				BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
241 	{"Dip B",				BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
242 	{"Dip C",				BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
243 };
244 
245 STDINPUTINFO(DualStick)
246 
247 static struct BurnInputInfo KikstartInputList[] = {
248 	{"P1 Coin",		        BIT_DIGITAL,	DrvJoy3 + 5,	"p1 coin"	},
249 	{"P1 Start",		    BIT_DIGITAL,	DrvJoy3 + 6,	"p1 start"	},
250 	{"P1 Left",		        BIT_DIGITAL,	DrvJoy1 + 0,	"p1 left"	},
251 	{"P1 Right",		    BIT_DIGITAL,	DrvJoy1 + 1,	"p1 right"	},
252 	{"P1 Button 1",		    BIT_DIGITAL,	DrvJoy1 + 4,	"p1 fire 1"	},
253 	{"P1 Button 2 (Gear Down)",BIT_DIGITAL,	DrvJoyF0 + 0,	"p1 fire 2"	},
254 	{"P1 Button 3 (Gear Up)",BIT_DIGITAL,	DrvJoyF0 + 1,	"p1 fire 3"	},
255 
256 	{"P2 Coin",		        BIT_DIGITAL,	DrvJoy3 + 4,	"p2 coin"	},
257 	{"P2 Start",		    BIT_DIGITAL,	DrvJoy3 + 7,	"p2 start"	},
258 	{"P2 Left",		        BIT_DIGITAL,	DrvJoy2 + 0,	"p2 left"	},
259 	{"P2 Right",		    BIT_DIGITAL,	DrvJoy2 + 1,	"p2 right"	},
260 	{"P2 Button 1",		    BIT_DIGITAL,	DrvJoy2 + 4,	"p2 fire 1"	},
261 	{"P2 Button 2 (Gear Down)",BIT_DIGITAL,	DrvJoyF1 + 0,	"p2 fire 2"	},
262 	{"P2 Button 3 (Gear Up)",BIT_DIGITAL,	DrvJoyF1 + 1,	"p2 fire 3"	},
263 
264 	{"Reset",		        BIT_DIGITAL,	&DrvReset,	    "reset"		},
265 	{"Service",		        BIT_DIGITAL,	DrvJoy4 + 4,	"service"	},
266 	{"Tilt",		        BIT_DIGITAL,	DrvJoy4 + 5,	"tilt"		},
267 	{"Dip A",		        BIT_DIPSWITCH,	DrvDips + 0,	"dip"		},
268 	{"Dip B",		        BIT_DIPSWITCH,	DrvDips + 1,	"dip"		},
269 	{"Dip C",				BIT_DIPSWITCH,	DrvDips + 2,	"dip"		},
270 };
271 
272 STDINPUTINFO(Kikstart)
273 
274 #define COMMON_COIN_DIPS(offs)							\
275 	{0   , 0xfe, 0   ,   16, "Coin A"				},	\
276 	{offs, 0x01, 0x0f, 0x0f, "9 Coins 1 Credits"	},	\
277 	{offs, 0x01, 0x0f, 0x0e, "8 Coins 1 Credits"	},	\
278 	{offs, 0x01, 0x0f, 0x0d, "7 Coins 1 Credits"	},	\
279 	{offs, 0x01, 0x0f, 0x0c, "6 Coins 1 Credits"	},	\
280 	{offs, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits"	},	\
281 	{offs, 0x01, 0x0f, 0x0a, "4 Coins 1 Credits"	},	\
282 	{offs, 0x01, 0x0f, 0x09, "3 Coins 1 Credits"	},	\
283 	{offs, 0x01, 0x0f, 0x08, "2 Coins 1 Credits"	},	\
284 	{offs, 0x01, 0x0f, 0x00, "1 Coin  1 Credits"	},	\
285 	{offs, 0x01, 0x0f, 0x01, "1 Coin  2 Credits"	},	\
286 	{offs, 0x01, 0x0f, 0x02, "1 Coin  3 Credits"	},	\
287 	{offs, 0x01, 0x0f, 0x03, "1 Coin  4 Credits"	},	\
288 	{offs, 0x01, 0x0f, 0x04, "1 Coin  5 Credits"	},	\
289 	{offs, 0x01, 0x0f, 0x05, "1 Coin  6 Credits"	},	\
290 	{offs, 0x01, 0x0f, 0x06, "1 Coin  7 Credits"	},	\
291 	{offs, 0x01, 0x0f, 0x07, "1 Coin  8 Credits"	},	\
292 	{0   , 0xfe, 0   ,   16, "Coin B"				},	\
293 	{offs, 0x01, 0xf0, 0xf0, "9 Coins 1 Credits"	},	\
294 	{offs, 0x01, 0xf0, 0xe0, "8 Coins 1 Credits"	},	\
295 	{offs, 0x01, 0xf0, 0xd0, "7 Coins 1 Credits"	},	\
296 	{offs, 0x01, 0xf0, 0xc0, "6 Coins 1 Credits"	},	\
297 	{offs, 0x01, 0xf0, 0xb0, "5 Coins 1 Credits"	},	\
298 	{offs, 0x01, 0xf0, 0xa0, "4 Coins 1 Credits"	},	\
299 	{offs, 0x01, 0xf0, 0x90, "3 Coins 1 Credits"	},	\
300 	{offs, 0x01, 0xf0, 0x80, "2 Coins 1 Credits"	},	\
301 	{offs, 0x01, 0xf0, 0x00, "1 Coin  1 Credits"	},	\
302 	{offs, 0x01, 0xf0, 0x10, "1 Coin  2 Credits"	},	\
303 	{offs, 0x01, 0xf0, 0x20, "1 Coin  3 Credits"	},	\
304 	{offs, 0x01, 0xf0, 0x30, "1 Coin  4 Credits"	},	\
305 	{offs, 0x01, 0xf0, 0x40, "1 Coin  5 Credits"	},	\
306 	{offs, 0x01, 0xf0, 0x50, "1 Coin  6 Credits"	},	\
307 	{offs, 0x01, 0xf0, 0x60, "1 Coin  7 Credits"	},	\
308 	{offs, 0x01, 0xf0, 0x70, "1 Coin  8 Credits"	},
309 
310 static struct BurnDIPInfo SpaceskrDIPList[]=
311 {
312 	{0x12, 0xff, 0xff, 0xe7, NULL					},
313 	{0x13, 0xff, 0xff, 0x00, NULL					},
314 	{0x14, 0xff, 0xff, 0xff, NULL					},
315 
316 	{0   , 0xfe, 0   ,    4, "Lives"				},
317 	{0x12, 0x01, 0x18, 0x00, "3"					},
318 	{0x12, 0x01, 0x18, 0x08, "4"					},
319 	{0x12, 0x01, 0x18, 0x10, "5"					},
320 	{0x12, 0x01, 0x18, 0x18, "6"					},
321 
322 	{0   , 0xfe, 0   ,    2, "Service Mode"			},
323 	{0x12, 0x01, 0x20, 0x20, "Off"					},
324 	{0x12, 0x01, 0x20, 0x00, "On"					},
325 
326 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
327 	{0x12, 0x01, 0x80, 0x80, "Upright"				},
328 	{0x12, 0x01, 0x80, 0x00, "Cocktail"				},
329 
330 	COMMON_COIN_DIPS(0x13)
331 
332 	{0   , 0xfe, 0   ,    2, "Year Display"			},
333 	{0x14, 0x01, 0x20, 0x00, "No"					},
334 	{0x14, 0x01, 0x20, 0x20, "Yes"					},
335 
336 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
337 	{0x14, 0x01, 0x40, 0x40, "Off"					},
338 	{0x14, 0x01, 0x40, 0x00, "On"					},
339 
340 	{0   , 0xfe, 0   ,    2, "Coinage"				},
341 	{0x14, 0x01, 0x80, 0x80, "A and B"				},
342 	{0x14, 0x01, 0x80, 0x00, "A only"				},
343 };
344 
345 STDDIPINFO(Spaceskr)
346 
347 static struct BurnDIPInfo SpacecrDIPList[]=
348 {
349 	{0x0e, 0xff, 0xff, 0x3f, NULL					},
350 	{0x0f, 0xff, 0xff, 0x00, NULL					},
351 	{0x10, 0xff, 0xff, 0xff, NULL					},
352 
353 	{0   , 0xfe, 0   ,    4, "Lives"				},
354 	{0x0e, 0x01, 0x18, 0x00, "6"					},
355 	{0x0e, 0x01, 0x18, 0x08, "5"					},
356 	{0x0e, 0x01, 0x18, 0x10, "4"					},
357 	{0x0e, 0x01, 0x18, 0x18, "3"					},
358 
359 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
360 	{0x0e, 0x01, 0x40, 0x00, "Upright"				},
361 	{0x0e, 0x01, 0x40, 0x40, "Cocktail"				},
362 
363 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
364 	{0x0e, 0x01, 0x80, 0x00, "Off"					},
365 	{0x0e, 0x01, 0x80, 0x80, "On"					},
366 
367 	COMMON_COIN_DIPS(0x0f)
368 
369 	{0   , 0xfe, 0   ,    2, "Year Display"			},
370 	{0x10, 0x01, 0x20, 0x00, "No"					},
371 	{0x10, 0x01, 0x20, 0x20, "Yes"					},
372 
373 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
374 	{0x10, 0x01, 0x40, 0x40, "Off"					},
375 	{0x10, 0x01, 0x40, 0x00, "On"					},
376 
377 	{0   , 0xfe, 0   ,    2, "Coinage"				},
378 	{0x10, 0x01, 0x80, 0x80, "A and B"				},
379 	{0x10, 0x01, 0x80, 0x00, "A only"				},
380 };
381 
382 STDDIPINFO(Spacecr)
383 
384 static struct BurnDIPInfo KikstartDIPList[]=
385 {
386 	{0x11, 0xff, 0xff, 0x75, NULL				    },
387 	{0x12, 0xff, 0xff, 0x00, NULL					},
388 	{0x13, 0xff, 0xff, 0x78, NULL				    },
389 
390 	{0   , 0xfe, 0   ,    4, "Gate Bonus"			},
391 	{0x11, 0x01, 0x03, 0x00, "5k Points"			},
392 	{0x11, 0x01, 0x03, 0x01, "10k Points"			},
393 	{0x11, 0x01, 0x03, 0x02, "15k Points"			},
394 	{0x11, 0x01, 0x03, 0x03, "20k Points"			},
395 
396 	{0   , 0xfe, 0   ,    2, "Free Play"			},
397 	{0x11, 0x01, 0x04, 0x04, "Off"				    },
398 	{0x11, 0x01, 0x04, 0x00, "On"				    },
399 
400 	{0   , 0xfe, 0   ,    4, "Difficulty"			},
401 	{0x11, 0x01, 0x18, 0x18, "Easy"				    },
402 	{0x11, 0x01, 0x18, 0x10, "Normal"			    },
403 	{0x11, 0x01, 0x18, 0x08, "Difficult"			},
404 	{0x11, 0x01, 0x18, 0x00, "Very Difficult"		},
405 
406 	{0   , 0xfe, 0   ,    2, "Service Mode"			},
407 	{0x11, 0x01, 0x20, 0x20, "Off"					},
408 	{0x11, 0x01, 0x20, 0x00, "On"					},
409 
410 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
411 	{0x11, 0x01, 0x40, 0x40, "Off"				    },
412 	{0x11, 0x01, 0x40, 0x00, "On"				    },
413 
414 	{0   , 0xfe, 0   ,    2, "Cabinet"			    },
415 	{0x11, 0x01, 0x80, 0x00, "Upright"			    },
416 	{0x11, 0x01, 0x80, 0x80, "Cocktail"			    },
417 
418 	COMMON_COIN_DIPS(0x12)
419 
420 	{0   , 0xfe, 0   ,    2, "Control Type"			},
421 	{0x13, 0x01, 0x08, 0x08, "Revolve"			    },
422 	{0x13, 0x01, 0x08, 0x00, "Buttons"			    },
423 
424 	{0   , 0xfe, 0   ,    2, "Coinage Display"		},
425 	{0x13, 0x01, 0x10, 0x00, "Off"				    },
426 	{0x13, 0x01, 0x10, 0x10, "On"				    },
427 
428 	{0   , 0xfe, 0   ,    2, "Year Display"			},
429 	{0x13, 0x01, 0x20, 0x00, "No"				    },
430 	{0x13, 0x01, 0x20, 0x20, "Yes"				    },
431 
432 	{0   , 0xfe, 0   ,    2, "No Hit (Cheat)"		},
433 	{0x13, 0x01, 0x40, 0x40, "No"				    },
434 	{0x13, 0x01, 0x40, 0x00, "Yes"				    },
435 
436 	{0   , 0xfe, 0   ,    2, "Coinage"			    },
437 	{0x13, 0x01, 0x80, 0x80, "A and B"			    },
438 	{0x13, 0x01, 0x80, 0x00, "A only"			    },
439 };
440 
441 STDDIPINFO(Kikstart)
442 
443 static struct BurnDIPInfo JunglekDIPList[]=
444 {
445 	{0x10, 0xff, 0xff, 0xff, NULL					},
446 	{0x11, 0xff, 0xff, 0x00, NULL					},
447 	{0x12, 0xff, 0xff, 0xff, NULL					},
448 
449 	{0   , 0xfe, 0   ,    4, "Finish Bonus"			},
450 	{0x10, 0x01, 0x03, 0x03, "None"					},
451 	{0x10, 0x01, 0x03, 0x02, "Timer x1"				},
452 	{0x10, 0x01, 0x03, 0x01, "Timer x2"				},
453 	{0x10, 0x01, 0x03, 0x00, "Timer x3"				},
454 
455 	{0   , 0xfe, 0   ,    4, "Lives"				},
456 	{0x10, 0x01, 0x18, 0x18, "3"					},
457 	{0x10, 0x01, 0x18, 0x10, "4"					},
458 	{0x10, 0x01, 0x18, 0x08, "5"					},
459 	{0x10, 0x01, 0x18, 0x00, "6"					},
460 
461 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
462 	{0x10, 0x01, 0x40, 0x00, "Off"					},
463 	{0x10, 0x01, 0x40, 0x40, "On"					},
464 
465 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
466 	{0x10, 0x01, 0x80, 0x00, "Upright"				},
467 	{0x10, 0x01, 0x80, 0x80, "Cocktail"				},
468 
469 	COMMON_COIN_DIPS(0x11)
470 
471 	{0   , 0xfe, 0   ,    4, "Bonus Life"			},
472 	{0x12, 0x01, 0x03, 0x02, "10000"				},
473 	{0x12, 0x01, 0x03, 0x01, "20000"				},
474 	{0x12, 0x01, 0x03, 0x00, "30000"				},
475 	{0x12, 0x01, 0x03, 0x03, "None"					},
476 
477 	{0   , 0xfe, 0   ,    2, "Year Display"			},
478 	{0x12, 0x01, 0x20, 0x00, "No"					},
479 	{0x12, 0x01, 0x20, 0x20, "Yes"					},
480 
481 	{0   , 0xfe, 0   ,    2, "Infinite Lives"		},
482 	{0x12, 0x01, 0x40, 0x40, "No"					},
483 	{0x12, 0x01, 0x40, 0x00, "Yes"					},
484 
485 	{0   , 0xfe, 0   ,    2, "Coinage"				},
486 	{0x12, 0x01, 0x80, 0x80, "A and B"				},
487 	{0x12, 0x01, 0x80, 0x00, "A only"				},
488 };
489 
490 STDDIPINFO(Junglek)
491 
492 static struct BurnDIPInfo PiratpetDIPList[]=
493 {
494 	{0x10, 0xff, 0xff, 0xff, NULL					},
495 	{0x11, 0xff, 0xff, 0x00, NULL					},
496 	{0x12, 0xff, 0xff, 0xff, NULL					},
497 
498 	{0   , 0xfe, 0   ,    4, "Finish Bonus"			},
499 	{0x10, 0x01, 0x03, 0x03, "None"					},
500 	{0x10, 0x01, 0x03, 0x02, "Timer x1"				},
501 	{0x10, 0x01, 0x03, 0x01, "Timer x2"				},
502 	{0x10, 0x01, 0x03, 0x00, "Timer x3"				},
503 
504 	{0   , 0xfe, 0   ,    2, "Debug Mode"			},
505 	{0x10, 0x01, 0x04, 0x04, "Off"					},
506 	{0x10, 0x01, 0x04, 0x00, "On"					},
507 
508 	{0   , 0xfe, 0   ,    4, "Lives"				},
509 	{0x10, 0x01, 0x18, 0x18, "3"					},
510 	{0x10, 0x01, 0x18, 0x10, "4"					},
511 	{0x10, 0x01, 0x18, 0x08, "5"					},
512 	{0x10, 0x01, 0x18, 0x00, "6"					},
513 
514 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
515 	{0x10, 0x01, 0x40, 0x00, "Off"					},
516 	{0x10, 0x01, 0x40, 0x40, "On"					},
517 
518 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
519 	{0x10, 0x01, 0x80, 0x00, "Upright"				},
520 	{0x10, 0x01, 0x80, 0x80, "Cocktail"				},
521 
522 	COMMON_COIN_DIPS(0x11)
523 
524 	{0   , 0xfe, 0   ,    4, "Bonus Life"			},
525 	{0x12, 0x01, 0x03, 0x02, "10000"				},
526 	{0x12, 0x01, 0x03, 0x01, "20000"				},
527 	{0x12, 0x01, 0x03, 0x00, "50000"				},
528 	{0x12, 0x01, 0x03, 0x03, "None"					},
529 
530 	{0   , 0xfe, 0   ,    7, "Difficulty"			},
531 	{0x12, 0x01, 0x1c, 0x1c, "Easiest"				},
532 	{0x12, 0x01, 0x1c, 0x18, "Easier"				},
533 	{0x12, 0x01, 0x1c, 0x14, "Easy"					},
534 	{0x12, 0x01, 0x1c, 0x10, "Normal"				},
535 	{0x12, 0x01, 0x1c, 0x0c, "Medium"				},
536 	{0x12, 0x01, 0x1c, 0x08, "Hard"					},
537 	{0x12, 0x01, 0x1c, 0x04, "Harder"				},
538 
539 	{0   , 0xfe, 0   ,    2, "Year Display"			},
540 	{0x12, 0x01, 0x20, 0x00, "No"					},
541 	{0x12, 0x01, 0x20, 0x20, "Yes"					},
542 
543 	{0   , 0xfe, 0   ,    2, "Free Game (Cheat)"	},
544 	{0x12, 0x01, 0x40, 0x40, "No"					},
545 	{0x12, 0x01, 0x40, 0x00, "Yes"					},
546 
547 	{0   , 0xfe, 0   ,    2, "Coinage"				},
548 	{0x12, 0x01, 0x80, 0x80, "A and B"				},
549 	{0x12, 0x01, 0x80, 0x00, "A only"				},
550 };
551 
552 STDDIPINFO(Piratpet)
553 
554 static struct BurnDIPInfo AlpineDIPList[]=
555 {
556 	{0x0c, 0xff, 0xff, 0xdf, NULL					},
557 	{0x0d, 0xff, 0xff, 0x00, NULL					},
558 	{0x0e, 0xff, 0xff, 0xff, NULL					},
559 
560 	{0   , 0xfe, 0   ,    4, "Jump Bonus"			},
561 	{0x0c, 0x01, 0x03, 0x00, "500-1500"				},
562 	{0x0c, 0x01, 0x03, 0x01, "800-2000"				},
563 	{0x0c, 0x01, 0x03, 0x02, "1000-2500"			},
564 	{0x0c, 0x01, 0x03, 0x03, "2000-4000"			},
565 
566 	{0   , 0xfe, 0   ,    0, "Time"					},
567 	{0x0c, 0x01, 0x18, 0x00, "1:00"					},
568 	{0x0c, 0x01, 0x18, 0x08, "1:30"					},
569 	{0x0c, 0x01, 0x18, 0x10, "2:00"					},
570 	{0x0c, 0x01, 0x18, 0x18, "2:30"					},
571 
572 	{0   , 0xfe, 0   ,    4, "Race End Time Bonus"	},
573 	{0x0c, 0x01, 0x20, 0x20, "0:10"					},
574 	{0x0c, 0x01, 0x20, 0x00, "0:20"					},
575 
576 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
577 	{0x0c, 0x01, 0x40, 0x40, "Off"					},
578 	{0x0c, 0x01, 0x40, 0x00, "On"					},
579 
580 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
581 	{0x0c, 0x01, 0x80, 0x80, "Upright"				},
582 	{0x0c, 0x01, 0x80, 0x00, "Cocktail"				},
583 
584 	COMMON_COIN_DIPS(0x0d)
585 
586 	{0   , 0xfe, 0   ,    16, "1st Extended Time"	},
587 	{0x0e, 0x01, 0x03, 0x00, "10k"					},
588 	{0x0e, 0x01, 0x03, 0x01, "15k"					},
589 	{0x0e, 0x01, 0x03, 0x02, "20k"					},
590 	{0x0e, 0x01, 0x03, 0x03, "25k"					},
591 
592 	{0   , 0xfe, 0   ,    4, "Extended Time Every"	},
593 	{0x0e, 0x01, 0x1c, 0x00, "5k"					},
594 	{0x0e, 0x01, 0x1c, 0x04, "6k"					},
595 	{0x0e, 0x01, 0x1c, 0x08, "7k"					},
596 	{0x0e, 0x01, 0x1c, 0x0c, "8k"					},
597 	{0x0e, 0x01, 0x1c, 0x10, "9k"					},
598 	{0x0e, 0x01, 0x1c, 0x14, "10k"					},
599 	{0x0e, 0x01, 0x1c, 0x18, "11k"					},
600 	{0x0e, 0x01, 0x1c, 0x1c, "12k"					},
601 
602 	{0   , 0xfe, 0   ,    8, "Year Display"			},
603 	{0x0e, 0x01, 0x20, 0x00, "No"					},
604 	{0x0e, 0x01, 0x20, 0x20, "Yes"					},
605 
606 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
607 	{0x0e, 0x01, 0x40, 0x40, "Off"					},
608 	{0x0e, 0x01, 0x40, 0x00, "On"					},
609 
610 	{0   , 0xfe, 0   ,    2, "Coinage"				},
611 	{0x0e, 0x01, 0x80, 0x80, "A and B"				},
612 	{0x0e, 0x01, 0x80, 0x00, "A only"				},
613 };
614 
615 STDDIPINFO(Alpine)
616 
617 static struct BurnDIPInfo AlpineaDIPList[]=
618 {
619 	{0x0c, 0xff, 0xff, 0xff, NULL					},
620 	{0x0d, 0xff, 0xff, 0x00, NULL					},
621 	{0x0e, 0xff, 0xff, 0xff, NULL					},
622 
623 	{0   , 0xfe, 0   ,    4, "Jump Bonus"			},
624 	{0x0c, 0x01, 0x03, 0x00, "500-1500"				},
625 	{0x0c, 0x01, 0x03, 0x01, "800-2000"				},
626 	{0x0c, 0x01, 0x03, 0x02, "1000-2500"			},
627 	{0x0c, 0x01, 0x03, 0x03, "2000-4000"			},
628 
629 	{0   , 0xfe, 0   ,    0, "Time"					},
630 	{0x0c, 0x01, 0x18, 0x00, "1:00"					},
631 	{0x0c, 0x01, 0x18, 0x08, "1:30"					},
632 	{0x0c, 0x01, 0x18, 0x10, "2:00"					},
633 	{0x0c, 0x01, 0x18, 0x18, "2:30"					},
634 
635 	{0   , 0xfe, 0   ,    2, "Service Mode"			},
636 	{0x0c, 0x01, 0x20, 0x20, "Off"					},
637 	{0x0c, 0x01, 0x20, 0x00, "On"					},
638 
639 	{0   , 0xfe, 0   ,    4, "Flip Screen"			},
640 	{0x0c, 0x01, 0x40, 0x40, "Off"					},
641 	{0x0c, 0x01, 0x40, 0x00, "On"					},
642 
643 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
644 	{0x0c, 0x01, 0x80, 0x80, "Upright"				},
645 	{0x0c, 0x01, 0x80, 0x00, "Cocktail"				},
646 
647 	COMMON_COIN_DIPS(0x0d)
648 
649 	{0   , 0xfe, 0   ,    16, "1st Extended Time"	},
650 	{0x0e, 0x01, 0x03, 0x00, "10k"					},
651 	{0x0e, 0x01, 0x03, 0x01, "15k"					},
652 	{0x0e, 0x01, 0x03, 0x02, "20k"					},
653 	{0x0e, 0x01, 0x03, 0x03, "25k"					},
654 
655 	{0   , 0xfe, 0   ,    4, "Extended Time Every"	},
656 	{0x0e, 0x01, 0x1c, 0x00, "5k"					},
657 	{0x0e, 0x01, 0x1c, 0x04, "6k"					},
658 	{0x0e, 0x01, 0x1c, 0x08, "7k"					},
659 	{0x0e, 0x01, 0x1c, 0x0c, "8k"					},
660 	{0x0e, 0x01, 0x1c, 0x10, "9k"					},
661 	{0x0e, 0x01, 0x1c, 0x14, "10k"					},
662 	{0x0e, 0x01, 0x1c, 0x18, "11k"					},
663 	{0x0e, 0x01, 0x1c, 0x1c, "12k"					},
664 
665 	{0   , 0xfe, 0   ,    8, "Year Display"			},
666 	{0x0e, 0x01, 0x20, 0x00, "No"					},
667 	{0x0e, 0x01, 0x20, 0x20, "Yes"					},
668 
669 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
670 	{0x0e, 0x01, 0x40, 0x40, "Off"					},
671 	{0x0e, 0x01, 0x40, 0x00, "On"					},
672 
673 	{0   , 0xfe, 0   ,    2, "Coinage"				},
674 	{0x0e, 0x01, 0x80, 0x80, "A and B"				},
675 	{0x0e, 0x01, 0x80, 0x00, "A only"				},
676 };
677 
678 STDDIPINFO(Alpinea)
679 
680 static struct BurnDIPInfo TimetunlDIPList[]=
681 {
682 	{0x0c, 0xff, 0xff, 0x1c, NULL					},
683 	{0x0d, 0xff, 0xff, 0x00, NULL					},
684 	{0x0e, 0xff, 0xff, 0xf0, NULL					},
685 
686 	{0   , 0xfe, 0   ,    2, "Free Play"			},
687 	{0x0c, 0x01, 0x04, 0x04, "Off"					},
688 	{0x0c, 0x01, 0x04, 0x00, "On"					},
689 
690 	{0   , 0xfe, 0   ,    4, "Lives"				},
691 	{0x0c, 0x01, 0x18, 0x18, "3"					},
692 	{0x0c, 0x01, 0x18, 0x10, "4"					},
693 	{0x0c, 0x01, 0x18, 0x08, "5"					},
694 	{0x0c, 0x01, 0x18, 0x00, "6"					},
695 
696 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
697 	{0x0c, 0x01, 0x40, 0x00, "Off"					},
698 	{0x0c, 0x01, 0x40, 0x40, "On"					},
699 
700 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
701 	{0x0c, 0x01, 0x80, 0x00, "Upright"				},
702 	{0x0c, 0x01, 0x80, 0x80, "Cocktail"				},
703 
704 	COMMON_COIN_DIPS(0x0d)
705 
706 	{0   , 0xfe, 0   ,    2, "Coinage Display"		},
707 	{0x0e, 0x01, 0x10, 0x10, "Coins/Credits"		},
708 	{0x0e, 0x01, 0x10, 0x00, "Insert Coin"			},
709 
710 	{0   , 0xfe, 0   ,    2, "Year Display"			},
711 	{0x0e, 0x01, 0x20, 0x00, "No"					},
712 	{0x0e, 0x01, 0x20, 0x20, "Yes"					},
713 
714 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
715 	{0x0e, 0x01, 0x40, 0x40, "Off"					},
716 	{0x0e, 0x01, 0x40, 0x00, "On"					},
717 
718 	{0   , 0xfe, 0   ,    2, "Coinage"				},
719 	{0x0e, 0x01, 0x80, 0x80, "A and B"				},
720 	{0x0e, 0x01, 0x80, 0x00, "A only"				},
721 };
722 
723 STDDIPINFO(Timetunl)
724 
725 static struct BurnDIPInfo ElevatorDIPList[]=
726 {
727 	{0x12, 0xff, 0xff, 0x7f, NULL					},
728 	{0x13, 0xff, 0xff, 0x00, NULL					},
729 	{0x14, 0xff, 0xff, 0xff, NULL					},
730 
731 	{0   , 0xfe, 0   ,    4, "Bonus Life"			},
732 	{0x12, 0x01, 0x03, 0x03, "10000"				},
733 	{0x12, 0x01, 0x03, 0x02, "15000"				},
734 	{0x12, 0x01, 0x03, 0x01, "20000"				},
735 	{0x12, 0x01, 0x03, 0x00, "25000"				},
736 
737 	{0   , 0xfe, 0   ,    2, "Free Play"			},
738 	{0x12, 0x01, 0x04, 0x04, "Off"					},
739 	{0x12, 0x01, 0x04, 0x00, "On"					},
740 
741 	{0   , 0xfe, 0   ,    4, "Lives"				},
742 	{0x12, 0x01, 0x18, 0x18, "3"					},
743 	{0x12, 0x01, 0x18, 0x10, "4"					},
744 	{0x12, 0x01, 0x18, 0x08, "5"					},
745 	{0x12, 0x01, 0x18, 0x00, "6"					},
746 
747 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
748 	{0x12, 0x01, 0x40, 0x40, "Off"					},
749 	{0x12, 0x01, 0x40, 0x00, "On"					},
750 
751 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
752 	{0x12, 0x01, 0x80, 0x00, "Upright"				},
753 	{0x12, 0x01, 0x80, 0x80, "Cocktail"				},
754 
755 	COMMON_COIN_DIPS(0x13)
756 
757 	{0   , 0xfe, 0   ,    4, "Difficulty"			},
758 	{0x14, 0x01, 0x03, 0x03, "Easiest"				},
759 	{0x14, 0x01, 0x03, 0x02, "Easy"					},
760 	{0x14, 0x01, 0x03, 0x01, "Normal"				},
761 	{0x14, 0x01, 0x03, 0x00, "Hard"					},
762 
763 	{0   , 0xfe, 0   ,    2, "Coinage Display"		},
764 	{0x14, 0x01, 0x10, 0x10, "Coins/Credits"		},
765 	{0x14, 0x01, 0x10, 0x00, "Insert Coin"			},
766 
767 	{0   , 0xfe, 0   ,    2, "Year Display"			},
768 	{0x14, 0x01, 0x20, 0x00, "No"					},
769 	{0x14, 0x01, 0x20, 0x20, "Yes"					},
770 
771 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
772 	{0x14, 0x01, 0x40, 0x40, "Off"					},
773 	{0x14, 0x01, 0x40, 0x00, "On"					},
774 
775 	{0   , 0xfe, 0   ,    2, "Coinage"				},
776 	{0x14, 0x01, 0x80, 0x80, "A and B"				},
777 	{0x14, 0x01, 0x80, 0x00, "A only"				},
778 };
779 
780 STDDIPINFO(Elevator)
781 
782 static struct BurnDIPInfo WaterskiDIPList[]=
783 {
784 	{0x0e, 0xff, 0xff, 0x3f, NULL					},
785 	{0x0f, 0xff, 0xff, 0x00, NULL					},
786 	{0x10, 0xff, 0xff, 0xff, NULL					},
787 
788 	{0   , 0xfe, 0   ,    2, "Free Play"			},
789 	{0x0e, 0x01, 0x04, 0x04, "Off"					},
790 	{0x0e, 0x01, 0x04, 0x00, "On"					},
791 
792 	{0   , 0xfe, 0   ,    4, "Time"					},
793 	{0x0e, 0x01, 0x18, 0x00, "2:00"					},
794 	{0x0e, 0x01, 0x18, 0x08, "2:10"					},
795 	{0x0e, 0x01, 0x18, 0x10, "2:20"					},
796 	{0x0e, 0x01, 0x18, 0x18, "2:30"					},
797 
798 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
799 	{0x0e, 0x01, 0x40, 0x00, "Off"					},
800 	{0x0e, 0x01, 0x40, 0x40, "On"					},
801 
802 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
803 	{0x0e, 0x01, 0x80, 0x00, "Upright"				},
804 	{0x0e, 0x01, 0x80, 0x80, "Cocktail"				},
805 
806 	COMMON_COIN_DIPS(0x0f)
807 
808 	{0   , 0xfe, 0   ,    2, "Coinage Display"		},
809 	{0x10, 0x01, 0x10, 0x10, "Coins/Credits"		},
810 	{0x10, 0x01, 0x10, 0x00, "Insert Coin"			},
811 
812 	{0   , 0xfe, 0   ,    2, "Year Display"			},
813 	{0x10, 0x01, 0x20, 0x00, "No"					},
814 	{0x10, 0x01, 0x20, 0x20, "Yes"					},
815 
816 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
817 	{0x10, 0x01, 0x40, 0x40, "Off"					},
818 	{0x10, 0x01, 0x40, 0x00, "On"					},
819 
820 	{0   , 0xfe, 0   ,    2, "Coinage"				},
821 	{0x10, 0x01, 0x80, 0x80, "A and B"				},
822 	{0x10, 0x01, 0x80, 0x00, "A only"				},
823 };
824 
825 STDDIPINFO(Waterski)
826 
827 static struct BurnDIPInfo BioatackDIPList[]=
828 {
829 	{0x10, 0xff, 0xff, 0x3f, NULL					},
830 	{0x11, 0xff, 0xff, 0x00, NULL					},
831 	{0x12, 0xff, 0xff, 0xff, NULL					},
832 
833 	{0   , 0xfe, 0   ,    4, "Bonus Life"			},
834 	{0x10, 0x01, 0x03, 0x03, "5000"					},
835 	{0x10, 0x01, 0x03, 0x02, "10000"				},
836 	{0x10, 0x01, 0x03, 0x01, "15000"				},
837 	{0x10, 0x01, 0x03, 0x00, "20000"				},
838 
839 	{0   , 0xfe, 0   ,    4, "Lives"				},
840 	{0x10, 0x01, 0x18, 0x18, "3"					},
841 	{0x10, 0x01, 0x18, 0x10, "4"					},
842 	{0x10, 0x01, 0x18, 0x08, "5"					},
843 	{0x10, 0x01, 0x18, 0x00, "6"					},
844 
845 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
846 	{0x10, 0x01, 0x40, 0x00, "Off"					},
847 	{0x10, 0x01, 0x40, 0x40, "On"					},
848 
849 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
850 	{0x10, 0x01, 0x80, 0x00, "Upright"				},
851 	{0x10, 0x01, 0x80, 0x80, "Cocktail"				},
852 
853 	COMMON_COIN_DIPS(0x11)
854 
855 	{0   , 0xfe, 0   ,    2, "Year Display"			},
856 	{0x12, 0x01, 0x20, 0x00, "No"					},
857 	{0x12, 0x01, 0x20, 0x20, "Yes"					},
858 
859 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
860 	{0x12, 0x01, 0x40, 0x40, "Off"					},
861 	{0x12, 0x01, 0x40, 0x00, "On"					},
862 
863 	{0   , 0xfe, 0   ,    2, "Coinage"				},
864 	{0x12, 0x01, 0x80, 0x80, "A and B"				},
865 	{0x12, 0x01, 0x80, 0x00, "A only"				},
866 };
867 
868 STDDIPINFO(Bioatack)
869 
870 static struct BurnDIPInfo FrontlinDIPList[]=
871 {
872 	{0x1b, 0xff, 0xff, 0x7f, NULL					},
873 	{0x1c, 0xff, 0xff, 0x00, NULL					},
874 	{0x1d, 0xff, 0xff, 0xff, NULL					},
875 
876 	{0   , 0xfe, 0   ,    4, "Bonus Life"			},
877 	{0x1b, 0x01, 0x03, 0x03, "10000"				},
878 	{0x1b, 0x01, 0x03, 0x02, "20000"				},
879 	{0x1b, 0x01, 0x03, 0x01, "30000"				},
880 	{0x1b, 0x01, 0x03, 0x00, "50000"				},
881 
882 	{0   , 0xfe, 0   ,    2, "Free Play"			},
883 	{0x1b, 0x01, 0x04, 0x04, "Off"					},
884 	{0x1b, 0x01, 0x04, 0x00, "On"					},
885 
886 	{0   , 0xfe, 0   ,    4, "Lives"				},
887 	{0x1b, 0x01, 0x18, 0x18, "3"					},
888 	{0x1b, 0x01, 0x18, 0x10, "4"					},
889 	{0x1b, 0x01, 0x18, 0x08, "5"					},
890 	{0x1b, 0x01, 0x18, 0x00, "6"					},
891 
892 	{0   , 0xfe, 0   ,    2, "Service Mode"			},
893 	{0x1b, 0x01, 0x20, 0x20, "Off"					},
894 	{0x1b, 0x01, 0x20, 0x00, "On"					},
895 
896 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
897 	{0x1b, 0x01, 0x40, 0x40, "Off"					},
898 	{0x1b, 0x01, 0x40, 0x00, "On"					},
899 
900 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
901 	{0x1b, 0x01, 0x80, 0x00, "Upright"				},
902 	{0x1b, 0x01, 0x80, 0x80, "Cocktail"				},
903 
904 	COMMON_COIN_DIPS(0x1c)
905 
906 	{0   , 0xfe, 0   ,    2, "Coinage Display"		},
907 	{0x1d, 0x01, 0x10, 0x10, "Coins/Credits"		},
908 	{0x1d, 0x01, 0x10, 0x00, "Insert Coin"			},
909 
910 	{0   , 0xfe, 0   ,    2, "Year Display"			},
911 	{0x1d, 0x01, 0x20, 0x00, "No"					},
912 	{0x1d, 0x01, 0x20, 0x20, "Yes"					},
913 
914 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
915 	{0x1d, 0x01, 0x40, 0x40, "Off"					},
916 	{0x1d, 0x01, 0x40, 0x00, "On"					},
917 
918 	{0   , 0xfe, 0   ,    2, "Coinage"				},
919 	{0x1d, 0x01, 0x80, 0x80, "A and B"				},
920 	{0x1d, 0x01, 0x80, 0x00, "A only"				},
921 };
922 
923 STDDIPINFO(Frontlin)
924 
925 static struct BurnDIPInfo WwesternDIPList[]=
926 {
927 	{0x1b, 0xff, 0xff, 0x7b, NULL					},
928 	{0x1c, 0xff, 0xff, 0x00, NULL					},
929 	{0x1d, 0xff, 0xff, 0xff, NULL					},
930 
931 	{0   , 0xfe, 0   ,    4, "Bonus Life"			},
932 	{0x1b, 0x01, 0x03, 0x03, "10000"				},
933 	{0x1b, 0x01, 0x03, 0x02, "30000"				},
934 	{0x1b, 0x01, 0x03, 0x01, "50000"				},
935 	{0x1b, 0x01, 0x03, 0x00, "70000"				},
936 
937 	{0   , 0xfe, 0   ,    2, "High Score Table"		},
938 	{0x1b, 0x01, 0x04, 0x04, "No"					},
939 	{0x1b, 0x01, 0x04, 0x00, "Yes"					},
940 
941 	{0   , 0xfe, 0   ,    4, "Lives"				},
942 	{0x1b, 0x01, 0x18, 0x18, "3"					},
943 	{0x1b, 0x01, 0x18, 0x10, "4"					},
944 	{0x1b, 0x01, 0x18, 0x08, "5"					},
945 	{0x1b, 0x01, 0x18, 0x00, "6"					},
946 
947 	{0   , 0xfe, 0   ,    2, "Service Mode"			},
948 	{0x1b, 0x01, 0x20, 0x20, "Off"					},
949 	{0x1b, 0x01, 0x20, 0x00, "On"					},
950 
951 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
952 	{0x1b, 0x01, 0x40, 0x40, "Off"					},
953 	{0x1b, 0x01, 0x40, 0x00, "On"					},
954 
955 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
956 	{0x1b, 0x01, 0x80, 0x00, "Upright"				},
957 	{0x1b, 0x01, 0x80, 0x80, "Cocktail"				},
958 
959 	COMMON_COIN_DIPS(0x1c)
960 
961 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
962 	{0x1d, 0x01, 0x40, 0x40, "Off"					},
963 	{0x1d, 0x01, 0x40, 0x00, "On"					},
964 
965 	{0   , 0xfe, 0   ,    2, "Coinage"				},
966 	{0x1d, 0x01, 0x80, 0x80, "A and B"				},
967 	{0x1d, 0x01, 0x80, 0x00, "A only"				},
968 };
969 
970 STDDIPINFO(Wwestern)
971 
972 static struct BurnDIPInfo TinstarDIPList[]=
973 {
974 	{0x1b, 0xff, 0xff, 0x37, NULL					},
975 	{0x1c, 0xff, 0xff, 0x00, NULL					},
976 	{0x1d, 0xff, 0xff, 0xfd, NULL					},
977 
978 	{0   , 0xfe, 0   ,    4, "Bonus Life?"			},
979 	{0x1b, 0x01, 0x03, 0x03, "10000?"				},
980 	{0x1b, 0x01, 0x03, 0x02, "20000?"				},
981 	{0x1b, 0x01, 0x03, 0x01, "30000?"				},
982 	{0x1b, 0x01, 0x03, 0x00, "50000?"				},
983 
984 	{0   , 0xfe, 0   ,    2, "Free Play"			},
985 	{0x1b, 0x01, 0x04, 0x04, "Off"					},
986 	{0x1b, 0x01, 0x04, 0x00, "On"					},
987 
988 	{0   , 0xfe, 0   ,    4, "Lives"				},
989 	{0x1b, 0x01, 0x18, 0x18, "2"					},
990 	{0x1b, 0x01, 0x18, 0x10, "3"					},
991 	{0x1b, 0x01, 0x18, 0x08, "4"					},
992 	{0x1b, 0x01, 0x18, 0x00, "5"					},
993 
994 	{0   , 0xfe, 0   ,    2, "Service Mode"			},
995 	{0x1b, 0x01, 0x20, 0x20, "Off"					},
996 	{0x1b, 0x01, 0x20, 0x00, "On"					},
997 
998 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
999 	{0x1b, 0x01, 0x40, 0x00, "Off"					},
1000 	{0x1b, 0x01, 0x40, 0x40, "On"					},
1001 
1002 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
1003 	{0x1b, 0x01, 0x80, 0x00, "Upright"				},
1004 	{0x1b, 0x01, 0x80, 0x80, "Cocktail"				},
1005 
1006 	COMMON_COIN_DIPS(0x1c)
1007 
1008 	{0   , 0xfe, 0   ,    2, "Coinage Display"		},
1009 	{0x1d, 0x01, 0x10, 0x10, "Coins/Credits"		},
1010 	{0x1d, 0x01, 0x10, 0x00, "Insert Coin"			},
1011 
1012 	{0   , 0xfe, 0   ,    2, "Year Display"			},
1013 	{0x1d, 0x01, 0x20, 0x00, "No"					},
1014 	{0x1d, 0x01, 0x20, 0x20, "Yes"					},
1015 
1016 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
1017 	{0x1d, 0x01, 0x40, 0x40, "Off"					},
1018 	{0x1d, 0x01, 0x40, 0x00, "On"					},
1019 
1020 	{0   , 0xfe, 0   ,    2, "Coinage"				},
1021 	{0x1d, 0x01, 0x80, 0x80, "A and B"				},
1022 	{0x1d, 0x01, 0x80, 0x00, "A only"				},
1023 };
1024 
1025 STDDIPINFO(Tinstar)
1026 
1027 static struct BurnDIPInfo SfposeidDIPList[]=
1028 {
1029 	{0x12, 0xff, 0xff, 0x6f, NULL					},
1030 	{0x13, 0xff, 0xff, 0x00, NULL					},
1031 	{0x14, 0xff, 0xff, 0xff, NULL					},
1032 
1033 	{0   , 0xfe, 0   ,    4, "Lives"				},
1034 	{0x12, 0x01, 0x18, 0x00, "2"					},
1035 	{0x12, 0x01, 0x18, 0x08, "3"					},
1036 	{0x12, 0x01, 0x18, 0x10, "4"					},
1037 	{0x12, 0x01, 0x18, 0x18, "5"					},
1038 
1039 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
1040 	{0x12, 0x01, 0x40, 0x40, "Off"					},
1041 	{0x12, 0x01, 0x40, 0x00, "On"					},
1042 
1043 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
1044 	{0x12, 0x01, 0x80, 0x00, "Upright"				},
1045 	{0x12, 0x01, 0x80, 0x80, "Cocktail"				},
1046 
1047 	COMMON_COIN_DIPS(0x13)
1048 
1049 	{0   , 0xfe, 0   ,    2, "Coinage Display"		},
1050 	{0x14, 0x01, 0x10, 0x10, "Coins/Credits"		},
1051 	{0x14, 0x01, 0x10, 0x00, "Insert Coin"			},
1052 
1053 	{0   , 0xfe, 0   ,    2, "Year Display"			},
1054 	{0x14, 0x01, 0x20, 0x00, "No"					},
1055 	{0x14, 0x01, 0x20, 0x20, "Yes"					},
1056 
1057 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
1058 	{0x14, 0x01, 0x40, 0x40, "Off"					},
1059 	{0x14, 0x01, 0x40, 0x00, "On"					},
1060 
1061 	{0   , 0xfe, 0   ,    2, "Coinage"				},
1062 	{0x14, 0x01, 0x80, 0x80, "A and B"				},
1063 	{0x14, 0x01, 0x80, 0x00, "A only"				},
1064 };
1065 
1066 STDDIPINFO(Sfposeid)
1067 
1068 static struct BurnDIPInfo HwraceDIPList[]=
1069 {
1070 	{0x12, 0xff, 0xff, 0x7f, NULL					},
1071 	{0x13, 0xff, 0xff, 0x00, NULL					},
1072 	{0x14, 0xff, 0xff, 0xff, NULL					},
1073 
1074 	{0   , 0xfe, 0   ,    2, "Free Play"			},
1075 	{0x12, 0x01, 0x04, 0x04, "Off"					},
1076 	{0x12, 0x01, 0x04, 0x00, "On"					},
1077 
1078 	{0   , 0xfe, 0   ,    2, "Service Mode"			},
1079 	{0x12, 0x01, 0x20, 0x20, "Off"					},
1080 	{0x12, 0x01, 0x20, 0x00, "On"					},
1081 
1082 	{0   , 0xfe, 0   ,    2, "Flip Screen"			},
1083 	{0x12, 0x01, 0x40, 0x40, "Off"					},
1084 	{0x12, 0x01, 0x40, 0x00, "On"					},
1085 
1086 	{0   , 0xfe, 0   ,    2, "Cabinet"				},
1087 	{0x12, 0x01, 0x80, 0x00, "Upright"				},
1088 	{0x12, 0x01, 0x80, 0x80, "Cocktail"				},
1089 
1090 	COMMON_COIN_DIPS(0x13)
1091 
1092 	{0   , 0xfe, 0   ,    2, "Coinage Display"		},
1093 	{0x14, 0x01, 0x10, 0x00, "Off"					},
1094 	{0x14, 0x01, 0x10, 0x10, "On"					},
1095 
1096 	{0   , 0xfe, 0   ,    2, "Year Display"			},
1097 	{0x14, 0x01, 0x20, 0x00, "No"					},
1098 	{0x14, 0x01, 0x20, 0x20, "Yes"					},
1099 
1100 	{0   , 0xfe, 0   ,    2, "Invulnerability"		},
1101 	{0x14, 0x01, 0x40, 0x40, "Off"					},
1102 	{0x14, 0x01, 0x40, 0x00, "On"					},
1103 
1104 	{0   , 0xfe, 0   ,    2, "Coinage"				},
1105 	{0x14, 0x01, 0x80, 0x80, "A and B"				},
1106 	{0x14, 0x01, 0x80, 0x00, "A only"				},
1107 };
1108 
STDDIPINFO(Hwrace)1109 STDDIPINFO(Hwrace)
1110 
1111 static void alpine_protection_write(INT32 data)
1112 {
1113 	switch (data)
1114 	{
1115 		case 0x05:
1116 			protection_value = 0x18;
1117 		break;
1118 
1119 		case 0x07:
1120 		case 0x0c:
1121 		case 0x0f:
1122 			protection_value = 0x00;      // not used?
1123 		break;
1124 
1125 		case 0x16:
1126 			protection_value = 0x08;
1127 		break;
1128 
1129 		case 0x1d:
1130 			protection_value = 0x18;
1131 		break;
1132 
1133 		default:
1134 			protection_value = data;      // not used?
1135 		break;
1136 	}
1137 }
1138 
ram_decode(INT32 offset)1139 static void ram_decode(INT32 offset)
1140 {
1141 	INT32 destbase = 0;
1142 	INT32 source = 0;
1143 
1144 	if (offset >= 0x1800) {
1145 		destbase = 0x4000;
1146 		source = 0x1800;
1147 	}
1148 
1149 	offset &= 0x7ff;
1150 	UINT8 a = DrvCharRAM[0x0000 + offset + source];
1151 	UINT8 b = DrvCharRAM[0x0800 + offset + source];
1152 	UINT8 c = DrvCharRAM[0x1000 + offset + source];
1153 	UINT8 *tdest = DrvGfxExp + destbase + (offset * 8);
1154 	UINT8 *sdest = DrvSprExp + destbase + (((offset & 7) << 4) + (offset & 8) + ((offset & 0x7f0) << 3));
1155 
1156 	for (INT32 i = 0; i < 8; i++)
1157 	{
1158 		tdest[i] = sdest[i] = ((a >> i) & 1) | (((b >> i) & 1) << 1) | (((c >> i) & 1) << 2);
1159 	}
1160 }
1161 
bankswitch(INT32 data)1162 static void bankswitch(INT32 data)
1163 {
1164 	rom_bank = data;
1165 
1166 	INT32 bank = 0x6000 + ((data >> 7) * 0x2000);
1167 
1168 	ZetMapMemory(DrvZ80ROM0 + bank, 	0x6000, 0x7fff, MAP_ROM);
1169 
1170 	if (is_alpine == 2) protection_value = data >> 2; // alpinea
1171 }
1172 
taitosj_main_write(UINT16 address,UINT8 data)1173 static void __fastcall taitosj_main_write(UINT16 address, UINT8 data)
1174 {
1175 	if (address >= 0xd700) return; // nop
1176 
1177 	if (address >= 0x9000 && address <= 0xbfff) {
1178 		address -= 0x9000;
1179 		DrvCharRAM[address] = data ^ charram_xor;
1180 		ram_decode(address);
1181 		return;
1182 	}
1183 
1184 	if ((address & 0xff00) == 0xd200) { // mirror 2x
1185 		DrvPalRAM[address & 0x7f] = data ^ 0xff;
1186 		return;
1187 	}
1188 
1189 	if ((address & 0xf000) == 0xd000) address &= ~0x00f0;
1190 
1191 	switch (address)
1192 	{
1193 		case 0x8800:
1194 		{
1195 			if (has_mcu == 0) return;
1196 
1197 			zready = 1;
1198 			m68705SetIrqLine(0, 1);
1199 			fromz80 = data;
1200 		}
1201 		return;
1202 
1203 		case 0x8801:
1204 		return;	// nop?
1205 
1206 		case 0x8802:
1207 		return;	// kikstart nop
1208 
1209 		case 0xd300:
1210 			video_priority = data;
1211 		return;
1212 
1213 		case 0xd40e:
1214 		case 0xd40f:
1215 			AY8910Write(0, address & 1, data);
1216 		return;
1217 
1218 		case 0xd500:
1219 		case 0xd501:
1220 		case 0xd502:
1221 		case 0xd503:
1222 		case 0xd504:
1223 		case 0xd505:
1224 			scroll[address & 7] = data;
1225 		return;
1226 
1227 		case 0xd506:
1228 		case 0xd507:
1229 			color_bank[address & 1] = data;
1230 		return;
1231 
1232 		case 0xd508:
1233 			memset (collision_reg, 0, 4);
1234 		return;
1235 
1236 		case 0xd509:
1237 		case 0xd50a:
1238 			gfxpointer[address - 0xd509] = data;
1239 		return;
1240 
1241 		case 0xd50b:
1242 			soundlatch = data;
1243 			if (sound_nmi_disable == 0) {
1244 				ZetNmi(1);
1245 			}
1246 		return;
1247 
1248 		case 0xd50c:
1249 			// semaphore2_w
1250 		return;
1251 
1252 		case 0xd50d:
1253 			BurnWatchdogWrite();
1254 		return;
1255 
1256 		case 0xd50e:
1257 			bankswitch(data);
1258 		return;
1259 
1260 		case 0xd50f:
1261 			if (is_alpine == 1) alpine_protection_write(data);
1262 			// nop
1263 		return;
1264 
1265 		case 0xd600:
1266 			video_mode = data;
1267 		return;
1268 	}
1269 
1270 	bprintf (0, _T("MW: %4.4x, %2.2x bad!\n"), address, data);
1271 }
1272 
taitosj_main_read(UINT16 address)1273 static UINT8 __fastcall taitosj_main_read(UINT16 address)
1274 {
1275 	if (address >= 0xd700) return 0; // nop
1276 
1277 	if ((address & 0xff00) == 0xd200) { // mirror 2x
1278 		return DrvPalRAM[address & 0x7f] ^ 0xff;
1279 	}
1280 
1281 	if ((address & 0xf000) == 0xd000) address &= ~0x00f0;
1282 
1283 	switch (address)
1284 	{
1285 		case 0x8800:
1286 			zaccept = 1;
1287 			return toz80;
1288 
1289 		case 0x8801:
1290 			if (has_mcu) {
1291 				return ~((zready << 0) | (zaccept << 1));
1292 			}
1293 			return 0xff;
1294 
1295 		case 0x8802:
1296 			return 0;	// kikstart nop
1297 
1298 		case 0xd400:
1299 		case 0xd401:
1300 		case 0xd402:
1301 		case 0xd403:
1302 			return collision_reg[address & 3];
1303 
1304 		case 0xd404:
1305 		{
1306 			UINT16 addr = gfxpointer[0] + (gfxpointer[1] << 8);
1307 
1308 			UINT8 ret = 0;
1309 			if (addr < 0x8000) ret = DrvGfxROM[addr];
1310 
1311 			addr++;
1312 			gfxpointer[0] = addr & 0xff;
1313 			gfxpointer[1] = addr >> 8;
1314 
1315 			return ret;
1316 		}
1317 
1318 		case 0xd408:
1319 			return DrvInputs[0]; // in0
1320 
1321 		case 0xd409:
1322 			return DrvInputs[1]; // in1
1323 
1324 		case 0xd40a:
1325 			return DrvDips[0]; // dsw1
1326 
1327 		case 0xd40b:
1328 			if (is_alpine == 1) return ((DrvInputs[2] & ~0x1e) | protection_value);
1329 			if (is_alpine == 2) return ((DrvInputs[2] & ~0x0f) | protection_value);
1330 			return DrvInputs[2]; // in2
1331 
1332 		case 0xd40c:
1333 			return DrvInputs[3]; // in3
1334 
1335 		case 0xd40d:
1336 			return DrvInputs[4] | (input_port_data & 0xf0); // in4
1337 
1338 		case 0xd40f:
1339 			return AY8910Read(0);
1340 
1341 		case 0xd48b:
1342 			protection_value ^= 0xff;
1343 			return protection_value;
1344 	}
1345 
1346 	bprintf (0, _T("MR: %4.4x bad!\n"), address);
1347 
1348 	return 0;
1349 }
1350 
kikstart_main_write(UINT16 address,UINT8 data)1351 static void __fastcall kikstart_main_write(UINT16 address, UINT8 data)
1352 {
1353 	switch (address)
1354 	{
1355 		case 0xd000:
1356 		case 0xd001:
1357 			color_bank[address & 1] = data;
1358 		return;
1359 
1360 		case 0xd002:
1361 		case 0xd003:
1362 		case 0xd004:
1363 		case 0xd005:
1364 		case 0xd006:
1365 		case 0xd007:
1366 			scroll[address - 0xd002] = data;
1367 		return;
1368 	}
1369 
1370 	taitosj_main_write(address, data);
1371 }
1372 
taitosj_sound_write(UINT16 address,UINT8 data)1373 static void __fastcall taitosj_sound_write(UINT16 address, UINT8 data)
1374 {
1375 	switch (address)
1376 	{
1377 		case 0x4800:
1378 		case 0x4801:
1379 			AY8910Write(1, address & 1, data);
1380 		return;
1381 
1382 		case 0x4802:
1383 		case 0x4803:
1384 			AY8910Write(2, address & 1, data);
1385 		return;
1386 
1387 		case 0x4804:
1388 		case 0x4805:
1389 			AY8910Write(3, address & 1, data);
1390 		return;
1391 	}
1392 }
1393 
taitosj_sound_read(UINT16 address)1394 static UINT8 __fastcall taitosj_sound_read(UINT16 address)
1395 {
1396 	switch (address)
1397 	{
1398 		case 0x4800:
1399 		case 0x4801:
1400 			return AY8910Read(1);
1401 
1402 		case 0x4802:
1403 		case 0x4803:
1404 			return AY8910Read(2);
1405 
1406 		case 0x4804:
1407 		case 0x4805:
1408 			return AY8910Read(3);
1409 
1410 		case 0x5000:
1411 			return soundlatch;
1412 	}
1413 
1414 	return 0;
1415 }
1416 
taitosj_68705_portB_w(UINT8 data)1417 static void taitosj_68705_portB_w(UINT8 data)
1418 {
1419 	if (~data & 0x02)
1420 	{
1421 		zready = 0;
1422 		m68705SetIrqLine(0, 0);
1423 		portA_in = fromz80;
1424 	}
1425 
1426 	busreq = (data & 0x08) >> 3;
1427 
1428 	if (~data & 0x04)
1429 	{
1430 		toz80 = portA_out;
1431 		zaccept = 0;
1432 	}
1433 
1434 	if (~data & 0x10)
1435 	{
1436 		ZetWriteByte(mcu_address, portA_out);
1437 		mcu_address = (mcu_address & 0xff00) | ((mcu_address + 1) & 0xff);
1438 	}
1439 
1440 	if (~data & 0x20)
1441 	{
1442 		portA_in = ZetReadByte(mcu_address);
1443 	}
1444 
1445 	if (~data & 0x40)
1446 	{
1447 		mcu_address = (mcu_address & 0xff00) | portA_out;
1448 	}
1449 
1450 	if (~data & 0x80)
1451 	{
1452 		mcu_address = (mcu_address & 0x00ff) | (portA_out << 8);
1453 	}
1454 }
1455 
m67805_mcu_write(UINT16 address,UINT8 data)1456 static void m67805_mcu_write(UINT16 address, UINT8 data)
1457 {
1458 	switch (address & 0x7ff)
1459 	{
1460 		case 0x0000:
1461 			portA_out = data;
1462 		return;
1463 
1464 		case 0x0001:
1465 			taitosj_68705_portB_w(data);
1466 		return;
1467 	}
1468 
1469 	if (address < 0x80) DrvMCURAM[address] = data;
1470 }
1471 
m67805_mcu_read(UINT16 address)1472 static UINT8 m67805_mcu_read(UINT16 address)
1473 {
1474 	switch (address & 0x7ff)
1475 	{
1476 		case 0x0000:
1477 			return portA_in;
1478 
1479 		case 0x0001:
1480 			return 0xff;
1481 
1482 		case 0x0002:
1483 			return (zready << 0) | (zaccept << 1) | (busreq << 2);
1484 	}
1485 
1486 	if (address < 0x80) return DrvMCURAM[address];
1487 
1488 	return 0;
1489 }
1490 
ay8910_0_port_A_r(UINT32)1491 static UINT8 ay8910_0_port_A_r(UINT32)
1492 {
1493 	return DrvDips[1];
1494 }
1495 
ay8910_0_port_B_r(UINT32)1496 static UINT8 ay8910_0_port_B_r(UINT32)
1497 {
1498 	return DrvDips[2];
1499 }
1500 
ay8910_1_port_A_w(UINT32,UINT32 data)1501 static void ay8910_1_port_A_w(UINT32, UINT32 data)
1502 {
1503 	dac_out_data = data - 0x80;
1504 	DACWrite16(0, dac_out_data * dac_volume);
1505 }
1506 
ay8910_1_port_B_w(UINT32,UINT32 data)1507 static void ay8910_1_port_B_w(UINT32, UINT32 data)
1508 {
1509 	dac_volume = (((data ^ 255) * 157) / 255) + 98;
1510 	DACWrite16(0, dac_out_data * dac_volume);
1511 }
1512 
ay8910_2_port_A_w(UINT32,UINT32 data)1513 static void ay8910_2_port_A_w(UINT32, UINT32 data)
1514 {
1515 	input_port_data = data;
1516 }
1517 
ay8910_3_port_B_w(UINT32,UINT32 data)1518 static void ay8910_3_port_B_w(UINT32, UINT32 data)
1519 {
1520 	sound_nmi_disable = data & 1;
1521 }
1522 
DrvDoReset(INT32 clear_mem)1523 static INT32 DrvDoReset(INT32 clear_mem)
1524 {
1525 	if (clear_mem) {
1526 		memset (AllRam, 0, RamEnd - AllRam);
1527 
1528 		input_port_data = 0;
1529 		video_priority = 0;
1530 		soundlatch = 0xff;
1531 		sound_nmi_disable = 1;
1532 		video_mode = 0;
1533 		memset (scroll, 0, 6);
1534 		memset (color_bank, 0, 2);
1535 		memset (gfxpointer, 0, 2);
1536 		memset (collision_reg, 0, 4);
1537 		sound_irq_timer = 0;
1538 		dac_volume = 0;
1539 		dac_out_data = 0;
1540 		protection_value = 0;
1541 
1542 		toz80 = 0;
1543 		fromz80 = 0;
1544 		mcu_address = 0;
1545 		portA_in = 0;
1546 		portA_out = 0;
1547 		zready = 0;
1548 		zaccept = 1;
1549 		busreq = 0;
1550 
1551 		kikstart_gears[0] = 0;
1552 		kikstart_gears[1] = 0;
1553 	}
1554 
1555 	ZetOpen(0);
1556 	if (clear_mem) bankswitch(0);
1557 	ZetReset();
1558 	ZetClose();
1559 
1560 	ZetOpen(1);
1561 	ZetReset();
1562 	DACReset();
1563 	AY8910Reset(0);
1564 	AY8910Reset(1);
1565 	AY8910Reset(2);
1566 	AY8910Reset(3);
1567 	ZetClose();
1568 
1569 	m6805Open(0);
1570 	m68705Reset();
1571 	m68705SetIrqLine(0, CPU_IRQSTATUS_NONE);
1572 	m6805Close();
1573 
1574 	BurnWatchdogReset();
1575 
1576 	sound_irq_timer = 0;
1577 
1578 	return 0;
1579 }
1580 
MemIndex()1581 static INT32 MemIndex()
1582 {
1583 	UINT8 *Next; Next = AllMem;
1584 
1585 	DrvZ80ROM0		= Next; Next += 0x0100000;
1586 	DrvZ80ROM1		= Next; Next += 0x0100000;
1587 
1588 	DrvMCUROM		= Next; Next += 0x0008000;
1589 
1590 	DrvGfxExp		= Next; Next += 0x0080000;
1591 	DrvSprExp		= Next; Next += 0x0080000;
1592 
1593 	DrvGfxROM		= Next; Next += 0x0100000;
1594 
1595 	DrvPalette		= (UINT32*)Next; Next += 0x400 * sizeof(UINT32);
1596 
1597 	AllRam			= Next;
1598 
1599 	DrvZ80RAMA		= Next; Next += 0x0008000;
1600 	DrvZ80RAMB		= Next; Next += 0x0004000;
1601 	DrvZ80RAMC		= Next; Next += 0x0008000;
1602 	DrvVidRAM1		= Next; Next += 0x0004000;
1603 	DrvVidRAM2		= Next; Next += 0x0004000;
1604 	DrvVidRAM3		= Next; Next += 0x0004000;
1605 
1606 	DrvZ80RAM1		= Next; Next += 0x0004000;
1607 
1608 	DrvPalRAM		= Next; Next += 0x0000800;
1609 
1610 	DrvMCURAM		= Next; Next += 0x0000800;
1611 
1612 	DrvColScroll	= Next; Next += 0x0001000;
1613 	DrvSprRAM		= Next; Next += 0x0001000;
1614 
1615 	DrvCharRAM		= Next; Next += 0x0030000;
1616 
1617 	RamEnd			= Next;
1618 
1619 	bitmap[0]		= (UINT16*)Next; Next += 256 * 256 * sizeof(INT16);
1620 	bitmap[1]		= (UINT16*)Next; Next += 256 * 256 * sizeof(INT16);
1621 	bitmap[2]		= (UINT16*)Next; Next += 256 * 256 * sizeof(INT16);
1622 	bitmap[3]		= NULL; // not used
1623 	bitmap[4]		= (UINT16*)Next; Next += 32 * 32 * sizeof(INT16);
1624 	bitmap[5]		= (UINT16*)Next; Next += 32 * 32 * sizeof(INT16);
1625 
1626 	bitmap[6]		= (UINT16*)Next; Next += 256 * 256 * sizeof(INT16);
1627 	bitmap[7]		= (UINT16*)Next; Next += 256 * 256 * sizeof(INT16);
1628 	bitmap[8]		= (UINT16*)Next; Next += 256 * 256 * sizeof(INT16);
1629 
1630 	MemEnd			= Next;
1631 
1632 	return 0;
1633 }
1634 
DrvVideoOrder(UINT8 * prom)1635 static void DrvVideoOrder(UINT8 *prom)
1636 {
1637 	for (INT32 i = 0; i < 32; i++)
1638 	{
1639 		UINT8 mask = 0;
1640 
1641 		for (INT32 j = 3; j >= 0; j--)
1642 		{
1643 			UINT8 data = (prom[0x10 * (i & 0x0f) + mask] >> ((i & 0x10) ? 2 : 0)) & 3;
1644 
1645 			mask |= (1 << data);
1646 
1647 			draw_order[i][j] = data;
1648 		}
1649 	}
1650 }
1651 
DrvLoadRoms()1652 static INT32 DrvLoadRoms()
1653 {
1654 	char* pRomName;
1655 	struct BurnRomInfo ri;
1656 
1657 	UINT8 *mLoad = DrvZ80ROM0;
1658 	UINT8 *sLoad = DrvZ80ROM1;
1659 	UINT8 *gLoad = DrvGfxROM;
1660 
1661 	for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) {
1662 
1663 		BurnDrvGetRomInfo(&ri, i);
1664 
1665 		if ((ri.nType & 7) == 1) {
1666 			if ((mLoad - DrvZ80ROM0) >= 0xa000) mLoad = DrvZ80ROM0 + 0xe000; // frontline
1667 			if (BurnLoadRom(mLoad, i, 1)) return 1;
1668 			mLoad += ri.nLen;
1669 			if (ri.nType & 8) mLoad += 0x1000;
1670 			continue;
1671 		}
1672 
1673 		if ((ri.nType & 7) == 2) {
1674 			if (BurnLoadRom(sLoad, i, 1)) return 1;
1675 			sLoad += ri.nLen;
1676 			continue;
1677 		}
1678 
1679 		if ((ri.nType & 7) == 3) {
1680 			if (BurnLoadRom(gLoad, i, 1)) return 1;
1681 			gLoad += ri.nLen;
1682 			continue;
1683 		}
1684 
1685 		if ((ri.nType & 7) == 4) {
1686 			UINT8 *tmp = (UINT8*)BurnMalloc(ri.nLen);
1687 			if (BurnLoadRom(tmp, i, 1)) return 1;
1688 			DrvVideoOrder(tmp);
1689 			BurnFree(tmp);
1690 			continue;
1691 		}
1692 
1693 		if ((ri.nType & 7) == 5) {
1694 			if (BurnLoadRom(DrvMCUROM, i, 1)) return 1;
1695 			has_mcu = 1;
1696 			continue;
1697 		}
1698 	}
1699 
1700 	return 0;
1701 }
1702 
CommonInit(INT32 coinstate,INT32 charramxor,INT32 kikstart)1703 static INT32 CommonInit(INT32 coinstate, INT32 charramxor, INT32 kikstart)
1704 {
1705 	AllMem = NULL;
1706 	MemIndex();
1707 	INT32 nLen = MemEnd - (UINT8 *)0;
1708 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1709 	memset(AllMem, 0, nLen);
1710 	MemIndex();
1711 
1712 	if (DrvLoadRoms()) return 1;
1713 
1714 	if (kikstart)
1715 	{
1716 		ZetInit(0);
1717 		ZetOpen(0);
1718 		ZetMapMemory(DrvZ80ROM0,		0x0000, 0x5fff, MAP_ROM);
1719 		ZetMapMemory(DrvZ80RAMA,		0x8000, 0x87ff, MAP_RAM);
1720 		ZetMapMemory(DrvColScroll,		0x8a00, 0x8aff, MAP_RAM); // 0-5f
1721 		ZetMapMemory(DrvCharRAM,		0x9000, 0xbfff, MAP_ROM); // Handler
1722 		ZetMapMemory(DrvZ80RAMB,		0xc000, 0xc3ff, MAP_RAM);
1723 		ZetMapMemory(DrvVidRAM1,		0xc400, 0xc7ff, MAP_RAM);
1724 		ZetMapMemory(DrvVidRAM2,		0xc800, 0xcbff, MAP_RAM);
1725 		ZetMapMemory(DrvVidRAM3,		0xcc00, 0xcfff, MAP_RAM);
1726 		ZetMapMemory(DrvSprRAM,			0xd100, 0xd1ff, MAP_RAM);
1727 		ZetMapMemory(DrvZ80RAMC,		0xd800, 0xdfff, MAP_RAM);
1728 		ZetMapMemory(DrvZ80ROM0 + 0xe000,	0xe000, 0xffff, MAP_ROM);
1729 		ZetSetWriteHandler(kikstart_main_write);
1730 		ZetSetReadHandler(taitosj_main_read);
1731 		ZetClose();
1732 	} else {
1733 		ZetInit(0);
1734 		ZetOpen(0);
1735 		ZetMapMemory(DrvZ80ROM0,		0x0000, 0x5fff, MAP_ROM);
1736 		ZetMapMemory(DrvZ80RAMA,		0x8000, 0x87ff, MAP_RAM);
1737 		ZetMapMemory(DrvCharRAM,		0x9000, 0xbfff, MAP_ROM); // Handler
1738 		ZetMapMemory(DrvZ80RAMB,		0xc000, 0xc3ff, MAP_RAM);
1739 		ZetMapMemory(DrvVidRAM1,		0xc400, 0xc7ff, MAP_RAM);
1740 		ZetMapMemory(DrvVidRAM2,		0xc800, 0xcbff, MAP_RAM);
1741 		ZetMapMemory(DrvVidRAM3,		0xcc00, 0xcfff, MAP_RAM);
1742 		ZetMapMemory(DrvColScroll,		0xd000, 0xd0ff, MAP_RAM); // 0-5f
1743 		ZetMapMemory(DrvSprRAM,			0xd100, 0xd1ff, MAP_RAM);
1744 		ZetMapMemory(DrvZ80ROM0 + 0xe000,	0xe000, 0xffff, MAP_ROM);
1745 		ZetSetWriteHandler(taitosj_main_write);
1746 		ZetSetReadHandler(taitosj_main_read);
1747 		ZetClose();
1748 	}
1749 
1750 	ZetInit(1);
1751 	ZetOpen(1);
1752 	ZetMapMemory(DrvZ80ROM1,		0x0000, 0x3fff, MAP_ROM);
1753 	ZetMapMemory(DrvZ80RAM1,		0x4000, 0x43ff, MAP_RAM);
1754 	ZetMapMemory(DrvZ80ROM1 + 0xe000,	0xe000, 0xefff, MAP_ROM);
1755 	ZetSetWriteHandler(taitosj_sound_write);
1756 	ZetSetReadHandler(taitosj_sound_read);
1757 	ZetClose();
1758 
1759 	m6805Init(1, 0x800 /*max memory range - page size is max range / 0x100*/);
1760 	m6805Open(0);
1761 	m6805MapMemory(DrvMCURAM + 0x08, 	0x0008, 0x007f, MAP_RAM);
1762 	m6805MapMemory(DrvMCUROM + 0x80,	0x0080, 0x07ff, MAP_ROM);
1763 	m6805SetWriteHandler(m67805_mcu_write);
1764 	m6805SetReadHandler(m67805_mcu_read);
1765 	m6805Close();
1766 
1767 	BurnWatchdogInit(DrvDoReset, 180);
1768 
1769 	DACInit(0, 0, 1, ZetTotalCycles, 3000000);
1770 	DACSetRoute(0, 0.15, BURN_SND_ROUTE_BOTH);
1771 
1772 	AY8910Init(0, 1500000, 0);
1773 	AY8910Init(1, 1500000, 1);
1774 	AY8910Init(2, 1500000, 1);
1775 	AY8910Init(3, 1500000, 1);
1776 	AY8910SetPorts(0, &ay8910_0_port_A_r, &ay8910_0_port_B_r, NULL, NULL);
1777 	AY8910SetPorts(1, NULL, NULL, &ay8910_1_port_A_w, &ay8910_1_port_B_w);
1778 	AY8910SetPorts(2, NULL, NULL, &ay8910_2_port_A_w, NULL);
1779 	AY8910SetPorts(3, NULL, NULL, NULL, &ay8910_3_port_B_w);
1780 	AY8910SetAllRoutes(0, 0.12, BURN_SND_ROUTE_BOTH);
1781 	AY8910SetAllRoutes(1, 0.12, BURN_SND_ROUTE_BOTH);
1782 	AY8910SetAllRoutes(2, 0.12, BURN_SND_ROUTE_BOTH);
1783 	AY8910SetAllRoutes(3, 0.18, BURN_SND_ROUTE_BOTH);
1784 
1785 	coin_state = (coinstate) ? 0 : 0x10;
1786 	charram_xor = charramxor;
1787 
1788 	GenericTilesInit();
1789 
1790 	DrvDoReset(1);
1791 
1792 	return 0;
1793 }
1794 
DrvExit()1795 static INT32 DrvExit()
1796 {
1797 	GenericTilesExit();
1798 
1799 	ZetExit();
1800 	m6805Exit();
1801 
1802 	AY8910Exit(0);
1803 	AY8910Exit(1);
1804 	AY8910Exit(2);
1805 	AY8910Exit(3);
1806 	DACExit();
1807 
1808 	BurnFree(AllMem);
1809 
1810 	input2_xor = 0;
1811 	has_mcu = 0;
1812 	is_alpine = 0;
1813 	is_kikstart = 0;
1814 
1815 	return 0;
1816 }
1817 
DrvPaletteUpdate()1818 static void DrvPaletteUpdate()
1819 {
1820 	for (INT32 i = 0; i < 0x40; i++)
1821 	{
1822 		INT32 bit0 = (DrvPalRAM[(i * 2) + 1] >> 6) & 0x01;
1823 		INT32 bit1 = (DrvPalRAM[(i * 2) + 1] >> 7) & 0x01;
1824 		INT32 bit2 = (DrvPalRAM[(i * 2) + 0] >> 0) & 0x01;
1825 		INT32 r = (bit2 * 1000) + (bit1 * 470) + (bit0 * 270);
1826 
1827 		bit0 = (DrvPalRAM[(i * 2) + 1] >> 3) & 0x01;
1828 		bit1 = (DrvPalRAM[(i * 2) + 1] >> 4) & 0x01;
1829 		bit2 = (DrvPalRAM[(i * 2) + 1] >> 5) & 0x01;
1830 		INT32 g = (bit2 * 1000) + (bit1 * 470) + (bit0 * 270);
1831 
1832 		bit0 = (DrvPalRAM[(i * 2) + 1] >> 0) & 0x01;
1833 		bit1 = (DrvPalRAM[(i * 2) + 1] >> 1) & 0x01;
1834 		bit2 = (DrvPalRAM[(i * 2) + 1] >> 2) & 0x01;
1835 		INT32 b = (bit2 * 1000) + (bit1 * 470) + (bit0 * 270);
1836 
1837 		DrvPalette[i] = BurnHighCol((r * 255) / 1740, (g * 255) / 1740, (b * 255) / 1740,0);
1838 	}
1839 }
1840 
draw_layers()1841 static void draw_layers()
1842 {
1843 	GenericTilesSetClipRaw(0, 256, 0, 256);
1844 
1845 	memset (bitmap[0], 0, 256*256*2);
1846 	memset (bitmap[1], 0, 256*256*2);
1847 	memset (bitmap[2], 0, 256*256*2);
1848 
1849 	INT32 colbank0 = color_bank[0] & 7;
1850 	INT32 colbank1 =(color_bank[0] >> 4) & 7;
1851 	INT32 colbank2 = color_bank[1] & 7;
1852 
1853 	INT32 gfxbank0 = (color_bank[0] & 0x08) << 5;
1854 	INT32 gfxbank1 = (color_bank[0] & 0x80) << 1;
1855 	INT32 gfxbank2 = (color_bank[1] & 0x08) << 5;
1856 
1857 	for (INT32 offs = 0; offs < 32 * 32; offs++)
1858 	{
1859 		INT32 sx = (offs & 0x1f) * 8;
1860 		INT32 sy = (offs / 32) * 8;
1861 
1862 		if (global_flipx) sx = 248 - sx;
1863 		if (global_flipy) sy = 248 - sy;
1864 
1865 		if (global_flipy) {
1866 			if (global_flipx) {
1867 				Render8x8Tile_Mask_FlipXY(bitmap[0], DrvVidRAM1[offs] + gfxbank0, sx, sy, colbank0, 3, 0, 0, DrvGfxExp);
1868 				Render8x8Tile_Mask_FlipXY(bitmap[1], DrvVidRAM2[offs] + gfxbank1, sx, sy, colbank1, 3, 0, 0, DrvGfxExp);
1869 				Render8x8Tile_Mask_FlipXY(bitmap[2], DrvVidRAM3[offs] + gfxbank2, sx, sy, colbank2, 3, 0, 0, DrvGfxExp);
1870 			} else {
1871 				Render8x8Tile_Mask_FlipY(bitmap[0], DrvVidRAM1[offs] + gfxbank0, sx, sy, colbank0, 3, 0, 0, DrvGfxExp);
1872 				Render8x8Tile_Mask_FlipY(bitmap[1], DrvVidRAM2[offs] + gfxbank1, sx, sy, colbank1, 3, 0, 0, DrvGfxExp);
1873 				Render8x8Tile_Mask_FlipY(bitmap[2], DrvVidRAM3[offs] + gfxbank2, sx, sy, colbank2, 3, 0, 0, DrvGfxExp);
1874 			}
1875 		} else {
1876 			if (global_flipx) {
1877 				Render8x8Tile_Mask_FlipX(bitmap[0], DrvVidRAM1[offs] + gfxbank0, sx, sy, colbank0, 3, 0, 0, DrvGfxExp);
1878 				Render8x8Tile_Mask_FlipX(bitmap[1], DrvVidRAM2[offs] + gfxbank1, sx, sy, colbank1, 3, 0, 0, DrvGfxExp);
1879 				Render8x8Tile_Mask_FlipX(bitmap[2], DrvVidRAM3[offs] + gfxbank2, sx, sy, colbank2, 3, 0, 0, DrvGfxExp);
1880 			} else {
1881 				Render8x8Tile_Mask(bitmap[0], DrvVidRAM1[offs] + gfxbank0, sx, sy, colbank0, 3, 0, 0, DrvGfxExp);
1882 				Render8x8Tile_Mask(bitmap[1], DrvVidRAM2[offs] + gfxbank1, sx, sy, colbank1, 3, 0, 0, DrvGfxExp);
1883 				Render8x8Tile_Mask(bitmap[2], DrvVidRAM3[offs] + gfxbank2, sx, sy, colbank2, 3, 0, 0, DrvGfxExp);
1884 			}
1885 		}
1886 	}
1887 
1888 	GenericTilesClearClipRaw();
1889 }
1890 
draw_single_sprite(UINT16 * dest,INT32 code,INT32 color,INT32 sx,INT32 sy,INT32 flipx,INT32 flipy)1891 static void draw_single_sprite(UINT16 *dest, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy)
1892 {
1893 	if (flipy) {
1894 		if (flipx) {
1895 			Render8x8Tile_Mask_FlipXY_Clip(dest, code, sx, sy, color, 3, 0, 0, DrvGfxExp);
1896 		} else {
1897 			Render8x8Tile_Mask_FlipY_Clip(dest, code, sx, sy, color, 3, 0, 0, DrvGfxExp);
1898 		}
1899 	} else {
1900 		if (flipx) {
1901 			Render8x8Tile_Mask_FlipX_Clip(dest, code, sx, sy, color, 3, 0, 0, DrvGfxExp);
1902 		} else {
1903 			Render8x8Tile_Mask_Clip(dest, code, sx, sy, color, 3, 0, 0, DrvGfxExp);
1904 		}
1905 	}
1906 }
1907 
draw_one_sprite(UINT16 * dest,INT32 code,INT32 color,INT32 sx,INT32 sy,INT32 flipx,INT32 flipy)1908 static void draw_one_sprite(UINT16 *dest, INT32 code, INT32 color, INT32 sx, INT32 sy, INT32 flipx, INT32 flipy)
1909 {
1910 	if (flipy) {
1911 		if (flipx) {
1912 			draw_single_sprite(dest, code + 3, color, sx + 0, sy + 0, flipx, flipy);
1913 			draw_single_sprite(dest, code + 2, color, sx + 8, sy + 0, flipx, flipy);
1914 			draw_single_sprite(dest, code + 1, color, sx + 0, sy + 8, flipx, flipy);
1915 			draw_single_sprite(dest, code + 0, color, sx + 8, sy + 8, flipx, flipy);
1916 		} else {
1917 			draw_single_sprite(dest, code + 2, color, sx + 0, sy + 0, flipx, flipy);
1918 			draw_single_sprite(dest, code + 3, color, sx + 8, sy + 0, flipx, flipy);
1919 			draw_single_sprite(dest, code + 0, color, sx + 0, sy + 8, flipx, flipy);
1920 			draw_single_sprite(dest, code + 1, color, sx + 8, sy + 8, flipx, flipy);
1921 		}
1922 	} else {
1923 		if (flipx) {
1924 			draw_single_sprite(dest, code + 1, color, sx + 0, sy + 0, flipx, flipy);
1925 			draw_single_sprite(dest, code + 0, color, sx + 8, sy + 0, flipx, flipy);
1926 			draw_single_sprite(dest, code + 3, color, sx + 0, sy + 8, flipx, flipy);
1927 			draw_single_sprite(dest, code + 2, color, sx + 8, sy + 8, flipx, flipy);
1928 		} else {
1929 			draw_single_sprite(dest, code + 0, color, sx + 0, sy + 0, flipx, flipy);
1930 			draw_single_sprite(dest, code + 1, color, sx + 8, sy + 0, flipx, flipy);
1931 			draw_single_sprite(dest, code + 2, color, sx + 0, sy + 8, flipx, flipy);
1932 			draw_single_sprite(dest, code + 3, color, sx + 8, sy + 8, flipx, flipy);
1933 		}
1934 	}
1935 }
1936 
get_sprite_xy(INT32 which,UINT8 * sx,UINT8 * sy)1937 static inline INT32 get_sprite_xy(INT32 which, UINT8 * sx, UINT8* sy)
1938 {
1939 	INT32 offs = which * 4;
1940 
1941 	*sx =       DrvSprRAM[spriteram_bank + offs + 0] - 1;
1942 	*sy = 240 - DrvSprRAM[spriteram_bank + offs + 1];
1943 
1944 	return (*sy < 240);
1945 }
1946 
check_sprite_sprite_bitpattern(INT32 sx1,INT32 sy1,INT32 which1,INT32 sx2,INT32 sy2,INT32 which2)1947 static INT32 check_sprite_sprite_bitpattern(INT32 sx1, INT32 sy1, INT32 which1, INT32 sx2, INT32 sy2, INT32 which2)
1948 {
1949 	INT32 minx, miny, maxx = 16, maxy = 16;
1950 
1951 	INT32 offs1 = which1 * 4;
1952 	INT32 offs2 = which2 * 4;
1953 
1954 	if (sx1 < sx2)
1955 	{
1956 		sx2 -= sx1;
1957 		sx1 = 0;
1958 		minx = sx2;
1959 	}
1960 	else
1961 	{
1962 		sx1 -= sx2;
1963 		sx2 = 0;
1964 		minx = sx1;
1965 	}
1966 
1967 	if (sy1 < sy2)
1968 	{
1969 		sy2 -= sy1;
1970 		sy1 = 0;
1971 		miny = sy2;
1972 	}
1973 	else
1974 	{
1975 		sy1 -= sy2;
1976 		sy2 = 0;
1977 		miny = sy1;
1978 	}
1979 
1980 	memset (bitmap[4], 0, 32 * 32 * 2);
1981 	memset (bitmap[5], 0, 32 * 32 * 2);
1982 
1983 	GenericTilesSetClipRaw(0, 32, 0, 32);
1984 
1985 	INT32 code  = DrvSprRAM[spriteram_bank + offs1 + 3] & 0x7f;
1986 	INT32 flipx = DrvSprRAM[spriteram_bank + offs1 + 2] & 0x01;
1987 	INT32 flipy = DrvSprRAM[spriteram_bank + offs1 + 2] & 0x02;
1988 
1989 	draw_one_sprite(bitmap[4], code * 4, 0, sx1, sy1, flipx, flipy);
1990 
1991 	code  = DrvSprRAM[spriteram_bank + offs2 + 3] & 0x7f;
1992 	flipx = DrvSprRAM[spriteram_bank + offs2 + 2] & 0x01;
1993 	flipy = DrvSprRAM[spriteram_bank + offs2 + 2] & 0x02;
1994 
1995 	draw_one_sprite(bitmap[5], code * 4, 0, sx2, sy2, flipx, flipy);
1996 
1997 	GenericTilesClearClipRaw();
1998 
1999 	for (INT32 y = miny; y < maxy; y++)
2000 		for (INT32 x = minx; x < maxx; x++)
2001 			if ((bitmap[4][y*32+x] != 0) && (bitmap[5][y*32+x] != 0))
2002 				return 1;
2003 
2004 	return 0;
2005 }
2006 
check_sprite_sprite_collision()2007 static void check_sprite_sprite_collision()
2008 {
2009 	if (video_mode & 0x80)
2010 	{
2011 		for (INT32 which1 = 0; which1 < 0x20; which1++)
2012 		{
2013 			UINT8 sx1, sy1;
2014 
2015 			if ((which1 >= 0x10) && (which1 <= 0x17)) continue; // no sprites here
2016 
2017 			if (!get_sprite_xy(which1, &sx1, &sy1)) continue;
2018 
2019 			for (INT32 which2 = which1 + 1; which2 < 0x20; which2++)
2020 			{
2021 				UINT8 sx2, sy2;
2022 
2023 				if ((which2 >= 0x10) && (which2 <= 0x17)) continue;   // no sprites here
2024 
2025 				if (!get_sprite_xy(which2, &sx2, &sy2)) continue;
2026 
2027 				if ((abs((INT8)sx1 - (INT8)sx2) < 16) && (abs((INT8)sy1 - (INT8)sy2) < 16))
2028 				{
2029 					if (!check_sprite_sprite_bitpattern(sx1, sy1, which1, sx2, sy2, which2))  continue;
2030 
2031 					if (which2 == 0x1f)
2032 					{
2033 						INT32 reg = which1 >> 3;
2034 						if (reg == 3)  reg = 2;
2035 
2036 						collision_reg[reg] |= (1 << (which1 & 0x07));
2037 					}
2038 					else
2039 					{
2040 						INT32 reg = which2 >> 3;
2041 						if (reg == 3)  reg = 2;
2042 
2043 						collision_reg[reg] |= (1 << (which2 & 0x07));
2044 					}
2045 				}
2046 			}
2047 		}
2048 	}
2049 }
2050 
draw_sprites()2051 static void draw_sprites()
2052 {
2053 	if (video_mode & 0x80)
2054 	{
2055 		for (INT32 sprite = 0x1f; sprite >= 0; sprite--)
2056 		{
2057 			UINT8 sx, sy;
2058 			INT32 which = (sprite - 1) & 0x1f;
2059 			INT32 offs = which * 4;
2060 
2061 			if ((which >= 0x10) && (which <= 0x17)) continue;   // no sprites here */
2062 
2063 			if (get_sprite_xy(which, &sx, &sy))
2064 			{
2065 				INT32 code = DrvSprRAM[spriteram_bank + offs + 3] & 0x7f;
2066 				INT32 color = 2 * ((color_bank[1] >> 4) & 0x03) + ((DrvSprRAM[spriteram_bank + offs + 2] >> 2) & 0x01);
2067 				INT32 flipx = DrvSprRAM[spriteram_bank + offs + 2] & 0x01;
2068 				INT32 flipy = DrvSprRAM[spriteram_bank + offs + 2] & 0x02;
2069 
2070 				if (global_flipx)
2071 				{
2072 					sx = 238 - sx;
2073 					flipx = !flipx;
2074 				}
2075 
2076 				if (global_flipy)
2077 				{
2078 					sy = 242 - sy;
2079 					flipy = !flipy;
2080 				}
2081 
2082 				code *= 4;
2083 
2084 				// note -16 for removing rows
2085 				draw_one_sprite(pTransDraw, code, color, sx, sy - 16, flipx, flipy);
2086 				draw_one_sprite(pTransDraw, code, color, sx - 0x100, sy - 16, flipx, flipy); // wrap
2087 			}
2088 		}
2089 	}
2090 }
2091 
copyscrollbitmap(UINT16 * dest,UINT16 * src,INT32 rows,INT32 * scrollx,INT32 cols,INT32 * scrolly,INT32 * area,INT32 transparent)2092 static void copyscrollbitmap(UINT16 *dest, UINT16 *src, INT32 rows, INT32 *scrollx, INT32 cols, INT32 *scrolly, INT32 *area, INT32 transparent)
2093 {
2094 	INT32 minx = area[0];
2095 	INT32 maxx = area[1];
2096 	INT32 miny = area[2];
2097 	INT32 maxy = area[3];
2098 
2099 	INT32 shifty = 0;
2100 
2101 	if (transparent == 0) // hacky - remove top and bottom rows
2102 	{
2103 		if (miny < 16) miny = 16;
2104 		if (maxy > 240) maxy = 240;
2105 
2106 		shifty = 16;
2107 	}
2108 
2109 	for (INT32 y = miny; y < maxy; y++)
2110 	{
2111 		for (INT32 x = minx; x < maxx; x++)
2112 		{
2113 			UINT8 sx = x - scrollx[y/(256/rows)];
2114 			UINT8 sy = y - scrolly[sx/(256/cols)];
2115 
2116 			UINT16 pxl = src[sy * 256 + sx];
2117 
2118 			if (pxl != transparent)
2119 				dest[(y - shifty) * 256 + x] = pxl;
2120 		}
2121 	}
2122 }
2123 
taitosj_copy_layer(INT32 which,INT32 * sprites_on,INT32 * sprite_areas)2124 static void taitosj_copy_layer(INT32 which, INT32 *sprites_on, INT32 *sprite_areas)
2125 {
2126 	static const INT32 fudge1[3] = { 3,  1, -1 };
2127 	static const INT32 fudge2[3] = { 8, 10, 12 };
2128 
2129 	INT32 area[4] = { 0, 256, 0, 256 };
2130 
2131 	if (video_mode & (1 << (which+4)))
2132 	{
2133 		INT32 scrolly[32];
2134 		INT32 scrollx = scroll[2 * which];
2135 
2136 		if (video_mode & 0x01)
2137 			scrollx =  (scrollx & 0xf8) + ((scrollx + fudge1[which]) & 7) + fudge2[which];
2138 		else
2139 			scrollx = -(scrollx & 0xf8) + ((scrollx + fudge1[which]) & 7) + fudge2[which];
2140 
2141 		if (video_mode & 0x02)
2142 			for (INT32 i = 0;i < 32;i++)
2143 				scrolly[31 - i] =  DrvColScroll[32 * which + i] + scroll[2 * which + 1];
2144 		else
2145 			for (INT32 i = 0;i < 32;i++)
2146 				scrolly[i]      = -DrvColScroll[32 * which + i] - scroll[2 * which + 1];
2147 
2148 		copyscrollbitmap(pTransDraw, bitmap[which], 1, &scrollx, 32, scrolly, area, 0);
2149 
2150 		for (INT32 i = 0; i < 0x20; i++)
2151 		{
2152 			if ((i >= 0x10) && (i <= 0x17)) continue; /* no sprites here */
2153 
2154 			if (sprites_on[i])
2155 				copyscrollbitmap(bitmap[6+which], bitmap[which], 1, &scrollx, 32, scrolly, sprite_areas + i * 4, -1);
2156 		}
2157 	}
2158 }
2159 
kikstart_copy_layer(int which,int * sprites_on,INT32 * sprite_areas)2160 static void kikstart_copy_layer(int which, int *sprites_on, INT32 *sprite_areas)
2161 {
2162 	INT32 area[4] = { 0, 256, 0, 256 };
2163 
2164 	if (video_mode & (1 << (which+4)))
2165 	{
2166 		INT32 scrollx[32 * 8];
2167 
2168 		for (INT32 i = 1; i < 32*8; i++) {
2169 			if (video_mode & 2) {
2170 				switch (which)
2171 				{
2172 					case 0: scrollx[32 * 8 - i] = 0 ;break;
2173 					case 1: scrollx[32 * 8 - i] = DrvZ80RAMC[i] + ((scroll[2 * which] + 0x0a) & 0xff);break;
2174 					case 2: scrollx[32 * 8 - i] = DrvZ80RAMC[0x100 + i] + ((scroll[2 * which] + 0xc) & 0xff);break;
2175 				}
2176 			} else {
2177 				switch (which)
2178 				{
2179 					case 0: scrollx[i] = 0 ;break;
2180 					case 1: scrollx[i] = 0xff - DrvZ80RAMC[i - 1] - ((scroll[2 * which] - 0x10) & 0xff);break;
2181 					case 2: scrollx[i] = 0xff - DrvZ80RAMC[0x100 + i - 1] - ((scroll[2 * which] - 0x12) & 0xff);break;
2182 				}
2183 			}
2184 		}
2185 
2186 		INT32 scrolly = scroll[2 * which + 1];
2187 
2188 		copyscrollbitmap(pTransDraw, bitmap[which], 256, scrollx, 1, &scrolly, area, 0);
2189 
2190 		for (INT32 i = 0; i < 0x20; i++)
2191 		{
2192 			if ((i >= 0x10) && (i <= 0x17)) continue; /* no sprites here */
2193 
2194 			if (sprites_on[i])
2195 				copyscrollbitmap(bitmap[6+which], bitmap[which], 256, scrollx, 1, &scrolly, sprite_areas + i * 4, -1);
2196 		}
2197 	}
2198 }
2199 
copy_layers(void (* copy_func)(INT32 which,INT32 * sprites_on,INT32 * sprite_areas),INT32 * sprites_on,INT32 * sprite_areas)2200 static void copy_layers(void (*copy_func)(INT32 which, INT32 *sprites_on, INT32 *sprite_areas), INT32 *sprites_on, INT32 *sprite_areas)
2201 {
2202 	BurnTransferClear(8 * (color_bank[1] & 7));
2203 
2204 	for (INT32 i = 0; i < 4; i++)
2205 	{
2206 		INT32 which = draw_order[video_priority & 0x1f][i];
2207 
2208 		if (which == 0)
2209 		{
2210 			draw_sprites();
2211 		}
2212 		else
2213 			copy_func(which - 1, sprites_on, sprite_areas);
2214 	}
2215 }
2216 
check_sprite_layer_bitpattern(int which,INT32 * sprite_areas)2217 static INT32 check_sprite_layer_bitpattern(int which, INT32 *sprite_areas)
2218 {
2219 	INT32 offs = which * 4;
2220 	INT32 result = 0;  // no collisions
2221 
2222 	INT32 check_layer_1 = video_mode & 0x10;
2223 	INT32 check_layer_2 = video_mode & 0x20;
2224 	INT32 check_layer_3 = video_mode & 0x40;
2225 
2226 	INT32 minx = sprite_areas[which*4+0];
2227 	INT32 miny = sprite_areas[which*4+2];
2228 	INT32 maxx = sprite_areas[which*4+1] + 1;
2229 	INT32 maxy = sprite_areas[which*4+3] + 1;
2230 
2231 	INT32 code = DrvSprRAM[spriteram_bank + offs + 3] & 0x7f;
2232 	INT32 flip_x = (DrvSprRAM[spriteram_bank + offs + 2] & 0x01) ^ global_flipx;
2233 	INT32 flip_y = (DrvSprRAM[spriteram_bank + offs + 2] & 0x02) ^ global_flipy;
2234 
2235 	GenericTilesSetClipRaw(0, 32, 0, 32);
2236 	memset (bitmap[4], 0, 32*32*2);
2237 	draw_one_sprite(bitmap[4], code*4, 0, 0, 0, flip_x, flip_y);
2238 	GenericTilesClearClipRaw();
2239 
2240 	for (INT32 y = miny; y < maxy; y++) {
2241 		for (INT32 x = minx; x < maxx; x++) {
2242 			if (bitmap[4][(y - miny) * 32 + (x - minx)] != 0) // is there anything to check for ?
2243 			{
2244 				if (check_layer_1 && bitmap[6][y*256+x] != 0) result |= 0x01;  // collided with layer 1
2245 				if (check_layer_2 && bitmap[7][y*256+x] != 0) result |= 0x02;  // collided with layer 2
2246 				if (check_layer_3 && bitmap[8][y*256+x] != 0) result |= 0x04;  // collided with layer 3
2247 			}
2248 		}
2249 	}
2250 
2251 	return result;
2252 }
2253 
check_sprite_layer_collision(int * sprites_on,INT32 * sprite_areas)2254 static void check_sprite_layer_collision(int *sprites_on, INT32 *sprite_areas)
2255 {
2256 	if (video_mode & 0x80)
2257 	{
2258 		for (INT32 which = 0; which < 0x20; which++)
2259 		{
2260 			if ((which >= 0x10) && (which <= 0x17)) continue;
2261 
2262 			if (sprites_on[which])
2263 				collision_reg[3] |= check_sprite_layer_bitpattern(which, sprite_areas);
2264 		}
2265 	}
2266 }
2267 
calculate_sprite_areas(int * sprites_on,INT32 * sprite_areas)2268 static void calculate_sprite_areas(int *sprites_on, INT32 *sprite_areas)
2269 {
2270 	INT32 width = 256;
2271 	INT32 height = 256;
2272 
2273 	for (INT32 which = 0; which < 0x20; which++)
2274 	{
2275 		UINT8 sx, sy;
2276 
2277 		if ((which >= 0x10) && (which <= 0x17)) continue;
2278 
2279 		if (get_sprite_xy(which, &sx, &sy))
2280 		{
2281 			int minx, miny, maxx, maxy;
2282 
2283 			if (video_mode & 0x01)
2284 				sx = 238 - sx;
2285 
2286 			if (video_mode & 0x02)
2287 				sy = 242 - sy;
2288 
2289 			minx = sx;
2290 			miny = sy;
2291 
2292 			maxx = minx + 15;
2293 			maxy = miny + 15;
2294 
2295 			if (minx < 0) minx = 0;
2296 			if (miny < 0) miny = 0;
2297 			if (maxx >= width - 1)
2298 				maxx = width - 1;
2299 			if (maxy >= height - 1)
2300 				maxy = height - 1;
2301 
2302 			sprite_areas[which*4+0] = minx;
2303 			sprite_areas[which*4+1] = maxx;
2304 			sprite_areas[which*4+2] = miny;
2305 			sprite_areas[which*4+3] = maxy;
2306 
2307 			sprites_on[which] = 1;
2308 		}
2309 		else
2310 			sprites_on[which] = 0;
2311 	}
2312 }
2313 
DrvDraw()2314 static INT32 DrvDraw()
2315 {
2316 	//if (DrvRecalc) {
2317 		DrvPaletteUpdate();
2318 		DrvRecalc = 1;
2319 	//}
2320 
2321 	INT32 sprites_on[0x20];
2322 	INT32 sprite_areas[0x20*4];  // minx, maxx, miny, maxy
2323 
2324 	global_flipx = video_mode & 0x01;
2325 	global_flipy = video_mode & 0x02;
2326 	spriteram_bank = (video_mode & 0x04) ? 0x80 : 0x00;
2327 
2328 	draw_layers();
2329 
2330 	calculate_sprite_areas(sprites_on, sprite_areas);
2331 
2332 	copy_layers(taitosj_copy_layer, sprites_on, sprite_areas);
2333 
2334 	check_sprite_sprite_collision();
2335 
2336 	check_sprite_layer_collision(sprites_on, sprite_areas);
2337 
2338 	BurnTransferCopy(DrvPalette);
2339 
2340 	return 0;
2341 }
2342 
KikstartDraw()2343 static INT32 KikstartDraw()
2344 {
2345 	//if (DrvRecalc) {
2346 		DrvPaletteUpdate();
2347 		DrvRecalc = 1;
2348 	//}
2349 
2350 	INT32 sprites_on[0x20];
2351 	INT32 sprite_areas[0x20*4];  // minx, maxx, miny, maxy
2352 
2353 	global_flipx = video_mode & 0x01;
2354 	global_flipy = video_mode & 0x02;
2355 	spriteram_bank = (video_mode & 0x04) ? 0x80 : 0x00;
2356 
2357 	draw_layers();
2358 
2359 	calculate_sprite_areas(sprites_on, sprite_areas);
2360 
2361 	copy_layers(kikstart_copy_layer, sprites_on, sprite_areas);
2362 
2363 	check_sprite_sprite_collision();
2364 
2365 	check_sprite_layer_collision(sprites_on, sprite_areas);
2366 
2367 	BurnTransferCopy(DrvPalette);
2368 
2369 	return 0;
2370 }
2371 
DrvFrame()2372 static INT32 DrvFrame()
2373 {
2374 	BurnWatchdogUpdate();
2375 
2376 	if (DrvReset) {
2377 		DrvDoReset(1);
2378 	}
2379 
2380 	ZetNewFrame();
2381 	m6805NewFrame();
2382 
2383 	{
2384 		UINT8 Last5 = DrvInputs[5]; // kikstart gear shifter
2385 		UINT8 Last6 = DrvInputs[6]; // kikstart gear shifter
2386 
2387 		memset (DrvInputs, 0xff, 5);
2388 
2389 		DrvInputs[2] ^= input2_xor; // protection
2390 		DrvInputs[3] &= ~coin_state;
2391 		DrvInputs[4] &= 0x0f;
2392 
2393 		DrvInputs[5] = 0; // gear shifter
2394 		DrvInputs[6] = 0; // gear shifter
2395 
2396 		for (INT32 i = 0; i < 8; i++) {
2397 			DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
2398 			DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
2399 			DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
2400 			DrvInputs[3] ^= (DrvJoy4[i] & 1) << i;
2401 			DrvInputs[4] ^= (DrvJoy5[i] & 1) << i;
2402 			DrvInputs[5] ^= (DrvJoyF0[i] & 1) << i; // Fake Inputs for kikstart
2403 			DrvInputs[6] ^= (DrvJoyF1[i] & 1) << i;
2404 		}
2405 
2406 		if (is_kikstart) {
2407 			if (DrvInputs[5]&1 && ~Last5&1) if (kikstart_gears[0] > 0) kikstart_gears[0]--;
2408 			if (DrvInputs[5]&2 && ~Last5&2) if (kikstart_gears[0] < 2) kikstart_gears[0]++;
2409 
2410 			if (DrvInputs[6]&1 && ~Last6&1) if (kikstart_gears[1] > 0) kikstart_gears[1]--;
2411 			if (DrvInputs[6]&2 && ~Last6&2) if (kikstart_gears[1] < 2) kikstart_gears[1]++;
2412 
2413 			DrvInputs[3] = (DrvInputs[3] & ~(3|8)) | (kikstart_gears[0] ^ 2) | (kikstart_gears[0] >> 1); // 0,1,2 -> 2,3,1
2414 			DrvInputs[4] = (DrvInputs[4] & ~(3|8)) | (kikstart_gears[1] ^ 2) | (kikstart_gears[1] >> 1);
2415 		}
2416 	}
2417 
2418 	INT32 nInterleave = 256;
2419 	INT32 nCyclesTotal[3] = { 4000000 / 60, 3000000 / 60, 3000000 / 4 / 60 };
2420 	INT32 nCyclesDone[3] = { 0, 0, 0 };
2421 	INT32 nSoundBufferPos = 0;
2422 
2423 	m6805Open(0);
2424 
2425 	for (INT32 i = 0; i < nInterleave; i++)
2426 	{
2427 		ZetOpen(0);
2428 		nCyclesDone[0] += ZetRun(nCyclesTotal[0] / nInterleave);
2429 		if (i == (nInterleave - 1)) ZetSetIRQLine(0, CPU_IRQSTATUS_HOLD);
2430 		INT32 cycles = (ZetTotalCycles() * 3) / 4;
2431 		ZetClose();
2432 
2433 		ZetOpen(1);
2434 		nCyclesDone[1] += ZetRun(cycles - ZetTotalCycles());
2435 		if (sound_irq_timer == 419) ZetSetIRQLine(0, CPU_IRQSTATUS_HOLD); // 36HZ
2436 		ZetClose();
2437 
2438 		if (has_mcu) {
2439 			ZetOpen(0);
2440 			nCyclesDone[2] += m6805Run((cycles / 4) - m6805TotalCycles());
2441 			ZetClose();
2442 		}
2443 
2444 		sound_irq_timer++;
2445 		if (sound_irq_timer == 420)
2446 			sound_irq_timer = 0;
2447 
2448 		if (pBurnSoundOut && i&1) {
2449 			INT32 nSegmentLength = nBurnSoundLen / (nInterleave/2);
2450 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2451 			AY8910Render(pSoundBuf, nSegmentLength);
2452 			nSoundBufferPos += nSegmentLength;
2453 		}
2454 	}
2455 
2456 	m6805Close();
2457 
2458 	ZetOpen(1);
2459 
2460 	if (pBurnSoundOut) {
2461 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
2462 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
2463 		if (nSegmentLength) {
2464 			AY8910Render(pSoundBuf, nSegmentLength);
2465 		}
2466 		DACUpdate(pBurnSoundOut, nBurnSoundLen);
2467 	}
2468 
2469 	ZetClose();
2470 
2471 	if (pBurnDraw) {
2472 		BurnDrvRedraw();
2473 	}
2474 
2475 	return 0;
2476 }
2477 
DrvScan(INT32 nAction,INT32 * pnMin)2478 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
2479 {
2480 	struct BurnArea ba;
2481 
2482 	if (pnMin) {
2483 		*pnMin = 0x029702;
2484 	}
2485 
2486 	if (nAction & ACB_VOLATILE) {
2487 		memset(&ba, 0, sizeof(ba));
2488 
2489 		ba.Data	  = AllRam;
2490 		ba.nLen	  = RamEnd - AllRam;
2491 		ba.szName = "All Ram";
2492 		BurnAcb(&ba);
2493 
2494 		ZetScan(nAction);
2495 		AY8910Scan(nAction, pnMin);
2496 		DACScan(nAction, pnMin);
2497 		BurnWatchdogScan(nAction);
2498 
2499 		SCAN_VAR(video_priority);
2500 		SCAN_VAR(scroll);
2501 		SCAN_VAR(color_bank);
2502 		SCAN_VAR(gfxpointer);
2503 		SCAN_VAR(soundlatch);
2504 		SCAN_VAR(video_mode);
2505 		SCAN_VAR(collision_reg);
2506 		SCAN_VAR(rom_bank);
2507 		SCAN_VAR(sound_nmi_disable);
2508 		SCAN_VAR(input_port_data);
2509 		SCAN_VAR(protection_value);
2510 		SCAN_VAR(dac_volume);
2511 		SCAN_VAR(dac_out_data);
2512 		SCAN_VAR(toz80);
2513 		SCAN_VAR(fromz80);
2514 		SCAN_VAR(mcu_address);
2515 		SCAN_VAR(portA_in);
2516 		SCAN_VAR(portA_out);
2517 		SCAN_VAR(zready);
2518 		SCAN_VAR(zaccept);
2519 		SCAN_VAR(busreq);
2520 		SCAN_VAR(sound_irq_timer);
2521 		SCAN_VAR(kikstart_gears);
2522 	}
2523 
2524 	if (nAction & ACB_WRITE) {
2525 		ZetOpen(0);
2526 		bankswitch(rom_bank);
2527 		ZetClose();
2528 
2529 		for (INT32 i = 0; i < 0x3000; i++) {
2530 			ram_decode(i);
2531 		}
2532 	}
2533 
2534 	return 0;
2535 }
2536 
2537 
2538 // Space Seeker
2539 
2540 static struct BurnRomInfo spaceskrRomDesc[] = {
2541 	{ "eb01",				0x1000, 0x92345b05, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2542 	{ "eb02",				0x1000, 0xa3e21420, 1 | BRF_PRG | BRF_ESS }, //  1
2543 	{ "eb03",				0x1000, 0xa077c52f, 1 | BRF_PRG | BRF_ESS }, //  2
2544 	{ "eb04",				0x1000, 0x440030cf, 1 | BRF_PRG | BRF_ESS }, //  3
2545 	{ "eb05",				0x1000, 0xb0d396ab, 1 | BRF_PRG | BRF_ESS }, //  4
2546 	{ "eb06",				0x1000, 0x371d2f7a, 1 | BRF_PRG | BRF_ESS }, //  5
2547 	{ "eb07",				0x1000, 0x13e667c4, 1 | BRF_PRG | BRF_ESS }, //  6
2548 	{ "eb08",				0x1000, 0xf2e84015, 1 | BRF_PRG | BRF_ESS }, //  7
2549 
2550 	{ "eb13",				0x1000, 0x192f6536, 2 | BRF_PRG | BRF_ESS }, //  8 Sound Z80 Code
2551 	{ "eb14",				0x1000, 0xd04d0a21, 2 | BRF_PRG | BRF_ESS }, //  9
2552 	{ "eb15",				0x1000, 0x88194305, 2 | BRF_PRG | BRF_ESS }, // 10
2553 
2554 	{ "eb09",				0x1000, 0x77af540e, 3 | BRF_GRA },           // 11 Graphics data
2555 	{ "eb10",				0x1000, 0xb10073de, 3 | BRF_GRA },           // 12
2556 	{ "eb11",				0x1000, 0xc7954bd1, 3 | BRF_GRA },           // 13
2557 	{ "eb12",				0x1000, 0xcd6c087b, 3 | BRF_GRA },           // 14
2558 
2559 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 15 Layer Priority
2560 };
2561 
2562 STD_ROM_PICK(spaceskr)
STD_ROM_FN(spaceskr)2563 STD_ROM_FN(spaceskr)
2564 
2565 static INT32 spaceskrInit()
2566 {
2567 	return CommonInit(0, 0, 0);
2568 }
2569 
2570 struct BurnDriver BurnDrvSpaceskr = {
2571 	"spaceskr", NULL, NULL, NULL, "1981",
2572 	"Space Seeker\0", NULL, "Taito Corporation", "Taito SJ System",
2573 	NULL, NULL, NULL, NULL,
2574 	BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0,
2575 	NULL, spaceskrRomInfo, spaceskrRomName, NULL, NULL, NULL, NULL, TwoButtonInputInfo, SpaceskrDIPInfo,
2576 	spaceskrInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2577 	256, 224, 4, 3
2578 };
2579 
2580 
2581 // Space Cruiser
2582 
2583 static struct BurnRomInfo spacecrRomDesc[] = {
2584 	{ "cg01.69",			0x1000, 0x2fe28b71, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2585 	{ "cg02.68",			0x1000, 0x88f4f856, 1 | BRF_PRG | BRF_ESS }, //  1
2586 	{ "cg03.67",			0x1000, 0x2223319c, 1 | BRF_PRG | BRF_ESS }, //  2
2587 	{ "cg04.66",			0x1000, 0x4daeb8b5, 1 | BRF_PRG | BRF_ESS }, //  3
2588 	{ "cg05.65",			0x1000, 0xcdc40ca0, 1 | BRF_PRG | BRF_ESS }, //  4
2589 	{ "cg06.64",			0x1000, 0x2cc6b4c0, 1 | BRF_PRG | BRF_ESS }, //  5
2590 	{ "cg07.55",			0x1000, 0xe4c8780a, 1 | BRF_PRG | BRF_ESS }, //  6
2591 	{ "cg08.54",			0x1000, 0x2c23ff4d, 1 | BRF_PRG | BRF_ESS }, //  7
2592 	{ "cg09.53",			0x1000, 0x3c8bb95e, 1 | BRF_PRG | BRF_ESS }, //  8
2593 	{ "cg10.52",			0x1000, 0x0ff17fce, 1 | BRF_PRG | BRF_ESS }, //  9
2594 
2595 	{ "cg17.70",			0x1000, 0x53486204, 2 | BRF_PRG | BRF_ESS }, // 10 Sound Z80 Code
2596 	{ "cg18.71",			0x1000, 0xd1acf96c, 2 | BRF_PRG | BRF_ESS }, // 11
2597 	{ "cg19.72",			0x1000, 0xffd27215, 2 | BRF_PRG | BRF_ESS }, // 12
2598 
2599 	{ "cg11.1",				0x1000, 0x1e4ae527, 3 | BRF_GRA },           // 13 Graphics data
2600 	{ "cg12.2",				0x1000, 0xaa57b616, 3 | BRF_GRA },           // 14
2601 	{ "cg13.3",				0x1000, 0x945a1b69, 3 | BRF_GRA },           // 15
2602 	{ "cg14.4",				0x1000, 0x1a29d06b, 3 | BRF_GRA },           // 16
2603 	{ "cg15.5",				0x1000, 0x656f9713, 3 | BRF_GRA },           // 17
2604 	{ "cg16.6",				0x1000, 0xe2c0d585, 3 | BRF_GRA },           // 18
2605 
2606 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 19 Layer Priority
2607 };
2608 
2609 STD_ROM_PICK(spacecr)
STD_ROM_FN(spacecr)2610 STD_ROM_FN(spacecr)
2611 
2612 static INT32 spacecrInit()
2613 {
2614 	return CommonInit(1, 0, 0);
2615 }
2616 
2617 struct BurnDriver BurnDrvSpacecr = {
2618 	"spacecr", NULL, NULL, NULL, "1981",
2619 	"Space Cruiser\0", NULL, "Taito Corporation", "Taito SJ System",
2620 	NULL, NULL, NULL, NULL,
2621 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0,
2622 	NULL, spacecrRomInfo, spacecrRomName, NULL, NULL, NULL, NULL, TwoButtonLRInputInfo, SpacecrDIPInfo,
2623 	spacecrInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2624 	224, 256, 3, 4
2625 };
2626 
2627 
2628 // Jungle King (Japan)
2629 
2630 static struct BurnRomInfo junglekRomDesc[] = {
2631 	{ "kn21-1.bin",			0x1000, 0x45f55d30, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2632 	{ "kn22-1.bin",			0x1000, 0x07cc9a21, 1 | BRF_PRG | BRF_ESS }, //  1
2633 	{ "kn43.bin",			0x1000, 0xa20e5a48, 1 | BRF_PRG | BRF_ESS }, //  2
2634 	{ "kn24.bin",			0x1000, 0x19ea7f83, 1 | BRF_PRG | BRF_ESS }, //  3
2635 	{ "kn25.bin",			0x1000, 0x844365ea, 1 | BRF_PRG | BRF_ESS }, //  4
2636 	{ "kn46.bin",			0x1000, 0x27a95fd5, 1 | BRF_PRG | BRF_ESS }, //  5
2637 	{ "kn47.bin",			0x1000, 0x5c3199e0, 1 | BRF_PRG | BRF_ESS }, //  6
2638 	{ "kn28.bin",			0x1000, 0x194a2d09, 9 | BRF_PRG | BRF_ESS }, //  7
2639 	{ "kn60.bin",			0x1000, 0x1a9c0a26, 1 | BRF_PRG | BRF_ESS }, //  8
2640 
2641 	{ "kn37.bin",			0x1000, 0xdee7f5d4, 2 | BRF_PRG | BRF_ESS }, //  9 Sound Z80 Code
2642 	{ "kn38.bin",			0x1000, 0xbffd3d21, 2 | BRF_PRG | BRF_ESS }, // 10
2643 	{ "kn59-1.bin",			0x1000, 0xcee485fc, 2 | BRF_PRG | BRF_ESS }, // 11
2644 
2645 	{ "kn29.bin",			0x1000, 0x8f83c290, 3 | BRF_GRA },           // 12 Graphics data
2646 	{ "kn30.bin",			0x1000, 0x89fd19f1, 3 | BRF_GRA },           // 13
2647 	{ "kn51.bin",			0x1000, 0x70e8fc12, 3 | BRF_GRA },           // 14
2648 	{ "kn52.bin",			0x1000, 0xbcbac1a3, 3 | BRF_GRA },           // 15
2649 	{ "kn53.bin",			0x1000, 0xb946c87d, 3 | BRF_GRA },           // 16
2650 	{ "kn34.bin",			0x1000, 0x320db2e1, 3 | BRF_GRA },           // 17
2651 	{ "kn55.bin",			0x1000, 0x70aef58f, 3 | BRF_GRA },           // 18
2652 	{ "kn56.bin",			0x1000, 0x932eb667, 3 | BRF_GRA },           // 19
2653 
2654 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 20 Layer Priority
2655 };
2656 
2657 STD_ROM_PICK(junglek)
STD_ROM_FN(junglek)2658 STD_ROM_FN(junglek)
2659 
2660 static INT32 junglekInit()
2661 {
2662 	return CommonInit(0, 0, 0);
2663 }
2664 
2665 struct BurnDriver BurnDrvJunglek = {
2666 	"junglek", NULL, NULL, NULL, "1982",
2667 	"Jungle King (Japan)\0", NULL, "Taito Corporation", "Taito SJ System",
2668 	NULL, NULL, NULL, NULL,
2669 	BDF_GAME_WORKING | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM | GBF_ACTION, 0,
2670 	NULL, junglekRomInfo, junglekRomName, NULL, NULL, NULL, NULL, OneButtonInputInfo, JunglekDIPInfo,
2671 	junglekInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2672 	256, 224, 4, 3
2673 };
2674 
2675 
2676 // Jungle King (alternate sound)
2677 
2678 static struct BurnRomInfo junglekasRomDesc[] = {
2679 	{ "kn21-1.bin",			0x1000, 0x45f55d30, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2680 	{ "kn22-1.bin",			0x1000, 0x07cc9a21, 1 | BRF_PRG | BRF_ESS }, //  1
2681 	{ "kn43.bin",			0x1000, 0xa20e5a48, 1 | BRF_PRG | BRF_ESS }, //  2
2682 	{ "kn24.bin",			0x1000, 0x19ea7f83, 1 | BRF_PRG | BRF_ESS }, //  3
2683 	{ "kn25.bin",			0x1000, 0x844365ea, 1 | BRF_PRG | BRF_ESS }, //  4
2684 	{ "kn46.bin",			0x1000, 0x27a95fd5, 1 | BRF_PRG | BRF_ESS }, //  5
2685 	{ "kn47.bin",			0x1000, 0x5c3199e0, 1 | BRF_PRG | BRF_ESS }, //  6
2686 	{ "kn28.bin",			0x1000, 0x194a2d09, 9 | BRF_PRG | BRF_ESS }, //  7
2687 	{ "kn60.bin",			0x1000, 0x1a9c0a26, 1 | BRF_PRG | BRF_ESS }, //  8
2688 
2689 	{ "kn-a17.bin",			0x1000, 0x62f6763a, 2 | BRF_PRG | BRF_ESS }, //  9 Sound Z80 Code
2690 	{ "kn-a18.bin",			0x1000, 0x8a813a7c, 2 | BRF_PRG | BRF_ESS }, // 10
2691 	{ "kn-a19.bin",			0x1000, 0xabbe4ae5, 2 | BRF_PRG | BRF_ESS }, // 11
2692 
2693 	{ "kn29.bin",			0x1000, 0x8f83c290, 3 | BRF_GRA },           // 12 Graphics data
2694 	{ "kn30.bin",			0x1000, 0x89fd19f1, 3 | BRF_GRA },           // 13
2695 	{ "kn51.bin",			0x1000, 0x70e8fc12, 3 | BRF_GRA },           // 14
2696 	{ "kn52.bin",			0x1000, 0xbcbac1a3, 3 | BRF_GRA },           // 15
2697 	{ "kn53.bin",			0x1000, 0xb946c87d, 3 | BRF_GRA },           // 16
2698 	{ "kn34.bin",			0x1000, 0x320db2e1, 3 | BRF_GRA },           // 17
2699 	{ "kn55.bin",			0x1000, 0x70aef58f, 3 | BRF_GRA },           // 18
2700 	{ "kn56.bin",			0x1000, 0x932eb667, 3 | BRF_GRA },           // 19
2701 
2702 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 20 Layer Priority
2703 };
2704 
2705 STD_ROM_PICK(junglekas)
2706 STD_ROM_FN(junglekas)
2707 
2708 struct BurnDriver BurnDrvJunglekas = {
2709 	"junglekas", "junglek", NULL, NULL, "1982",
2710 	"Jungle King (alternate sound)\0", NULL, "Taito Corporation", "Taito SJ System",
2711 	NULL, NULL, NULL, NULL,
2712 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM | GBF_ACTION, 0,
2713 	NULL, junglekasRomInfo, junglekasRomName, NULL, NULL, NULL, NULL, OneButtonInputInfo, JunglekDIPInfo,
2714 	junglekInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2715 	256, 224, 4, 3
2716 };
2717 
2718 
2719 // Jungle Boy (bootleg)
2720 
2721 static struct BurnRomInfo junglebyRomDesc[] = {
2722 	{ "j1.bin",				0x1000, 0x6f2ac11f, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2723 	{ "j2.bin",				0x1000, 0x07cc9a21, 1 | BRF_PRG | BRF_ESS }, //  1
2724 	{ "j3.bin",				0x1000, 0xa20e5a48, 1 | BRF_PRG | BRF_ESS }, //  2
2725 	{ "j4.bin",				0x1000, 0x19ea7f83, 1 | BRF_PRG | BRF_ESS }, //  3
2726 	{ "j5.bin",				0x1000, 0x844365ea, 1 | BRF_PRG | BRF_ESS }, //  4
2727 	{ "j6.bin",				0x1000, 0x27a95fd5, 1 | BRF_PRG | BRF_ESS }, //  5
2728 	{ "j7.bin",				0x1000, 0x5c3199e0, 1 | BRF_PRG | BRF_ESS }, //  6
2729 	{ "j8.bin",				0x1000, 0x895e5708, 9 | BRF_PRG | BRF_ESS }, //  7
2730 	{ "j9.bin",				0x1000, 0x1a9c0a26, 1 | BRF_PRG | BRF_ESS }, //  8
2731 
2732 	{ "j10.bin",			0x1000, 0xdee7f5d4, 2 | BRF_PRG | BRF_ESS }, //  9 Sound Z80 Code
2733 	{ "j11.bin",			0x1000, 0xbffd3d21, 2 | BRF_PRG | BRF_ESS }, // 10
2734 	{ "j12.bin",			0x1000, 0xcee485fc, 2 | BRF_PRG | BRF_ESS }, // 11
2735 
2736 	{ "j13.bin",			0x1000, 0x8f83c290, 3 | BRF_GRA },           // 12 Graphics data
2737 	{ "j14.bin",			0x1000, 0x89fd19f1, 3 | BRF_GRA },           // 13
2738 	{ "j15.bin",			0x1000, 0x70e8fc12, 3 | BRF_GRA },           // 14
2739 	{ "j16.bin",			0x1000, 0xbcbac1a3, 3 | BRF_GRA },           // 15
2740 	{ "j17.bin",			0x1000, 0xb946c87d, 3 | BRF_GRA },           // 16
2741 	{ "j18.bin",			0x1000, 0x320db2e1, 3 | BRF_GRA },           // 17
2742 	{ "j19.bin",			0x1000, 0x8438eb41, 3 | BRF_GRA },           // 18
2743 	{ "j20.bin",			0x1000, 0x932eb667, 3 | BRF_GRA },           // 19
2744 
2745 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 20 Layer Priority
2746 };
2747 
2748 STD_ROM_PICK(jungleby)
2749 STD_ROM_FN(jungleby)
2750 
2751 struct BurnDriver BurnDrvJungleby = {
2752 	"jungleby", "junglek", NULL, NULL, "1982",
2753 	"Jungle Boy (bootleg)\0", NULL, "bootleg", "Taito SJ System",
2754 	NULL, NULL, NULL, NULL,
2755 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM | GBF_ACTION, 0,
2756 	NULL, junglebyRomInfo, junglebyRomName, NULL, NULL, NULL, NULL, OneButtonInputInfo, JunglekDIPInfo,
2757 	junglekInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2758 	256, 224, 4, 3
2759 };
2760 
2761 
2762 // Jungle King (Japan, earlier)
2763 
2764 static struct BurnRomInfo junglekj2RomDesc[] = {
2765 	{ "kn41.bin",			0x1000, 0x7e4cd631, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2766 	{ "kn42.bin",			0x1000, 0xbade53af, 1 | BRF_PRG | BRF_ESS }, //  1
2767 	{ "kn43.bin",			0x1000, 0xa20e5a48, 1 | BRF_PRG | BRF_ESS }, //  2
2768 	{ "kn44.bin",			0x1000, 0x44c770d3, 1 | BRF_PRG | BRF_ESS }, //  3
2769 	{ "kn45.bin",			0x1000, 0xf60a3d06, 1 | BRF_PRG | BRF_ESS }, //  4
2770 	{ "kn46.bin",			0x1000, 0x27a95fd5, 1 | BRF_PRG | BRF_ESS }, //  5
2771 	{ "kn47.bin",			0x1000, 0x5c3199e0, 1 | BRF_PRG | BRF_ESS }, //  6
2772 	{ "kn48.bin",			0x1000, 0xe690b36e, 9 | BRF_PRG | BRF_ESS }, //  7
2773 	{ "kn60.bin",			0x1000, 0x1a9c0a26, 1 | BRF_PRG | BRF_ESS }, //  8
2774 
2775 	{ "kn57-1.bin",			0x1000, 0x62f6763a, 2 | BRF_PRG | BRF_ESS }, //  9 Sound Z80 Code
2776 	{ "kn58-1.bin",			0x1000, 0x9ef46c7f, 2 | BRF_PRG | BRF_ESS }, // 10
2777 	{ "kn59-1.bin",			0x1000, 0xcee485fc, 2 | BRF_PRG | BRF_ESS }, // 11
2778 
2779 	{ "kn49.bin",			0x1000, 0xfe275213, 3 | BRF_GRA },           // 12 Graphics data
2780 	{ "kn50.bin",			0x1000, 0xd9f93c55, 3 | BRF_GRA },           // 13
2781 	{ "kn51.bin",			0x1000, 0x70e8fc12, 3 | BRF_GRA },           // 14
2782 	{ "kn52.bin",			0x1000, 0xbcbac1a3, 3 | BRF_GRA },           // 15
2783 	{ "kn53.bin",			0x1000, 0xb946c87d, 3 | BRF_GRA },           // 16
2784 	{ "kn54.bin",			0x1000, 0xf757d8f0, 3 | BRF_GRA },           // 17
2785 	{ "kn55.bin",			0x1000, 0x70aef58f, 3 | BRF_GRA },           // 18
2786 	{ "kn56.bin",			0x1000, 0x932eb667, 3 | BRF_GRA },           // 19
2787 
2788 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 20 Layer Priority
2789 };
2790 
2791 STD_ROM_PICK(junglekj2)
2792 STD_ROM_FN(junglekj2)
2793 
2794 struct BurnDriver BurnDrvJunglekj2 = {
2795 	"junglekj2", "junglek", NULL, NULL, "1982",
2796 	"Jungle King (Japan, earlier)\0", NULL, "Taito Corporation", "Taito SJ System",
2797 	NULL, NULL, NULL, NULL,
2798 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM | GBF_ACTION, 0,
2799 	NULL, junglekj2RomInfo, junglekj2RomName, NULL, NULL, NULL, NULL, OneButtonInputInfo, JunglekDIPInfo,
2800 	junglekInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2801 	256, 224, 4, 3
2802 };
2803 
2804 
2805 // Jungle Hunt (US)
2806 
2807 static struct BurnRomInfo junglehRomDesc[] = {
2808 	{ "kn41a",				0x1000, 0x6bf118d8, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2809 	{ "kn42.bin",			0x1000, 0xbade53af, 1 | BRF_PRG | BRF_ESS }, //  1
2810 	{ "kn43.bin",			0x1000, 0xa20e5a48, 1 | BRF_PRG | BRF_ESS }, //  2
2811 	{ "kn44.bin",			0x1000, 0x44c770d3, 1 | BRF_PRG | BRF_ESS }, //  3
2812 	{ "kn45.bin",			0x1000, 0xf60a3d06, 1 | BRF_PRG | BRF_ESS }, //  4
2813 	{ "kn46a",				0x1000, 0xac89c155, 1 | BRF_PRG | BRF_ESS }, //  5
2814 	{ "kn47.bin",			0x1000, 0x5c3199e0, 1 | BRF_PRG | BRF_ESS }, //  6
2815 	{ "kn48a",				0x1000, 0xef80e931, 9 | BRF_PRG | BRF_ESS }, //  7
2816 	{ "kn60.bin",			0x1000, 0x1a9c0a26, 1 | BRF_PRG | BRF_ESS }, //  8
2817 
2818 	{ "kn57-1.bin",			0x1000, 0x62f6763a, 2 | BRF_PRG | BRF_ESS }, //  9 Sound Z80 Code
2819 	{ "kn58-1.bin",			0x1000, 0x9ef46c7f, 2 | BRF_PRG | BRF_ESS }, // 10
2820 	{ "kn59-1.bin",			0x1000, 0xcee485fc, 2 | BRF_PRG | BRF_ESS }, // 11
2821 
2822 	{ "kn49a",				0x1000, 0xb139e792, 3 | BRF_GRA },           // 12 Graphics data
2823 	{ "kn50a",				0x1000, 0x1046019f, 3 | BRF_GRA },           // 13
2824 	{ "kn51a",				0x1000, 0xda50c8a4, 3 | BRF_GRA },           // 14
2825 	{ "kn52a",				0x1000, 0x0444f06c, 3 | BRF_GRA },           // 15
2826 	{ "kn53a",				0x1000, 0x6a17803e, 3 | BRF_GRA },           // 16
2827 	{ "kn54a",				0x1000, 0xd41428c7, 3 | BRF_GRA },           // 17
2828 	{ "kn55.bin",			0x1000, 0x70aef58f, 3 | BRF_GRA },           // 18
2829 	{ "kn56a",				0x1000, 0x679c1101, 3 | BRF_GRA },           // 19
2830 
2831 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 20 Layer Priority
2832 };
2833 
2834 STD_ROM_PICK(jungleh)
2835 STD_ROM_FN(jungleh)
2836 
2837 struct BurnDriver BurnDrvJungleh = {
2838 	"jungleh", "junglek", NULL, NULL, "1982",
2839 	"Jungle Hunt (US)\0", NULL, "Taito America Corporation", "Taito SJ System",
2840 	NULL, NULL, NULL, NULL,
2841 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM | GBF_ACTION, 0,
2842 	NULL, junglehRomInfo, junglehRomName, NULL, NULL, NULL, NULL, OneButtonInputInfo, JunglekDIPInfo,
2843 	junglekInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2844 	256, 224, 4, 3
2845 };
2846 
2847 
2848 // Jungle Hunt (Brazil)
2849 
2850 static struct BurnRomInfo junglehbrRomDesc[] = {
2851 	{ "ic1.bin",			0x2000, 0x3255a10e, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2852 	{ "ic2.bin",			0x2000, 0x8482bc63, 1 | BRF_PRG | BRF_ESS }, //  1
2853 	{ "ic3.bin",			0x2000, 0x1abc661d, 1 | BRF_PRG | BRF_ESS }, //  2
2854 	{ "kn47.bin",			0x1000, 0x5c3199e0, 1 | BRF_PRG | BRF_ESS }, //  3
2855 	{ "kn48a",				0x1000, 0xef80e931, 9 | BRF_PRG | BRF_ESS }, //  4
2856 	{ "kn60.bin",			0x1000, 0x1a9c0a26, 1 | BRF_PRG | BRF_ESS }, //  5
2857 
2858 	{ "kn37.bin",			0x1000, 0xdee7f5d4, 2 | BRF_PRG | BRF_ESS }, //  6 Sound Z80 Code
2859 	{ "kn38.bin",			0x1000, 0xbffd3d21, 2 | BRF_PRG | BRF_ESS }, //  7
2860 	{ "kn59-1.bin",			0x1000, 0xcee485fc, 2 | BRF_PRG | BRF_ESS }, //  8
2861 
2862 	{ "kn29.bin",			0x1000, 0x8f83c290, 3 | BRF_GRA },           //  9 Graphics data
2863 	{ "kn30.bin",			0x1000, 0x89fd19f1, 3 | BRF_GRA },           // 10
2864 	{ "kn51.bin",			0x1000, 0x70e8fc12, 3 | BRF_GRA },           // 11
2865 	{ "kn52.bin",			0x1000, 0xbcbac1a3, 3 | BRF_GRA },           // 12
2866 	{ "kn53.bin",			0x1000, 0xb946c87d, 3 | BRF_GRA },           // 13
2867 	{ "kn34.bin",			0x1000, 0x320db2e1, 3 | BRF_GRA },           // 14
2868 	{ "kn55.bin",			0x1000, 0x70aef58f, 3 | BRF_GRA },           // 15
2869 	{ "kn56.bin",			0x1000, 0x932eb667, 3 | BRF_GRA },           // 16
2870 
2871 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 17 Layer Priority
2872 };
2873 
2874 STD_ROM_PICK(junglehbr)
STD_ROM_FN(junglehbr)2875 STD_ROM_FN(junglehbr)
2876 
2877 static INT32 junglehbrInit()
2878 {
2879 	return CommonInit(0, 0xfc, 0);
2880 }
2881 
2882 struct BurnDriver BurnDrvJunglehbr = {
2883 	"junglehbr", "junglek", NULL, NULL, "1983",
2884 	"Jungle Hunt (Brazil)\0", NULL, "Taito do Brasil", "Taito SJ System",
2885 	NULL, NULL, NULL, NULL,
2886 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM | GBF_ACTION, 0,
2887 	NULL, junglehbrRomInfo, junglehbrRomName, NULL, NULL, NULL, NULL, OneButtonInputInfo, JunglekDIPInfo,
2888 	junglehbrInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2889 	256, 224, 4, 3
2890 };
2891 
2892 
2893 // Pirate Pete
2894 
2895 static struct BurnRomInfo piratpetRomDesc[] = {
2896 	{ "pp0p_ic.69",			0x1000, 0x8287dbc2, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2897 	{ "pp1p_ic.68",			0x1000, 0x27a90850, 1 | BRF_PRG | BRF_ESS }, //  1
2898 	{ "pp2p_ic.67",			0x1000, 0xd224fa85, 1 | BRF_PRG | BRF_ESS }, //  2
2899 	{ "pp3p_ic.66",			0x1000, 0x2c900874, 1 | BRF_PRG | BRF_ESS }, //  3
2900 	{ "pp4p_ic.65",			0x1000, 0x1aed98d9, 1 | BRF_PRG | BRF_ESS }, //  4
2901 	{ "pp5p_ic.64",			0x1000, 0x09c3aacd, 1 | BRF_PRG | BRF_ESS }, //  5
2902 	{ "pp6p_ic.55",			0x1000, 0xbdeed702, 1 | BRF_PRG | BRF_ESS }, //  6
2903 	{ "pp7p_ic.54",			0x1000, 0x5f36d082, 9 | BRF_PRG | BRF_ESS }, //  7
2904 	{ "pp7b_ic.52",			0x1000, 0xbbc38b03, 1 | BRF_PRG | BRF_ESS }, //  8
2905 
2906 	{ "pp05_ic.70",			0x1000, 0xdcb5eb9d, 2 | BRF_PRG | BRF_ESS }, //  9 Sound Z80 Code
2907 	{ "pp15_ic.71",			0x1000, 0x3123dbe1, 2 | BRF_PRG | BRF_ESS }, // 10
2908 
2909 	{ "pp0e_ic.1",			0x1000, 0xaceaf79b, 3 | BRF_GRA },           // 11 Graphics data
2910 	{ "pp1e_ic.2",			0x1000, 0xac148214, 3 | BRF_GRA },           // 12
2911 	{ "pp2e_ic.3",			0x1000, 0x108194d2, 3 | BRF_GRA },           // 13
2912 	{ "pp3e_ic.4",			0x1000, 0x621b0da1, 3 | BRF_GRA },           // 14
2913 	{ "pp4e_ic.5",			0x1000, 0xe9826d90, 3 | BRF_GRA },           // 15
2914 	{ "pp5e_ic.6",			0x1000, 0xfe0d38c6, 3 | BRF_GRA },           // 16
2915 	{ "pp6e_ic.7",			0x1000, 0x2cfd127b, 3 | BRF_GRA },           // 17
2916 	{ "pp7e_ic.8",			0x1000, 0x9857533f, 3 | BRF_GRA },           // 18
2917 
2918 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 19 Layer Priority
2919 };
2920 
2921 STD_ROM_PICK(piratpet)
2922 STD_ROM_FN(piratpet)
2923 
2924 struct BurnDriver BurnDrvPiratpet = {
2925 	"piratpet", "junglek", NULL, NULL, "1982",
2926 	"Pirate Pete\0", NULL, "Taito America Corporation", "Taito SJ System",
2927 	NULL, NULL, NULL, NULL,
2928 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM | GBF_ACTION, 0,
2929 	NULL, piratpetRomInfo, piratpetRomName, NULL, NULL, NULL, NULL, OneButtonInputInfo, PiratpetDIPInfo,
2930 	junglekInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2931 	256, 224, 4, 3
2932 };
2933 
2934 
2935 // Alpine Ski (set 1)
2936 
2937 static struct BurnRomInfo alpineRomDesc[] = {
2938 	{ "rh16.069",			0x1000, 0x6b2a69b7, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2939 	{ "rh17.068",			0x1000, 0xe344b0b7, 1 | BRF_PRG | BRF_ESS }, //  1
2940 	{ "rh18.067",			0x1000, 0x753bdd87, 1 | BRF_PRG | BRF_ESS }, //  2
2941 	{ "rh19.066",			0x1000, 0x3efb3fcd, 1 | BRF_PRG | BRF_ESS }, //  3
2942 	{ "rh20.065",			0x1000, 0xc2cd4e79, 1 | BRF_PRG | BRF_ESS }, //  4
2943 	{ "rh21.064",			0x1000, 0x74109145, 1 | BRF_PRG | BRF_ESS }, //  5
2944 	{ "rh22.055",			0x1000, 0xefa82a57, 1 | BRF_PRG | BRF_ESS }, //  6
2945 	{ "rh23.054",			0x1000, 0x77c25acf, 1 | BRF_PRG | BRF_ESS }, //  7
2946 
2947 	{ "rh13.070",			0x1000, 0xdcad1794, 2 | BRF_PRG | BRF_ESS }, //  8 Sound Z80 Code
2948 
2949 	{ "rh24.001",			0x1000, 0x4b1d9455, 3 | BRF_GRA },           //  9 Graphics data
2950 	{ "rh25.002",			0x1000, 0xbf71e278, 3 | BRF_GRA },           // 10
2951 	{ "rh26.003",			0x1000, 0x13da2a9b, 3 | BRF_GRA },           // 11
2952 	{ "rh27.004",			0x1000, 0x425b52b0, 3 | BRF_GRA },           // 12
2953 
2954 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 13 Layer Priority
2955 };
2956 
2957 STD_ROM_PICK(alpine)
STD_ROM_FN(alpine)2958 STD_ROM_FN(alpine)
2959 
2960 static INT32 alpineInit()
2961 {
2962 	is_alpine = 1;
2963 	return CommonInit(1, 0, 0);
2964 }
2965 
2966 struct BurnDriver BurnDrvAlpine = {
2967 	"alpine", NULL, NULL, NULL, "1982",
2968 	"Alpine Ski (set 1)\0", NULL, "Taito Corporation", "Taito SJ System",
2969 	NULL, NULL, NULL, NULL,
2970 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_SPORTSMISC, 0,
2971 	NULL, alpineRomInfo, alpineRomName, NULL, NULL, NULL, NULL, AlpineInputInfo, AlpineDIPInfo,
2972 	alpineInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
2973 	224, 256, 3, 4
2974 };
2975 
2976 
2977 // Alpine Ski (set 2)
2978 
2979 static struct BurnRomInfo alpineaRomDesc[] = {
2980 	{ "rh01-1.69",			0x1000, 0x7fbcb635, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
2981 	{ "rh02.68",			0x1000, 0xc83f95af, 1 | BRF_PRG | BRF_ESS }, //  1
2982 	{ "rh03.67",			0x1000, 0x211102bc, 1 | BRF_PRG | BRF_ESS }, //  2
2983 	{ "rh04-1.66",			0x1000, 0x494a91b0, 1 | BRF_PRG | BRF_ESS }, //  3
2984 	{ "rh05.65",			0x1000, 0xd85588be, 1 | BRF_PRG | BRF_ESS }, //  4
2985 	{ "rh06.64",			0x1000, 0x521fddb9, 1 | BRF_PRG | BRF_ESS }, //  5
2986 	{ "rh07.55",			0x1000, 0x51f369a4, 1 | BRF_PRG | BRF_ESS }, //  6
2987 	{ "rh08.54",			0x1000, 0xe0af9cb2, 1 | BRF_PRG | BRF_ESS }, //  7
2988 
2989 	{ "rh13.070",			0x1000, 0xdcad1794, 2 | BRF_PRG | BRF_ESS }, //  8 Sound Z80 Code
2990 
2991 	{ "rh24.001",			0x1000, 0x4b1d9455, 3 | BRF_GRA },           //  9 Graphics data
2992 	{ "rh25.002",			0x1000, 0xbf71e278, 3 | BRF_GRA },           // 10
2993 	{ "rh26.003",			0x1000, 0x13da2a9b, 3 | BRF_GRA },           // 11
2994 	{ "rh12.4",				0x1000, 0x0ff0d1fe, 3 | BRF_GRA },           // 12
2995 
2996 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 13 Layer Priority
2997 };
2998 
2999 STD_ROM_PICK(alpinea)
STD_ROM_FN(alpinea)3000 STD_ROM_FN(alpinea)
3001 
3002 static INT32 alpineaInit()
3003 {
3004 	is_alpine = 2;
3005 	return CommonInit(1, 0, 0);
3006 }
3007 
3008 struct BurnDriver BurnDrvAlpinea = {
3009 	"alpinea", "alpine", NULL, NULL, "1982",
3010 	"Alpine Ski (set 2)\0", NULL, "Taito Corporation", "Taito SJ System",
3011 	NULL, NULL, NULL, NULL,
3012 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_SPORTSMISC, 0,
3013 	NULL, alpineaRomInfo, alpineaRomName, NULL, NULL, NULL, NULL, AlpineInputInfo, AlpineaDIPInfo,
3014 	alpineaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3015 	224, 256, 3, 4
3016 };
3017 
3018 
3019 // Time Tunnel
3020 
3021 static struct BurnRomInfo timetunlRomDesc[] = {
3022 	{ "un01.69",			0x1000, 0x2e56d946, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3023 	{ "un02.68",			0x1000, 0xf611d852, 1 | BRF_PRG | BRF_ESS }, //  1
3024 	{ "un03.67",			0x1000, 0x144b5e7f, 1 | BRF_PRG | BRF_ESS }, //  2
3025 	{ "un04.66",			0x1000, 0xb6767eba, 1 | BRF_PRG | BRF_ESS }, //  3
3026 	{ "un05.65",			0x1000, 0x91e3c558, 1 | BRF_PRG | BRF_ESS }, //  4
3027 	{ "un06.64",			0x1000, 0xaf5a7d2a, 1 | BRF_PRG | BRF_ESS }, //  5
3028 	{ "un07.55",			0x1000, 0x4ee50999, 1 | BRF_PRG | BRF_ESS }, //  6
3029 	{ "un08.54",			0x1000, 0x97259b57, 1 | BRF_PRG | BRF_ESS }, //  7
3030 	{ "un09.53",			0x1000, 0x771d0fb0, 1 | BRF_PRG | BRF_ESS }, //  8
3031 	{ "un10.52",			0x1000, 0x8b6afad2, 1 | BRF_PRG | BRF_ESS }, //  9
3032 
3033 	{ "un19.70",			0x1000, 0xdbf726c6, 2 | BRF_PRG | BRF_ESS }, // 10 Sound Z80 Code
3034 
3035 	{ "un11.1",				0x1000, 0x3be4fed6, 3 | BRF_GRA },           // 11 Graphics data
3036 	{ "un12.2",				0x1000, 0x2dee1cf3, 3 | BRF_GRA },           // 12
3037 	{ "un13.3",				0x1000, 0x72b491a8, 3 | BRF_GRA },           // 13
3038 	{ "un14.4",				0x1000, 0x5f695369, 3 | BRF_GRA },           // 14
3039 	{ "un15.5",				0x1000, 0x001df94b, 3 | BRF_GRA },           // 15
3040 	{ "un16.6",				0x1000, 0xe33b9019, 3 | BRF_GRA },           // 16
3041 	{ "un17.7",				0x1000, 0xd66025b8, 3 | BRF_GRA },           // 17
3042 	{ "un18.8",				0x1000, 0xe67ff377, 3 | BRF_GRA },           // 18
3043 
3044 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 19 Layer Priority
3045 };
3046 
3047 STD_ROM_PICK(timetunl)
STD_ROM_FN(timetunl)3048 STD_ROM_FN(timetunl)
3049 
3050 static INT32 timetunlInit()
3051 {
3052 	return CommonInit(1, 0, 0);
3053 }
3054 
3055 struct BurnDriver BurnDrvTimetunl = {
3056 	"timetunl", NULL, NULL, NULL, "1982",
3057 	"Time Tunnel\0", NULL, "Taito Corporation", "Taito SJ System",
3058 	NULL, NULL, NULL, NULL,
3059 	BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_MAZE, 0,
3060 	NULL, timetunlRomInfo, timetunlRomName, NULL, NULL, NULL, NULL, TimetunlInputInfo, TimetunlDIPInfo,
3061 	timetunlInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3062 	256, 224, 4, 3
3063 };
3064 
3065 
3066 // Wild Western (set 1)
3067 
3068 static struct BurnRomInfo wwesternRomDesc[] = {
3069 	{ "ww01.bin",			0x1000, 0xbfe10753, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3070 	{ "ww02d.bin",			0x1000, 0x20579e90, 1 | BRF_PRG | BRF_ESS }, //  1
3071 	{ "ww03d.bin",			0x1000, 0x0e65be37, 1 | BRF_PRG | BRF_ESS }, //  2
3072 	{ "ww04d.bin",			0x1000, 0xb3565a31, 1 | BRF_PRG | BRF_ESS }, //  3
3073 	{ "ww05d.bin",			0x1000, 0x089f3d89, 1 | BRF_PRG | BRF_ESS }, //  4
3074 	{ "ww06d.bin",			0x1000, 0xc81c9736, 1 | BRF_PRG | BRF_ESS }, //  5
3075 	{ "ww07.bin",			0x1000, 0x1937cc17, 1 | BRF_PRG | BRF_ESS }, //  6
3076 
3077 	{ "ww14.bin",			0x1000, 0x23776870, 2 | BRF_PRG | BRF_ESS }, //  7 Sound Z80 Code
3078 
3079 	{ "ww08.bin",			0x1000, 0x041a5a1c, 3 | BRF_GRA },           //  8 Graphics data
3080 	{ "ww09.bin",			0x1000, 0x07982ac5, 3 | BRF_GRA },           //  9
3081 	{ "ww10.bin",			0x1000, 0xf32ae203, 3 | BRF_GRA },           // 10
3082 	{ "ww11.bin",			0x1000, 0x7ff1431f, 3 | BRF_GRA },           // 11
3083 	{ "ww12.bin",			0x1000, 0xbe1b563a, 3 | BRF_GRA },           // 12
3084 	{ "ww13.bin",			0x1000, 0x092cd9e5, 3 | BRF_GRA },           // 13
3085 
3086 	{ "ww17",				0x0100, 0x93447d2b, 4 | BRF_GRA },           // 14 Layer Priority
3087 };
3088 
3089 STD_ROM_PICK(wwestern)
STD_ROM_FN(wwestern)3090 STD_ROM_FN(wwestern)
3091 
3092 static INT32 wwesternInit()
3093 {
3094 	input2_xor = 0x04;
3095 	return CommonInit(0, 0, 0);
3096 }
3097 
3098 struct BurnDriver BurnDrvWwestern = {
3099 	"wwestern", NULL, NULL, NULL, "1982",
3100 	"Wild Western (set 1)\0", NULL, "Taito Corporation", "Taito SJ System",
3101 	NULL, NULL, NULL, NULL,
3102 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0,
3103 	NULL, wwesternRomInfo, wwesternRomName, NULL, NULL, NULL, NULL, DualStickInputInfo, WwesternDIPInfo,
3104 	wwesternInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3105 	224, 256, 3, 4
3106 };
3107 
3108 
3109 // Wild Western (set 2)
3110 
3111 static struct BurnRomInfo wwestern1RomDesc[] = {
3112 	{ "ww01.bin",			0x1000, 0xbfe10753, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3113 	{ "ww02",				0x1000, 0xf011103a, 1 | BRF_PRG | BRF_ESS }, //  1
3114 	{ "ww03d.bin",			0x1000, 0x0e65be37, 1 | BRF_PRG | BRF_ESS }, //  2
3115 	{ "ww04a",				0x1000, 0x68b31a6e, 1 | BRF_PRG | BRF_ESS }, //  3
3116 	{ "ww05",				0x1000, 0x78293f81, 1 | BRF_PRG | BRF_ESS }, //  4
3117 	{ "ww06",				0x1000, 0xd015e435, 1 | BRF_PRG | BRF_ESS }, //  5
3118 	{ "ww07.bin",			0x1000, 0x1937cc17, 1 | BRF_PRG | BRF_ESS }, //  6
3119 
3120 	{ "ww14.bin",			0x1000, 0x23776870, 2 | BRF_PRG | BRF_ESS }, //  7 Sound Z80 Code
3121 
3122 	{ "ww08.bin",			0x1000, 0x041a5a1c, 3 | BRF_GRA },           //  8 Graphics data
3123 	{ "ww09.bin",			0x1000, 0x07982ac5, 3 | BRF_GRA },           //  9
3124 	{ "ww10.bin",			0x1000, 0xf32ae203, 3 | BRF_GRA },           // 10
3125 	{ "ww11.bin",			0x1000, 0x7ff1431f, 3 | BRF_GRA },           // 11
3126 	{ "ww12.bin",			0x1000, 0xbe1b563a, 3 | BRF_GRA },           // 12
3127 	{ "ww13.bin",			0x1000, 0x092cd9e5, 3 | BRF_GRA },           // 13
3128 
3129 	{ "ww17",				0x0100, 0x93447d2b, 4 | BRF_GRA },           // 14 Layer Priority
3130 };
3131 
3132 STD_ROM_PICK(wwestern1)
3133 STD_ROM_FN(wwestern1)
3134 
3135 struct BurnDriver BurnDrvWwestern1 = {
3136 	"wwestern1", "wwestern", NULL, NULL, "1982",
3137 	"Wild Western (set 2)\0", NULL, "Taito Corporation", "Taito SJ System",
3138 	NULL, NULL, NULL, NULL,
3139 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0,
3140 	NULL, wwestern1RomInfo, wwestern1RomName, NULL, NULL, NULL, NULL, DualStickInputInfo, WwesternDIPInfo,
3141 	wwesternInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3142 	224, 256, 3, 4
3143 };
3144 
3145 
3146 // Front Line
3147 
3148 static struct BurnRomInfo frontlinRomDesc[] = {
3149 	{ "fl69.u69",			0x1000, 0x93b64599, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3150 	{ "fl68.u68",			0x1000, 0x82dccdfb, 1 | BRF_PRG | BRF_ESS }, //  1
3151 	{ "fl67.u67",			0x1000, 0x3fa1ba12, 1 | BRF_PRG | BRF_ESS }, //  2
3152 	{ "fl66.u66",			0x1000, 0x4a3db285, 1 | BRF_PRG | BRF_ESS }, //  3
3153 	{ "fl65.u65",			0x1000, 0xda00ec70, 1 | BRF_PRG | BRF_ESS }, //  4
3154 	{ "fl64.u64",			0x1000, 0x9fc90a20, 1 | BRF_PRG | BRF_ESS }, //  5
3155 	{ "fl55.u55",			0x1000, 0x359242c2, 1 | BRF_PRG | BRF_ESS }, //  6
3156 	{ "fl54.u54",			0x1000, 0xd234c60f, 1 | BRF_PRG | BRF_ESS }, //  7
3157 	{ "fl53.u53",			0x1000, 0x67429975, 1 | BRF_PRG | BRF_ESS }, //  8
3158 	{ "fl52.u52",			0x1000, 0xcb223d34, 1 | BRF_PRG | BRF_ESS }, //  9
3159 	{ "aa1_10.8",			0x1000, 0x2704aa4c, 1 | BRF_PRG | BRF_ESS }, // 10
3160 
3161 	{ "fl70.u70",			0x1000, 0x15f4ed8c, 2 | BRF_PRG | BRF_ESS }, // 11 Sound Z80 Code
3162 	{ "fl71.u71",			0x1000, 0xc3eb38e7, 2 | BRF_PRG | BRF_ESS }, // 12
3163 
3164 	{ "fl1.u1",				0x1000, 0xe82c9f46, 3 | BRF_GRA },           // 13 Graphics data
3165 	{ "fl2.u2",				0x1000, 0x123055d3, 3 | BRF_GRA },           // 14
3166 	{ "fl3.u3",				0x1000, 0x7ea46347, 3 | BRF_GRA },           // 15
3167 	{ "fl4.u4",				0x1000, 0x9e2cff10, 3 | BRF_GRA },           // 16
3168 	{ "fl5.u5",				0x1000, 0x630b4be1, 3 | BRF_GRA },           // 17
3169 	{ "fl6.u6",				0x1000, 0x9e092d58, 3 | BRF_GRA },           // 18
3170 	{ "fl7.u7",				0x1000, 0x613682a3, 3 | BRF_GRA },           // 19
3171 	{ "fl8.u8",				0x1000, 0xf73b0d5e, 3 | BRF_GRA },           // 20
3172 
3173 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 21 Layer Priority
3174 
3175 	{ "aa1.13",				0x0800, 0x7e78bdd3, 5 | BRF_PRG | BRF_ESS }, // 22 M68705 MCU Code
3176 };
3177 
3178 STD_ROM_PICK(frontlin)
STD_ROM_FN(frontlin)3179 STD_ROM_FN(frontlin)
3180 
3181 static INT32 frontlinInit()
3182 {
3183 	input2_xor = 0x02;
3184 	return CommonInit(0, 0, 0);
3185 }
3186 
3187 struct BurnDriver BurnDrvFrontlin = {
3188 	"frontlin", NULL, NULL, NULL, "1982",
3189 	"Front Line\0", NULL, "Taito Corporation", "Taito SJ System",
3190 	NULL, NULL, NULL, NULL,
3191 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_RUNGUN, 0,
3192 	NULL, frontlinRomInfo, frontlinRomName, NULL, NULL, NULL, NULL, DualStickInputInfo, FrontlinDIPInfo,
3193 	frontlinInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3194 	224, 256, 3, 4
3195 };
3196 
3197 
3198 // Elevator Action (5 pcb version, 1.1)
3199 
3200 static struct BurnRomInfo elevatorRomDesc[] = {
3201 	{ "ea_12.2732.ic69",	0x1000, 0x24e277ef, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3202 	{ "ea_13.2732.ic68",	0x1000, 0x13702e39, 1 | BRF_PRG | BRF_ESS }, //  1
3203 	{ "ea_14.2732.ic67",	0x1000, 0x46f52646, 1 | BRF_PRG | BRF_ESS }, //  2
3204 	{ "ea_15.2732.ic66",	0x1000, 0xe22fe57e, 1 | BRF_PRG | BRF_ESS }, //  3
3205 	{ "ea_16.2732.ic65",	0x1000, 0xc10691d7, 1 | BRF_PRG | BRF_ESS }, //  4
3206 	{ "ea_17.2732.ic64",	0x1000, 0x8913b293, 1 | BRF_PRG | BRF_ESS }, //  5
3207 	{ "ea_18.2732.ic55",	0x1000, 0x1cabda08, 1 | BRF_PRG | BRF_ESS }, //  6
3208 	{ "ea_19.2732.ic54",	0x1000, 0xf4647b4f, 1 | BRF_PRG | BRF_ESS }, //  7
3209 
3210 	{ "ea_9.2732.ic70",		0x1000, 0x6d5f57cb, 2 | BRF_PRG | BRF_ESS }, //  8 Sound Z80 Code
3211 	{ "ea_10.2732.ic71",	0x1000, 0xf0a769a1, 2 | BRF_PRG | BRF_ESS }, //  9
3212 
3213 	{ "ea_20.2732.ic1",		0x1000, 0xbbbb3fba, 3 | BRF_GRA },           // 10 Graphics data
3214 	{ "ea_21.2732.ic2",		0x1000, 0x639cc2fd, 3 | BRF_GRA },           // 11
3215 	{ "ea_22.2732.ic3",		0x1000, 0x61317eea, 3 | BRF_GRA },           // 12
3216 	{ "ea_23.2732.ic4",		0x1000, 0x55446482, 3 | BRF_GRA },           // 13
3217 	{ "ea_24.2732.ic5",		0x1000, 0x77895c0f, 3 | BRF_GRA },           // 14
3218 	{ "ea_25.2732.ic6",		0x1000, 0x9a1b6901, 3 | BRF_GRA },           // 15
3219 	{ "ea_26.2732.ic7",		0x1000, 0x839112ec, 3 | BRF_GRA },           // 16
3220 	{ "ea_27.2732.ic8",		0x1000, 0xdb7ff692, 3 | BRF_GRA },           // 17
3221 
3222 	{ "eb16.ic22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 18 Layer Priority
3223 
3224 	{ "ba3__11.mc68705p3.ic4", 0x0800, 0x9ce75afc, 5 | BRF_PRG | BRF_ESS }, // 19 M68705 MCU Code
3225 
3226 	{ "ww15.pal16l8.ic24.jed.bin",	0x0117, 0xc3ec20d6, 0 | BRF_OPT },   // 20 pal
3227 };
3228 
3229 STD_ROM_PICK(elevator)
STD_ROM_FN(elevator)3230 STD_ROM_FN(elevator)
3231 
3232 static INT32 elevatorInit()
3233 {
3234 	return CommonInit(0, 0, 0);
3235 }
3236 
3237 struct BurnDriver BurnDrvElevator = {
3238 	"elevator", NULL, NULL, NULL, "1983",
3239 	"Elevator Action (5 pcb version, 1.1)\0", NULL, "Taito Corporation", "Taito SJ System",
3240 	NULL, NULL, NULL, NULL,
3241 	BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0,
3242 	NULL, elevatorRomInfo, elevatorRomName, NULL, NULL, NULL, NULL, TwoButtonInputInfo, ElevatorDIPInfo,
3243 	elevatorInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3244 	256, 224, 4, 3
3245 };
3246 
3247 
3248 // Elevator Action (bootleg)
3249 
3250 static struct BurnRomInfo elevatorbRomDesc[] = {
3251 	{ "eabl_12.2732.ic69",	0x1000, 0x66baa214, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3252 	{ "ea_13.2732.ic68",	0x1000, 0x13702e39, 1 | BRF_PRG | BRF_ESS }, //  1
3253 	{ "ea_14.2732.ic67",	0x1000, 0x46f52646, 1 | BRF_PRG | BRF_ESS }, //  2
3254 	{ "eabl_15.2732.ic66",	0x1000, 0xb88f3383, 1 | BRF_PRG | BRF_ESS }, //  3
3255 	{ "ea_16.2732.ic65",	0x1000, 0xc10691d7, 1 | BRF_PRG | BRF_ESS }, //  4
3256 	{ "ea_17.2732.ic64",	0x1000, 0x8913b293, 1 | BRF_PRG | BRF_ESS }, //  5
3257 	{ "eabl_18.2732.ic55",	0x1000, 0xd546923e, 1 | BRF_PRG | BRF_ESS }, //  6
3258 	{ "eabl_19.2732.ic54",	0x1000, 0x963ec5a5, 9 | BRF_PRG | BRF_ESS }, //  7
3259 	{ "eabl.2732.ic52",		0x1000, 0x44b1314a, 1 | BRF_PRG | BRF_ESS }, //  8
3260 
3261 	{ "ea_9.2732.ic70",		0x1000, 0x6d5f57cb, 2 | BRF_PRG | BRF_ESS }, //  9 Sound Z80 Code
3262 	{ "ea_10.2732.ic71",	0x1000, 0xf0a769a1, 2 | BRF_PRG | BRF_ESS }, // 10
3263 
3264 	{ "ea_20.2732.ic1",		0x1000, 0xbbbb3fba, 3 | BRF_GRA },           // 11 Graphics data
3265 	{ "ea_21.2732.ic2",		0x1000, 0x639cc2fd, 3 | BRF_GRA },           // 12
3266 	{ "ea_22.2732.ic3",		0x1000, 0x61317eea, 3 | BRF_GRA },           // 13
3267 	{ "ea_23.2732.ic4",		0x1000, 0x55446482, 3 | BRF_GRA },           // 14
3268 	{ "ea_24.2732.ic5",		0x1000, 0x77895c0f, 3 | BRF_GRA },           // 15
3269 	{ "ea_25.2732.ic6",		0x1000, 0x9a1b6901, 3 | BRF_GRA },           // 16
3270 	{ "ea_26.2732.ic7",		0x1000, 0x839112ec, 3 | BRF_GRA },           // 17
3271 	{ "eabl_27.2732.ic8",	0x1000, 0x67ebf7c1, 3 | BRF_GRA },           // 18
3272 
3273 	{ "eb16.ic22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 19 Layer Priority
3274 
3275 	{ "ww15.pal16l8.ic24.jed.bin",	0x0117, 0xc3ec20d6, 0 | BRF_OPT },   // 20 pal
3276 };
3277 
3278 STD_ROM_PICK(elevatorb)
STD_ROM_FN(elevatorb)3279 STD_ROM_FN(elevatorb)
3280 
3281 static INT32 elevatorbInit()
3282 {
3283 	return CommonInit(0, 0, 0);
3284 }
3285 
3286 struct BurnDriver BurnDrvElevatorb = {
3287 	"elevatorb", "elevator", NULL, NULL, "1983",
3288 	"Elevator Action (bootleg)\0", NULL, "bootleg", "Taito SJ System",
3289 	NULL, NULL, NULL, NULL,
3290 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0,
3291 	NULL, elevatorbRomInfo, elevatorbRomName, NULL, NULL, NULL, NULL, TwoButtonInputInfo, ElevatorDIPInfo,
3292 	elevatorbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3293 	256, 224, 4, 3
3294 };
3295 
3296 
3297 // Elevator Action (4 pcb version, 1.1)
3298 
3299 static struct BurnRomInfo elevator4RomDesc[] = {
3300 	{ "ba3__01.2764.ic1",	0x2000, 0xda775a24, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3301 	{ "ba3__02.2764.ic2",	0x2000, 0xfbfd8b3a, 1 | BRF_PRG | BRF_ESS }, //  1
3302 	{ "ba3__03-1.2764.ic3",	0x2000, 0xa2e69833, 1 | BRF_PRG | BRF_ESS }, //  2
3303 	{ "ba3__04-1.2764.ic6",	0x2000, 0x2b78c462, 1 | BRF_PRG | BRF_ESS }, //  3
3304 
3305 	{ "ba3__09.2732.ic70",	0x1000, 0x6d5f57cb, 2 | BRF_PRG | BRF_ESS }, //  4 Sound Z80 Code
3306 	{ "ba3__10.2732.ic71",	0x1000, 0xf0a769a1, 2 | BRF_PRG | BRF_ESS }, //  5
3307 
3308 	{ "ba3__05.2764.ic4",	0x2000, 0x6c4ee58f, 3 | BRF_GRA },           //  6 Graphics data
3309 	{ "ba3__06.2764.ic5",	0x2000, 0x41ab0afc, 3 | BRF_GRA },           //  7
3310 	{ "ba3__07.2764.ic9",	0x2000, 0xefe43731, 3 | BRF_GRA },           //  8
3311 	{ "ba3__08.2764.ic10",	0x2000, 0x3ca20696, 3 | BRF_GRA },           //  9
3312 
3313 	{ "eb16.ic22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 10 Layer Priority
3314 
3315 	{ "ba3__11.mc68705p3.ic24",	0x0800, 0x9ce75afc, 5 | BRF_PRG | BRF_ESS }, // 11 M68705 MCU Code
3316 
3317 	{ "ww15.pal16l8.ic24.jed.bin",	0x0117, 0xc3ec20d6, 0 | BRF_OPT },   // 12 pal
3318 };
3319 
3320 STD_ROM_PICK(elevator4)
3321 STD_ROM_FN(elevator4)
3322 
3323 struct BurnDriver BurnDrvElevator4 = {
3324 	"elevator4", "elevator", NULL, NULL, "1983",
3325 	"Elevator Action (4 pcb version, 1.1)\0", NULL, "Taito Corporation", "Taito SJ System",
3326 	NULL, NULL, NULL, NULL,
3327 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_PLATFORM, 0,
3328 	NULL, elevator4RomInfo, elevator4RomName, NULL, NULL, NULL, NULL, TwoButtonInputInfo, ElevatorDIPInfo,
3329 	elevatorInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3330 	256, 224, 4, 3
3331 };
3332 
3333 
3334 // The Tin Star (set 1)
3335 
3336 static struct BurnRomInfo tinstarRomDesc[] = {
3337 	{ "ts.69",				0x1000, 0xa930af60, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3338 	{ "ts.68",				0x1000, 0x7f2714ca, 1 | BRF_PRG | BRF_ESS }, //  1
3339 	{ "ts.67",				0x1000, 0x49170786, 1 | BRF_PRG | BRF_ESS }, //  2
3340 	{ "ts.66",				0x1000, 0x3766f130, 1 | BRF_PRG | BRF_ESS }, //  3
3341 	{ "ts.65",				0x1000, 0x41251246, 1 | BRF_PRG | BRF_ESS }, //  4
3342 	{ "ts.64",				0x1000, 0x812285d5, 1 | BRF_PRG | BRF_ESS }, //  5
3343 	{ "ts.55",				0x1000, 0x6b80ac51, 1 | BRF_PRG | BRF_ESS }, //  6
3344 	{ "ts.54",				0x1000, 0xb352360f, 1 | BRF_PRG | BRF_ESS }, //  7
3345 
3346 	{ "ts.70",				0x1000, 0x4771838d, 2 | BRF_PRG | BRF_ESS }, //  8 Sound Z80 Code
3347 	{ "ts.71",				0x1000, 0x03c91332, 2 | BRF_PRG | BRF_ESS }, //  9
3348 	{ "ts.72",				0x1000, 0xbeeed8f3, 2 | BRF_PRG | BRF_ESS }, // 10
3349 
3350 	{ "ts.1",				0x1000, 0xf1160718, 3 | BRF_GRA },           // 11 Graphics data
3351 	{ "ts.2",				0x1000, 0x39dc6dbb, 3 | BRF_GRA },           // 12
3352 	{ "ts.3",				0x1000, 0x079df429, 3 | BRF_GRA },           // 13
3353 	{ "ts.4",				0x1000, 0xe61105d4, 3 | BRF_GRA },           // 14
3354 	{ "ts.5",				0x1000, 0xffab5d15, 3 | BRF_GRA },           // 15
3355 	{ "ts.6",				0x1000, 0xf1d8ca36, 3 | BRF_GRA },           // 16
3356 	{ "ts.7",				0x1000, 0x894f6332, 3 | BRF_GRA },           // 17
3357 	{ "ts.8",				0x1000, 0x519aed19, 3 | BRF_GRA },           // 18
3358 
3359 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 19 Layer Priority
3360 
3361 	{ "a10-12",				0x0800, 0x889eefc9, 5 | BRF_PRG | BRF_ESS }, // 20 M68705 MCU Code
3362 };
3363 
3364 STD_ROM_PICK(tinstar)
STD_ROM_FN(tinstar)3365 STD_ROM_FN(tinstar)
3366 
3367 static INT32 TinstarInit()
3368 {
3369 	input2_xor = 0x02;
3370 	return CommonInit(1, 0, 0);
3371 }
3372 
3373 struct BurnDriver BurnDrvTinstar = {
3374 	"tinstar", NULL, NULL, NULL, "1983",
3375 	"The Tin Star (set 1)\0", NULL, "Taito Corporation", "Taito SJ System",
3376 	NULL, NULL, NULL, NULL,
3377 	BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0,
3378 	NULL, tinstarRomInfo, tinstarRomName, NULL, NULL, NULL, NULL, DualStickInputInfo, TinstarDIPInfo,
3379 	TinstarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3380 	256, 224, 4, 3
3381 };
3382 
3383 
3384 // The Tin Star (set 2)
3385 
3386 static struct BurnRomInfo tinstar2RomDesc[] = {
3387 	{ "a10-01.bin",			0x2000, 0x19faf0b3, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3388 	{ "a10-02.bin",			0x2000, 0x99bb26ff, 1 | BRF_PRG | BRF_ESS }, //  1
3389 	{ "a10-03.bin",			0x2000, 0x3169e175, 1 | BRF_PRG | BRF_ESS }, //  2
3390 	{ "a10-04.bin",			0x2000, 0x6641233c, 1 | BRF_PRG | BRF_ESS }, //  3
3391 
3392 	{ "a10-29.bin",			0x2000, 0x771f1a6a, 2 | BRF_PRG | BRF_ESS }, //  4 Sound Z80 Code
3393 	{ "a10-10.bin",			0x1000, 0xbeeed8f3, 2 | BRF_PRG | BRF_ESS }, //  5
3394 
3395 	{ "a10-05.bin",			0x2000, 0x6bb1bba9, 3 | BRF_GRA },           //  6 Graphics data
3396 	{ "a10-06.bin",			0x2000, 0x0abff1a1, 3 | BRF_GRA },           //  7
3397 	{ "a10-07.bin",			0x2000, 0xd1bec7a8, 3 | BRF_GRA },           //  8
3398 	{ "a10-08.bin",			0x2000, 0x15c6eb41, 3 | BRF_GRA },           //  9
3399 
3400 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 10 Layer Priority
3401 
3402 	{ "a10-12",				0x0800, 0x889eefc9, 5 | BRF_PRG | BRF_ESS }, // 11 M68705 MCU Code
3403 };
3404 
3405 STD_ROM_PICK(tinstar2)
3406 STD_ROM_FN(tinstar2)
3407 
3408 struct BurnDriver BurnDrvTinstar2 = {
3409 	"tinstar2", "tinstar", NULL, NULL, "1983",
3410 	"The Tin Star (set 2)\0", NULL, "Taito Corporation", "Taito SJ System",
3411 	NULL, NULL, NULL, NULL,
3412 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_TAITO_MISC, GBF_SHOOT, 0,
3413 	NULL, tinstar2RomInfo, tinstar2RomName, NULL, NULL, NULL, NULL, DualStickInputInfo, TinstarDIPInfo,
3414 	TinstarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3415 	256, 224, 4, 3
3416 };
3417 
3418 
3419 // Water Ski
3420 
3421 static struct BurnRomInfo waterskiRomDesc[] = {
3422 	{ "a03-01",				0x1000, 0x322c4c2c, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3423 	{ "a03-02",				0x1000, 0x8df176d1, 1 | BRF_PRG | BRF_ESS }, //  1
3424 	{ "a03-03",				0x1000, 0x420bd04f, 1 | BRF_PRG | BRF_ESS }, //  2
3425 	{ "a03-04",				0x1000, 0x5c081a94, 1 | BRF_PRG | BRF_ESS }, //  3
3426 	{ "a03-05",				0x1000, 0x1fae90d2, 1 | BRF_PRG | BRF_ESS }, //  4
3427 	{ "a03-06",				0x1000, 0x55b7c151, 1 | BRF_PRG | BRF_ESS }, //  5
3428 	{ "a03-07",				0x1000, 0x8abc7522, 1 | BRF_PRG | BRF_ESS }, //  6
3429 
3430 	{ "a03-13",				0x1000, 0x78c7d37f, 2 | BRF_PRG | BRF_ESS }, //  7 Sound Z80 Code
3431 	{ "a03-14",				0x1000, 0x31f991ca, 2 | BRF_PRG | BRF_ESS }, //  8
3432 
3433 	{ "a03-08",				0x1000, 0xc206d870, 3 | BRF_GRA },           //  9 Graphics
3434 	{ "a03-09",				0x1000, 0x48ac912a, 3 | BRF_GRA },           // 10
3435 	{ "a03-10",				0x1000, 0xa056defb, 3 | BRF_GRA },           // 11
3436 	{ "a03-11",				0x1000, 0xf06cddd6, 3 | BRF_GRA },           // 12
3437 	{ "a03-12",				0x1000, 0x27dfd8c2, 3 | BRF_GRA },           // 13
3438 
3439 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 14 Layer Priority
3440 };
3441 
3442 STD_ROM_PICK(waterski)
STD_ROM_FN(waterski)3443 STD_ROM_FN(waterski)
3444 
3445 static INT32 waterskiInit()
3446 {
3447 	return CommonInit(0, 0, 0);
3448 }
3449 
3450 struct BurnDriver BurnDrvWaterski = {
3451 	"waterski", NULL, NULL, NULL, "1983",
3452 	"Water Ski\0", NULL, "Taito Corporation", "Taito SJ System",
3453 	NULL, NULL, NULL, NULL,
3454 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0,
3455 	NULL, waterskiRomInfo, waterskiRomName, NULL, NULL, NULL, NULL, TwoButtonLRInputInfo, WaterskiDIPInfo,
3456 	waterskiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3457 	224, 256, 3, 4
3458 };
3459 
3460 
3461 // Bio Attack
3462 
3463 static struct BurnRomInfo bioatackRomDesc[] = {
3464 	{ "aa8-01.69",			0x1000, 0xe5abc211, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3465 	{ "aa8-02.68",			0x1000, 0xb5bfde00, 1 | BRF_PRG | BRF_ESS }, //  1
3466 	{ "aa8-03.67",			0x1000, 0xe4e46e69, 1 | BRF_PRG | BRF_ESS }, //  2
3467 	{ "aa8-04.66",			0x1000, 0x86e0af8c, 1 | BRF_PRG | BRF_ESS }, //  3
3468 	{ "aa8-05.65",			0x1000, 0xc6248608, 1 | BRF_PRG | BRF_ESS }, //  4
3469 	{ "aa8-06.64",			0x1000, 0x685a0383, 1 | BRF_PRG | BRF_ESS }, //  5
3470 	{ "aa8-07.55",			0x1000, 0x9d58e2b7, 1 | BRF_PRG | BRF_ESS }, //  6
3471 	{ "aa8-08.54",			0x1000, 0xdec5271f, 1 | BRF_PRG | BRF_ESS }, //  7
3472 
3473 	{ "aa8-17.70",			0x1000, 0x36eb95b5, 2 | BRF_PRG | BRF_ESS }, //  8 Sound Z80 Code
3474 
3475 	{ "aa8-09.1",			0x1000, 0x1fee5fd6, 3 | BRF_GRA },           //  9 Graphics
3476 	{ "aa8-10.2",			0x1000, 0xe0133423, 3 | BRF_GRA },           // 10
3477 	{ "aa8-11.3",			0x1000, 0x0f5715c6, 3 | BRF_GRA },           // 11
3478 	{ "aa8-12.4",			0x1000, 0x71126dd0, 3 | BRF_GRA },           // 12
3479 	{ "aa8-13.5",			0x1000, 0xadcdd2f0, 3 | BRF_GRA },           // 13
3480 	{ "aa8-14.6",			0x1000, 0x2fe18680, 3 | BRF_GRA },           // 14
3481 	{ "aa8-15.7",			0x1000, 0xff5aad4b, 3 | BRF_GRA },           // 15
3482 	{ "aa8-16.8",			0x1000, 0xceba4036, 3 | BRF_GRA },           // 16
3483 
3484 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 17 Layer Priority
3485 };
3486 
3487 STD_ROM_PICK(bioatack)
STD_ROM_FN(bioatack)3488 STD_ROM_FN(bioatack)
3489 
3490 static INT32 bioatackInit()
3491 {
3492 	input2_xor = 0x30; // coins active high
3493 	return CommonInit(1, 0, 0);
3494 }
3495 
3496 struct BurnDriver BurnDrvBioatack = {
3497 	"bioatack", NULL, NULL, NULL, "1983",
3498 	"Bio Attack\0", NULL, "Taito Corporation (Fox Video Games license)", "Taito SJ System",
3499 	NULL, NULL, NULL, NULL,
3500 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_VERSHOOT, 0,
3501 	NULL, bioatackRomInfo, bioatackRomName, NULL, NULL, NULL, NULL, OneButtonInputInfo, BioatackDIPInfo,
3502 	bioatackInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3503 	224, 256, 3, 4
3504 };
3505 
3506 
3507 // Sea Fighter Poseidon
3508 
3509 static struct BurnRomInfo sfposeidRomDesc[] = {
3510 	{ "a14-01.1",			0x2000, 0xaa779fbb, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3511 	{ "a14-02.2",			0x2000, 0xecec9dc3, 1 | BRF_PRG | BRF_ESS }, //  1
3512 	{ "a14-03.3",			0x2000, 0x469498c1, 1 | BRF_PRG | BRF_ESS }, //  2
3513 	{ "a14-04.6",			0x2000, 0x1db4bc02, 1 | BRF_PRG | BRF_ESS }, //  3
3514 	{ "a14-05.7",			0x2000, 0x95e2f903, 1 | BRF_PRG | BRF_ESS }, //  4
3515 
3516 	{ "a14-10.70",			0x1000, 0xf1365f35, 2 | BRF_PRG | BRF_ESS }, //  5 Sound Z80 Code
3517 	{ "a14-11.71",			0x1000, 0x74a12fe2, 2 | BRF_PRG | BRF_ESS }, //  6
3518 
3519 	{ "a14-06.4",			0x2000, 0x9740493b, 3 | BRF_GRA },           //  7 Graphics
3520 	{ "a14-07.5",			0x2000, 0x1c93de97, 3 | BRF_GRA },           //  8
3521 	{ "a14-08.9",			0x2000, 0x4367e65a, 3 | BRF_GRA },           //  9
3522 	{ "a14-09.10",			0x2000, 0x677cffd5, 3 | BRF_GRA },           // 10
3523 
3524 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 11 Layer Priority
3525 
3526 	{ "a14-12",				0x0800, 0x091beed8, 5 | BRF_PRG | BRF_ESS }, // 12 M68705 MCU Code
3527 };
3528 
3529 STD_ROM_PICK(sfposeid)
STD_ROM_FN(sfposeid)3530 STD_ROM_FN(sfposeid)
3531 
3532 static INT32 sfposeidInit()
3533 {
3534 	return CommonInit(0, 0, 0);
3535 }
3536 
3537 struct BurnDriver BurnDrvSfposeid = {
3538 	"sfposeid", NULL, NULL, NULL, "1984",
3539 	"Sea Fighter Poseidon\0", NULL, "Taito Corporation", "Taito SJ System",
3540 	NULL, NULL, NULL, NULL,
3541 	BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_HORSHOOT, 0,
3542 	NULL, sfposeidRomInfo, sfposeidRomName, NULL, NULL, NULL, NULL, TwoButtonInputInfo, SfposeidDIPInfo,
3543 	sfposeidInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3544 	256, 224, 4, 3
3545 };
3546 
3547 
3548 // High Way Race
3549 
3550 static struct BurnRomInfo hwraceRomDesc[] = {
3551 	{ "hw_race.01",			0x1000, 0x8beec11f, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3552 	{ "hw_race.02",			0x1000, 0x72ad099d, 1 | BRF_PRG | BRF_ESS }, //  1
3553 	{ "hw_race.03",			0x1000, 0xd0c221d7, 1 | BRF_PRG | BRF_ESS }, //  2
3554 	{ "hw_race.04",			0x1000, 0xeb97015b, 1 | BRF_PRG | BRF_ESS }, //  3
3555 	{ "hw_race.05",			0x1000, 0x777c8007, 1 | BRF_PRG | BRF_ESS }, //  4
3556 	{ "hw_race.06",			0x1000, 0x165f46a3, 1 | BRF_PRG | BRF_ESS }, //  5
3557 	{ "hw_race.07",			0x1000, 0x53d7e323, 1 | BRF_PRG | BRF_ESS }, //  6
3558 	{ "hw_race.08",			0x1000, 0xbdbc1208, 1 | BRF_PRG | BRF_ESS }, //  7
3559 
3560 	{ "hw_race.17",			0x1000, 0xafe24f3e, 2 | BRF_PRG | BRF_ESS }, //  8 Sound Z80 Code
3561 	{ "hw_race.18",			0x1000, 0xdbec897d, 2 | BRF_PRG | BRF_ESS }, //  9
3562 
3563 	{ "hw_race.09",			0x1000, 0x345b9b88, 3 | BRF_GRA },           // 10 Graphics
3564 	{ "hw_race.10",			0x1000, 0x598a3c3e, 3 | BRF_GRA },           // 11
3565 	{ "hw_race.11",			0x1000, 0x3f436a7d, 3 | BRF_GRA },           // 12
3566 	{ "hw_race.12",			0x1000, 0x8694b2c6, 3 | BRF_GRA },           // 13
3567 	{ "hw_race.13",			0x1000, 0xa0af7711, 3 | BRF_GRA },           // 14
3568 	{ "hw_race.14",			0x1000, 0x9be0f556, 3 | BRF_GRA },           // 15
3569 	{ "hw_race.15",			0x1000, 0xe1057eb7, 3 | BRF_GRA },           // 16
3570 	{ "hw_race.16",			0x1000, 0xf7104668, 3 | BRF_GRA },           // 17
3571 
3572 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 18 Layer Priority
3573 };
3574 
3575 STD_ROM_PICK(hwrace)
STD_ROM_FN(hwrace)3576 STD_ROM_FN(hwrace)
3577 
3578 static INT32 hwraceInit()
3579 {
3580 	return CommonInit(0, 0, 0);
3581 }
3582 
3583 struct BurnDriver BurnDrvHwrace = {
3584 	"hwrace", NULL, NULL, NULL, "1983",
3585 	"High Way Race\0", NULL, "Taito Corporation", "Taito SJ System",
3586 	NULL, NULL, NULL, NULL,
3587 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0,
3588 	NULL, hwraceRomInfo, hwraceRomName, NULL, NULL, NULL, NULL, TwoButtonInputInfo, HwraceDIPInfo,
3589 	hwraceInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x40,
3590 	224, 256, 3, 4
3591 };
3592 
3593 
3594 // Kick Start - Wheelie King
3595 
3596 static struct BurnRomInfo kikstartRomDesc[] = {
3597 	{ "a20-01",				0x2000, 0x5810be97, 1 | BRF_PRG | BRF_ESS }, //  0 Main Z80 Code
3598 	{ "a20-02",				0x2000, 0x13e9565d, 1 | BRF_PRG | BRF_ESS }, //  1
3599 	{ "a20-03",				0x2000, 0x93d7a9e1, 1 | BRF_PRG | BRF_ESS }, //  2
3600 	{ "a20-04",				0x2000, 0x1f23c5d6, 1 | BRF_PRG | BRF_ESS }, //  3
3601 	{ "a20-05",				0x2000, 0x66e100aa, 1 | BRF_PRG | BRF_ESS }, //  4
3602 
3603 	{ "a20-10",				0x1000, 0xde4352a4, 2 | BRF_PRG | BRF_ESS }, //  5 Sound Z80 Code
3604 	{ "a20-11",				0x1000, 0x8db12dd9, 2 | BRF_PRG | BRF_ESS }, //  6
3605 	{ "a20-12",				0x1000, 0xe7eeb933, 2 | BRF_PRG | BRF_ESS }, //  7
3606 
3607 	{ "a20-06",				0x2000, 0x6582fc89, 3 | BRF_GRA },           //  8 Graphics
3608 	{ "a20-07",				0x2000, 0x8c0b76d2, 3 | BRF_GRA },           //  9
3609 	{ "a20-08",				0x2000, 0x0cca7a9d, 3 | BRF_GRA },           // 10
3610 	{ "a20-09",				0x2000, 0xda625ccf, 3 | BRF_GRA },           // 11
3611 
3612 	{ "eb16.22",			0x0100, 0xb833b5ea, 4 | BRF_GRA },           // 12 Layer Priority
3613 
3614 	{ "a20-13.ic91",		0x0800, 0x3fb6c4fb, 5 | BRF_PRG | BRF_ESS }, // 13 M68705 MCU Code
3615 
3616 	{ "pal16l8.28",			0x0104, 0       ,0 | BRF_NODUMP | BRF_OPT }, // 14 PLDs
3617 };
3618 
3619 STD_ROM_PICK(kikstart)
STD_ROM_FN(kikstart)3620 STD_ROM_FN(kikstart)
3621 
3622 static INT32 kikstartInit()
3623 {
3624 	input2_xor = 0x30;
3625 	is_kikstart = 1;
3626 
3627 	return CommonInit(0, 0, 1);
3628 }
3629 
3630 struct BurnDriver BurnDrvKikstart = {
3631 	"kikstart", NULL, NULL, NULL, "1984",
3632 	"Kick Start - Wheelie King\0", NULL, "Taito Corporation", "Taito SJ System",
3633 	NULL, NULL, NULL, NULL,
3634 	BDF_GAME_WORKING, 2, HARDWARE_TAITO_MISC, GBF_RACING, 0,
3635 	NULL, kikstartRomInfo, kikstartRomName, NULL, NULL, NULL, NULL, KikstartInputInfo, KikstartDIPInfo,
3636 	kikstartInit, DrvExit, DrvFrame, KikstartDraw, DrvScan, &DrvRecalc, 0x40,
3637 	256, 224, 4, 3
3638 };
3639