1 // FB Alpha Teenage Mutant Ninja Turtle driver module
2 // Based on MAME driver by Nicola Salmoria
3 
4 #include "tiles_generic.h"
5 #include "m68000_intf.h"
6 #include "z80_intf.h"
7 #include "konamiic.h"
8 #include "burn_ym2151.h"
9 #include "upd7759.h"
10 #include "k007232.h"
11 #include "k053260.h"
12 #include "eeprom.h"
13 
14 static UINT8 DrvInputPort0[8] = {0, 0, 0, 0, 0, 0, 0, 0};
15 static UINT8 DrvInputPort1[8] = {0, 0, 0, 0, 0, 0, 0, 0};
16 static UINT8 DrvInputPort2[8] = {0, 0, 0, 0, 0, 0, 0, 0};
17 static UINT8 DrvInputPort3[8] = {0, 0, 0, 0, 0, 0, 0, 0};
18 static UINT8 DrvInputPort4[8] = {0, 0, 0, 0, 0, 0, 0, 0};
19 static UINT8 DrvInputPort5[8] = {0, 0, 0, 0, 0, 0, 0, 0};
20 static UINT8 DrvDip[3]        = {0, 0, 0};
21 static UINT8 DrvInput[6]      = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
22 static UINT8 DrvReset         = 0;
23 
24 static UINT8 *Mem                 = NULL;
25 static UINT8 *MemEnd              = NULL;
26 static UINT8 *RamStart            = NULL;
27 static UINT8 *RamEnd              = NULL;
28 static UINT8 *Drv68KRom           = NULL;
29 static UINT8 *Drv68KRam           = NULL;
30 static UINT8 *DrvZ80Rom           = NULL;
31 static UINT8 *DrvZ80Ram           = NULL;
32 static UINT8 *DrvSoundRom         = NULL;
33 static UINT8 *DrvUPD7759CRom      = NULL;
34 static UINT8 *DrvTileRom          = NULL;
35 static UINT8 *DrvSpriteRom        = NULL;
36 static UINT8 *DrvSpriteRam        = NULL;
37 static UINT8 *DrvPaletteRam       = NULL;
38 static UINT8 *DrvNvRam            = NULL;
39 static UINT8 *DrvTiles            = NULL;
40 static UINT8 *DrvSprites          = NULL;
41 static UINT8 *DrvTempRom          = NULL;
42 static UINT32 *DrvPalette          = NULL;
43 static INT16  *DrvTitleSample      = NULL;
44 
45 static INT32 nCyclesDone[2], nCyclesTotal[2];
46 static INT32 nCyclesSegment;
47 
48 static UINT8 bIrqEnable;
49 static INT32 LayerColourBase[3];
50 static INT32 SpriteColourBase;
51 static INT32 LayerPri[3];
52 static UINT8 DrvSoundLatch;
53 static INT32 PriorityFlag;
54 
55 static INT32 dim_c, dim_v;
56 static INT32 NoDim = 0;
57 
58 static INT32 DrvNvRamBank;
59 static INT32 CuebrickSndIrqFire;
60 static INT32 BlswhstlTileRomBank;
61 
62 static INT32 TitleSoundLatch;
63 static INT32 PlayTitleSample;
64 static double TitleSamplePos = 0;
65 static double TitleSampleGain;
66 static INT32 TitleSampleOutputDir;
67 
68 static UINT8 DrvVBlank;
69 
70 static INT32 InitEEPROMCount;
71 
72 static INT32 uses_k007232 = 0;
73 
74 static const eeprom_interface BlswhstlEEPROMInterface =
75 {
76 	7,
77 	8,
78 	"011000",
79 	"011100",
80 	0,
81 	"0100000000000",
82 	"0100110000000",
83 	0,
84 	0
85 };
86 
87 static const eeprom_interface thndrx2_eeprom_interface =
88 {
89 	7,
90 	8,
91 	"011000",
92 	"010100",
93 	0,
94 	"0100000000000",
95 	"0100110000000",
96 	0,
97 	0
98 };
99 
100 static struct BurnInputInfo TmntInputList[] =
101 {
102 	{"P1 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 0, "p1 coin"   },
103 	{"P1 Up"             , BIT_DIGITAL  , DrvInputPort1 + 2, "p1 up"     },
104 	{"P1 Down"           , BIT_DIGITAL  , DrvInputPort1 + 3, "p1 down"   },
105 	{"P1 Left"           , BIT_DIGITAL  , DrvInputPort1 + 0, "p1 left"   },
106 	{"P1 Right"          , BIT_DIGITAL  , DrvInputPort1 + 1, "p1 right"  },
107 	{"P1 Fire 1"         , BIT_DIGITAL  , DrvInputPort1 + 4, "p1 fire 1" },
108 	{"P1 Fire 2"         , BIT_DIGITAL  , DrvInputPort1 + 5, "p1 fire 2" },
109 
110 	{"P2 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 1, "p2 coin"   },
111 	{"P2 Up"             , BIT_DIGITAL  , DrvInputPort2 + 2, "p2 up"     },
112 	{"P2 Down"           , BIT_DIGITAL  , DrvInputPort2 + 3, "p2 down"   },
113 	{"P2 Left"           , BIT_DIGITAL  , DrvInputPort2 + 0, "p2 left"   },
114 	{"P2 Right"          , BIT_DIGITAL  , DrvInputPort2 + 1, "p2 right"  },
115 	{"P2 Fire 1"         , BIT_DIGITAL  , DrvInputPort2 + 4, "p2 fire 1" },
116 	{"P2 Fire 2"         , BIT_DIGITAL  , DrvInputPort2 + 5, "p2 fire 2" },
117 
118 	{"P3 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 2, "p3 coin"   },
119 	{"P3 Up"             , BIT_DIGITAL  , DrvInputPort3 + 2, "p3 up"     },
120 	{"P3 Down"           , BIT_DIGITAL  , DrvInputPort3 + 3, "p3 down"   },
121 	{"P3 Left"           , BIT_DIGITAL  , DrvInputPort3 + 0, "p3 left"   },
122 	{"P3 Right"          , BIT_DIGITAL  , DrvInputPort3 + 1, "p3 right"  },
123 	{"P3 Fire 1"         , BIT_DIGITAL  , DrvInputPort3 + 4, "p3 fire 1" },
124 	{"P3 Fire 2"         , BIT_DIGITAL  , DrvInputPort3 + 5, "p3 fire 2" },
125 
126 	{"P4 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 3, "p4 coin"   },
127 	{"P4 Up"             , BIT_DIGITAL  , DrvInputPort4 + 2, "p4 up"     },
128 	{"P4 Down"           , BIT_DIGITAL  , DrvInputPort4 + 3, "p4 down"   },
129 	{"P4 Left"           , BIT_DIGITAL  , DrvInputPort4 + 0, "p4 left"   },
130 	{"P4 Right"          , BIT_DIGITAL  , DrvInputPort4 + 1, "p4 right"  },
131 	{"P4 Fire 1"         , BIT_DIGITAL  , DrvInputPort4 + 4, "p4 fire 1" },
132 	{"P4 Fire 2"         , BIT_DIGITAL  , DrvInputPort4 + 5, "p4 fire 2" },
133 
134 	{"Reset"             , BIT_DIGITAL  , &DrvReset        , "reset"     },
135 	{"Service 1"         , BIT_DIGITAL  , DrvInputPort0 + 4, "service"   },
136 	{"Service 2"         , BIT_DIGITAL  , DrvInputPort0 + 5, "service2"  },
137 	{"Service 3"         , BIT_DIGITAL  , DrvInputPort0 + 6, "service3"  },
138 	{"Service 4"         , BIT_DIGITAL  , DrvInputPort0 + 7, "service4"  },
139 	{"Dip 1"             , BIT_DIPSWITCH, DrvDip + 0       , "dip"       },
140 	{"Dip 2"             , BIT_DIPSWITCH, DrvDip + 1       , "dip"       },
141 	{"Dip 3"             , BIT_DIPSWITCH, DrvDip + 2       , "dip"       },
142 };
143 
144 STDINPUTINFO(Tmnt)
145 
146 static struct BurnInputInfo Tmnt2pInputList[] =
147 {
148 	{"P1 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 0, "p1 coin"   },
149 	{"P1 Start"          , BIT_DIGITAL  , DrvInputPort1 + 7, "p1 start"  },
150 	{"P1 Up"             , BIT_DIGITAL  , DrvInputPort1 + 2, "p1 up"     },
151 	{"P1 Down"           , BIT_DIGITAL  , DrvInputPort1 + 3, "p1 down"   },
152 	{"P1 Left"           , BIT_DIGITAL  , DrvInputPort1 + 0, "p1 left"   },
153 	{"P1 Right"          , BIT_DIGITAL  , DrvInputPort1 + 1, "p1 right"  },
154 	{"P1 Fire 1"         , BIT_DIGITAL  , DrvInputPort1 + 4, "p1 fire 1" },
155 	{"P1 Fire 2"         , BIT_DIGITAL  , DrvInputPort1 + 5, "p1 fire 2" },
156 
157 	{"P2 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 1, "p2 coin"   },
158 	{"P2 Start"          , BIT_DIGITAL  , DrvInputPort2 + 7, "p2 start"  },
159 	{"P2 Up"             , BIT_DIGITAL  , DrvInputPort2 + 2, "p2 up"     },
160 	{"P2 Down"           , BIT_DIGITAL  , DrvInputPort2 + 3, "p2 down"   },
161 	{"P2 Left"           , BIT_DIGITAL  , DrvInputPort2 + 0, "p2 left"   },
162 	{"P2 Right"          , BIT_DIGITAL  , DrvInputPort2 + 1, "p2 right"  },
163 	{"P2 Fire 1"         , BIT_DIGITAL  , DrvInputPort2 + 4, "p2 fire 1" },
164 	{"P2 Fire 2"         , BIT_DIGITAL  , DrvInputPort2 + 5, "p2 fire 2" },
165 
166 	{"Reset"             , BIT_DIGITAL  , &DrvReset        , "reset"     },
167 	{"Service 1"         , BIT_DIGITAL  , DrvInputPort0 + 4, "service"   },
168 	{"Service 2"         , BIT_DIGITAL  , DrvInputPort0 + 5, "service2"  },
169 	{"Dip 1"             , BIT_DIPSWITCH, DrvDip + 0       , "dip"       },
170 	{"Dip 2"             , BIT_DIPSWITCH, DrvDip + 1       , "dip"       },
171 	{"Dip 3"             , BIT_DIPSWITCH, DrvDip + 2       , "dip"       },
172 };
173 
174 STDINPUTINFO(Tmnt2p)
175 
176 static struct BurnInputInfo MiaInputList[] =
177 {
178 	{"P1 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 0, "p1 coin"   },
179 	{"P1 Start"          , BIT_DIGITAL  , DrvInputPort0 + 3, "p1 start"  },
180 	{"P1 Up"             , BIT_DIGITAL  , DrvInputPort1 + 2, "p1 up"     },
181 	{"P1 Down"           , BIT_DIGITAL  , DrvInputPort1 + 3, "p1 down"   },
182 	{"P1 Left"           , BIT_DIGITAL  , DrvInputPort1 + 0, "p1 left"   },
183 	{"P1 Right"          , BIT_DIGITAL  , DrvInputPort1 + 1, "p1 right"  },
184 	{"P1 Fire 1"         , BIT_DIGITAL  , DrvInputPort1 + 4, "p1 fire 1" },
185 	{"P1 Fire 2"         , BIT_DIGITAL  , DrvInputPort1 + 5, "p1 fire 2" },
186 	{"P1 Fire 3"         , BIT_DIGITAL  , DrvInputPort1 + 6, "p1 fire 3" },
187 
188 	{"P2 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 1, "p2 coin"   },
189 	{"P2 Start"          , BIT_DIGITAL  , DrvInputPort0 + 4, "p2 start"  },
190 	{"P2 Up"             , BIT_DIGITAL  , DrvInputPort2 + 2, "p2 up"     },
191 	{"P2 Down"           , BIT_DIGITAL  , DrvInputPort2 + 3, "p2 down"   },
192 	{"P2 Left"           , BIT_DIGITAL  , DrvInputPort2 + 0, "p2 left"   },
193 	{"P2 Right"          , BIT_DIGITAL  , DrvInputPort2 + 1, "p2 right"  },
194 	{"P2 Fire 1"         , BIT_DIGITAL  , DrvInputPort2 + 4, "p2 fire 1" },
195 	{"P2 Fire 2"         , BIT_DIGITAL  , DrvInputPort2 + 5, "p2 fire 2" },
196 	{"P2 Fire 3"         , BIT_DIGITAL  , DrvInputPort2 + 6, "p2 fire 3" },
197 
198 	{"Reset"             , BIT_DIGITAL  , &DrvReset        , "reset"     },
199 	{"Service"           , BIT_DIGITAL  , DrvInputPort0 + 6, "service"   },
200 	{"Dip 1"             , BIT_DIPSWITCH, DrvDip + 0       , "dip"       },
201 	{"Dip 2"             , BIT_DIPSWITCH, DrvDip + 1       , "dip"       },
202 	{"Dip 3"             , BIT_DIPSWITCH, DrvDip + 2       , "dip"       },
203 };
204 
205 STDINPUTINFO(Mia)
206 
207 static struct BurnInputInfo BlswhstlInputList[] =
208 {
209 	{"P1 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 0, "p1 coin"   },
210 	{"P1 Start"          , BIT_DIGITAL  , DrvInputPort0 + 4, "p1 start"  },
211 	{"P1 Up"             , BIT_DIGITAL  , DrvInputPort1 + 2, "p1 up"     },
212 	{"P1 Down"           , BIT_DIGITAL  , DrvInputPort1 + 3, "p1 down"   },
213 	{"P1 Left"           , BIT_DIGITAL  , DrvInputPort1 + 0, "p1 left"   },
214 	{"P1 Right"          , BIT_DIGITAL  , DrvInputPort1 + 1, "p1 right"  },
215 	{"P1 Fire 1"         , BIT_DIGITAL  , DrvInputPort1 + 4, "p1 fire 1" },
216 	{"P1 Fire 2"         , BIT_DIGITAL  , DrvInputPort1 + 5, "p1 fire 2" },
217 
218 	{"P2 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 1, "p2 coin"   },
219 	{"P2 Start"          , BIT_DIGITAL  , DrvInputPort0 + 5, "p2 start"  },
220 	{"P2 Up"             , BIT_DIGITAL  , DrvInputPort2 + 2, "p2 up"     },
221 	{"P2 Down"           , BIT_DIGITAL  , DrvInputPort2 + 3, "p2 down"   },
222 	{"P2 Left"           , BIT_DIGITAL  , DrvInputPort2 + 0, "p2 left"   },
223 	{"P2 Right"          , BIT_DIGITAL  , DrvInputPort2 + 1, "p2 right"  },
224 	{"P2 Fire 1"         , BIT_DIGITAL  , DrvInputPort2 + 4, "p2 fire 1" },
225 	{"P2 Fire 2"         , BIT_DIGITAL  , DrvInputPort2 + 5, "p2 fire 2" },
226 
227 	{"Reset"             , BIT_DIGITAL  , &DrvReset        , "reset"     },
228 	{"Service"           , BIT_DIGITAL  , DrvInputPort0 + 2, "service"   },
229 	{"Diagnostics"       , BIT_DIGITAL  , DrvInputPort0 + 3, "diag"      },
230 };
231 
232 STDINPUTINFO(Blswhstl)
233 
234 static struct BurnInputInfo Ssriders4pInputList[] =
235 {
236 	{"P1 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 0, "p1 coin"   },
237 	{"P1 Up"             , BIT_DIGITAL  , DrvInputPort1 + 2, "p1 up"     },
238 	{"P1 Down"           , BIT_DIGITAL  , DrvInputPort1 + 3, "p1 down"   },
239 	{"P1 Left"           , BIT_DIGITAL  , DrvInputPort1 + 0, "p1 left"   },
240 	{"P1 Right"          , BIT_DIGITAL  , DrvInputPort1 + 1, "p1 right"  },
241 	{"P1 Fire 1"         , BIT_DIGITAL  , DrvInputPort1 + 4, "p1 fire 1" },
242 	{"P1 Fire 2"         , BIT_DIGITAL  , DrvInputPort1 + 5, "p1 fire 2" },
243 
244 	{"P2 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 1, "p2 coin"   },
245 	{"P2 Up"             , BIT_DIGITAL  , DrvInputPort2 + 2, "p2 up"     },
246 	{"P2 Down"           , BIT_DIGITAL  , DrvInputPort2 + 3, "p2 down"   },
247 	{"P2 Left"           , BIT_DIGITAL  , DrvInputPort2 + 0, "p2 left"   },
248 	{"P2 Right"          , BIT_DIGITAL  , DrvInputPort2 + 1, "p2 right"  },
249 	{"P2 Fire 1"         , BIT_DIGITAL  , DrvInputPort2 + 4, "p2 fire 1" },
250 	{"P2 Fire 2"         , BIT_DIGITAL  , DrvInputPort2 + 5, "p2 fire 2" },
251 
252 	{"P3 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 2, "p3 coin"   },
253 	{"P3 Up"             , BIT_DIGITAL  , DrvInputPort3 + 2, "p3 up"     },
254 	{"P3 Down"           , BIT_DIGITAL  , DrvInputPort3 + 3, "p3 down"   },
255 	{"P3 Left"           , BIT_DIGITAL  , DrvInputPort3 + 0, "p3 left"   },
256 	{"P3 Right"          , BIT_DIGITAL  , DrvInputPort3 + 1, "p3 right"  },
257 	{"P3 Fire 1"         , BIT_DIGITAL  , DrvInputPort3 + 4, "p3 fire 1" },
258 	{"P3 Fire 2"         , BIT_DIGITAL  , DrvInputPort3 + 5, "p3 fire 2" },
259 
260 	{"P4 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 3, "p4 coin"   },
261 	{"P4 Up"             , BIT_DIGITAL  , DrvInputPort4 + 2, "p4 up"     },
262 	{"P4 Down"           , BIT_DIGITAL  , DrvInputPort4 + 3, "p4 down"   },
263 	{"P4 Left"           , BIT_DIGITAL  , DrvInputPort4 + 0, "p4 left"   },
264 	{"P4 Right"          , BIT_DIGITAL  , DrvInputPort4 + 1, "p4 right"  },
265 	{"P4 Fire 1"         , BIT_DIGITAL  , DrvInputPort4 + 4, "p4 fire 1" },
266 	{"P4 Fire 2"         , BIT_DIGITAL  , DrvInputPort4 + 5, "p4 fire 2" },
267 
268 	{"Reset"             , BIT_DIGITAL  , &DrvReset        , "reset"     },
269 	{"Service 1"         , BIT_DIGITAL  , DrvInputPort0 + 4, "service"   },
270 	{"Service 2"         , BIT_DIGITAL  , DrvInputPort0 + 5, "service2"  },
271 	{"Service 3"         , BIT_DIGITAL  , DrvInputPort0 + 6, "service3"  },
272 	{"Service 4"         , BIT_DIGITAL  , DrvInputPort0 + 7, "service4"  },
273 	{"Diagnostics"       , BIT_DIGITAL  , DrvInputPort5 + 7, "diag"      },
274 };
275 
276 STDINPUTINFO(Ssriders4p)
277 
278 static struct BurnInputInfo SsridersInputList[] =
279 {
280 	{"P1 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 0, "p1 coin"   },
281 	{"P1 Start"          , BIT_DIGITAL  , DrvInputPort1 + 7, "p1 start"  },
282 	{"P1 Up"             , BIT_DIGITAL  , DrvInputPort1 + 2, "p1 up"     },
283 	{"P1 Down"           , BIT_DIGITAL  , DrvInputPort1 + 3, "p1 down"   },
284 	{"P1 Left"           , BIT_DIGITAL  , DrvInputPort1 + 0, "p1 left"   },
285 	{"P1 Right"          , BIT_DIGITAL  , DrvInputPort1 + 1, "p1 right"  },
286 	{"P1 Fire 1"         , BIT_DIGITAL  , DrvInputPort1 + 4, "p1 fire 1" },
287 	{"P1 Fire 2"         , BIT_DIGITAL  , DrvInputPort1 + 5, "p1 fire 2" },
288 
289 	{"P2 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 1, "p2 coin"   },
290 	{"P2 Start"          , BIT_DIGITAL  , DrvInputPort2 + 7, "p2 start"  },
291 	{"P2 Up"             , BIT_DIGITAL  , DrvInputPort2 + 2, "p2 up"     },
292 	{"P2 Down"           , BIT_DIGITAL  , DrvInputPort2 + 3, "p2 down"   },
293 	{"P2 Left"           , BIT_DIGITAL  , DrvInputPort2 + 0, "p2 left"   },
294 	{"P2 Right"          , BIT_DIGITAL  , DrvInputPort2 + 1, "p2 right"  },
295 	{"P2 Fire 1"         , BIT_DIGITAL  , DrvInputPort2 + 4, "p2 fire 1" },
296 	{"P2 Fire 2"         , BIT_DIGITAL  , DrvInputPort2 + 5, "p2 fire 2" },
297 
298 	{"Reset"             , BIT_DIGITAL  , &DrvReset        , "reset"     },
299 	{"Service 1"         , BIT_DIGITAL  , DrvInputPort0 + 4, "service"   },
300 	{"Service 2"         , BIT_DIGITAL  , DrvInputPort0 + 5, "service2"  },
301 	{"Diagnostics"       , BIT_DIGITAL  , DrvInputPort5 + 7, "diag"      },
302 };
303 
304 STDINPUTINFO(Ssriders)
305 
306 static struct BurnInputInfo Ssriders4psInputList[] =
307 {
308 	{"P1 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 0, "p1 coin"   },
309 	{"P1 Start"          , BIT_DIGITAL  , DrvInputPort1 + 7, "p1 start"  },
310 	{"P1 Up"             , BIT_DIGITAL  , DrvInputPort1 + 2, "p1 up"     },
311 	{"P1 Down"           , BIT_DIGITAL  , DrvInputPort1 + 3, "p1 down"   },
312 	{"P1 Left"           , BIT_DIGITAL  , DrvInputPort1 + 0, "p1 left"   },
313 	{"P1 Right"          , BIT_DIGITAL  , DrvInputPort1 + 1, "p1 right"  },
314 	{"P1 Fire 1"         , BIT_DIGITAL  , DrvInputPort1 + 4, "p1 fire 1" },
315 	{"P1 Fire 2"         , BIT_DIGITAL  , DrvInputPort1 + 5, "p1 fire 2" },
316 
317 	{"P2 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 1, "p2 coin"   },
318 	{"P2 Start"          , BIT_DIGITAL  , DrvInputPort2 + 7, "p2 start"  },
319 	{"P2 Up"             , BIT_DIGITAL  , DrvInputPort2 + 2, "p2 up"     },
320 	{"P2 Down"           , BIT_DIGITAL  , DrvInputPort2 + 3, "p2 down"   },
321 	{"P2 Left"           , BIT_DIGITAL  , DrvInputPort2 + 0, "p2 left"   },
322 	{"P2 Right"          , BIT_DIGITAL  , DrvInputPort2 + 1, "p2 right"  },
323 	{"P2 Fire 1"         , BIT_DIGITAL  , DrvInputPort2 + 4, "p2 fire 1" },
324 	{"P2 Fire 2"         , BIT_DIGITAL  , DrvInputPort2 + 5, "p2 fire 2" },
325 
326 	{"P3 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 2, "p3 coin"   },
327 	{"P3 Start"          , BIT_DIGITAL  , DrvInputPort3 + 7, "p3 start"  },
328 	{"P3 Up"             , BIT_DIGITAL  , DrvInputPort3 + 2, "p3 up"     },
329 	{"P3 Down"           , BIT_DIGITAL  , DrvInputPort3 + 3, "p3 down"   },
330 	{"P3 Left"           , BIT_DIGITAL  , DrvInputPort3 + 0, "p3 left"   },
331 	{"P3 Right"          , BIT_DIGITAL  , DrvInputPort3 + 1, "p3 right"  },
332 	{"P3 Fire 1"         , BIT_DIGITAL  , DrvInputPort3 + 4, "p3 fire 1" },
333 	{"P3 Fire 2"         , BIT_DIGITAL  , DrvInputPort3 + 5, "p3 fire 2" },
334 
335 	{"P4 Coin"           , BIT_DIGITAL  , DrvInputPort0 + 3, "p4 coin"   },
336 	{"P4 Start"          , BIT_DIGITAL  , DrvInputPort4 + 7, "p4 start"  },
337 	{"P4 Up"             , BIT_DIGITAL  , DrvInputPort4 + 2, "p4 up"     },
338 	{"P4 Down"           , BIT_DIGITAL  , DrvInputPort4 + 3, "p4 down"   },
339 	{"P4 Left"           , BIT_DIGITAL  , DrvInputPort4 + 0, "p4 left"   },
340 	{"P4 Right"          , BIT_DIGITAL  , DrvInputPort4 + 1, "p4 right"  },
341 	{"P4 Fire 1"         , BIT_DIGITAL  , DrvInputPort4 + 4, "p4 fire 1" },
342 	{"P4 Fire 2"         , BIT_DIGITAL  , DrvInputPort4 + 5, "p4 fire 2" },
343 
344 	{"Reset"             , BIT_DIGITAL  , &DrvReset        , "reset"     },
345 	{"Service 1"         , BIT_DIGITAL  , DrvInputPort0 + 4, "service"   },
346 	{"Service 2"         , BIT_DIGITAL  , DrvInputPort0 + 5, "service2"  },
347 	{"Service 3"         , BIT_DIGITAL  , DrvInputPort0 + 6, "service3"  },
348 	{"Service 4"         , BIT_DIGITAL  , DrvInputPort0 + 7, "service4"  },
349 	{"Diagnostics"       , BIT_DIGITAL  , DrvInputPort5 + 7, "diag"      },
350 };
351 
352 STDINPUTINFO(Ssriders4ps)
353 
354 static struct BurnInputInfo Thndrx2InputList[] = {
355 	{"P1 Coin",		BIT_DIGITAL,	DrvInputPort1 + 0,	"p1 coin"	},
356 
357 	{"P1 Start",		BIT_DIGITAL,	DrvInputPort0 + 7,	"p1 start"	},
358 	{"P1 Up",		BIT_DIGITAL,	DrvInputPort0 + 2,	"p1 up"		},
359 	{"P1 Down",		BIT_DIGITAL,	DrvInputPort0 + 3,	"p1 down"	},
360 	{"P1 Left",		BIT_DIGITAL,	DrvInputPort0 + 0,	"p1 left"	},
361 	{"P1 Right",		BIT_DIGITAL,	DrvInputPort0 + 1,	"p1 right"	},
362 	{"P1 Button 1",		BIT_DIGITAL,	DrvInputPort0 + 4,	"p1 fire 1"	},
363 	{"P1 Button 2",		BIT_DIGITAL,	DrvInputPort0 + 5,	"p1 fire 2"	},
364 
365 	{"P2 Coin",		BIT_DIGITAL,	DrvInputPort1 + 1,	"p2 coin"	},
366 
367 	{"P2 Start",		BIT_DIGITAL,	DrvInputPort2 + 7,	"p2 start"	},
368 	{"P2 Up",		BIT_DIGITAL,	DrvInputPort2 + 2,	"p2 up"		},
369 	{"P2 Down",		BIT_DIGITAL,	DrvInputPort2 + 3,	"p2 down"	},
370 	{"P2 Left",		BIT_DIGITAL,	DrvInputPort2 + 0,	"p2 left"	},
371 	{"P2 Right",		BIT_DIGITAL,	DrvInputPort2 + 1,	"p2 right"	},
372 	{"P2 Button 1",		BIT_DIGITAL,	DrvInputPort2 + 4,	"p2 fire 1"	},
373 	{"P2 Button 2",		BIT_DIGITAL,	DrvInputPort2 + 5,	"p2 fire 2"	},
374 
375 	{"Reset",		BIT_DIGITAL,	&DrvReset,		"reset"		},
376 	{"Service",		BIT_DIGITAL,	DrvInputPort1 + 2,	"service"	},
377 	{"Diagnostics",		BIT_DIGITAL,	DrvInputPort1 + 3,	"diag"		},
378 };
379 
380 STDINPUTINFO(Thndrx2)
381 
382 static struct BurnInputInfo LgtnfghtInputList[] = {
383 	{"P1 Coin",		BIT_DIGITAL,	DrvInputPort0 + 0,	"p1 coin"	},
384 	{"P1 Start",		BIT_DIGITAL,	DrvInputPort0 + 3,	"p1 start"	},
385 	{"P1 Up",		BIT_DIGITAL,	DrvInputPort1 + 2,	"p1 up"		},
386 	{"P1 Down",		BIT_DIGITAL,	DrvInputPort1 + 3,	"p1 down"	},
387 	{"P1 Left",		BIT_DIGITAL,	DrvInputPort1 + 0,	"p1 left"	},
388 	{"P1 Right",		BIT_DIGITAL,	DrvInputPort1 + 1,	"p1 right"	},
389 	{"P1 Button 1",		BIT_DIGITAL,	DrvInputPort1 + 4,	"p1 fire 1"	},
390 	{"P1 Button 2",		BIT_DIGITAL,	DrvInputPort1 + 5,	"p1 fire 2"	},
391 	{"P1 Button 3",		BIT_DIGITAL,	DrvInputPort1 + 6,	"p1 fire 3"	},
392 
393 	{"P2 Coin",		BIT_DIGITAL,	DrvInputPort0 + 1,	"p2 coin"	},
394 	{"P2 Start",		BIT_DIGITAL,	DrvInputPort0 + 4,	"p2 start"	},
395 	{"P2 Up",		BIT_DIGITAL,	DrvInputPort2 + 2,	"p2 up"		},
396 	{"P2 Down",		BIT_DIGITAL,	DrvInputPort2 + 3,	"p2 down"	},
397 	{"P2 Left",		BIT_DIGITAL,	DrvInputPort2 + 0,	"p2 left"	},
398 	{"P2 Right",		BIT_DIGITAL,	DrvInputPort2 + 1,	"p2 right"	},
399 	{"P2 Button 1",		BIT_DIGITAL,	DrvInputPort2 + 4,	"p2 fire 1"	},
400 	{"P2 Button 2",		BIT_DIGITAL,	DrvInputPort2 + 5,	"p2 fire 2"	},
401 	{"P2 Button 3",		BIT_DIGITAL,	DrvInputPort2 + 6,	"p2 fire 3"	},
402 
403 	{"Reset",		BIT_DIGITAL,	&DrvReset,		"reset"		},
404 	{"Service",		BIT_DIGITAL,	DrvInputPort0 + 6,	"service"	},
405 	{"Dip A",		BIT_DIPSWITCH,	DrvDip + 0,		"dip"		},
406 	{"Dip B",		BIT_DIPSWITCH,	DrvDip + 1,		"dip"		},
407 	{"Dip C",		BIT_DIPSWITCH,	DrvDip + 2,		"dip"		},
408 };
409 
410 STDINPUTINFO(Lgtnfght)
411 
412 static struct BurnInputInfo QgakumonInputList[] = {
413 	{"P1 Coin",		BIT_DIGITAL,	DrvInputPort0 + 0,	"p1 coin"	},
414 	{"P1 Start",		BIT_DIGITAL,	DrvInputPort1 + 7,	"p1 start"	},
415 	{"P1 Button 1",		BIT_DIGITAL,	DrvInputPort1 + 2,	"p1 fire 1"	},
416 	{"P1 Button 2",		BIT_DIGITAL,	DrvInputPort1 + 3,	"p1 fire 2"	},
417 	{"P1 Button 3",		BIT_DIGITAL,	DrvInputPort1 + 0,	"p1 fire 3"	},
418 	{"P1 Button 4",		BIT_DIGITAL,	DrvInputPort1 + 1,	"p1 fire 4"	},
419 	{"P1 Push",		BIT_DIGITAL,	DrvInputPort1 + 4,	"p1 fire 5"	},
420 
421 	{"P2 Coin",		BIT_DIGITAL,	DrvInputPort0 + 1,	"p2 coin"	},
422 	{"P2 Start",		BIT_DIGITAL,	DrvInputPort2 + 7,	"p2 start"	},
423 	{"P2 Button 1",		BIT_DIGITAL,	DrvInputPort2 + 2,	"p2 fire 1"	},
424 	{"P2 Button 2",		BIT_DIGITAL,	DrvInputPort2 + 3,	"p2 fire 2"	},
425 	{"P2 Button 3",		BIT_DIGITAL,	DrvInputPort2 + 0,	"p2 fire 3"	},
426 	{"P2 Button 4",		BIT_DIGITAL,	DrvInputPort2 + 1,	"p2 fire 4"	},
427 	{"P2 Push",		BIT_DIGITAL,	DrvInputPort2 + 4,	"p2 fire 5"	},
428 
429 	{"Reset",		BIT_DIGITAL,	&DrvReset,		"reset"		},
430 	{"Service",		BIT_DIGITAL,	DrvInputPort0 + 4,	"service"	},
431 	{"Diagnostics",		BIT_DIGITAL,	DrvInputPort5 + 7,	"diag"		},
432 };
433 
434 STDINPUTINFO(Qgakumon)
435 
436 static struct BurnInputInfo PunkshotInputList[] = {
437 	{"P1 Coin",		BIT_DIGITAL,	DrvInputPort0 + 0,	"p1 coin"	},
438 	{"P1 Up",		BIT_DIGITAL,	DrvInputPort1 + 2,	"p1 up"		},
439 	{"P1 Down",		BIT_DIGITAL,	DrvInputPort1 + 3,	"p1 down"	},
440 	{"P1 Left",		BIT_DIGITAL,	DrvInputPort1 + 0,	"p1 left"	},
441 	{"P1 Right",		BIT_DIGITAL,	DrvInputPort1 + 1,	"p1 right"	},
442 	{"P1 Button 1",		BIT_DIGITAL,	DrvInputPort1 + 4,	"p1 fire 1"	},
443 	{"P1 Button 2",		BIT_DIGITAL,	DrvInputPort1 + 5,	"p1 fire 2"	},
444 
445 	{"P2 Coin",		BIT_DIGITAL,	DrvInputPort0 + 1,	"p2 coin"	},
446 	{"P2 Up",		BIT_DIGITAL,	DrvInputPort2 + 2,	"p2 up"		},
447 	{"P2 Down",		BIT_DIGITAL,	DrvInputPort2 + 3,	"p2 down"	},
448 	{"P2 Left",		BIT_DIGITAL,	DrvInputPort2 + 0,	"p2 left"	},
449 	{"P2 Right",		BIT_DIGITAL,	DrvInputPort2 + 1,	"p2 right"	},
450 	{"P2 Button 1",		BIT_DIGITAL,	DrvInputPort2 + 4,	"p2 fire 1"	},
451 	{"P2 Button 2",		BIT_DIGITAL,	DrvInputPort2 + 5,	"p2 fire 2"	},
452 
453 	{"P3 Coin",		BIT_DIGITAL,	DrvInputPort0 + 2,	"p3 coin"	},
454 	{"P3 Up",		BIT_DIGITAL,	DrvInputPort3 + 2,	"p3 up"		},
455 	{"P3 Down",		BIT_DIGITAL,	DrvInputPort3 + 3,	"p3 down"	},
456 	{"P3 Left",		BIT_DIGITAL,	DrvInputPort3 + 0,	"p3 left"	},
457 	{"P3 Right",		BIT_DIGITAL,	DrvInputPort3 + 1,	"p3 right"	},
458 	{"P3 Button 1",		BIT_DIGITAL,	DrvInputPort3 + 4,	"p3 fire 1"	},
459 	{"P3 Button 2",		BIT_DIGITAL,	DrvInputPort3 + 5,	"p3 fire 2"	},
460 
461 	{"P4 Coin",		BIT_DIGITAL,	DrvInputPort0 + 3,	"p4 coin"	},
462 	{"P4 Up",		BIT_DIGITAL,	DrvInputPort4 + 2,	"p4 up"		},
463 	{"P4 Down",		BIT_DIGITAL,	DrvInputPort4 + 3,	"p4 down"	},
464 	{"P4 Left",		BIT_DIGITAL,	DrvInputPort4 + 0,	"p4 left"	},
465 	{"P4 Right",		BIT_DIGITAL,	DrvInputPort4 + 1,	"p4 right"	},
466 	{"P4 Button 1",		BIT_DIGITAL,	DrvInputPort4 + 4,	"p4 fire 1"	},
467 	{"P4 Button 2",		BIT_DIGITAL,	DrvInputPort4 + 5,	"p4 fire 2"	},
468 
469 	{"Reset",		BIT_DIGITAL,	&DrvReset,		"reset"		},
470 	{"Service 1",		BIT_DIGITAL,	DrvInputPort0 + 4,	"service"	},
471 	{"Service 2",		BIT_DIGITAL,	DrvInputPort0 + 5,	"service2"	},
472 	{"Service 3",		BIT_DIGITAL,	DrvInputPort0 + 6,	"service3"	},
473 	{"Service 4",		BIT_DIGITAL,	DrvInputPort0 + 7,	"service4"	},
474 	{"Dip A",		BIT_DIPSWITCH,	DrvDip + 0,		"dip"		},
475 	{"Dip B",		BIT_DIPSWITCH,	DrvDip + 1,		"dip"		},
476 	{"Dip C",		BIT_DIPSWITCH,	DrvDip + 2,		"dip"		},
477 };
478 
479 STDINPUTINFO(Punkshot)
480 
481 static struct BurnInputInfo Punkshot2InputList[] = {
482 	{"P1 Coin",		BIT_DIGITAL,	DrvInputPort0 + 0,	"p1 coin"	},
483 	{"P1 Start",		BIT_DIGITAL,	DrvInputPort5 + 0,	"p1 start"	},
484 	{"P1 Up",		BIT_DIGITAL,	DrvInputPort1 + 2,	"p1 up"		},
485 	{"P1 Down",		BIT_DIGITAL,	DrvInputPort1 + 3,	"p1 down"	},
486 	{"P1 Left",		BIT_DIGITAL,	DrvInputPort1 + 0,	"p1 left"	},
487 	{"P1 Right",		BIT_DIGITAL,	DrvInputPort1 + 1,	"p1 right"	},
488 	{"P1 Button 1",		BIT_DIGITAL,	DrvInputPort1 + 4,	"p1 fire 1"	},
489 	{"P1 Button 2",		BIT_DIGITAL,	DrvInputPort1 + 5,	"p1 fire 2"	},
490 
491 	{"P2 Coin",		BIT_DIGITAL,	DrvInputPort0 + 1,	"p2 coin"	},
492 	{"P2 Start",		BIT_DIGITAL,	DrvInputPort5 + 1,	"p2 start"	},
493 	{"P2 Up",		BIT_DIGITAL,	DrvInputPort2 + 2,	"p2 up"		},
494 	{"P2 Down",		BIT_DIGITAL,	DrvInputPort2 + 3,	"p2 down"	},
495 	{"P2 Left",		BIT_DIGITAL,	DrvInputPort2 + 0,	"p2 left"	},
496 	{"P2 Right",		BIT_DIGITAL,	DrvInputPort2 + 1,	"p2 right"	},
497 	{"P2 Button 1",		BIT_DIGITAL,	DrvInputPort2 + 4,	"p2 fire 1"	},
498 	{"P2 Button 2",		BIT_DIGITAL,	DrvInputPort2 + 5,	"p2 fire 2"	},
499 
500 	{"Reset",		BIT_DIGITAL,	&DrvReset,		"reset"		},
501 	{"Service",		BIT_DIGITAL,	DrvInputPort0 + 4,	"service"	},
502 	{"Dip A",		BIT_DIPSWITCH,	DrvDip + 0,		"dip"		},
503 	{"Dip B",		BIT_DIPSWITCH,	DrvDip + 1,		"dip"		},
504 	{"Dip C",		BIT_DIPSWITCH,	DrvDip + 2,		"dip"		},
505 };
506 
STDINPUTINFO(Punkshot2)507 STDINPUTINFO(Punkshot2)
508 
509 static inline void DrvClearOpposites(UINT8* nJoystickInputs)
510 {
511 	if ((*nJoystickInputs & 0x03) == 0x03) {
512 		*nJoystickInputs &= ~0x03;
513 	}
514 	if ((*nJoystickInputs & 0x0c) == 0x0c) {
515 		*nJoystickInputs &= ~0x0c;
516 	}
517 }
518 
DrvMakeInputs()519 static inline void DrvMakeInputs()
520 {
521 	// Reset Inputs
522 	DrvInput[0] = DrvInput[1] = DrvInput[2] = DrvInput[3] = DrvInput[4] = DrvInput[5] = 0x00;
523 
524 	// Compile Digital Inputs
525 	for (int i = 0; i < 8; i++) {
526 		DrvInput[0] |= (DrvInputPort0[i] & 1) << i;
527 		DrvInput[1] |= (DrvInputPort1[i] & 1) << i;
528 		DrvInput[2] |= (DrvInputPort2[i] & 1) << i;
529 		DrvInput[3] |= (DrvInputPort3[i] & 1) << i;
530 		DrvInput[4] |= (DrvInputPort4[i] & 1) << i;
531 		DrvInput[5] |= (DrvInputPort5[i] & 1) << i;
532 	}
533 
534 	// Clear Opposites
535 	DrvClearOpposites(&DrvInput[0]);
536 	DrvClearOpposites(&DrvInput[1]);
537 	DrvClearOpposites(&DrvInput[2]);
538 	DrvClearOpposites(&DrvInput[3]);
539 	DrvClearOpposites(&DrvInput[4]);
540 }
541 
SsridersMakeInputs()542 static inline void SsridersMakeInputs()
543 {
544 	DrvMakeInputs();
545 
546 	DrvInput[5] ^= 0xf6;
547 	//if (DrvInputPort5[7]) DrvInput[5] -= 0x80;
548 }
549 
550 static struct BurnDIPInfo TmntDIPList[]=
551 {
552 	// Default Values
553 	{0x21, 0xff, 0xff, 0xff, NULL                     },
554 	{0x22, 0xff, 0xff, 0x5e, NULL                     },
555 	{0x23, 0xff, 0xff, 0xff, NULL                     },
556 
557 	// Dip 1
558 	{0   , 0xfe, 0   , 16   , "Coinage"               },
559 	{0x21, 0x01, 0x0f, 0x00, "5 Coins 1 Credit"       },
560 	{0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit"       },
561 	{0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit"       },
562 	{0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit"       },
563 	{0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits"      },
564 	{0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits"      },
565 	{0x21, 0x01, 0x0f, 0x0f, "1 Coin  1 Credit"       },
566 	{0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits"      },
567 	{0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits"      },
568 	{0x21, 0x01, 0x0f, 0x0e, "1 Coin  2 Credits"      },
569 	{0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits"      },
570 	{0x21, 0x01, 0x0f, 0x0d, "1 Coin  3 Credits"      },
571 	{0x21, 0x01, 0x0f, 0x0c, "1 Coin  4 Credits"      },
572 	{0x21, 0x01, 0x0f, 0x0b, "1 Coin  5 Credits"      },
573 	{0x21, 0x01, 0x0f, 0x0a, "1 Coin  6 Credits"      },
574 	{0x21, 0x01, 0x0f, 0x09, "1 Coin  7 Credits"      },
575 
576 	// Dip 2
577 	{0   , 0xfe, 0   , 4   , "Lives"                  },
578 	{0x22, 0x01, 0x03, 0x03, "1"                      },
579 	{0x22, 0x01, 0x03, 0x02, "2"                      },
580 	{0x22, 0x01, 0x03, 0x01, "3"                      },
581 	{0x22, 0x01, 0x03, 0x00, "5"                      },
582 
583 	{0   , 0xfe, 0   , 4   , "Difficulty"             },
584 	{0x22, 0x01, 0x60, 0x60, "Easy"                   },
585 	{0x22, 0x01, 0x60, 0x40, "Normal"                 },
586 	{0x22, 0x01, 0x60, 0x20, "Difficult"              },
587 	{0x22, 0x01, 0x60, 0x00, "Very Difficult"         },
588 
589 	{0   , 0xfe, 0   , 2   , "Demo Sounds"            },
590 	{0x22, 0x01, 0x80, 0x80, "Off"                    },
591 	{0x22, 0x01, 0x80, 0x00, "On"                     },
592 
593 	// Dip 3
594 	{0   , 0xfe, 0   , 2   , "Flip Screen"            },
595 	{0x23, 0x01, 0x01, 0x01, "Off"                    },
596 	{0x23, 0x01, 0x01, 0x00, "On"                     },
597 
598 	{0   , 0xfe, 0   , 2   , "Test Mode"              },
599 	{0x23, 0x01, 0x04, 0x04, "Off"                    },
600 	{0x23, 0x01, 0x04, 0x00, "On"                     },
601 };
602 
603 STDDIPINFO(Tmnt)
604 
605 static struct BurnDIPInfo Tmnt2pDIPList[]=
606 {
607 	// Default Values
608 	{0x13, 0xff, 0xff, 0xff, NULL                     },
609 	{0x14, 0xff, 0xff, 0x5e, NULL                     },
610 	{0x15, 0xff, 0xff, 0xff, NULL                     },
611 
612 	// Dip 1
613 	{0   , 0xfe, 0   , 16   , "Coin A"                },
614 	{0x13, 0x01, 0x0f, 0x02, "4 Coins 1 Credit"       },
615 	{0x13, 0x01, 0x0f, 0x05, "3 Coins 1 Credit"       },
616 	{0x13, 0x01, 0x0f, 0x08, "2 Coins 1 Credit"       },
617 	{0x13, 0x01, 0x0f, 0x04, "3 Coins 2 Credits"      },
618 	{0x13, 0x01, 0x0f, 0x01, "4 Coins 3 Credits"      },
619 	{0x13, 0x01, 0x0f, 0x0f, "1 Coin  1 Credit"       },
620 	{0x13, 0x01, 0x0f, 0x03, "3 Coins 4 Credits"      },
621 	{0x13, 0x01, 0x0f, 0x07, "2 Coins 3 Credits"      },
622 	{0x13, 0x01, 0x0f, 0x0e, "1 Coin  2 Credits"      },
623 	{0x13, 0x01, 0x0f, 0x06, "2 Coins 5 Credits"      },
624 	{0x13, 0x01, 0x0f, 0x0d, "1 Coin  3 Credits"      },
625 	{0x13, 0x01, 0x0f, 0x0c, "1 Coin  4 Credits"      },
626 	{0x13, 0x01, 0x0f, 0x0b, "1 Coin  5 Credits"      },
627 	{0x13, 0x01, 0x0f, 0x0a, "1 Coin  6 Credits"      },
628 	{0x13, 0x01, 0x0f, 0x09, "1 Coin  7 Credits"      },
629 	{0x13, 0x01, 0x0f, 0x00, "Free Play"              },
630 
631 	{0   , 0xfe, 0   , 15   , "Coin B"                },
632 	{0x13, 0x01, 0xf0, 0x20, "4 Coins 1 Credit"       },
633 	{0x13, 0x01, 0xf0, 0x50, "3 Coins 1 Credit"       },
634 	{0x13, 0x01, 0xf0, 0x80, "2 Coins 1 Credit"       },
635 	{0x13, 0x01, 0xf0, 0x40, "3 Coins 2 Credits"      },
636 	{0x13, 0x01, 0xf0, 0x10, "4 Coins 3 Credits"      },
637 	{0x13, 0x01, 0xf0, 0xf0, "1 Coin  1 Credit"       },
638 	{0x13, 0x01, 0xf0, 0x30, "3 Coins 4 Credits"      },
639 	{0x13, 0x01, 0xf0, 0x70, "2 Coins 3 Credits"      },
640 	{0x13, 0x01, 0xf0, 0xe0, "1 Coin  2 Credits"      },
641 	{0x13, 0x01, 0xf0, 0x60, "2 Coins 5 Credits"      },
642 	{0x13, 0x01, 0xf0, 0xd0, "1 Coin  3 Credits"      },
643 	{0x13, 0x01, 0xf0, 0xc0, "1 Coin  4 Credits"      },
644 	{0x13, 0x01, 0xf0, 0xb0, "1 Coin  5 Credits"      },
645 	{0x13, 0x01, 0xf0, 0xa0, "1 Coin  6 Credits"      },
646 	{0x13, 0x01, 0xf0, 0x90, "1 Coin  7 Credits"      },
647 
648 	// Dip 2
649 	{0   , 0xfe, 0   , 4   , "Lives"                  },
650 	{0x14, 0x01, 0x03, 0x03, "1"                      },
651 	{0x14, 0x01, 0x03, 0x02, "2"                      },
652 	{0x14, 0x01, 0x03, 0x01, "3"                      },
653 	{0x14, 0x01, 0x03, 0x00, "5"                      },
654 
655 	{0   , 0xfe, 0   , 4   , "Difficulty"             },
656 	{0x14, 0x01, 0x60, 0x60, "Easy"                   },
657 	{0x14, 0x01, 0x60, 0x40, "Normal"                 },
658 	{0x14, 0x01, 0x60, 0x20, "Difficult"              },
659 	{0x14, 0x01, 0x60, 0x00, "Very Difficult"         },
660 
661 	{0   , 0xfe, 0   , 2   , "Demo Sounds"            },
662 	{0x14, 0x01, 0x80, 0x80, "Off"                    },
663 	{0x14, 0x01, 0x80, 0x00, "On"                     },
664 
665 	// Dip 3
666 	{0   , 0xfe, 0   , 2   , "Flip Screen"            },
667 	{0x15, 0x01, 0x01, 0x01, "Off"                    },
668 	{0x15, 0x01, 0x01, 0x00, "On"                     },
669 
670 	{0   , 0xfe, 0   , 2   , "Test Mode"              },
671 	{0x15, 0x01, 0x04, 0x04, "Off"                    },
672 	{0x15, 0x01, 0x04, 0x00, "On"                     },
673 };
674 
675 STDDIPINFO(Tmnt2p)
676 
677 static struct BurnDIPInfo MiaDIPList[]=
678 {
679 	// Default Values
680 	{0x14, 0xff, 0xff, 0xff, NULL                     },
681 	{0x15, 0xff, 0xff, 0x56, NULL                     },
682 	{0x16, 0xff, 0xff, 0xff, NULL                     },
683 
684 	// Dip 1
685 	{0   , 0xfe, 0   , 16   , "Coin A"                },
686 	{0x14, 0x01, 0x0f, 0x02, "4 Coins 1 Credit"       },
687 	{0x14, 0x01, 0x0f, 0x05, "3 Coins 1 Credit"       },
688 	{0x14, 0x01, 0x0f, 0x08, "2 Coins 1 Credit"       },
689 	{0x14, 0x01, 0x0f, 0x04, "3 Coins 2 Credits"      },
690 	{0x14, 0x01, 0x0f, 0x01, "4 Coins 3 Credits"      },
691 	{0x14, 0x01, 0x0f, 0x0f, "1 Coin  1 Credit"       },
692 	{0x14, 0x01, 0x0f, 0x03, "3 Coins 4 Credits"      },
693 	{0x14, 0x01, 0x0f, 0x07, "2 Coins 3 Credits"      },
694 	{0x14, 0x01, 0x0f, 0x0e, "1 Coin  2 Credits"      },
695 	{0x14, 0x01, 0x0f, 0x06, "2 Coins 5 Credits"      },
696 	{0x14, 0x01, 0x0f, 0x0d, "1 Coin  3 Credits"      },
697 	{0x14, 0x01, 0x0f, 0x0c, "1 Coin  4 Credits"      },
698 	{0x14, 0x01, 0x0f, 0x0b, "1 Coin  5 Credits"      },
699 	{0x14, 0x01, 0x0f, 0x0a, "1 Coin  6 Credits"      },
700 	{0x14, 0x01, 0x0f, 0x09, "1 Coin  7 Credits"      },
701 	{0x14, 0x01, 0x0f, 0x00, "Free Play"              },
702 
703 	{0   , 0xfe, 0   , 15   , "Coin B"                },
704 	{0x14, 0x01, 0xf0, 0x20, "4 Coins 1 Credit"       },
705 	{0x14, 0x01, 0xf0, 0x50, "3 Coins 1 Credit"       },
706 	{0x14, 0x01, 0xf0, 0x80, "2 Coins 1 Credit"       },
707 	{0x14, 0x01, 0xf0, 0x40, "3 Coins 2 Credits"      },
708 	{0x14, 0x01, 0xf0, 0x10, "4 Coins 3 Credits"      },
709 	{0x14, 0x01, 0xf0, 0xf0, "1 Coin  1 Credit"       },
710 	{0x14, 0x01, 0xf0, 0x30, "3 Coins 4 Credits"      },
711 	{0x14, 0x01, 0xf0, 0x70, "2 Coins 3 Credits"      },
712 	{0x14, 0x01, 0xf0, 0xe0, "1 Coin  2 Credits"      },
713 	{0x14, 0x01, 0xf0, 0x60, "2 Coins 5 Credits"      },
714 	{0x14, 0x01, 0xf0, 0xd0, "1 Coin  3 Credits"      },
715 	{0x14, 0x01, 0xf0, 0xc0, "1 Coin  4 Credits"      },
716 	{0x14, 0x01, 0xf0, 0xb0, "1 Coin  5 Credits"      },
717 	{0x14, 0x01, 0xf0, 0xa0, "1 Coin  6 Credits"      },
718 	{0x14, 0x01, 0xf0, 0x90, "1 Coin  7 Credits"      },
719 
720 	// Dip 2
721 	{0   , 0xfe, 0   , 4   , "Lives"                  },
722 	{0x15, 0x01, 0x03, 0x03, "2"                      },
723 	{0x15, 0x01, 0x03, 0x02, "3"                      },
724 	{0x15, 0x01, 0x03, 0x01, "5"                      },
725 	{0x15, 0x01, 0x03, 0x00, "7"                      },
726 
727 	{0   , 0xfe, 0   , 4   , "Bonus Life"             },
728 	{0x15, 0x01, 0x18, 0x18, "30k  80k"               },
729 	{0x15, 0x01, 0x18, 0x10, "50k 100k"               },
730 	{0x15, 0x01, 0x18, 0x08, "50k"                    },
731 	{0x15, 0x01, 0x18, 0x00, "100k"                   },
732 
733 	{0   , 0xfe, 0   , 4   , "Difficulty"             },
734 	{0x15, 0x01, 0x60, 0x60, "Easy"                   },
735 	{0x15, 0x01, 0x60, 0x40, "Normal"                 },
736 	{0x15, 0x01, 0x60, 0x20, "Difficult"              },
737 	{0x15, 0x01, 0x60, 0x00, "Very Difficult"         },
738 
739 	{0   , 0xfe, 0   , 2   , "Demo Sounds"            },
740 	{0x15, 0x01, 0x80, 0x80, "Off"                    },
741 	{0x15, 0x01, 0x80, 0x00, "On"                     },
742 
743 	// Dip 3
744 	{0   , 0xfe, 0   , 2   , "Flip Screen"            },
745 	{0x16, 0x01, 0x01, 0x01, "Off"                    },
746 	{0x16, 0x01, 0x01, 0x00, "On"                     },
747 
748 	{0   , 0xfe, 0   , 2   , "VRAM Character Check"   },
749 	{0x16, 0x01, 0x02, 0x02, "Off"                    },
750 	{0x16, 0x01, 0x02, 0x00, "On"                     },
751 
752 	{0   , 0xfe, 0   , 2   , "Test Mode"              },
753 	{0x16, 0x01, 0x04, 0x04, "Off"                    },
754 	{0x16, 0x01, 0x04, 0x00, "On"                     },
755 };
756 
757 STDDIPINFO(Mia)
758 
759 static struct BurnDIPInfo LgtnfghtDIPList[]=
760 {
761 	{0x14, 0xff, 0xff, 0x5e, NULL			},
762 	{0x15, 0xff, 0xff, 0xff, NULL			},
763 	{0x16, 0xff, 0xff, 0xfd, NULL			},
764 
765 	{0   , 0xfe, 0   ,    4, "Lives"		},
766 	{0x14, 0x01, 0x03, 0x03, "2"			},
767 	{0x14, 0x01, 0x03, 0x02, "3"			},
768 	{0x14, 0x01, 0x03, 0x01, "5"			},
769 	{0x14, 0x01, 0x03, 0x00, "7"			},
770 
771 	{0   , 0xfe, 0   ,    4, "Bonus Life"		},
772 	{0x14, 0x01, 0x18, 0x18, "100000 400000"	},
773 	{0x14, 0x01, 0x18, 0x10, "150000 500000"	},
774 	{0x14, 0x01, 0x18, 0x08, "200000"		},
775 	{0x14, 0x01, 0x18, 0x00, "None"			},
776 
777 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
778 	{0x14, 0x01, 0x60, 0x60, "Easy"			},
779 	{0x14, 0x01, 0x60, 0x40, "Medium"		},
780 	{0x14, 0x01, 0x60, 0x20, "Hard"			},
781 	{0x14, 0x01, 0x60, 0x00, "Hardest"		},
782 
783 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
784 	{0x14, 0x01, 0x80, 0x80, "Off"			},
785 	{0x14, 0x01, 0x80, 0x00, "On"			},
786 
787 	{0   , 0xfe, 0   ,    16, "Coin A"		},
788 	{0x15, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" 	},
789 	{0x15, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" 	},
790 	{0x15, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" 	},
791 	{0x15, 0x01, 0x0f, 0x04, "3 Coins 2 Credits"	},
792 	{0x15, 0x01, 0x0f, 0x01, "4 Coins 3 Credits"	},
793 	{0x15, 0x01, 0x0f, 0x0f, "1 Coin  1 Credit" 	},
794 	{0x15, 0x01, 0x0f, 0x03, "3 Coins 4 Credits"	},
795 	{0x15, 0x01, 0x0f, 0x07, "2 Coins 3 Credits"	},
796 	{0x15, 0x01, 0x0f, 0x0e, "1 Coin  2 Credits"	},
797 	{0x15, 0x01, 0x0f, 0x06, "2 Coins 5 Credits"	},
798 	{0x15, 0x01, 0x0f, 0x0d, "1 Coin  3 Credits"	},
799 	{0x15, 0x01, 0x0f, 0x0c, "1 Coin  4 Credits"	},
800 	{0x15, 0x01, 0x0f, 0x0b, "1 Coin  5 Credits"	},
801 	{0x15, 0x01, 0x0f, 0x0a, "1 Coin  6 Credits"	},
802 	{0x15, 0x01, 0x0f, 0x09, "1 Coin  7 Credits"	},
803 	{0x15, 0x01, 0x0f, 0x00, "Free Play"		},
804 
805 	{0   , 0xfe, 0   ,    16, "Coin B"		},
806 	{0x15, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" 	},
807 	{0x15, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" 	},
808 	{0x15, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" 	},
809 	{0x15, 0x01, 0xf0, 0x40, "3 Coins 2 Credits"	},
810 	{0x15, 0x01, 0xf0, 0x10, "4 Coins 3 Credits"	},
811 	{0x15, 0x01, 0xf0, 0xf0, "1 Coin  1 Credit" 	},
812 	{0x15, 0x01, 0xf0, 0x30, "3 Coins 4 Credits"	},
813 	{0x15, 0x01, 0xf0, 0x70, "2 Coins 3 Credits"	},
814 	{0x15, 0x01, 0xf0, 0xe0, "1 Coin  2 Credits"	},
815 	{0x15, 0x01, 0xf0, 0x60, "2 Coins 5 Credits"	},
816 	{0x15, 0x01, 0xf0, 0xd0, "1 Coin  3 Credits"	},
817 	{0x15, 0x01, 0xf0, 0xc0, "1 Coin  4 Credits"	},
818 	{0x15, 0x01, 0xf0, 0xb0, "1 Coin  5 Credits"	},
819 	{0x15, 0x01, 0xf0, 0xa0, "1 Coin  6 Credits"	},
820 	{0x15, 0x01, 0xf0, 0x90, "1 Coin  7 Credits"	},
821 	{0x15, 0x01, 0xf0, 0x00, "No Coin B"		},
822 
823 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
824 	{0x16, 0x01, 0x01, 0x01, "Off"			},
825 	{0x16, 0x01, 0x01, 0x00, "On"			},
826 
827 	{0   , 0xfe, 0   ,    2, "Sound"		},
828 	{0x16, 0x01, 0x02, 0x02, "Mono"			},
829 	{0x16, 0x01, 0x02, 0x00, "Stereo"		},
830 
831 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
832 	{0x16, 0x01, 0x04, 0x04, "Off"			},
833 	{0x16, 0x01, 0x04, 0x00, "On"			},
834 };
835 
836 STDDIPINFO(Lgtnfght)
837 
838 static struct BurnDIPInfo PunkshotDIPList[]=
839 {
840 	{0x21, 0xff, 0xff, 0xff, NULL			},
841 	{0x22, 0xff, 0xff, 0x7f, NULL			},
842 	{0x23, 0xff, 0xff, 0xf0, NULL			},
843 
844 	{0   , 0xfe, 0   ,   16, "Coinage"		},
845 	{0x21, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" 	},
846 	{0x21, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" 	},
847 	{0x21, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" 	},
848 	{0x21, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" 	},
849 	{0x21, 0x01, 0x0f, 0x04, "3 Coins 2 Credits"	},
850 	{0x21, 0x01, 0x0f, 0x01, "4 Coins 3 Credits"	},
851 	{0x21, 0x01, 0x0f, 0x0f, "1 Coin  1 Credit" 	},
852 	{0x21, 0x01, 0x0f, 0x03, "3 Coins 4 Credits"	},
853 	{0x21, 0x01, 0x0f, 0x07, "2 Coins 3 Credits"	},
854 	{0x21, 0x01, 0x0f, 0x0e, "1 Coin  2 Credits"	},
855 	{0x21, 0x01, 0x0f, 0x06, "2 Coins 5 Credits"	},
856 	{0x21, 0x01, 0x0f, 0x0d, "1 Coin  3 Credits"	},
857 	{0x21, 0x01, 0x0f, 0x0c, "1 Coin  4 Credits"	},
858 	{0x21, 0x01, 0x0f, 0x0b, "1 Coin  5 Credits"	},
859 	{0x21, 0x01, 0x0f, 0x0a, "1 Coin  6 Credits"	},
860 	{0x21, 0x01, 0x0f, 0x09, "1 Coin  7 Credits"	},
861 
862 	{0   , 0xfe, 0   ,    2, "Continue"		},
863 	{0x21, 0x01, 0x10, 0x10, "Normal"		},
864 	{0x21, 0x01, 0x10, 0x00, "1 Coin"		},
865 
866 	{0   , 0xfe, 0   ,    4, "Energy"		},
867 	{0x22, 0x01, 0x03, 0x03, "30"			},
868 	{0x22, 0x01, 0x03, 0x02, "40"			},
869 	{0x22, 0x01, 0x03, 0x01, "50"			},
870 	{0x22, 0x01, 0x03, 0x00, "60"			},
871 
872 	{0   , 0xfe, 0   ,    4, "Period Length"	},
873 	{0x22, 0x01, 0x0c, 0x0c, "2 Minutes"		},
874 	{0x22, 0x01, 0x0c, 0x08, "3 Minutes"		},
875 	{0x22, 0x01, 0x0c, 0x04, "4 Minutes"		},
876 	{0x22, 0x01, 0x0c, 0x00, "5 Minutes"		},
877 
878 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
879 	{0x22, 0x01, 0x60, 0x60, "Easy"			},
880 	{0x22, 0x01, 0x60, 0x40, "Medium"		},
881 	{0x22, 0x01, 0x60, 0x20, "Hard"			},
882 	{0x22, 0x01, 0x60, 0x00, "Hardest"		},
883 
884 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
885 	{0x22, 0x01, 0x80, 0x80, "Off"			},
886 	{0x22, 0x01, 0x80, 0x00, "On"			},
887 
888 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
889 	{0x23, 0x01, 0x10, 0x10, "Off"			},
890 	{0x23, 0x01, 0x10, 0x00, "On"			},
891 
892 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
893 	{0x23, 0x01, 0x40, 0x40, "Off"			},
894 	{0x23, 0x01, 0x40, 0x00, "On"			},
895 
896 	{0   , 0xfe, 0   ,    2, "Freeze"		},
897 	{0x23, 0x01, 0x80, 0x80, "Off"			},
898 	{0x23, 0x01, 0x80, 0x00, "On"			},
899 };
900 
901 STDDIPINFO(Punkshot)
902 
903 static struct BurnDIPInfo Punkshot2DIPList[]=
904 {
905 	{0x12, 0xff, 0xff, 0xff, NULL			},
906 	{0x13, 0xff, 0xff, 0x7f, NULL			},
907 	{0x14, 0xff, 0xff, 0xf0, NULL			},
908 
909 	{0   , 0xfe, 0   ,    16, "Coinage"		},
910 	{0x12, 0x01, 0x0f, 0x00, "5 Coins 1 Credit" 	},
911 	{0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" 	},
912 	{0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" 	},
913 	{0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" 	},
914 	{0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits"	},
915 	{0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits"	},
916 	{0x12, 0x01, 0x0f, 0x0f, "1 Coin  1 Credit" 	},
917 	{0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits"	},
918 	{0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits"	},
919 	{0x12, 0x01, 0x0f, 0x0e, "1 Coin  2 Credits"	},
920 	{0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits"	},
921 	{0x12, 0x01, 0x0f, 0x0d, "1 Coin  3 Credits"	},
922 	{0x12, 0x01, 0x0f, 0x0c, "1 Coin  4 Credits"	},
923 	{0x12, 0x01, 0x0f, 0x0b, "1 Coin  5 Credits"	},
924 	{0x12, 0x01, 0x0f, 0x0a, "1 Coin  6 Credits"	},
925 	{0x12, 0x01, 0x0f, 0x09, "1 Coin  7 Credits"	},
926 
927 	{0   , 0xfe, 0   ,    2, "Continue"		},
928 	{0x12, 0x01, 0x10, 0x10, "Normal"		},
929 	{0x12, 0x01, 0x10, 0x00, "1 Coin"		},
930 
931 	{0   , 0xfe, 0   ,    4, "Energy"		},
932 	{0x13, 0x01, 0x03, 0x03, "40"			},
933 	{0x13, 0x01, 0x03, 0x02, "50"			},
934 	{0x13, 0x01, 0x03, 0x01, "60"			},
935 	{0x13, 0x01, 0x03, 0x00, "70"			},
936 
937 	{0   , 0xfe, 0   ,    4, "Period Length"	},
938 	{0x13, 0x01, 0x0c, 0x0c, "3 Minutes"		},
939 	{0x13, 0x01, 0x0c, 0x08, "4 Minutes"		},
940 	{0x13, 0x01, 0x0c, 0x04, "5 Minutes"		},
941 	{0x13, 0x01, 0x0c, 0x00, "6 Minutes"		},
942 
943 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
944 	{0x13, 0x01, 0x60, 0x60, "Easy"			},
945 	{0x13, 0x01, 0x60, 0x40, "Medium"		},
946 	{0x13, 0x01, 0x60, 0x20, "Hard"			},
947 	{0x13, 0x01, 0x60, 0x00, "Hardest"		},
948 
949 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
950 	{0x13, 0x01, 0x80, 0x80, "Off"			},
951 	{0x13, 0x01, 0x80, 0x00, "On"			},
952 
953 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
954 	{0x14, 0x01, 0x10, 0x10, "Off"			},
955 	{0x14, 0x01, 0x10, 0x00, "On"			},
956 
957 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
958 	{0x14, 0x01, 0x40, 0x40, "Off"			},
959 	{0x14, 0x01, 0x40, 0x00, "On"			},
960 
961 	{0   , 0xfe, 0   ,    2, "Freeze"		},
962 	{0x14, 0x01, 0x80, 0x80, "Off"			},
963 	{0x14, 0x01, 0x80, 0x00, "On"			},
964 };
965 
966 STDDIPINFO(Punkshot2)
967 
968 static struct BurnDIPInfo PunkshotjDIPList[]=
969 {
970 	{0x12, 0xff, 0xff, 0xff, NULL			},
971 	{0x13, 0xff, 0xff, 0x7f, NULL			},
972 	{0x14, 0xff, 0xff, 0xf0, NULL			},
973 
974 	{0   , 0xfe, 0   ,    16, "Coin A"		},
975 	{0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credit" 	},
976 	{0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credit" 	},
977 	{0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credit" 	},
978 	{0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits"	},
979 	{0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits"	},
980 	{0x12, 0x01, 0x0f, 0x0f, "1 Coin  1 Credit" 	},
981 	{0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits"	},
982 	{0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits"	},
983 	{0x12, 0x01, 0x0f, 0x0e, "1 Coin  2 Credits"	},
984 	{0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits"	},
985 	{0x12, 0x01, 0x0f, 0x0d, "1 Coin  3 Credits"	},
986 	{0x12, 0x01, 0x0f, 0x0c, "1 Coin  4 Credits"	},
987 	{0x12, 0x01, 0x0f, 0x0b, "1 Coin  5 Credits"	},
988 	{0x12, 0x01, 0x0f, 0x0a, "1 Coin  6 Credits"	},
989 	{0x12, 0x01, 0x0f, 0x09, "1 Coin  7 Credits"	},
990 	{0x12, 0x01, 0x0f, 0x00, "Free Play"		},
991 
992 	{0   , 0xfe, 0   ,    16, "Coin B"		},
993 	{0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credit" 	},
994 	{0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credit" 	},
995 	{0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credit" 	},
996 	{0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits"	},
997 	{0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits"	},
998 	{0x12, 0x01, 0xf0, 0xf0, "1 Coin  1 Credit" 	},
999 	{0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits"	},
1000 	{0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits"	},
1001 	{0x12, 0x01, 0xf0, 0xe0, "1 Coin  2 Credits"	},
1002 	{0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits"	},
1003 	{0x12, 0x01, 0xf0, 0xd0, "1 Coin  3 Credits"	},
1004 	{0x12, 0x01, 0xf0, 0xc0, "1 Coin  4 Credits"	},
1005 	{0x12, 0x01, 0xf0, 0xb0, "1 Coin  5 Credits"	},
1006 	{0x12, 0x01, 0xf0, 0xa0, "1 Coin  6 Credits"	},
1007 	{0x12, 0x01, 0xf0, 0x90, "1 Coin  7 Credits"	},
1008 	{0x12, 0x01, 0xf0, 0x00, "No Coin B"		},
1009 
1010 	{0   , 0xfe, 0   ,    4, "Period Time"	},
1011 	{0x13, 0x01, 0x0c, 0x0c, "1 Minute" 		},
1012 	{0x13, 0x01, 0x0c, 0x08, "2 Minutes"		},
1013 	{0x13, 0x01, 0x0c, 0x04, "3 Minutes"		},
1014 	{0x13, 0x01, 0x0c, 0x00, "4 Minutes"		},
1015 
1016 	{0   , 0xfe, 0   ,    4, "Difficulty"		},
1017 	{0x13, 0x01, 0x60, 0x60, "Easy"			},
1018 	{0x13, 0x01, 0x60, 0x40, "Medium"		},
1019 	{0x13, 0x01, 0x60, 0x20, "Hard"			},
1020 	{0x13, 0x01, 0x60, 0x00, "Hardest"		},
1021 
1022 	{0   , 0xfe, 0   ,    2, "Demo Sounds"		},
1023 	{0x13, 0x01, 0x80, 0x80, "Off"			},
1024 	{0x13, 0x01, 0x80, 0x00, "On"			},
1025 
1026 	{0   , 0xfe, 0   ,    2, "Flip Screen"		},
1027 	{0x14, 0x01, 0x10, 0x10, "Off"			},
1028 	{0x14, 0x01, 0x10, 0x00, "On"			},
1029 
1030 	{0   , 0xfe, 0   ,    2, "Service Mode"		},
1031 	{0x14, 0x01, 0x40, 0x40, "Off"			},
1032 	{0x14, 0x01, 0x40, 0x00, "On"			},
1033 
1034 	{0   , 0xfe, 0   ,    2, "Freeze"		},
1035 	{0x14, 0x01, 0x80, 0x80, "Off"			},
1036 	{0x14, 0x01, 0x80, 0x00, "On"			},
1037 };
1038 
1039 STDDIPINFO(Punkshotj)
1040 
1041 static struct BurnRomInfo TmntRomDesc[] = {
1042 	{ "963-x23.j17",        0x020000, 0xa9549004, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1043 	{ "963-x24.k17",        0x020000, 0xe5cc9067, BRF_ESS | BRF_PRG }, //  1
1044 	{ "963-x21.j15",        0x010000, 0x5789cf92, BRF_ESS | BRF_PRG }, //  2
1045 	{ "963-x22.k15",        0x010000, 0x0a74e277, BRF_ESS | BRF_PRG }, //  3
1046 
1047 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1048 
1049 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	   	   //  5	Tiles
1050 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	   	   //  6
1051 
1052 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1053 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1054 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1055 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1056 
1057 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1058 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	   	   // 12
1059 
1060 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	   	   // 13	K007232 Samples
1061 
1062 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1063 
1064 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1065 };
1066 
1067 STD_ROM_PICK(Tmnt)
1068 STD_ROM_FN(Tmnt)
1069 
1070 static struct BurnRomInfo TmntuRomDesc[] = {
1071 	{ "963-r23.j17",        0x020000, 0xa7f61195, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1072 	{ "963-r24.k17",        0x020000, 0x661e056a, BRF_ESS | BRF_PRG }, //  1
1073 	{ "963-r21.j15",        0x010000, 0xde047bb6, BRF_ESS | BRF_PRG }, //  2
1074 	{ "963-r22.k15",        0x010000, 0xd86a0888, BRF_ESS | BRF_PRG }, //  3
1075 
1076 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1077 
1078 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1079 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1080 
1081 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1082 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1083 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1084 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1085 
1086 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1087 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	   	   // 12
1088 
1089 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1090 
1091 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1092 
1093 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1094 };
1095 
1096 STD_ROM_PICK(Tmntu)
1097 STD_ROM_FN(Tmntu)
1098 
1099 static struct BurnRomInfo TmntuaRomDesc[] = {
1100 	{ "963-j23.j17",        0x020000, 0xf77314e2, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1101 	{ "963-j24.k17",        0x020000, 0x47f662d3, BRF_ESS | BRF_PRG }, //  1
1102 	{ "963-j21.j15",        0x010000, 0x7bee9fe8, BRF_ESS | BRF_PRG }, //  2
1103 	{ "963-j22.k15",        0x010000, 0x2efed09f, BRF_ESS | BRF_PRG }, //  3
1104 
1105 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1106 
1107 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1108 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1109 
1110 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1111 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1112 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1113 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1114 
1115 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1116 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1117 
1118 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1119 
1120 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1121 
1122 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1123 };
1124 
1125 STD_ROM_PICK(Tmntua)
1126 STD_ROM_FN(Tmntua)
1127 
1128 static struct BurnRomInfo TmntubRomDesc[] = {
1129 	{ "963-h23.j17",        0x020000, 0x718086e1, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1130 	{ "963-h24.k17",        0x020000, 0x2f7d66e1, BRF_ESS | BRF_PRG }, //  1
1131 	{ "963-h21.j15",        0x010000, 0x1944641e, BRF_ESS | BRF_PRG }, //  2
1132 	{ "963-h22.k15",        0x010000, 0x50ce5512, BRF_ESS | BRF_PRG }, //  3
1133 
1134 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1135 
1136 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1137 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1138 
1139 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1140 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1141 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1142 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1143 
1144 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1145 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1146 
1147 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1148 
1149 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1150 
1151 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1152 };
1153 
1154 STD_ROM_PICK(Tmntub)
1155 STD_ROM_FN(Tmntub)
1156 
1157 static struct BurnRomInfo TmhtRomDesc[] = {
1158 	{ "963-f23.j17",        0x020000, 0x9cb5e461, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1159 	{ "963-f24.k17",        0x020000, 0x2d902fab, BRF_ESS | BRF_PRG }, //  1
1160 	{ "963-f21.j15",        0x010000, 0x9fa25378, BRF_ESS | BRF_PRG }, //  2
1161 	{ "963-f22.k15",        0x010000, 0x2127ee53, BRF_ESS | BRF_PRG }, //  3
1162 
1163 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1164 
1165 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1166 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1167 
1168 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1169 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1170 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1171 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1172 
1173 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1174 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1175 
1176 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1177 
1178 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1179 
1180 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1181 };
1182 
1183 STD_ROM_PICK(Tmht)
1184 STD_ROM_FN(Tmht)
1185 
1186 static struct BurnRomInfo TmhtaRomDesc[] = {
1187 	{ "963-s23.j17",        0x020000, 0xb5af7eee, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1188 	{ "963-s24.k17",        0x020000, 0xbcb8ce8b, BRF_ESS | BRF_PRG }, //  1
1189 	{ "963-s21.j15",        0x010000, 0x0b88bfa6, BRF_ESS | BRF_PRG }, //  2
1190 	{ "963-s22.k15",        0x010000, 0x44ce6d4b, BRF_ESS | BRF_PRG }, //  3
1191 
1192 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1193 
1194 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1195 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1196 
1197 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1198 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1199 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1200 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1201 
1202 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1203 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1204 
1205 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1206 
1207 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1208 
1209 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1210 };
1211 
1212 STD_ROM_PICK(Tmhta)
1213 STD_ROM_FN(Tmhta)
1214 
1215 static struct BurnRomInfo TmhtbRomDesc[] = {
1216 	{ "unk3.i17",        	0x020000, 0x537eb047, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1217 	{ "unk4.k17",        	0x020000, 0x5afae564, BRF_ESS | BRF_PRG }, //  1
1218 	{ "unk2.j15",        	0x010000, 0xee34de05, BRF_ESS | BRF_PRG }, //  2
1219 	{ "unk5.k15",        	0x010000, 0x5ef58d4e, BRF_ESS | BRF_PRG }, //  3
1220 
1221 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1222 
1223 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1224 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1225 
1226 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1227 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1228 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1229 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1230 
1231 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1232 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1233 
1234 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1235 
1236 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1237 
1238 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1239 };
1240 
1241 STD_ROM_PICK(Tmhtb)
1242 STD_ROM_FN(Tmhtb)
1243 
1244 static struct BurnRomInfo TmntjRomDesc[] = {
1245 	{ "963_223.j17",        0x020000, 0x0d34a5ff, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1246 	{ "963_224.k17",        0x020000, 0x2fd453f2, BRF_ESS | BRF_PRG }, //  1
1247 	{ "963_221.j15",        0x010000, 0xfa8e25fd, BRF_ESS | BRF_PRG }, //  2
1248 	{ "963_222.k15",        0x010000, 0xca437a4f, BRF_ESS | BRF_PRG }, //  3
1249 
1250 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1251 
1252 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1253 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1254 
1255 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1256 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1257 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1258 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1259 
1260 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1261 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1262 
1263 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1264 
1265 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1266 
1267 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1268 };
1269 
1270 STD_ROM_PICK(Tmntj)
1271 STD_ROM_FN(Tmntj)
1272 
1273 static struct BurnRomInfo TmntaRomDesc[] = {
1274 	{ "tmnt j17.bin",       0x020000, 0x00819687, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1275 	{ "tmnt k17.bin",       0x020000, 0x6930e085, BRF_ESS | BRF_PRG }, //  1
1276 	{ "tmnt j15.bin",       0x010000, 0xfd1e2e01, BRF_ESS | BRF_PRG }, //  2
1277 	{ "tmnt k15.bin",       0x010000, 0xb01eea79, BRF_ESS | BRF_PRG }, //  3
1278 
1279 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1280 
1281 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1282 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1283 
1284 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1285 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1286 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1287 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1288 
1289 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1290 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1291 
1292 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1293 
1294 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1295 
1296 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1297 };
1298 
1299 STD_ROM_PICK(Tmnta)
1300 STD_ROM_FN(Tmnta)
1301 
1302 static struct BurnRomInfo Tmht2pRomDesc[] = {
1303 	{ "963-u23.j17",        0x020000, 0x58bec748, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1304 	{ "963-u24.k17",        0x020000, 0xdce87c8d, BRF_ESS | BRF_PRG }, //  1
1305 	{ "963-u21.j15",        0x010000, 0xabce5ead, BRF_ESS | BRF_PRG }, //  2
1306 	{ "963-u22.k15",        0x010000, 0x4ecc8d6b, BRF_ESS | BRF_PRG }, //  3
1307 
1308 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1309 
1310 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1311 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1312 
1313 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1314 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1315 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1316 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1317 
1318 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1319 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1320 
1321 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1322 
1323 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1324 
1325 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1326 };
1327 
1328 STD_ROM_PICK(Tmht2p)
1329 STD_ROM_FN(Tmht2p)
1330 
1331 static struct BurnRomInfo Tmht2paRomDesc[] = {
1332 	{ "963-_23.j17",        0x020000, 0x8698061a, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1333 	{ "963-_24.k17",        0x020000, 0x4036c075, BRF_ESS | BRF_PRG }, //  1
1334 	{ "963-_21.j15",        0x010000, 0xddcc979c, BRF_ESS | BRF_PRG }, //  2
1335 	{ "963-_22.k15",        0x010000, 0x71a38d27, BRF_ESS | BRF_PRG }, //  3
1336 
1337 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1338 
1339 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1340 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1341 
1342 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1343 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1344 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1345 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1346 
1347 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1348 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1349 
1350 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1351 
1352 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1353 
1354 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1355 };
1356 
1357 STD_ROM_PICK(Tmht2pa)
1358 STD_ROM_FN(Tmht2pa)
1359 
1360 static struct BurnRomInfo Tmnt2pjRomDesc[] = {
1361 	{ "963-123.j17",        0x020000, 0x6a3527c9, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1362 	{ "963-124.k17",        0x020000, 0x2c4bfa15, BRF_ESS | BRF_PRG }, //  1
1363 	{ "963-121.j15",        0x010000, 0x4181b733, BRF_ESS | BRF_PRG }, //  2
1364 	{ "963-122.k15",        0x010000, 0xc64eb5ff, BRF_ESS | BRF_PRG }, //  3
1365 
1366 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1367 
1368 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1369 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1370 
1371 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1372 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1373 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1374 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1375 
1376 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1377 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1378 
1379 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1380 
1381 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1382 
1383 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1384 };
1385 
1386 STD_ROM_PICK(Tmnt2pj)
1387 STD_ROM_FN(Tmnt2pj)
1388 
1389 static struct BurnRomInfo Tmnt2poRomDesc[] = {
1390 	{ "tmnt123.j17",        0x020000, 0x2d905183, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1391 	{ "tmnt124.k17",        0x020000, 0xe0125352, BRF_ESS | BRF_PRG }, //  1
1392 	{ "tmnt21.j15",         0x010000, 0x12deeafb, BRF_ESS | BRF_PRG }, //  2
1393 	{ "tmnt22.k15",         0x010000, 0xaec4f1c3, BRF_ESS | BRF_PRG }, //  3
1394 
1395 	{ "963e20.g13",         0x008000, 0x1692a6d6, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1396 
1397 	{ "963a28.h27",         0x080000, 0xdb4769a8, BRF_GRA },	       //  5	Tiles
1398 	{ "963a29.k27",         0x080000, 0x8069cd2e, BRF_GRA },	       //  6
1399 
1400 	{ "963a17.h4",          0x080000, 0xb5239a44, BRF_GRA },	       //  7	Sprites
1401 	{ "963a18.h6",          0x080000, 0xdd51adef, BRF_GRA },	       //  8
1402 	{ "963a15.k4",          0x080000, 0x1f324eed, BRF_GRA },	       //  9
1403 	{ "963a16.k6",          0x080000, 0xd4bd9984, BRF_GRA },	       // 10
1404 
1405 	{ "963a30.g7",          0x000100, 0xabd82680, BRF_GRA },	       // 11	PROMs
1406 	{ "963a31.g19",         0x000100, 0xf8004a1c, BRF_GRA },	       // 12
1407 
1408 	{ "963a26.c13",         0x020000, 0xe2ac3063, BRF_SND },	       // 13	K007232 Samples
1409 
1410 	{ "963a27.d18",         0x020000, 0x2dfd674b, BRF_SND },	       // 14	UP7759C Samples
1411 
1412 	{ "963a25.d5",          0x080000, 0xfca078c7, BRF_SND },	       // 15	Title Music Sample
1413 };
1414 
1415 STD_ROM_PICK(Tmnt2po)
1416 STD_ROM_FN(Tmnt2po)
1417 
1418 static struct BurnRomInfo MiaRomDesc[] = {
1419 	{ "808t20.h17",         0x020000, 0x6f0acb1d, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1420 	{ "808t21.j17",         0x020000, 0x42a30416, BRF_ESS | BRF_PRG }, //  1
1421 
1422 	{ "808e03.f4",          0x008000, 0x3d93a7cd, BRF_ESS | BRF_PRG }, //  2	Z80 Program
1423 
1424 	{ "808e12.f28",         0x010000, 0xd62f1fde, BRF_GRA },	       //  3	Tiles
1425 	{ "808e13.h28",         0x010000, 0x1fa708f4, BRF_GRA },	       //  4
1426 	{ "808e22.i28",         0x010000, 0x73d758f6, BRF_GRA },	       //  5
1427 	{ "808e23.k28",         0x010000, 0x8ff08b21, BRF_GRA },	       //  6
1428 
1429 	{ "808d17.j4",          0x080000, 0xd1299082, BRF_GRA },	       //  7	Sprites
1430 	{ "808d15.h4",          0x080000, 0x2b22a6b6, BRF_GRA },	       //  8
1431 
1432 	{ "808a18.f16",         0x000100, 0xeb95aede, BRF_GRA },	       //  9	PROMs
1433 
1434 	{ "808d01.d4",          0x020000, 0xfd4d37c0, BRF_SND },	       // 10	K007232 Samples
1435 };
1436 
1437 STD_ROM_PICK(Mia)
1438 STD_ROM_FN(Mia)
1439 
1440 static struct BurnRomInfo Mia2RomDesc[] = {
1441 	{ "808s20.h17",         0x020000, 0xcaa2897f, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1442 	{ "808s21.j17",         0x020000, 0x3d892ffb, BRF_ESS | BRF_PRG }, //  1
1443 
1444 	{ "808e03.f4",          0x008000, 0x3d93a7cd, BRF_ESS | BRF_PRG }, //  2	Z80 Program
1445 
1446 	{ "808e12.f28",         0x010000, 0xd62f1fde, BRF_GRA },	       //  3	Tiles
1447 	{ "808e13.h28",         0x010000, 0x1fa708f4, BRF_GRA },	       //  4
1448 	{ "808e22.i28",         0x010000, 0x73d758f6, BRF_GRA },	       //  5
1449 	{ "808e23.k28",         0x010000, 0x8ff08b21, BRF_GRA },	       //  6
1450 
1451 	{ "808d17.j4",          0x080000, 0xd1299082, BRF_GRA },	       //  7	Sprites
1452 	{ "808d15.h4",          0x080000, 0x2b22a6b6, BRF_GRA },	       //  8
1453 
1454 	{ "808a18.f16",         0x000100, 0xeb95aede, BRF_GRA },	       //  9	PROMs
1455 
1456 	{ "808d01.d4",          0x020000, 0xfd4d37c0, BRF_SND },	       // 10	K007232 Samples
1457 };
1458 
1459 STD_ROM_PICK(Mia2)
1460 STD_ROM_FN(Mia2)
1461 
1462 static struct BurnRomInfo CuebrickRomDesc[] = {
1463 	{ "903d25.g12",         0x010000, 0x8d575663, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1464 	{ "903d24.f12",         0x010000, 0x2973625d, BRF_ESS | BRF_PRG }, //  1
1465 
1466 	{ "903c29.k21",         0x010000, 0xfada986d, BRF_GRA },	       //  2	Tiles
1467 	{ "903c27.k17",         0x010000, 0x5bd4b8e1, BRF_GRA },	       //  3
1468 	{ "903c28.k19",         0x010000, 0x80d2bfaf, BRF_GRA },	       //  4
1469 	{ "903c26.k15",         0x010000, 0xf808fa3d, BRF_GRA },	       //  5
1470 
1471 	{ "903d23.k12",         0x010000, 0xc39fc9fd, BRF_GRA },	       //  6	Sprites
1472 	{ "903d21.k8",          0x010000, 0x3c7bf8cd, BRF_GRA },	       //  7
1473 	{ "903d22.k10",         0x010000, 0x95ad8591, BRF_GRA },	       //  8
1474 	{ "903d20.k6",          0x010000, 0x2872a1bb, BRF_GRA },	       //  9
1475 };
1476 
1477 STD_ROM_PICK(Cuebrick)
1478 STD_ROM_FN(Cuebrick)
1479 
1480 static struct BurnRomInfo BlswhstlRomDesc[] = {
1481 	{ "060_l02.e09",        0x020000, 0xe8b7b234, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1482 	{ "060_l03.g09",        0x020000, 0x3c26d281, BRF_ESS | BRF_PRG }, //  1
1483 	{ "060_l09.e11",        0x020000, 0x14628736, BRF_ESS | BRF_PRG }, //  2
1484 	{ "060_l10.g11",        0x020000, 0xf738ad4a, BRF_ESS | BRF_PRG }, //  3
1485 
1486 	{ "060j01.f3",          0x010000, 0xf9d9a673, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1487 
1488 	{ "060e07.k16",         0x080000, 0xc400edf3, BRF_GRA },	       //  5	Tiles
1489 	{ "060e08.k12",         0x080000, 0x70dddba1, BRF_GRA },	       //  6
1490 
1491 	{ "060e06.k7",          0x080000, 0x09381492, BRF_GRA },	       //  7	Sprites
1492 	{ "060e05.k3",          0x080000, 0x32454241, BRF_GRA },	       //  8
1493 
1494 	{ "060e04.d1",          0x100000, 0xc680395d, BRF_SND },	       //  9	K053260 Samples
1495 
1496 	{ "blswhstl.nv",  		0x000080, 0x87434e3f, BRF_OPT },
1497 };
1498 
1499 STD_ROM_PICK(Blswhstl)
1500 STD_ROM_FN(Blswhstl)
1501 
1502 static struct BurnRomInfo BlswhstlaRomDesc[] = {
1503 	{ "060_m02.e09",        0x020000, 0xbc9dd08f, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1504 	{ "060_m03.g09",        0x020000, 0x7b6ee4a4, BRF_ESS | BRF_PRG }, //  1
1505 	{ "060_m09.e11",        0x020000, 0x14628736, BRF_ESS | BRF_PRG }, //  2
1506 	{ "060_m10.g11",        0x020000, 0xf738ad4a, BRF_ESS | BRF_PRG }, //  3
1507 
1508 	{ "060j01.f3",          0x010000, 0xf9d9a673, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1509 
1510 	{ "060e07.k16",         0x080000, 0xc400edf3, BRF_GRA },	       //  5	Tiles
1511 	{ "060e08.k12",         0x080000, 0x70dddba1, BRF_GRA },	       //  6
1512 
1513 	{ "060e06.k7",          0x080000, 0x09381492, BRF_GRA },	       //  7	Sprites
1514 	{ "060e05.k3",          0x080000, 0x32454241, BRF_GRA },	       //  8
1515 
1516 	{ "060e04.d1",          0x100000, 0xc680395d, BRF_SND },	       //  9	K053260 Samples
1517 
1518 	{ "blswhstl.nv",  		0x000080, 0x87434e3f, BRF_OPT },
1519 };
1520 
1521 STD_ROM_PICK(Blswhstla)
1522 STD_ROM_FN(Blswhstla)
1523 
1524 static struct BurnRomInfo DetatwinRomDesc[] = {
1525 	{ "060_j02.e09",        0x020000, 0x11b761ac, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1526 	{ "060_j03.g09",        0x020000, 0x8d0b588c, BRF_ESS | BRF_PRG }, //  1
1527 	{ "060_j09.e11",        0x020000, 0xf2a5f15f, BRF_ESS | BRF_PRG }, //  2
1528 	{ "060_j10.g11",        0x020000, 0x36eefdbc, BRF_ESS | BRF_PRG }, //  3
1529 
1530 	{ "060j01.f3",          0x010000, 0xf9d9a673, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1531 
1532 	{ "060e07.k16",         0x080000, 0xc400edf3, BRF_GRA },	   	   //  5	Tiles
1533 	{ "060e08.k12",         0x080000, 0x70dddba1, BRF_GRA },	       //  6
1534 
1535 	{ "060e06.k7",          0x080000, 0x09381492, BRF_GRA },	       //  7	Sprites
1536 	{ "060e05.k3",          0x080000, 0x32454241, BRF_GRA },	       //  8
1537 
1538 	{ "060e04.d1",          0x100000, 0xc680395d, BRF_SND },	       //  9	K053260 Samples
1539 
1540 	{ "blswhstl.nv",  		0x000080, 0x87434e3f, BRF_OPT },
1541 };
1542 
1543 STD_ROM_PICK(Detatwin)
1544 STD_ROM_FN(Detatwin)
1545 
1546 static struct BurnRomInfo SsridersRomDesc[] = {
1547 	{ "064eac02.8e",        0x040000, 0x5a5425f4, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1548 	{ "064eac03.8g",        0x040000, 0x093c00fb, BRF_ESS | BRF_PRG }, //  1
1549 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1550 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1551 
1552 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1553 
1554 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1555 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1556 
1557 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1558 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1559 
1560 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1561 
1562 	{ "ssriders_eac.nv",  	0x000080, 0xf6d641a7, BRF_OPT },
1563 };
1564 
1565 STD_ROM_PICK(Ssriders)
1566 STD_ROM_FN(Ssriders)
1567 
1568 static struct BurnRomInfo SsridersebdRomDesc[] = {
1569 	{ "064ebd02.8e",        0x040000, 0x8deef9ac, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1570 	{ "064ebd03.8g",        0x040000, 0x2370c107, BRF_ESS | BRF_PRG }, //  1
1571 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1572 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1573 
1574 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1575 
1576 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1577 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1578 
1579 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1580 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1581 
1582 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1583 
1584 	{ "ssriders_ebd.nv",  	0x000080, 0xcbc903f6, BRF_OPT },
1585 };
1586 
1587 STD_ROM_PICK(Ssridersebd)
1588 STD_ROM_FN(Ssridersebd)
1589 
1590 static struct BurnRomInfo SsridersebcRomDesc[] = {
1591 	{ "064ebc02.8e",        0x040000, 0x9bd7d164, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1592 	{ "064ebc03.8g",        0x040000, 0x40fd4165, BRF_ESS | BRF_PRG }, //  1
1593 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1594 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1595 
1596 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1597 
1598 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1599 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1600 
1601 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1602 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1603 
1604 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1605 
1606 	{ "ssriders_ebc.nv",  	0x000080, 0x1918e90f, BRF_OPT },
1607 };
1608 
1609 STD_ROM_PICK(Ssridersebc)
1610 STD_ROM_FN(Ssridersebc)
1611 
1612 static struct BurnRomInfo SsridersudaRomDesc[] = {
1613 	{ "064uda02.8e",        0x040000, 0x5129a6b7, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1614 	{ "064uda03.8g",        0x040000, 0x9f887214, BRF_ESS | BRF_PRG }, //  1
1615 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1616 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1617 
1618 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1619 
1620 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1621 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1622 
1623 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1624 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1625 
1626 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1627 
1628 	{ "ssriders_uda.nv",  	0x000080, 0x148c6d64, BRF_OPT },
1629 };
1630 
1631 STD_ROM_PICK(Ssridersuda)
1632 STD_ROM_FN(Ssridersuda)
1633 
1634 static struct BurnRomInfo SsriderseaaRomDesc[] = {
1635 	{ "064eaa02.8e",        0x040000, 0x4844660f, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1636 	{ "064eaa03.8g",        0x040000, 0x0b9bcc7c, BRF_ESS | BRF_PRG }, //  1
1637 	{ "064eaa04.10e",       0x020000, 0x5d917c1c, BRF_ESS | BRF_PRG }, //  2
1638 	{ "064eaa05.10g",       0x020000, 0xf4647b74, BRF_ESS | BRF_PRG }, //  3
1639 
1640 	{ "064eaa01.2f",        0x010000, 0xbce45d82, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1641 
1642 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1643 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1644 
1645 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1646 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1647 
1648 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1649 
1650 	{ "ssriders_eaa.nv",  	0x000080, 0x74a45ef5, BRF_OPT },
1651 };
1652 
1653 STD_ROM_PICK(Ssriderseaa)
1654 STD_ROM_FN(Ssriderseaa)
1655 
1656 static struct BurnRomInfo SsridersuabRomDesc[] = {
1657 	{ "064uab02.8e",        0x040000, 0xf1a3c548, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1658 	{ "064uab03.8g",        0x040000, 0x66a61287, BRF_ESS | BRF_PRG }, //  1
1659 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1660 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1661 
1662 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1663 
1664 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1665 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1666 
1667 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1668 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1669 
1670 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1671 
1672 	{ "ssriders_uab.nv",  	0x000080, 0xfe08b210, BRF_OPT },
1673 };
1674 
1675 STD_ROM_PICK(Ssridersuab)
1676 STD_ROM_FN(Ssridersuab)
1677 
1678 static struct BurnRomInfo SsridersuacRomDesc[] = {
1679 	{ "064uac02.8e",        0x040000, 0x870473b6, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1680 	{ "064uac03.8g",        0x040000, 0xeadf289a, BRF_ESS | BRF_PRG }, //  1
1681 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1682 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1683 
1684 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1685 
1686 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1687 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1688 
1689 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1690 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1691 
1692 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1693 
1694 	{ "ssriders_uac.nv",  	0x000080, 0x26c8f1a0, BRF_OPT },
1695 };
1696 
1697 STD_ROM_PICK(Ssridersuac)
1698 STD_ROM_FN(Ssridersuac)
1699 
1700 static struct BurnRomInfo SsridersubcRomDesc[] = {
1701 	{ "064ubc02.8e",        0x040000, 0xaca7fda5, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1702 	{ "064ubc03.8g",        0x040000, 0xbb1fdeff, BRF_ESS | BRF_PRG }, //  1
1703 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1704 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1705 
1706 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1707 
1708 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1709 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1710 
1711 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1712 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1713 
1714 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1715 
1716 	{ "ssriders_ubc.nv",  	0x000080, 0x31c5504f, BRF_OPT },
1717 };
1718 
1719 STD_ROM_PICK(Ssridersubc)
1720 STD_ROM_FN(Ssridersubc)
1721 
1722 static struct BurnRomInfo SsridersabdRomDesc[] = {
1723 	{ "064abd02.8e",        0x040000, 0x713406cb, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1724 	{ "064abd03.8g",        0x040000, 0x680feb3c, BRF_ESS | BRF_PRG }, //  1
1725 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1726 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1727 
1728 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1729 
1730 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1731 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1732 
1733 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1734 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1735 
1736 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1737 
1738 	{ "ssriders_abd.nv",  	0x000080, 0xbfdafedf, BRF_OPT },
1739 };
1740 
1741 STD_ROM_PICK(Ssridersabd)
1742 STD_ROM_FN(Ssridersabd)
1743 
1744 static struct BurnRomInfo SsridersaddRomDesc[] = {
1745 	{ "064add02.8e",        0x040000, 0x06b0138e, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1746 	{ "064add03.8g",        0x040000, 0x03eb8b91, BRF_ESS | BRF_PRG }, //  1
1747 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1748 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1749 
1750 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1751 
1752 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1753 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1754 
1755 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1756 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1757 
1758 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1759 
1760 	{ "ssriders_add.nv",  	0x000080, 0xf06242d5, BRF_OPT },
1761 };
1762 
1763 STD_ROM_PICK(Ssridersadd)
1764 STD_ROM_FN(Ssridersadd)
1765 
1766 static struct BurnRomInfo SsridersjacRomDesc[] = {
1767 	{ "064jac02.8e",        0x040000, 0x64a35f6f, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1768 	{ "064jac03.8g",        0x040000, 0xb5957946, BRF_ESS | BRF_PRG }, //  1
1769 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1770 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1771 
1772 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1773 
1774 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1775 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1776 
1777 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1778 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1779 
1780 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1781 
1782 	{ "ssriders_jac.nv",  	0x000080, 0xeeb0c55f, BRF_OPT },
1783 };
1784 
1785 STD_ROM_PICK(Ssridersjac)
1786 STD_ROM_FN(Ssridersjac)
1787 
1788 static struct BurnRomInfo SsridersjadRomDesc[] = {
1789 	{ "064jad02.8e",        0x040000, 0x13709ee6, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1790 	{ "064jad03.8g",        0x040000, 0x2fa32229, BRF_ESS | BRF_PRG }, //  1
1791 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1792 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1793 
1794 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1795 
1796 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1797 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1798 
1799 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1800 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1801 
1802 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1803 
1804 	{ "ssriders_jad.nv",  	0x000080, 0x8962058c, BRF_OPT },
1805 };
1806 
1807 STD_ROM_PICK(Ssridersjad)
1808 STD_ROM_FN(Ssridersjad)
1809 
1810 static struct BurnRomInfo SsridersjbdRomDesc[] = {
1811 	{ "064jbd02.8e",        0x040000, 0x7acdc1e3, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1812 	{ "064jbd03.8g",        0x040000, 0x6a424918, BRF_ESS | BRF_PRG }, //  1
1813 	{ "064eab04.10e",       0x020000, 0xef2315bd, BRF_ESS | BRF_PRG }, //  2
1814 	{ "064eab05.10g",       0x020000, 0x51d6fbc4, BRF_ESS | BRF_PRG }, //  3
1815 
1816 	{ "064e01.2f",          0x010000, 0x44b9bc52, BRF_ESS | BRF_PRG }, //  4	Z80 Program
1817 
1818 	{ "064e12.16k",         0x080000, 0xe2bdc619, BRF_GRA },	       //  5	Tiles
1819 	{ "064e11.12k",         0x080000, 0x2d8ca8b0, BRF_GRA },	       //  6
1820 
1821 	{ "064e09.7l",          0x100000, 0x4160c372, BRF_GRA },	       //  7	Sprites
1822 	{ "064e07.3l",          0x100000, 0x64dd673c, BRF_GRA },	       //  8
1823 
1824 	{ "064e06.1d",          0x100000, 0x59810df9, BRF_SND },	       //  9	K053260 Samples
1825 
1826 	{ "ssriders_jbd.nv",  	0x000080, 0x006200e3, BRF_OPT },
1827 };
1828 
1829 STD_ROM_PICK(Ssridersjbd)
1830 STD_ROM_FN(Ssridersjbd)
1831 
1832 static struct BurnRomInfo ssridersbRomDesc[] = {
1833 	{ "sunsetb.03",		0x080000, 0x37ffe90b, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
1834 	{ "sunsetb.04",		0x080000, 0x8ff647b7, BRF_ESS | BRF_PRG }, //  1
1835 
1836 	{ "064e12.16k",		0x080000, 0xe2bdc619, BRF_GRA },	       //  2	Tiles
1837 	{ "064e11.12k",		0x080000, 0x2d8ca8b0, BRF_GRA },	       //  3
1838 
1839 	{ "sunsetb.05",		0x080000, 0x8a0ff31a, BRF_GRA },	       //  4	Sprites
1840 	{ "sunsetb.06",		0x080000, 0xfdf2c887, BRF_GRA },	       //  5
1841 	{ "sunsetb.07",		0x080000, 0xa545b1ed, BRF_GRA },	       //  6
1842 	{ "sunsetb.08",		0x080000, 0xf867cd38, BRF_GRA },	       //  7
1843 
1844 	{ "sunsetb.01",		0x080000, 0x1a8b5ca2, BRF_SND },	       //  8	OKI Samples
1845 	{ "sunsetb.02",		0x080000, 0x5d485523, BRF_SND },	       //  9
1846 };
1847 
1848 STD_ROM_PICK(ssridersb)
1849 STD_ROM_FN(ssridersb)
1850 
1851 static struct BurnRomInfo thndrx2RomDesc[] = {
1852 	{ "073-ea-l02.11c",	0x020000, 0xeae02b51, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
1853 	{ "073-ea-l03.12c",	0x020000, 0x738ed007, BRF_ESS | BRF_PRG }, //  1
1854 
1855 	{ "073-c01.4f",		0x010000, 0x44ebe83c, BRF_ESS | BRF_PRG }, //  2 	Z80 Code
1856 
1857 	{ "073-c06.16k",	0x080000, 0x24e22b42, BRF_GRA },           //  3 	Tiles
1858 	{ "073-c05.12k",	0x080000, 0x952a935f, BRF_GRA },           //  4
1859 
1860 	{ "073-c07.7k",		0x080000, 0x14e93f38, BRF_GRA },           //  5 	Sprites
1861 	{ "073-c08.3k",		0x080000, 0x09fab3ab, BRF_GRA },           //  6
1862 
1863 	{ "073-b04.2d",		0x080000, 0x05287a0b, BRF_SND },           //  7 	K053260 Samples
1864 
1865 	{ "thndrx2.nv",  	0x000080, 0xca613e98, BRF_OPT },
1866 };
1867 
1868 STD_ROM_PICK(thndrx2)
1869 STD_ROM_FN(thndrx2)
1870 
1871 static struct BurnRomInfo thndrx2aRomDesc[] = {
1872 	{ "073-aa-m02.11c",	0x020000, 0x5b5b4cc0, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
1873 	{ "073-aa-m03.12c",	0x020000, 0x320435a8, BRF_ESS | BRF_PRG }, //  1
1874 
1875 	{ "073-c01.4f",		0x010000, 0x44ebe83c, BRF_ESS | BRF_PRG }, //  2 	Z80 Code
1876 
1877 	{ "073-c06.16k",	0x080000, 0x24e22b42, BRF_GRA },           //  3 	Tiles
1878 	{ "073-c05.12k",	0x080000, 0x952a935f, BRF_GRA },           //  4
1879 
1880 	{ "073-c07.7k",		0x080000, 0x14e93f38, BRF_GRA },           //  5 	Sprites
1881 	{ "073-c08.3k",		0x080000, 0x09fab3ab, BRF_GRA },           //  6
1882 
1883 	{ "073-b04.2d",		0x080000, 0x05287a0b, BRF_SND },           //  7 	K053260 Samples
1884 
1885 	{ "thndrx2a.nv",  	0x000080, 0xf7893d00, BRF_OPT },
1886 };
1887 
1888 STD_ROM_PICK(thndrx2a)
1889 STD_ROM_FN(thndrx2a)
1890 
1891 static struct BurnRomInfo thndrx2jRomDesc[] = {
1892 	{ "073-ja-k02.11c",	0x020000, 0x0c8b2d3f, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
1893 	{ "073-ja-k03.12c",	0x020000, 0x3803b427, BRF_ESS | BRF_PRG }, //  1
1894 
1895 	{ "073-c01.4f",		0x010000, 0x44ebe83c, BRF_ESS | BRF_PRG }, //  2 	Z80 Code
1896 
1897 	{ "073-c06.16k",	0x080000, 0x24e22b42, BRF_GRA },           //  3 	Tiles
1898 	{ "073-c05.12k",	0x080000, 0x952a935f, BRF_GRA },           //  4
1899 
1900 	{ "073-c07.7k",		0x080000, 0x14e93f38, BRF_GRA },           //  5 	Sprites
1901 	{ "073-c08.3k",		0x080000, 0x09fab3ab, BRF_GRA },           //  6
1902 
1903 	{ "073-b04.2d",		0x080000, 0x05287a0b, BRF_SND },           //  7 	K053260 Samples
1904 
1905 	{ "thndrx2j.nv",  	0x000080, 0x83b4799b, BRF_OPT },
1906 };
1907 
1908 STD_ROM_PICK(thndrx2j)
1909 STD_ROM_FN(thndrx2j)
1910 
1911 static struct BurnRomInfo lgtnfghtRomDesc[] = {
1912 	{ "939k02.e11",		0x020000, 0x2dfefa53, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
1913 	{ "939k03.e15",		0x020000, 0x14f0c454, BRF_ESS | BRF_PRG }, //  1
1914 
1915 	{ "939e01.d7",		0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, //  2 	Z80 Code
1916 
1917 	{ "939a07.k14",		0x080000, 0x7955dfcf, BRF_GRA },           //  3 	Tiles
1918 	{ "939a08.k19",		0x080000, 0xed95b385, BRF_GRA },           //  4
1919 
1920 	{ "939a06.k8",		0x080000, 0xe393c206, BRF_GRA },           //  5 	Sprites
1921 	{ "939a05.k2",		0x080000, 0x3662d47a, BRF_GRA },           //  6
1922 
1923 	{ "939a04.c5",		0x080000, 0xc24e2b6e, BRF_SND },           //  7 	K053260 Samples
1924 };
1925 
1926 STD_ROM_PICK(lgtnfght)
1927 STD_ROM_FN(lgtnfght)
1928 
1929 static struct BurnRomInfo lgtnfghtuRomDesc[] = {
1930 	{ "939m02.e11",		0x020000, 0x61a12184, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
1931 	{ "939m03.e15",		0x020000, 0x6db6659d, BRF_ESS | BRF_PRG }, //  1
1932 
1933 	{ "939e01.d7",		0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, //  2 	Z80 Code
1934 
1935 	{ "939a07.k14",		0x080000, 0x7955dfcf, BRF_GRA },           //  3 	Tiles
1936 	{ "939a08.k19",		0x080000, 0xed95b385, BRF_GRA },           //  4
1937 
1938 	{ "939a06.k8",		0x080000, 0xe393c206, BRF_GRA },           //  5 	Sprites
1939 	{ "939a05.k2",		0x080000, 0x3662d47a, BRF_GRA },           //  6
1940 
1941 	{ "939a04.c5",		0x080000, 0xc24e2b6e, BRF_SND },           //  7 	K053260 Samples
1942 };
1943 
1944 STD_ROM_PICK(lgtnfghtu)
1945 STD_ROM_FN(lgtnfghtu)
1946 
1947 static struct BurnRomInfo lgtnfghtaRomDesc[] = {
1948 	{ "939j_02.e11",	0x020000, 0xbbbb4a74, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
1949 	{ "939j_03.e15",	0x020000, 0x8d4da7b7, BRF_ESS | BRF_PRG }, //  1
1950 
1951 	{ "939e01.d7",		0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, //  2 	Z80 Code
1952 
1953 	{ "939a07.k14",		0x080000, 0x7955dfcf, BRF_GRA },           //  3 	Tiles
1954 	{ "939a08.k19",		0x080000, 0xed95b385, BRF_GRA },           //  4
1955 
1956 	{ "939a06.k8",		0x080000, 0xe393c206, BRF_GRA },           //  5 	Sprites
1957 	{ "939a05.k2",		0x080000, 0x3662d47a, BRF_GRA },           //  6
1958 
1959 	{ "939a04.c5",		0x080000, 0xc24e2b6e, BRF_SND },           //  7 	K053260 Samples
1960 };
1961 
1962 STD_ROM_PICK(lgtnfghta)
1963 STD_ROM_FN(lgtnfghta)
1964 
1965 static struct BurnRomInfo trigonRomDesc[] = {
1966 	{ "939j02.e11",		0x020000, 0x38381d1b, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
1967 	{ "939j03.e15",		0x020000, 0xb5beddcd, BRF_ESS | BRF_PRG }, //  1
1968 
1969 	{ "939e01.d7",		0x008000, 0x4a5fc848, BRF_ESS | BRF_PRG }, //  2 	Z80 Code
1970 
1971 	{ "939a07.k14",		0x080000, 0x7955dfcf, BRF_GRA },           //  3 	Tiles
1972 	{ "939a08.k19",		0x080000, 0xed95b385, BRF_GRA },           //  4
1973 
1974 	{ "939a06.k8",		0x080000, 0xe393c206, BRF_GRA },           //  5 	Sprites
1975 	{ "939a05.k2",		0x080000, 0x3662d47a, BRF_GRA },           //  6
1976 
1977 	{ "939a04.c5",		0x080000, 0xc24e2b6e, BRF_SND },           //  7 	K053260 Samples
1978 };
1979 
1980 STD_ROM_PICK(trigon)
1981 STD_ROM_FN(trigon)
1982 
1983 static struct BurnRomInfo tmnt2RomDesc[] = {
1984 	{ "063uaa02.8e",	0x020000, 0x58d5c93d, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
1985 	{ "063uaa03.8g",	0x020000, 0x0541fec9, BRF_ESS | BRF_PRG }, //  1
1986 	{ "063uaa04.10e",	0x020000, 0x1d441a7d, BRF_ESS | BRF_PRG }, //  2
1987 	{ "063uaa05.10g",	0x020000, 0x9c428273, BRF_ESS | BRF_PRG }, //  3
1988 
1989 	{ "063b01.2f",		0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, //  4 	Z80 Code
1990 
1991 	{ "063b12.16k",		0x080000, 0xd3283d19, BRF_GRA },           //  5	Tiles
1992 	{ "063b11.12k",		0x080000, 0x6ebc0c15, BRF_GRA },           //  6
1993 
1994 	{ "063b09.7l",		0x100000, 0x2d7a9d2a, BRF_GRA },           //  7	Sprites
1995 	{ "063b10.7k",		0x080000, 0xf2dd296e, BRF_GRA },           //  8
1996 	{ "063b07.3l",		0x100000, 0xd9bee7bf, BRF_GRA },           //  9
1997 	{ "063b08.3k",		0x080000, 0x3b1ae36f, BRF_GRA },           // 10
1998 
1999 	{ "063b06.1d",		0x200000, 0x1e510aa5, BRF_SND },           // 11	K053260 Samples
2000 
2001 	{ "tmnt2_uaa.nv",  	0x000080, 0x284357bd, BRF_OPT },
2002 };
2003 
2004 STD_ROM_PICK(tmnt2)
2005 STD_ROM_FN(tmnt2)
2006 
2007 static struct BurnRomInfo tmnt22puRomDesc[] = {
2008 	{ "063uda02.8e",	0x020000, 0xaadffe3a, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
2009 	{ "063uda03.8g",	0x020000, 0x125687a8, BRF_ESS | BRF_PRG }, //  1
2010 	{ "063uda04.10e",	0x020000, 0xfb5c7ded, BRF_ESS | BRF_PRG }, //  2
2011 	{ "063uda05.10g",	0x020000, 0x3c40fe66, BRF_ESS | BRF_PRG }, //  3
2012 
2013 	{ "063b01.2f",		0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, //  4 	Z80 Code
2014 
2015 	{ "063b12.16k",		0x080000, 0xd3283d19, BRF_GRA },           //  5	Tiles
2016 	{ "063b11.12k",		0x080000, 0x6ebc0c15, BRF_GRA },           //  6
2017 
2018 	{ "063b09.7l",		0x100000, 0x2d7a9d2a, BRF_GRA },           //  7	Sprites
2019 	{ "063b10.7k",		0x080000, 0xf2dd296e, BRF_GRA },           //  8
2020 	{ "063b07.3l",		0x100000, 0xd9bee7bf, BRF_GRA },           //  9
2021 	{ "063b08.3k",		0x080000, 0x3b1ae36f, BRF_GRA },           // 10
2022 
2023 	{ "063b06.1d",		0x200000, 0x1e510aa5, BRF_SND },           // 11	K053260 Samples
2024 
2025 	{ "tmnt2_uda.nv",  	0x000080, 0x44928d33, BRF_OPT },
2026 };
2027 
2028 STD_ROM_PICK(tmnt22pu)
2029 STD_ROM_FN(tmnt22pu)
2030 
2031 static struct BurnRomInfo tmht22peRomDesc[] = {
2032 	{ "063eba02.8e",	0x020000, 0x99409094, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
2033 	{ "063eba03.8g",	0x020000, 0x4d65650f, BRF_ESS | BRF_PRG }, //  1
2034 	{ "063eba04.10e",	0x020000, 0xf6e3b9c7, BRF_ESS | BRF_PRG }, //  2
2035 	{ "063eba05.10g",	0x020000, 0x1bad6696, BRF_ESS | BRF_PRG }, //  3
2036 
2037 	{ "063b01.2f",		0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, //  4 	Z80 Code
2038 
2039 	{ "063b12.16k",		0x080000, 0xd3283d19, BRF_GRA },           //  5	Tiles
2040 	{ "063b11.12k",		0x080000, 0x6ebc0c15, BRF_GRA },           //  6
2041 
2042 	{ "063b09.7l",		0x100000, 0x2d7a9d2a, BRF_GRA },           //  7	Sprites
2043 	{ "063b10.7k",		0x080000, 0xf2dd296e, BRF_GRA },           //  8
2044 	{ "063b07.3l",		0x100000, 0xd9bee7bf, BRF_GRA },           //  9
2045 	{ "063b08.3k",		0x080000, 0x3b1ae36f, BRF_GRA },           // 10
2046 
2047 	{ "063b06.1d",		0x200000, 0x1e510aa5, BRF_SND },           // 11	K053260 Samples
2048 
2049 	{ "tmnt2_eba.nv",  	0x000080, 0xc0a3ed50, BRF_OPT },
2050 };
2051 
2052 STD_ROM_PICK(tmht22pe)
2053 STD_ROM_FN(tmht22pe)
2054 
2055 static struct BurnRomInfo tmht24peRomDesc[] = {
2056 	{ "063eaa02.8e",	0x020000, 0x665a68de, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
2057 	{ "063eaa03.8g",	0x020000, 0x7b7fb3af, BRF_ESS | BRF_PRG }, //  1
2058 	{ "063eaa04.10e",	0x020000, 0x69f38e1d, BRF_ESS | BRF_PRG }, //  2
2059 	{ "063eaa05.10g",	0x020000, 0x818032af, BRF_ESS | BRF_PRG }, //  3
2060 
2061 	{ "063b01.2f",		0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, //  4 	Z80 Code
2062 
2063 	{ "063b12.16k",		0x080000, 0xd3283d19, BRF_GRA },           //  5	Tiles
2064 	{ "063b11.12k",		0x080000, 0x6ebc0c15, BRF_GRA },           //  6
2065 
2066 	{ "063b09.7l",		0x100000, 0x2d7a9d2a, BRF_GRA },           //  7	Sprites
2067 	{ "063b10.7k",		0x080000, 0xf2dd296e, BRF_GRA },           //  8
2068 	{ "063b07.3l",		0x100000, 0xd9bee7bf, BRF_GRA },           //  9
2069 	{ "063b08.3k",		0x080000, 0x3b1ae36f, BRF_GRA },           // 10
2070 
2071 	{ "063b06.1d",		0x200000, 0x1e510aa5, BRF_SND },           // 11	K053260 Samples
2072 
2073 	{ "tmnt2_eaa.nv",  	0x000080, 0x124af18f, BRF_OPT },
2074 };
2075 
2076 STD_ROM_PICK(tmht24pe)
2077 STD_ROM_FN(tmht24pe)
2078 
2079 static struct BurnRomInfo tmnt2aRomDesc[] = {
2080 	{ "063ada02.8e",	0x020000, 0x4f11b587, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
2081 	{ "063ada03.8g",	0x020000, 0x82a1b9ac, BRF_ESS | BRF_PRG }, //  1
2082 	{ "063ada04.10e",	0x020000, 0x05ad187a, BRF_ESS | BRF_PRG }, //  2
2083 	{ "063ada05.10g",	0x020000, 0xd4826547, BRF_ESS | BRF_PRG }, //  3
2084 
2085 	{ "063b01.2f",		0x010000, 0x364f548a, BRF_ESS | BRF_PRG }, //  4 	Z80 Code
2086 
2087 	{ "063b12.16k",		0x080000, 0xd3283d19, BRF_GRA },           //  5	Tiles
2088 	{ "063b11.12k",		0x080000, 0x6ebc0c15, BRF_GRA },           //  6
2089 
2090 	{ "063b09.7l",		0x100000, 0x2d7a9d2a, BRF_GRA },           //  7	Sprites
2091 	{ "063b10.7k",		0x080000, 0xf2dd296e, BRF_GRA },           //  8
2092 	{ "063b07.3l",		0x100000, 0xd9bee7bf, BRF_GRA },           //  9
2093 	{ "063b08.3k",		0x080000, 0x3b1ae36f, BRF_GRA },           // 10
2094 
2095 	{ "063b06.1d",		0x200000, 0x1e510aa5, BRF_SND },           // 11	K053260 Samples
2096 
2097 	{ "tmnt2_ada.nv",  	0x000080, 0x063068a0, BRF_OPT },
2098 };
2099 
2100 STD_ROM_PICK(tmnt2a)
2101 STD_ROM_FN(tmnt2a)
2102 
2103 static struct BurnRomInfo qgakumonRomDesc[] = {
2104 	{ "248jaa02.8e",	0x040000, 0xfab79410, BRF_ESS | BRF_PRG }, //  0 	68000 Program Code
2105 	{ "248jaa03.8g",	0x040000, 0x8d888ef3, BRF_ESS | BRF_PRG }, //  1
2106 	{ "248jaa04.10e",	0x040000, 0x56cb16cb, BRF_ESS | BRF_PRG }, //  2
2107 	{ "248jaa05.10g",	0x040000, 0x27614fcd, BRF_ESS | BRF_PRG }, //  3
2108 
2109 	{ "248a01.2f",		0x010000, 0xa8a41cc6, BRF_ESS | BRF_PRG }, //  4 	Z80 Code
2110 
2111 	{ "248a12.16k",		0x080000, 0x62870987, BRF_GRA },           //  5 	Tiles
2112 	{ "248a11.12k",		0x080000, 0xfad2dbfd, BRF_GRA },           //  6
2113 
2114 	{ "248a09.7l",		0x100000, 0xa176e205, BRF_GRA },           //  7	Sprites
2115 	{ "248a07.3l",		0x100000, 0x9595589f, BRF_GRA },           //  8
2116 
2117 	{ "248a06.1d",		0x200000, 0x0fba1def, BRF_SND },           //  9	K053260 Samples
2118 
2119 	{ "qgakumon.nv",  	0x000080, 0x847bd238, BRF_OPT },
2120 };
2121 
2122 STD_ROM_PICK(qgakumon)
2123 STD_ROM_FN(qgakumon)
2124 
2125 static struct BurnRomInfo punkshotRomDesc[] = {
2126 	{ "907-j02.i7",		0x020000, 0xdbb3a23b, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
2127 	{ "907-j03.i10",	0x020000, 0x2151d1ab, BRF_ESS | BRF_PRG }, //  1
2128 
2129 	{ "907f01.e8",		0x008000, 0xf040c484, BRF_ESS | BRF_PRG }, //  2	Z80 Program
2130 
2131 	{ "907d06.e23",		0x040000, 0xf5cc38f4, BRF_GRA },	   	   //  3	Tiles
2132 	{ "907d05.e22",		0x040000, 0xe25774c1, BRF_GRA },	       //  4
2133 
2134 	{ "907d07.k2",		0x100000, 0xb0fe4543, BRF_GRA },	       //  5	Sprites
2135 	{ "907d08.k7",		0x100000, 0xd5ac8d9d, BRF_GRA },	       //  6
2136 
2137 	{ "907d04.d3",		0x080000, 0x090feb5e, BRF_SND },	       //  7	K053260 Samples
2138 };
2139 
2140 STD_ROM_PICK(punkshot)
2141 STD_ROM_FN(punkshot)
2142 
2143 static struct BurnRomInfo punkshot2RomDesc[] = {
2144 	{ "907m02.i7",		0x020000, 0x59e14575, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
2145 	{ "907m03.i10",		0x020000, 0xadb14b1e, BRF_ESS | BRF_PRG }, //  1
2146 
2147 	{ "907f01.e8",		0x008000, 0xf040c484, BRF_ESS | BRF_PRG }, //  2	Z80 Program
2148 
2149 	{ "907d06.e23",		0x040000, 0xf5cc38f4, BRF_GRA },	       //  3	Tiles
2150 	{ "907d05.e22",		0x040000, 0xe25774c1, BRF_GRA },	       //  4
2151 
2152 	{ "907d07.k2",		0x100000, 0xb0fe4543, BRF_GRA },	       //  5	Sprites
2153 	{ "907d08.k7",		0x100000, 0xd5ac8d9d, BRF_GRA },	       //  6
2154 
2155 	{ "907d04.d3",		0x080000, 0x090feb5e, BRF_SND },	       //  7	K053260 Samples
2156 };
2157 
2158 STD_ROM_PICK(punkshot2)
2159 STD_ROM_FN(punkshot2)
2160 
2161 static struct BurnRomInfo punkshotjRomDesc[] = {
2162 	{ "907z02.i7",		0x020000, 0x7a3a5c89, BRF_ESS | BRF_PRG }, //  0	68000 Program Code
2163 	{ "907z03.i10",		0x020000, 0x22a3d9d6, BRF_ESS | BRF_PRG }, //  1
2164 
2165 	{ "907f01.e8",		0x008000, 0xf040c484, BRF_ESS | BRF_PRG }, //  2	Z80 Program
2166 
2167 	{ "907d06.e23",		0x040000, 0xf5cc38f4, BRF_GRA },	       //  3	Tiles
2168 	{ "907d05.e22",		0x040000, 0xe25774c1, BRF_GRA },	       //  4
2169 
2170 	{ "907d07.k2",		0x100000, 0xb0fe4543, BRF_GRA },	       //  5	Sprites
2171 	{ "907d08.k7",		0x100000, 0xd5ac8d9d, BRF_GRA },	       //  6
2172 
2173 	{ "907d04.d3",		0x080000, 0x090feb5e, BRF_SND },	       //  7	K053260 Samples
2174 };
2175 
2176 STD_ROM_PICK(punkshotj)
STD_ROM_FN(punkshotj)2177 STD_ROM_FN(punkshotj)
2178 
2179 static INT32 TmntMemIndex()
2180 {
2181 	UINT8 *Next; Next = Mem;
2182 
2183 	Drv68KRom              = Next; Next += 0x060000;
2184 	DrvZ80Rom              = Next; Next += 0x008000;
2185 	DrvSoundRom            = Next; Next += 0x020000;
2186 	DrvUPD7759CRom         = Next; Next += 0x020000;
2187 	DrvTileRom             = Next; Next += 0x100000;
2188 	DrvSpriteRom           = Next; Next += 0x200000;
2189 
2190 	RamStart               = Next;
2191 
2192 	Drv68KRam              = Next; Next += 0x004000;
2193 	DrvZ80Ram              = Next; Next += 0x000800;
2194 	DrvPaletteRam          = Next; Next += 0x001000;
2195 
2196 	RamEnd                 = Next;
2197 
2198 	konami_palette32	= (UINT32*)Next;
2199 	DrvPalette             = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
2200 	DrvTitleSample         = (INT16*)Next; Next += 0x40000 * sizeof(INT16);
2201 	DrvTiles               = Next; Next += 0x008000 * 8 * 8;
2202 	DrvSprites             = Next; Next += 0x004000 * 16 * 16;
2203 
2204 	MemEnd                 = Next;
2205 
2206 	return 0;
2207 }
2208 
MiaMemIndex()2209 static INT32 MiaMemIndex()
2210 {
2211 	UINT8 *Next; Next = Mem;
2212 
2213 	Drv68KRom              = Next; Next += 0x040000;
2214 	DrvZ80Rom              = Next; Next += 0x008000;
2215 	DrvSoundRom            = Next; Next += 0x020000;
2216 	DrvTileRom             = Next; Next += 0x040000;
2217 	DrvSpriteRom           = Next; Next += 0x100000;
2218 
2219 	RamStart               = Next;
2220 
2221 	Drv68KRam              = Next; Next += 0x008000;
2222 	DrvZ80Ram              = Next; Next += 0x000800;
2223 	DrvPaletteRam          = Next; Next += 0x001000;
2224 
2225 	RamEnd                 = Next;
2226 
2227 	konami_palette32       = (UINT32*)Next;
2228 	DrvPalette             = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
2229 	DrvTiles               = Next; Next += 0x002000 * 8 * 8;
2230 	DrvSprites             = Next; Next += 0x002000 * 16 * 16;
2231 
2232 	MemEnd                 = Next;
2233 
2234 	return 0;
2235 }
2236 
CuebrickMemIndex()2237 static INT32 CuebrickMemIndex()
2238 {
2239 	UINT8 *Next; Next = Mem;
2240 
2241 	Drv68KRom              = Next; Next += 0x020000;
2242 	DrvTileRom             = Next; Next += 0x040000;
2243 	DrvSpriteRom           = Next; Next += 0x040000;
2244 
2245 	RamStart               = Next;
2246 
2247 	Drv68KRam              = Next; Next += 0x008000;
2248 	DrvPaletteRam          = Next; Next += 0x001000;
2249 
2250 	RamEnd                 = Next;
2251 
2252 	konami_palette32       = (UINT32*)Next;
2253 	DrvPalette             = (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
2254 	DrvTiles               = Next; Next += 0x002000 * 8 * 8;
2255 	DrvSprites             = Next; Next += 0x001000 * 16 * 16;
2256 	DrvNvRam               = Next; Next += 0x400 * 0x20;
2257 
2258 	MemEnd                 = Next;
2259 
2260 	return 0;
2261 }
2262 
BlswhstlMemIndex()2263 static INT32 BlswhstlMemIndex()
2264 {
2265 	UINT8 *Next; Next = Mem;
2266 
2267 	Drv68KRom              = Next; Next += 0x080000;
2268 	DrvZ80Rom              = Next; Next += 0x010000;
2269 	DrvSoundRom            = Next; Next += 0x100000;
2270 	DrvTileRom             = Next; Next += 0x100000;
2271 	DrvSpriteRom           = Next; Next += 0x100000;
2272 
2273 	RamStart               = Next;
2274 
2275 	Drv68KRam              = Next; Next += 0x004000;
2276 	DrvZ80Ram              = Next; Next += 0x000800;
2277 	DrvPaletteRam          = Next; Next += 0x001000;
2278 	DrvSpriteRam           = Next; Next += 0x004000;
2279 
2280 	RamEnd                 = Next;
2281 
2282 	DrvTiles               = Next; Next += 0x008000 * 8 * 8;
2283 	DrvSprites             = Next; Next += 0x002000 * 16 * 16;
2284 	konami_palette32       = (UINT32*)Next;
2285 	DrvPalette             = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
2286 
2287 	MemEnd                 = Next;
2288 
2289 	return 0;
2290 }
2291 
SsridersMemIndex()2292 static INT32 SsridersMemIndex()
2293 {
2294 	UINT8 *Next; Next = Mem;
2295 
2296 	Drv68KRom              = Next; Next += 0x0c0000;
2297 	DrvZ80Rom              = Next; Next += 0x010000;
2298 	DrvSoundRom            = Next; Next += 0x100000;
2299 	DrvTileRom             = Next; Next += 0x100000;
2300 	DrvSpriteRom           = Next; Next += 0x200000;
2301 
2302 	RamStart               = Next;
2303 
2304 	Drv68KRam              = Next; Next += 0x004080;
2305 	DrvZ80Ram              = Next; Next += 0x000800;
2306 	DrvPaletteRam          = Next; Next += 0x001000;
2307 	DrvSpriteRam           = Next; Next += 0x004000;
2308 
2309 	RamEnd                 = Next;
2310 
2311 	konami_palette32       = (UINT32*)Next;
2312 	DrvPalette             = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
2313 	DrvTiles               = Next; Next += 0x008000 * 8 * 8;
2314 	DrvSprites             = Next; Next += 0x004000 * 16 * 16;
2315 
2316 	MemEnd                 = Next;
2317 
2318 	return 0;
2319 }
2320 
Tmnt2MemIndex()2321 static INT32 Tmnt2MemIndex()
2322 {
2323 	UINT8 *Next; Next = Mem;
2324 
2325 	Drv68KRom              = Next; Next += 0x100000;
2326 	DrvZ80Rom              = Next; Next += 0x010000;
2327 	DrvSoundRom            = Next; Next += 0x200000;
2328 	DrvTileRom             = Next; Next += 0x100000;
2329 	DrvSpriteRom           = Next; Next += 0x400000;
2330 
2331 	RamStart               = Next;
2332 
2333 	Drv68KRam              = Next; Next += 0x005080;
2334 	DrvZ80Ram              = Next; Next += 0x000800;
2335 	DrvPaletteRam          = Next; Next += 0x001000;
2336 	DrvSpriteRam           = Next; Next += 0x004000;
2337 
2338 	RamEnd                 = Next;
2339 
2340 	konami_palette32       = (UINT32*)Next;
2341 	DrvPalette             = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
2342 	DrvTiles               = Next; Next += 0x008000 * 8 * 8;
2343 	DrvSprites             = Next; Next += 0x008000 * 16 * 16;
2344 
2345 	MemEnd                 = Next;
2346 
2347 	return 0;
2348 }
2349 
Thndrx2MemIndex()2350 static INT32 Thndrx2MemIndex()
2351 {
2352 	UINT8 *Next; Next = Mem;
2353 
2354 	RamStart               = Next;
2355 
2356 	Drv68KRam              = Next; Next += 0x004000;
2357 	DrvZ80Ram              = Next; Next += 0x000800;
2358 	DrvPaletteRam          = Next; Next += 0x001000;
2359 
2360 	RamEnd                 = Next;
2361 
2362 	Drv68KRom              = Next; Next += 0x080000;
2363 	DrvZ80Rom              = Next; Next += 0x010000;
2364 	DrvSoundRom            = Next; Next += 0x080000;
2365 	DrvTileRom             = Next; Next += 0x100000;
2366 	DrvSpriteRom           = Next; Next += 0x100000;
2367 
2368 	konami_palette32       = (UINT32*)Next;
2369 	DrvPalette             = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
2370 	DrvTiles               = Next; Next += 0x008000 * 8 * 8;
2371 	DrvSprites             = Next; Next += 0x002000 * 16 * 16;
2372 
2373 	MemEnd                 = Next;
2374 
2375 	return 0;
2376 }
2377 
LgtnfghtMemIndex()2378 static INT32 LgtnfghtMemIndex()
2379 {
2380 	UINT8 *Next; Next = Mem;
2381 
2382 	RamStart               = Next;
2383 
2384 	Drv68KRam              = Next; Next += 0x004000;
2385 	DrvZ80Ram              = Next; Next += 0x000800;
2386 	DrvPaletteRam          = Next; Next += 0x001000;
2387 	DrvSpriteRam           = Next; Next += 0x004000;
2388 
2389 	RamEnd                 = Next;
2390 
2391 	Drv68KRom              = Next; Next += 0x080000;
2392 	DrvZ80Rom              = Next; Next += 0x010000;
2393 	DrvSoundRom            = Next; Next += 0x080000;
2394 	DrvTileRom             = Next; Next += 0x100000;
2395 	DrvSpriteRom           = Next; Next += 0x100000;
2396 
2397 	konami_palette32       = (UINT32*)Next;
2398 	DrvPalette             = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
2399 	DrvTiles               = Next; Next += 0x008000 * 8 * 8;
2400 	DrvSprites             = Next; Next += 0x002000 * 16 * 16;
2401 
2402 	MemEnd                 = Next;
2403 
2404 	return 0;
2405 }
2406 
PunkshotMemIndex()2407 static INT32 PunkshotMemIndex()
2408 {
2409 	UINT8 *Next; Next = Mem;
2410 
2411 	Drv68KRom              = Next; Next += 0x040000;
2412 	DrvZ80Rom              = Next; Next += 0x010000;
2413 	DrvSoundRom            = Next; Next += 0x080000;
2414 	DrvTileRom             = Next; Next += 0x080000;
2415 	DrvSpriteRom           = Next; Next += 0x200000;
2416 
2417 	RamStart               = Next;
2418 
2419 	Drv68KRam              = Next; Next += 0x004000;
2420 	DrvZ80Ram              = Next; Next += 0x000800;
2421 	DrvPaletteRam          = Next; Next += 0x001000;
2422 
2423 	RamEnd                 = Next;
2424 
2425 	konami_palette32       = (UINT32*)Next;
2426 	DrvPalette             = (UINT32*)Next; Next += 0x00810 * sizeof(UINT32);
2427 	DrvTiles               = Next; Next += 0x004000 * 8 * 8;
2428 	DrvSprites             = Next; Next += 0x004000 * 16 * 16;
2429 
2430 	MemEnd                 = Next;
2431 
2432 	return 0;
2433 }
2434 
DrvDoReset()2435 static INT32 DrvDoReset()
2436 {
2437 	SekOpen(0);
2438 	SekReset();
2439 	SekClose();
2440 
2441 	ZetOpen(0);
2442 	ZetReset();
2443 	ZetClose();
2444 
2445 	if (uses_k007232) K007232Reset(0);
2446 	BurnYM2151Reset();
2447 
2448 	KonamiICReset();
2449 
2450 	bIrqEnable = 0;
2451 	DrvSoundLatch = 0;
2452 	TitleSoundLatch = 0;
2453 	PlayTitleSample = 0;
2454 	TitleSamplePos = 0;
2455 	PriorityFlag = 0;
2456 
2457 	return 0;
2458 }
2459 
TmntDoReset()2460 static INT32 TmntDoReset()
2461 {
2462 	INT32 nRet = DrvDoReset();
2463 
2464 	if (uses_k007232) K007232Reset(0);
2465 	UPD7759Reset();
2466 
2467 	UPD7759StartWrite(0, 0);
2468 	UPD7759ResetWrite(0, 1);
2469 
2470 	return nRet;
2471 }
2472 
CuebrickDoReset()2473 static INT32 CuebrickDoReset()
2474 {
2475 	SekOpen(0);
2476 	SekReset();
2477 	SekClose();
2478 
2479 	BurnYM2151Reset();
2480 
2481 	KonamiICReset();
2482 
2483 	bIrqEnable = 0;
2484 	DrvNvRamBank = 0;
2485 	PriorityFlag = 0;
2486 	CuebrickSndIrqFire = 0;
2487 
2488 	return 0;
2489 }
2490 
BlswhstlDoReset()2491 static INT32 BlswhstlDoReset()
2492 {
2493 	SekOpen(0);
2494 	SekReset();
2495 	SekClose();
2496 
2497 	ZetOpen(0);
2498 	ZetReset();
2499 	ZetClose();
2500 
2501 	BurnYM2151Reset();
2502 	K053260Reset(0);
2503 
2504 	KonamiICReset();
2505 
2506 	EEPROMReset();
2507 
2508 	if (EEPROMAvailable()) {
2509 		InitEEPROMCount = 0;
2510 	} else {
2511 		InitEEPROMCount = 10;
2512 	}
2513 
2514 	BlswhstlTileRomBank = 0;
2515 
2516 	K052109_irq_enabled = 0;
2517 
2518 	return 0;
2519 }
2520 
SsridersDoReset()2521 static INT32 SsridersDoReset()
2522 {
2523 	static const UINT8 thndrx2_eeprom_data[128] = { // Enable stereo sound (Dink)
2524 		0x00, 0x00, 0x40, 0xC0, 0x80, 0x20, 0x00, 0x0E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2525 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2526 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2527 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2528 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2529 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2530 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2531 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
2532 	};
2533 	static const UINT8 thndrx2j_eeprom_data[128] = { // Enable stereo sound (Dink)
2534 		0x00, 0x00, 0x40, 0xC0, 0x80, 0x20, 0x00, 0xD6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2535 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2536 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2537 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2538 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2539 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2540 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2541 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
2542 	};
2543 	static const UINT8 thndrx2a_eeprom_data[128] = { // Enable stereo sound (Dink)
2544 		0x00, 0x00, 0x40, 0xC0, 0x80, 0x20, 0x00, 0x2E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2545 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2546 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2547 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2548 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2549 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2550 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2551 		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
2552 	};
2553 
2554 	SekOpen(0);
2555 	SekReset();
2556 	SekClose();
2557 
2558 	ZetOpen(0);
2559 	ZetReset();
2560 	ZetClose();
2561 
2562 	BurnYM2151Reset();
2563 	K053260Reset(0);
2564 
2565 	KonamiICReset();
2566 
2567 	EEPROMReset();
2568 
2569 	if (EEPROMAvailable()) {
2570 		InitEEPROMCount = 0;
2571 	} else {
2572 		if (strncmp(BurnDrvGetTextA(DRV_NAME), "thndrx2j", 8) == 0) {
2573 			EEPROMFill(thndrx2j_eeprom_data, 0, 128);
2574 		} else
2575 		if (strncmp(BurnDrvGetTextA(DRV_NAME), "thndrx2a", 8) == 0) {
2576 			EEPROMFill(thndrx2a_eeprom_data, 0, 128);
2577 		} else
2578 			if (strncmp(BurnDrvGetTextA(DRV_NAME), "thndrx2", 7) == 0) {
2579 				EEPROMFill(thndrx2_eeprom_data, 0, 128);
2580 			} else {
2581 				InitEEPROMCount = 10;
2582 			}
2583 	}
2584 
2585 	K052109_irq_enabled = 0;
2586 	DrvVBlank = 0;
2587 
2588 	dim_c = 0;
2589 	dim_v = 0;
2590 
2591 	return 0;
2592 }
2593 
PunkshotDoReset()2594 static INT32 PunkshotDoReset()
2595 {
2596 	SekOpen(0);
2597 	SekReset();
2598 	SekClose();
2599 
2600 	ZetOpen(0);
2601 	ZetReset();
2602 	ZetClose();
2603 
2604 	BurnYM2151Reset();
2605 	K053260Reset(0);
2606 
2607 	KonamiICReset();
2608 
2609 	K052109_irq_enabled = 0;
2610 	DrvVBlank = 0;
2611 
2612 	return 0;
2613 }
2614 
Tmnt68KReadByte(UINT32 a)2615 UINT8 __fastcall Tmnt68KReadByte(UINT32 a)
2616 {
2617 	K052109WordNoA12Read(0x100000)
2618 	K051937ByteRead(0x140000)
2619 	K051960ByteRead(0x140400)
2620 
2621 	switch (a) {
2622 		case 0x0a0001: {
2623 			return 0xff - DrvInput[0];
2624 		}
2625 
2626 		case 0x0a0003: {
2627 			return 0xff - DrvInput[1];
2628 		}
2629 
2630 		case 0x0a0005: {
2631 			return 0xff - DrvInput[2];
2632 		}
2633 
2634 		case 0x0a0007: {
2635 			return 0xff - DrvInput[3];
2636 		}
2637 
2638 		case 0x0a0011: {
2639 			return DrvDip[0];
2640 		}
2641 
2642 		case 0x0a0013: {
2643 			return DrvDip[1];
2644 		}
2645 
2646 		case 0x0a0015: {
2647 			return 0xff - DrvInput[4];
2648 		}
2649 
2650 		case 0x0a0019: {
2651 			return DrvDip[2];
2652 		}
2653 
2654 		default: {
2655 			bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a);
2656 		}
2657 	}
2658 
2659 	return 0;
2660 }
2661 
Tmnt68KWriteByte(UINT32 a,UINT8 d)2662 void __fastcall Tmnt68KWriteByte(UINT32 a, UINT8 d)
2663 {
2664 	K052109WordNoA12Write(0x100000)
2665 	K015937ByteWrite(0x140000)
2666 	K051960ByteWrite(0x140400)
2667 
2668 	switch (a) {
2669 		case 0x0a0001: {
2670 			static INT32 Last;
2671 			if (Last == 0x08 && (d & 0x08) == 0) {
2672 				ZetOpen(0);
2673 				ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
2674 				ZetClose();
2675 			}
2676 			Last = d & 0x08;
2677 
2678 			bIrqEnable = (d & 0x20) ? 1 : 0;
2679 
2680 			K052109RMRDLine = d & 0x80;
2681 			return;
2682 		}
2683 
2684 		case 0x0a0009: {
2685 			DrvSoundLatch = d;
2686 			return;
2687 		}
2688 
2689 		case 0x0a0011: {
2690 			// watchdog write
2691 			return;
2692 		}
2693 
2694 		case 0x0c0001: {
2695 			PriorityFlag = (d & 0x0c) >> 2;
2696 			return;
2697 		}
2698 
2699 		case 0x10e801: {
2700 			// nop???
2701 			return;
2702 		}
2703 
2704 		default: {
2705 			bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d);
2706 		}
2707 	}
2708 }
2709 
Tmnt68KReadWord(UINT32 a)2710 UINT16 __fastcall Tmnt68KReadWord(UINT32 a)
2711 {
2712 	switch (a) {
2713 		default: {
2714 			bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a);
2715 		}
2716 	}
2717 
2718 	return 0;
2719 }
2720 
Tmnt68KWriteWord(UINT32 a,UINT16 d)2721 void __fastcall Tmnt68KWriteWord(UINT32 a, UINT16 d)
2722 {
2723 	K051960WordWrite(0x140400)
2724 
2725 	switch (a) {
2726 		default: {
2727 			bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d);
2728 		}
2729 	}
2730 }
2731 
Mia68KReadByte(UINT32 a)2732 UINT8 __fastcall Mia68KReadByte(UINT32 a)
2733 {
2734 	K052109WordNoA12Read(0x100000)
2735 	K051937ByteRead(0x140000)
2736 	K051960ByteRead(0x140400)
2737 
2738 	switch (a) {
2739 		case 0x0a0001: {
2740 			return 0xff - DrvInput[0];
2741 		}
2742 
2743 		case 0x0a0003: {
2744 			return 0xff - DrvInput[1];
2745 		}
2746 
2747 		case 0x0a0005: {
2748 			return 0xff - DrvInput[2];
2749 		}
2750 
2751 		case 0x0a0011: {
2752 			return DrvDip[0];
2753 		}
2754 
2755 		case 0x0a0013: {
2756 			return DrvDip[1];
2757 		}
2758 
2759 		case 0x0a0019: {
2760 			return DrvDip[2];
2761 		}
2762 
2763 		default: {
2764 			bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a);
2765 		}
2766 	}
2767 
2768 	return 0;
2769 }
2770 
Mia68KWriteByte(UINT32 a,UINT8 d)2771 void __fastcall Mia68KWriteByte(UINT32 a, UINT8 d)
2772 {
2773 	K052109WordNoA12Write(0x100000)
2774 	K015937ByteWrite(0x140000)
2775 	K051960ByteWrite(0x140400)
2776 
2777 	switch (a) {
2778 		case 0x0a0001: {
2779 			static INT32 Last;
2780 			if (Last == 0x08 && (d & 0x08) == 0) {
2781 				ZetOpen(0);
2782 				ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
2783 				ZetClose();
2784 			}
2785 			Last = d & 0x08;
2786 
2787 			bIrqEnable = (d & 0x20) ? 1 : 0;
2788 
2789 			K052109RMRDLine = d & 0x80;
2790 			return;
2791 		}
2792 
2793 		case 0x0a0009: {
2794 			DrvSoundLatch = d;
2795 			return;
2796 		}
2797 
2798 		case 0x0a0011: {
2799 			// watchdog write
2800 			return;
2801 		}
2802 
2803 		case 0x10e801: {
2804 			// nop???
2805 			return;
2806 		}
2807 
2808 		default: {
2809 			bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d);
2810 		}
2811 	}
2812 }
2813 
Mia68KReadWord(UINT32 a)2814 UINT16 __fastcall Mia68KReadWord(UINT32 a)
2815 {
2816 	switch (a) {
2817 		default: {
2818 			bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a);
2819 		}
2820 	}
2821 
2822 	return 0;
2823 }
2824 
Mia68KWriteWord(UINT32 a,UINT16 d)2825 void __fastcall Mia68KWriteWord(UINT32 a, UINT16 d)
2826 {
2827 	K051960WordWrite(0x140400)
2828 
2829 	switch (a) {
2830 		default: {
2831 			bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d);
2832 		}
2833 	}
2834 }
2835 
Cuebrick68KReadByte(UINT32 a)2836 UINT8 __fastcall Cuebrick68KReadByte(UINT32 a)
2837 {
2838 	K052109WordNoA12Read(0x100000)
2839 	K051937ByteRead(0x140000)
2840 	K051960ByteRead(0x140400)
2841 
2842 	if (a >= 0x0b0000 && a <= 0x0b03ff) {
2843 		return DrvNvRam[(a - 0x0b0000) + (DrvNvRamBank * 0x400)];
2844 	}
2845 
2846 	switch (a) {
2847 		case 0x0a0001: {
2848 			return 0xff - DrvInput[0];
2849 		}
2850 
2851 		case 0x0a0003: {
2852 			return 0xff - DrvInput[1];
2853 		}
2854 
2855 		case 0x0a0005: {
2856 			return 0xff - DrvInput[2];
2857 		}
2858 
2859 		case 0x0a0011: {
2860 			return DrvDip[1];
2861 		}
2862 
2863 		case 0x0a0013: {
2864 			return DrvDip[0];
2865 		}
2866 
2867 		case 0x0a0019: {
2868 			return DrvDip[2];
2869 		}
2870 
2871 		case 0x0c0000:
2872 			return 0xff;
2873 
2874 		case 0x0c0002: {
2875 			return BurnYM2151Read();
2876 		}
2877 
2878 		default: {
2879 			bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a);
2880 		}
2881 	}
2882 
2883 	return 0;
2884 }
2885 
Cuebrick68KWriteByte(UINT32 a,UINT8 d)2886 void __fastcall Cuebrick68KWriteByte(UINT32 a, UINT8 d)
2887 {
2888 	K052109WordNoA12Write(0x100000)
2889 	K015937ByteWrite(0x140000)
2890 	K051960ByteWrite(0x140400)
2891 
2892 	if (a >= 0x0b0000 && a <= 0x0b03ff) {
2893 		DrvNvRam[(a - 0x0b0000) + (DrvNvRamBank * 0x400)] = d;
2894 		return;
2895 	}
2896 
2897 	switch (a) {
2898 		case 0x0a0001: {
2899 			bIrqEnable = (d & 0x20) ? 1 : 0;
2900 
2901 			K052109RMRDLine = d & 0x80;
2902 			return;
2903 		}
2904 
2905 		case 0x0a0011: {
2906 			// watchdog write
2907 			return;
2908 		}
2909 
2910 		case 0x0b0400: {
2911 			DrvNvRamBank = d;
2912 			return;
2913 		}
2914 
2915 		case 0x0c0000: {
2916 			BurnYM2151SelectRegister(d);
2917 			return;
2918 		}
2919 
2920 		case 0x0c0002: {
2921 			BurnYM2151WriteRegister(d);
2922 			return;
2923 		}
2924 
2925 		default: {
2926 			bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d);
2927 		}
2928 	}
2929 }
2930 
Cuebrick68KReadWord(UINT32 a)2931 UINT16 __fastcall Cuebrick68KReadWord(UINT32 a)
2932 {
2933 	if (a >= 0x0b0000 && a <= 0x0b03ff) {
2934 		SEK_DEF_READ_WORD(0, a);
2935 		return 0;
2936 	}
2937 
2938 	switch (a) {
2939 		default: {
2940 			bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a);
2941 		}
2942 	}
2943 
2944 	return 0;
2945 }
2946 
Cuebrick68KWriteWord(UINT32 a,UINT16 d)2947 void __fastcall Cuebrick68KWriteWord(UINT32 a, UINT16 d)
2948 {
2949 	K051960WordWrite(0x140400)
2950 
2951 	if (a >= 0x0b0000 && a <= 0x0b03ff) {
2952 		SEK_DEF_WRITE_WORD(0, a, d);
2953 		return;
2954 	}
2955 
2956 	switch (a) {
2957 		default: {
2958 			bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d);
2959 		}
2960 	}
2961 }
2962 
Blswhstl68KReadByte(UINT32 a)2963 UINT8 __fastcall Blswhstl68KReadByte(UINT32 a)
2964 {
2965 	if (a >= 0x180000 && a <= 0x183fff) {
2966 		INT32 Offset = (a - 0x180000) >> 1;
2967 
2968 		if (a & 1) {
2969 			return K052109Read(Offset + 0x2000);
2970 		} else {
2971 			return K052109Read(Offset + 0x0000);
2972 		}
2973 	}
2974 
2975 	if (a >= 0x300000 && a <= 0x303fff) {
2976 		INT32 Offset = (a - 0x300000);
2977 
2978 		if (Offset & (0x31 << 1)) {
2979 			return DrvSpriteRam[Offset ^ 1];
2980 		} else {
2981 			Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3);
2982 			return K053245ReadWord(0, Offset/2) >> ((~a & 1) << 3);
2983 		}
2984 	}
2985 
2986 	if (a >= 0x500000 && a <= 0x50003f) {
2987 		INT32 Offset = (a - 0x500000) >> 1;
2988 		if (a & 1) {
2989 			return K054000Read(Offset);
2990 		} else {
2991 			return 0;
2992 		}
2993 	}
2994 
2995 	if (a >= 0x680000 && a <= 0x68001f) {
2996 		INT32 Offset = (a - 0x680000) >> 1;
2997 		Offset &= ~1;
2998 
2999 		if (a & 1) {
3000 			return K053244Read(0, Offset + 1);
3001 		} else {
3002 			return K053244Read(0, Offset + 0);
3003 		}
3004 	}
3005 
3006 	switch (a) {
3007 		case 0x700001: {
3008 			return 0xff - DrvInput[1];
3009 		}
3010 
3011 		case 0x700003: {
3012 			return 0xff - DrvInput[2];
3013 		}
3014 
3015 		case 0x700005: {
3016 			UINT8 Res;
3017 			static INT32 Toggle;
3018 
3019 			Res = 0xff - DrvInput[0];
3020 
3021 			if (InitEEPROMCount) {
3022 				InitEEPROMCount--;
3023 				Res &= 0xf7;
3024 			}
3025 
3026 			Toggle ^= 0x40;
3027 
3028 			return Res ^ Toggle;
3029 		}
3030 
3031 		case 0x700007: {
3032 			return 0xfe | (EEPROMRead() & 0x01);
3033 		}
3034 
3035 		case 0x780601:
3036 		case 0x780603: {
3037 			INT32 Offset = (a - 0x780601) >> 1;
3038 			return K053260Read(0, Offset + 2);
3039 		}
3040 
3041 		default: {
3042 			bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a);
3043 		}
3044 	}
3045 
3046 	return 0;
3047 }
3048 
Blswhstl68KWriteByte(UINT32 a,UINT8 d)3049 void __fastcall Blswhstl68KWriteByte(UINT32 a, UINT8 d)
3050 {
3051 	if (a >= 0x180000 && a <= 0x183fff) {
3052 		INT32 Offset = (a - 0x180000) >> 1;
3053 
3054 		if (a & 1) {
3055 			K052109Write(Offset + 0x2000, d);
3056 		} else {
3057 			K052109Write(Offset + 0x0000, d);
3058 		}
3059 		return;
3060 	}
3061 
3062 	if (a >= 0x300000 && a <= 0x303fff) {
3063 		INT32 Offset = (a - 0x300000);
3064 		DrvSpriteRam[Offset ^ 1] = d;
3065 
3066 		if (!(Offset & (0x31 << 1))) {
3067 			Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3);
3068 
3069 			INT32 data = K053245ReadWord(0, Offset/2);
3070 
3071 			if (a & 1) {
3072 				data &= 0xff00;
3073 				data |= d;
3074 			} else {
3075 				data &= 0x00ff;
3076 				data |= d << 8;
3077 			}
3078 
3079 			K053245WriteWord(0, Offset / 2, data);
3080 		}
3081 		return;
3082 	}
3083 
3084 	if (a >= 0x500000 && a <= 0x50003f) {
3085 		INT32 Offset = (a - 0x500000) >> 1;
3086 		if (a & 1) K054000Write(Offset, d);
3087 		return;
3088 	}
3089 
3090 	if (a >= 0x680000 && a <= 0x68001f) {
3091 		INT32 Offset = (a - 0x680000) >> 1;
3092 		Offset &= ~1;
3093 
3094 		if (a & 1) {
3095 			K053244Write(0, Offset + 1, d);
3096 		} else {
3097 			K053244Write(0, Offset + 0, d);
3098 		}
3099 		return;
3100 	}
3101 
3102 	if (a >= 0x780700 && a <= 0x78071f) {
3103 		K053251Write((a - 0x780700) >> 1, d);
3104 		return;
3105 	}
3106 
3107 	switch (a) {
3108 		case 0x700201: {
3109 			EEPROMWrite(d & 0x04, d & 0x02, d & 0x01);
3110 			return;
3111 		}
3112 
3113 		case 0x700301: {
3114 			K052109RMRDLine = d & 0x08;
3115 			BlswhstlTileRomBank = (d & 0x80) >> 7;
3116 			return;
3117 		}
3118 
3119 		case 0x700401: {
3120 			// watchdog write
3121 			return;
3122 		}
3123 
3124 		case 0x780601: {
3125 			K053260Write(0, 0, d);
3126 			return;
3127 		}
3128 
3129 		case 0x780605: {
3130 			ZetOpen(0);
3131 			ZetSetVector(0xff);
3132 			ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
3133 			ZetClose();
3134 			return;
3135 		}
3136 
3137 		default: {
3138 			bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d);
3139 		}
3140 	}
3141 }
3142 
Blswhstl68KReadWord(UINT32 a)3143 UINT16 __fastcall Blswhstl68KReadWord(UINT32 a)
3144 {
3145 	if (a >= 0x300000 && a <= 0x303fff) {
3146 		UINT16 *SpriteRam = (UINT16*)DrvSpriteRam;
3147 		INT32 Offset = (a - 0x300000) >> 1;
3148 
3149 		if (Offset & 0x31) {
3150 			return BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]);
3151 		} else {
3152 			Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3);
3153 			return K053245ReadWord(0, Offset);
3154 		}
3155 	}
3156 
3157 	switch (a) {
3158 		default: {
3159 			bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a);
3160 		}
3161 	}
3162 
3163 	return 0;
3164 }
3165 
Blswhstl68KWriteWord(UINT32 a,UINT16 d)3166 void __fastcall Blswhstl68KWriteWord(UINT32 a, UINT16 d)
3167 {
3168 	if (a >= 0x180000 && a <= 0x183fff) {
3169 		INT32 Offset = (a - 0x180000) >> 1;
3170 
3171 		K052109Write(Offset + 0x2000, d >> 8);
3172 		K052109Write(Offset + 0x0000, d & 0xff);
3173 		return;
3174 	}
3175 
3176 	if (a >= 0x300000 && a <= 0x303fff) {
3177 		UINT16 *SpriteRam = (UINT16*)DrvSpriteRam;
3178 		INT32 Offset = (a - 0x300000) >> 1;
3179 		SpriteRam[Offset] = BURN_ENDIAN_SWAP_INT16(d);
3180 
3181 		if (!(Offset & 0x0031)) {
3182 			Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3);
3183 			K053245WriteWord(0, Offset, d);
3184 		}
3185 		return;
3186 	}
3187 
3188 	if (a >= 0x500000 && a <= 0x50003f) {
3189 		INT32 Offset = (a - 0x500000) >> 1;
3190 		K054000Write(Offset, d & 0xff);
3191 		return;
3192 	}
3193 
3194 	if (a >= 0x680000 && a <= 0x68001f) {
3195 		INT32 Offset = (a - 0x680000) >> 1;
3196 		Offset &= ~1;
3197 
3198 		K053244Write(0, Offset + 1, d & 0xff);
3199 		K053244Write(0, Offset + 0, d >> 8);
3200 		return;
3201 	}
3202 
3203 	switch (a) {
3204 		default: {
3205 			bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d);
3206 		}
3207 	}
3208 }
3209 
3210 #ifdef _XBOX1
3211 #define pow powf
3212 #endif
3213 
tmnt2_protection_write()3214 static void tmnt2_protection_write()
3215 {
3216 	UINT32 src_addr, dst_addr, mod_addr, attr1, code, attr2, cbase, cmod, color;
3217 	INT32 xoffs, yoffs, xmod, ymod, zmod, xzoom, yzoom, i;
3218 	UINT16 *mcu;
3219 	UINT16 src[4], mod[24];
3220 	UINT8 keepaspect, xlock, ylock, zlock;
3221 
3222 	mcu = (UINT16*)(Drv68KRam + 0x4800);
3223 	if ((BURN_ENDIAN_SWAP_INT16(mcu[8]) & 0xff00) != 0x8200) return;
3224 
3225 	src_addr = (BURN_ENDIAN_SWAP_INT16(mcu[0]) | (BURN_ENDIAN_SWAP_INT16(mcu[1])&0xff)<<16) >> 1;
3226 	dst_addr = (BURN_ENDIAN_SWAP_INT16(mcu[2]) | (BURN_ENDIAN_SWAP_INT16(mcu[3])&0xff)<<16) >> 1;
3227 	mod_addr = (BURN_ENDIAN_SWAP_INT16(mcu[4]) | (BURN_ENDIAN_SWAP_INT16(mcu[5])&0xff)<<16) >> 1;
3228 	zlock    = (BURN_ENDIAN_SWAP_INT16(mcu[8]) & 0xff) == 0x0001;
3229 
3230 	for (i=0; i< 4; i++) src[i] = SekReadWord((src_addr + i) * 2);
3231 	for (i=0; i<24; i++) mod[i] = SekReadWord((mod_addr + i) * 2);
3232 
3233 	code = src[0];			// code
3234 
3235 	i= src[1];
3236 	attr1 = i>>2 & 0x3f00;	// flip y, flip x and sprite size
3237 	attr2 = i & 0x380;		// mirror y, mirror x, shadow
3238 	cbase = i & 0x01f;		// base color
3239 	cmod  = mod[0x2a/2]>>8;
3240 	color = (cbase != 0x0f && cmod <= 0x1f && !zlock) ? cmod : cbase;
3241 
3242 	xoffs = (INT16)src[2];	// local x
3243 	yoffs = (INT16)src[3];	// local y
3244 
3245 	i = mod[0];
3246 	attr2 |= i & 0x0060;	// priority
3247 	keepaspect = (i & 0x0014) == 0x0014;
3248 	if (i & 0x8000) { attr1 |= 0x8000; }	// active
3249 	if (keepaspect)	{ attr1 |= 0x4000; }	// keep aspect
3250 	if (i & 0x4000) { attr1 ^= 0x1000; xoffs = -xoffs; }	// flip x
3251 
3252 	xmod = (INT16)mod[6];	// global x
3253 	ymod = (INT16)mod[7];	// global y
3254 	zmod = (INT16)mod[8];	// global z
3255 	xzoom = mod[0x1c/2];
3256 	yzoom = (keepaspect) ? xzoom : mod[0x1e/2];
3257 
3258 	ylock = xlock = (i & 0x0020 && (!xzoom || xzoom == 0x100));
3259 
3260 	if (!xlock)
3261 	{
3262 		i = xzoom - 0x4f00;
3263 		if (i > 0)
3264 		{
3265 			i >>= 8;
3266 			xoffs += (INT32)(pow(i, /*1.898461*/1.891292) * xoffs / 599.250121);
3267 		}
3268 		else if (i < 0)
3269 		{
3270 			i = (i>>3) + (i>>4) + (i>>5) + (i>>6) + xzoom;
3271 			xoffs = (i > 0) ? (xoffs * i / 0x4f00) : 0;
3272 		}
3273 	}
3274 	if (!ylock)
3275 	{
3276 		i = yzoom - 0x4f00;
3277 		if (i > 0)
3278 		{
3279 			i >>= 8;
3280 			yoffs += (INT32)(pow(i, /*1.898461*/1.891292) * yoffs / 599.250121);
3281 		}
3282 		else if (i < 0)
3283 		{
3284 			i = (i>>3) + (i>>4) + (i>>5) + (i>>6) + yzoom;
3285 			yoffs = (i > 0) ? (yoffs * i / 0x4f00) : 0;
3286 		}
3287 
3288 	}
3289 	if (!zlock) yoffs += zmod;
3290 	xoffs += xmod;
3291 	yoffs += ymod;
3292 
3293 	SekWriteWord((dst_addr +  0) * 2, attr1);
3294 	SekWriteWord((dst_addr +  2) * 2, code);
3295 	SekWriteWord((dst_addr +  4) * 2, (UINT32)yoffs);
3296 	SekWriteWord((dst_addr +  6) * 2, (UINT32)xoffs);
3297 	SekWriteWord((dst_addr + 12) * 2, attr2 | color);
3298 }
3299 
Tmnt268KProtWord(UINT32 a,UINT16 d)3300 void __fastcall Tmnt268KProtWord(UINT32 a, UINT16 d)
3301 {
3302 	*((UINT16*)(Drv68KRam + 0x4800 + (a & 0x1e))) = BURN_ENDIAN_SWAP_INT16(d);
3303 }
3304 
Tmnt268KProtByte(UINT32 a,UINT8 d)3305 void __fastcall Tmnt268KProtByte(UINT32 a, UINT8 d)
3306 {
3307 	a &= 0x1f;
3308 	Drv68KRam[0x4801 ^ a] = d;
3309 
3310 	if (a == 0x18) tmnt2_protection_write();
3311 }
3312 
ssriders_protection_r()3313 static UINT16 ssriders_protection_r()
3314 {
3315     INT32 data = SekReadWord(0x105a0a);
3316     INT32 cmd  = SekReadWord(0x1058fc);
3317 
3318 	switch (cmd)
3319 	{
3320 		case 0x100b:
3321 			return 0x0064;
3322 
3323 		case 0x6003:
3324 			return data & 0x000f;
3325 
3326 		case 0x6004:
3327 			return data & 0x001f;
3328 
3329 		case 0x6000:
3330 			return data & 0x0001;
3331 
3332 		case 0x0000:
3333 			return data & 0x00ff;
3334 
3335 		case 0x6007:
3336 			return data & 0x00ff;
3337 
3338 		case 0x8abc:
3339 			/* collision table */
3340 			data = -SekReadWord(0x105818);
3341 			data = ((data / 8 - 4) & 0x1f) * 0x40;
3342             data += ((SekReadWord(0x105cb0) + SekReadWord(0x1040c8) - 6) / 8 + 12) & 0x3f;
3343 			return data;
3344 
3345 		default:
3346 			return 0xffff;
3347     }
3348 }
3349 
ssriders_protection_w(INT32 offset)3350 static void ssriders_protection_w(INT32 offset)
3351 {
3352 	offset >>= 1;
3353 
3354 	if (offset == 1)
3355 	{
3356 		INT32 logical_pri,hardware_pri;
3357 
3358 		/* create sprite priority attributes */
3359 		hardware_pri = 1;
3360 		for (logical_pri = 1;logical_pri < 0x100;logical_pri <<= 1)
3361 		{
3362 			INT32 i;
3363 
3364 			for (i = 0;i < 128;i++)
3365 			{
3366 				if ((SekReadWord(0x180006 + 128*i) >> 8) == (UINT16)logical_pri)
3367 				{
3368 					K053245Write(0,((8*i) * 2)+1,hardware_pri);
3369 					hardware_pri++;
3370 				}
3371 			}
3372 		}
3373 	}
3374 }
3375 
Ssriders68KReadByte(UINT32 a)3376 UINT8 __fastcall Ssriders68KReadByte(UINT32 a)
3377 {
3378 	if (a >= 0x180000 && a <= 0x183fff) {
3379 		INT32 Offset = (a - 0x180000);
3380 
3381 		if (Offset & (0x31 << 1)) {
3382 			return DrvSpriteRam[Offset ^ 1];
3383 		} else {
3384 			Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3);
3385 			return K053245ReadWord(0, Offset / 2) >> ((~a & 1) << 3);
3386 		}
3387 	}
3388 
3389 	if ((a & 0xffff80) == 0x1c0500) {
3390 		return Drv68KRam[0x4001 ^ (a & 0x7f)];
3391 	}
3392 
3393 	if (a >= 0x5a0000 && a <= 0x5a001f) {
3394 		INT32 Offset = (a - 0x5a0000) >> 1;
3395 		Offset &= ~1;
3396 
3397 		if (a & 1) {
3398 			return K053244Read(0, Offset + 1);
3399 		} else {
3400 			return K053244Read(0, Offset + 0);
3401 		}
3402 	}
3403 
3404 	if (a >= 0x600000 && a <= 0x603fff) {
3405 		INT32 Offset = (a - 0x600000) >> 1;
3406 
3407 		if (a & 1) {
3408 			return K052109Read(Offset + 0x2000);
3409 		} else {
3410 			return K052109Read(Offset + 0x0000);
3411 		}
3412 	}
3413 
3414 	switch (a) {
3415 		case 0x1c0800:
3416 		case 0x1c0801:
3417 			return ssriders_protection_r() >> ((~a & 1) << 3);
3418 
3419 		case 0x1c0001: {
3420 			return 0xff - DrvInput[1];
3421 		}
3422 
3423 		case 0x1c0003: {
3424 			return 0xff - DrvInput[2];
3425 		}
3426 
3427 		case 0x1c0005: {
3428 			return 0xff - DrvInput[3];
3429 		}
3430 
3431 		case 0x1c0007: {
3432 			return 0xff - DrvInput[4];
3433 		}
3434 
3435 		case 0x1c0101: {
3436 			return 0xff - DrvInput[0];
3437 		}
3438 
3439 		case 0x1c0103: {
3440 			UINT8 Res;
3441 			static INT32 Toggle;
3442 
3443 			Res = DrvInput[5];
3444 			if (DrvVBlank) Res |= 0x08;
3445 			Res |= EEPROMRead() & 0x01;
3446 
3447 			if (InitEEPROMCount) {
3448 				InitEEPROMCount--;
3449 				Res &= 0x7f;
3450 			}
3451 
3452 			Toggle ^= 0x04;
3453 
3454 			return Res ^ Toggle;
3455 		}
3456 
3457 		case 0x1c0401: {
3458 			// watchdog read
3459 			return 0;
3460 		}
3461 
3462 		case 0x5c0601:
3463 		case 0x5c0603: {
3464 			INT32 Offset = (a - 0x5c0601) >> 1;
3465 			return K053260Read(0, Offset + 2);
3466 		}
3467 
3468 		default: {
3469 			bprintf(PRINT_NORMAL, _T("68K Read byte => %06X\n"), a);
3470 		}
3471 	}
3472 
3473 	return 0;
3474 }
3475 
Ssriders68KWriteByte(UINT32 a,UINT8 d)3476 void __fastcall Ssriders68KWriteByte(UINT32 a, UINT8 d)
3477 {
3478 	if (a >= 0x180000 && a <= 0x183fff) {
3479 		INT32 Offset = (a - 0x180000);
3480 		DrvSpriteRam[Offset ^ 1] = d;
3481 
3482 		if (!(Offset & (0x31 << 1))) {
3483 			Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3);
3484 
3485 			INT32 data = K053245ReadWord(0, Offset/2);
3486 
3487 			if (a & 1) {
3488 				data &= 0xff00;
3489 				data |= d;
3490 			} else {
3491 				data &= 0x00ff;
3492 				data |= d << 8;
3493 			}
3494 
3495 			K053245WriteWord(0, Offset/2, data);
3496 
3497 		}
3498 		return;
3499 	}
3500 
3501 	if ((a & ~3) == 0x1c0800) {
3502 		bprintf (0, _T("protection write byte %x %x\n"), a, d);
3503 		return;
3504 	}
3505 
3506 	// extra ram for tmnt2
3507 	if ((a & 0xffff80) == 0x1c0500) {
3508 		Drv68KRam[0x4001 ^ (a & 0x7f)] = d;
3509 		//*((UINT16*)(Drv68KRam + 0x4000 + (a & 0x7e))) = d;
3510 		return;
3511 	}
3512 
3513 	if (a >= 0x5a0000 && a <= 0x5a001f) {
3514 		INT32 Offset = (a - 0x5a0000) >> 1;
3515 		Offset &= ~1;
3516 
3517 		K053244Write(0, Offset + (a&1), d);
3518 		return;
3519 	}
3520 
3521 	if (a >= 0x5c0700 && a <= 0x5c071f) {
3522 		K053251Write((a - 0x5c0700) >> 1, d);
3523 		return;
3524 	}
3525 
3526 	if (a >= 0x600000 && a <= 0x603fff) {
3527 		INT32 Offset = (a - 0x600000) >> 1;
3528 
3529 		if (a & 1) {
3530 			K052109Write(Offset + 0x2000, d);
3531 		} else {
3532 			K052109Write(Offset + 0x0000, d);
3533 		}
3534 		return;
3535 	}
3536 
3537 	switch (a) {
3538 		case 0x1c0201: {
3539 			EEPROMWrite(d & 0x04, d & 0x02, d & 0x01);
3540 			K053244BankSelect(0, ((d & 0x20) >> 5) << 2);
3541 			dim_c = d & 0x18;
3542 			return;
3543 		}
3544 
3545 		case 0x1c0301: {
3546 			K052109RMRDLine = d & 0x08;
3547 			dim_v = (d & 0x70) >> 4;
3548 			return;
3549 		}
3550 
3551 		case 0x5c0601: {
3552 			K053260Write(0, 0, d);
3553 			return;
3554 		}
3555 
3556 		case 0x5c0605: {
3557 			ZetOpen(0);
3558 			ZetSetVector(0xff);
3559 			ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
3560 			ZetClose();
3561 			return;
3562 		}
3563 
3564 		case 0x1c0401: {
3565 			// watchdog write
3566 			return;
3567 		}
3568 
3569 		default: {
3570 			bprintf(PRINT_NORMAL, _T("68K Write byte => %06X, %02X\n"), a, d);
3571 		}
3572 	}
3573 }
3574 
Ssriders68KReadWord(UINT32 a)3575 UINT16 __fastcall Ssriders68KReadWord(UINT32 a)
3576 {
3577 	if (a >= 0x180000 && a <= 0x183fff) {
3578 		UINT16 *SpriteRam = (UINT16*)DrvSpriteRam;
3579 		INT32 Offset = (a - 0x180000) >> 1;
3580 
3581 		if (Offset & 0x31) {
3582 			return BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]);
3583 		} else {
3584 			Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3);
3585 			return K053245ReadWord(0, Offset);
3586 		}
3587 	}
3588 
3589 	if ((a & 0xffff80) == 0x1c0500) {
3590 		return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(Drv68KRam + 0x4000 + (a & 0x7e))));
3591 	}
3592 
3593 	if (a == 0x1c0800) return ssriders_protection_r();
3594 
3595 	switch (a) {
3596 		default: {
3597 			bprintf(PRINT_NORMAL, _T("68K Read word => %06X\n"), a);
3598 		}
3599 	}
3600 
3601 	return 0;
3602 }
3603 
Ssriders68KWriteWord(UINT32 a,UINT16 d)3604 void __fastcall Ssriders68KWriteWord(UINT32 a, UINT16 d)
3605 {
3606 	if (a >= 0x180000 && a <= 0x183fff) {
3607 		UINT16 *SpriteRam = (UINT16*)DrvSpriteRam;
3608 		INT32 Offset = (a - 0x180000) >> 1;
3609 		SpriteRam[Offset] = BURN_ENDIAN_SWAP_INT16(d);
3610 
3611 		if (!(Offset & 0x0031)) {
3612 			Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3);
3613 			K053245WriteWord(0, Offset, d);
3614 		}
3615 		return;
3616 	}
3617 
3618 	if (a >= 0x5a0000 && a <= 0x5a001f) {
3619 		INT32 Offset = (a - 0x5a0000) >> 1;
3620 		Offset &= ~1;
3621 
3622 		K053244Write(0, Offset + 1, d & 0xff);
3623 		K053244Write(0, Offset + 0, d >> 8);
3624 		return;
3625 	}
3626 
3627 	if ((a & 0xffff80) == 0x1c0500) {
3628 		*((UINT16*)(Drv68KRam + 0x4000 + (a & 0x7e))) = BURN_ENDIAN_SWAP_INT16(d);
3629 		return;
3630 	}
3631 
3632 	if (a == 0x1c0802) {
3633 		ssriders_protection_w(2);
3634 		return;
3635 	}
3636 
3637 	switch (a) {
3638 		case 0x1c0800:
3639 		case 0x1c0802: {
3640 			ssriders_protection_w(a - 0x1c0800);
3641 			return;
3642 		}
3643 
3644 		default: {
3645 			bprintf(PRINT_NORMAL, _T("68K Write word => %06X, %04X\n"), a, d);
3646 		}
3647 	}
3648 }
3649 
Thndrx268KReadByte(UINT32 a)3650 UINT8 __fastcall Thndrx268KReadByte(UINT32 a)
3651 {
3652 	K052109WordNoA12Read(0x600000)
3653 	K051937ByteRead(0x700000)
3654 
3655 	if ((a & 0xffffc00) == 0x700400) {
3656 		return K051960Read(a & 0x3ff);
3657 	}
3658 
3659 	if (a >= 0x500000 && a <= 0x50003f) {
3660 		INT32 Offset = (a - 0x500000) >> 1;
3661 		if (a & 1) {
3662 			return K054000Read(Offset);
3663 		} else {
3664 			return 0;
3665 		}
3666 	}
3667 
3668 	switch (a)
3669 	{
3670 		case 0x400001:
3671 		case 0x400003:
3672 			return K053260Read(0, ((a & 2) >> 1) + 2);
3673 
3674 		case 0x500200:
3675 		{
3676 			INT32 ret = DrvInput[1]^0xff;
3677 			if (InitEEPROMCount) {
3678 				ret &= 0xf7;
3679 				InitEEPROMCount--;
3680 			}
3681 			return ret;
3682 		}
3683 
3684 		case 0x500201:
3685 			return DrvInput[0]^0xff;
3686 
3687 		case 0x500202:
3688 		{
3689 			static INT32 toggle;
3690 			toggle ^= 0x08;
3691 			INT32 ret = 0xfe;
3692 			ret |= (EEPROMRead() & 1);
3693 			ret ^= toggle;
3694 
3695 			return ret;
3696 		}
3697 
3698 		case 0x500203:
3699 			return DrvInput[2]^0xff;
3700 	}
3701 
3702 
3703 	return 0;
3704 }
3705 
Thndrx268KWriteWord(UINT32 a,UINT16 d)3706 void __fastcall Thndrx268KWriteWord(UINT32 a, UINT16 d)
3707 {
3708 	if ((a & 0xffffc00) == 0x700400) {
3709 		K051960Write((a & 0x3fe) | 0, d >> 8);
3710 		K051960Write((a & 0x3fe) | 1, d & 0xff);
3711 		return;
3712 	}
3713 }
3714 
Thndrx268KWriteByte(UINT32 a,UINT8 d)3715 void __fastcall Thndrx268KWriteByte(UINT32 a, UINT8 d)
3716 {
3717 	K052109WordNoA12Write(0x600000)
3718 	K015937ByteWrite(0x700000)
3719 
3720 	if ((a & 0xffffc00) == 0x700400) {
3721 		K051960Write(a & 0x3ff, d);
3722 		return;
3723 	}
3724 
3725 	if (a >= 0x300000 && a <= 0x30001f) {
3726 		if (a & 1) K053251Write((a - 0x300000) >> 1, d);
3727 		return;
3728 	}
3729 
3730 	if (a >= 0x500000 && a <= 0x50003f) {
3731 		INT32 Offset = (a - 0x500000) >> 1;
3732 		if (a & 1) K054000Write(Offset, d);
3733 		return;
3734 	}
3735 
3736 	switch (a)
3737 	{
3738 		case 0x400001:
3739 			K053260Write(0, 0, d);
3740 		return;
3741 
3742 		case 0x500101:
3743 		{
3744 			EEPROMWriteBit(d & 0x01);
3745 			EEPROMSetCSLine((d & 0x02) ? EEPROM_CLEAR_LINE : EEPROM_ASSERT_LINE);
3746 			EEPROMSetClockLine((d & 0x04) ? EEPROM_ASSERT_LINE : EEPROM_CLEAR_LINE);
3747 
3748 		//	EEPROMWrite(d & 0x04, d & 0x02, d & 0x01);
3749 
3750 			static INT32 last;
3751 			if (last == 0 && (d & 0x20) != 0) {
3752 				ZetSetVector(0xff);
3753 				ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
3754 			}
3755 			last = d & 0x20;
3756 
3757 			K052109RMRDLine = d & 0x40;
3758 		}
3759 		return;
3760 	}
3761 }
3762 
Lgtnfght68KReadWord(UINT32 a)3763 UINT16 __fastcall Lgtnfght68KReadWord(UINT32 a)
3764 {
3765 	if (a >= 0xb0000 && a <= 0xb3fff) {
3766 		UINT16 *SpriteRam = (UINT16*)DrvSpriteRam;
3767 		INT32 Offset = (a - 0xb0000) >> 1;
3768 
3769 		if (Offset & 0x31) {
3770 			return BURN_ENDIAN_SWAP_INT16(SpriteRam[Offset]);
3771 		} else {
3772 			Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3);
3773 			return K053245ReadWord(0, Offset);
3774 		}
3775 	}
3776 
3777 	return 0;
3778 }
3779 
Lgtnfght68KReadByte(UINT32 a)3780 UINT8 __fastcall Lgtnfght68KReadByte(UINT32 a)
3781 {
3782 	K052109WordNoA12Read(0x100000)
3783 
3784 	if (a >= 0xb0000 && a <= 0xb3fff) {
3785 		INT32 Offset = (a - 0xb0000);
3786 
3787 		if (Offset & (0x31 << 1)) {
3788 			return DrvSpriteRam[Offset ^ 1];
3789 		} else {
3790 			Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3);
3791 			return K053245ReadWord(0, Offset / 2) >> ((~a & 1) << 3);
3792 		}
3793 	}
3794 
3795 	if (a >= 0xc0000 && a <= 0xc001f) {
3796 		INT32 Offset = (a - 0xc0000) >> 1;
3797 		Offset &= ~1;
3798 
3799 		if (a & 1) {
3800 			return K053244Read(0, Offset + 1);
3801 		} else {
3802 			return K053244Read(0, Offset + 0);
3803 		}
3804 	}
3805 
3806 	switch (a)
3807 	{
3808 		case 0x0a0001:
3809 			return ~DrvInput[0] & 0xfb;
3810 
3811 		case 0x0a0003:
3812 			return ~DrvInput[1];
3813 
3814 		case 0x0a0005:
3815 			return ~DrvInput[2];
3816 
3817 		case 0x0a0007:
3818 			return DrvDip[0];
3819 
3820 		case 0x0a0009:
3821 			return DrvDip[1];
3822 
3823 		case 0x0a0011:
3824 			return DrvDip[2];
3825 
3826 		case 0x0a0021:
3827 		case 0x0a0023:
3828 			return K053260Read(0, ((a & 2) >> 1) + 2); // k053260
3829 	}
3830 
3831 	return 0;
3832 }
3833 
Lgtnfght68KWriteWord(UINT32 a,UINT16 d)3834 void __fastcall Lgtnfght68KWriteWord(UINT32 a, UINT16 d)
3835 {
3836 	if (a >= 0xb0000 && a <= 0xb3fff) {
3837 		UINT16 *SpriteRam = (UINT16*)DrvSpriteRam;
3838 		INT32 Offset = (a - 0xb0000) >> 1;
3839 		SpriteRam[Offset] = BURN_ENDIAN_SWAP_INT16(d);
3840 
3841 		if (!(Offset & 0x0031)) {
3842 			Offset = ((Offset & 0x000e) >> 1) | ((Offset & 0x1fc0) >> 3);
3843 			K053245WriteWord(0, Offset, d);
3844 		}
3845 		return;
3846 	}
3847 }
3848 
Lgtnfght68KWriteByte(UINT32 a,UINT8 d)3849 void __fastcall Lgtnfght68KWriteByte(UINT32 a, UINT8 d)
3850 {
3851 	K052109WordNoA12Write(0x100000)
3852 
3853 	if (a >= 0x0e0000 && a <= 0x0e001f) {
3854 		K053251Write((a - 0x0e0000) >> 1, d);
3855 		return;
3856 	}
3857 
3858 	if (a >= 0xb0000 && a <= 0xb3fff) {
3859 		INT32 Offset = (a - 0xb0000);
3860 		DrvSpriteRam[Offset ^ 1] = d;
3861 
3862 		if (!(Offset & (0x31 << 1))) {
3863 			Offset = ((Offset & (0x000e << 1)) >> 1) | ((Offset & (0x1fc0 << 1)) >> 3);
3864 
3865 			INT32 data = K053245ReadWord(0, Offset/2);
3866 
3867 			if (a & 1) {
3868 				data &= 0xff00;
3869 				data |= d;
3870 			} else {
3871 				data &= 0x00ff;
3872 				data |= d << 8;
3873 			}
3874 
3875 			K053245WriteWord(0, Offset/2, data);
3876 
3877 		}
3878 		return;
3879 	}
3880 
3881 	if (a >= 0xc0000 && a <= 0xc001f) {
3882 		INT32 Offset = (a - 0xc0000) >> 1;
3883 		Offset &= ~1;
3884 
3885 		K053244Write(0, Offset + (a&1), d);
3886 		return;
3887 	}
3888 
3889 	switch (a)
3890 	{
3891 		case 0xa0019:
3892 		{
3893 			static INT32 last;
3894 			if (last == 0 && (d & 0x4) != 0) {
3895 				ZetSetVector(0xff);
3896 				ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
3897 			}
3898 			last = d & 0x4;
3899 
3900 			K052109RMRDLine = d & 0x8;
3901 		}
3902 		return;
3903 
3904 		case 0xa0021:
3905 			K053260Write(0, 0, d);
3906 		return;
3907 
3908 		case 0xa0029: // watchdog
3909 		return;
3910 	}
3911 }
3912 
Punkshot68KReadWord(UINT32 a)3913 UINT16 __fastcall Punkshot68KReadWord(UINT32 a)
3914 {
3915 	if ((a & 0xfffc00) == 0x110400) {
3916 		return K051960Read((a & 0x3fe) | 1) | (K051960Read((a & 0x3fe) | 0) << 8);
3917 	}
3918 
3919 	return 0;
3920 }
3921 
Punkshot68KReadByte(UINT32 a)3922 UINT8 __fastcall Punkshot68KReadByte(UINT32 a)
3923 {
3924 	K052109WordNoA12Read(0x100000)
3925 	K051937ByteRead(0x110000)
3926 	K051960ByteRead(0x110400)
3927 
3928 	switch (a)
3929 	{
3930 		case 0x0a0000:
3931 			return DrvDip[1];
3932 
3933 		case 0x0a0001:
3934 			return DrvDip[0];
3935 
3936 		case 0x0a0003:
3937 			return ~DrvInput[0];
3938 
3939 		case 0x0a0002:
3940 			return DrvDip[2] | (~DrvInput[5] & 0x0f);
3941 
3942 		case 0x0a0005:
3943 			return ~DrvInput[3];
3944 
3945 		case 0x0a0004:
3946 			return ~DrvInput[4];
3947 
3948 		case 0x0a0007:
3949 			return ~DrvInput[1];
3950 
3951 		case 0x0a0006:
3952 			return ~DrvInput[2];
3953 
3954 		case 0x0a0041:
3955 		case 0x0a0043:
3956 			return K053260Read(0, ((a & 2) >> 1) | 2);
3957 
3958 		case 0xfffffc:
3959 		case 0xfffffd:
3960 		case 0xfffffe:
3961 		case 0xffffff:
3962 			return BurnRandom();
3963 	}
3964 
3965 	return 0;
3966 }
3967 
Punkshot68KWriteWord(UINT32 a,UINT16 d)3968 void __fastcall Punkshot68KWriteWord(UINT32 a, UINT16 d)
3969 {
3970 	if ((a & 0xfffc00) == 0x110400) {
3971 		K051960Write((a & 0x3fe) | 0, d >> 8);
3972 		K051960Write((a & 0x3fe) | 1, d & 0xff);
3973 
3974 		return;
3975 	}
3976 
3977 	if ((a & 0xff8000) == 0x100000) {
3978 		SekWriteByte(a+1, d & 0xff);
3979 		return;
3980 	}
3981 }
3982 
Punkshot68KWriteByte(UINT32 a,UINT8 d)3983 void __fastcall Punkshot68KWriteByte(UINT32 a, UINT8 d)
3984 {
3985 	K052109WordNoA12Write(0x100000)
3986 	K015937ByteWrite(0x110000)
3987 	K051960ByteWrite(0x110400)
3988 
3989 	if ((a & 0xffffe1) == 0xa0061) {
3990 		K053251Write((a & 0x1f) >> 1, d);
3991 		return;
3992 	}
3993 
3994 	switch (a)
3995 	{
3996 		case 0x0a0020:
3997 		case 0x0a0021:
3998 		{
3999 			static INT32 last;
4000 			K052109RMRDLine = d & 0x08;
4001 
4002 			if (last == 0x04 && (d & 0x04) == 0x00) {
4003 				ZetSetVector(0xff);
4004 				ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
4005 			}
4006 
4007 			last = d & 0x04;
4008 		}
4009 		return;
4010 
4011 		case 0x0a0041:
4012 			K053260Write(0, 0, d);
4013 		return;
4014 
4015 		case 0x0a0081:
4016 			// watchdog
4017 		return;
4018 	}
4019 }
4020 
TmntZ80Read(UINT16 a)4021 UINT8 __fastcall TmntZ80Read(UINT16 a)
4022 {
4023 	if (a >= 0xb000 && a <= 0xb00d) {
4024 		return K007232ReadReg(0, a - 0xb000);
4025 	}
4026 
4027 	switch (a) {
4028 		case 0x9000: {
4029 			return TitleSoundLatch;
4030 		}
4031 
4032 		case 0xa000: {
4033 			ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
4034 			return DrvSoundLatch;
4035 		}
4036 
4037 		case 0xc001: {
4038 			return BurnYM2151Read();
4039 		}
4040 
4041 		case 0xf000: {
4042 			return UPD7759BusyRead(0);
4043 		}
4044 
4045 		default: {
4046 			bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a);
4047 		}
4048 	}
4049 
4050 	return 0;
4051 }
4052 
TmntZ80Write(UINT16 a,UINT8 d)4053 void __fastcall TmntZ80Write(UINT16 a, UINT8 d)
4054 {
4055 	if (a >= 0xb000 && a <= 0xb00d) {
4056 		K007232WriteReg(0, (a - 0xb000), d);
4057 		return;
4058 	}
4059 
4060 	switch (a) {
4061 		case 0x9000: {
4062 			TitleSoundLatch = d;
4063 			if (d & 0x04) {
4064 				PlayTitleSample = 1;
4065 			} else {
4066 				PlayTitleSample = 0;
4067 				TitleSamplePos = 0;
4068 			}
4069 
4070 			UPD7759ResetWrite(0, d & 2);
4071 			return;
4072 		}
4073 
4074 		case 0xc000: {
4075 			BurnYM2151SelectRegister(d);
4076 			return;
4077 		}
4078 
4079 		case 0xc001: {
4080 			BurnYM2151WriteRegister(d);
4081 			return;
4082 		}
4083 
4084 		case 0xd000: {
4085 			UPD7759PortWrite(0, d);
4086 			return;
4087 		}
4088 
4089 		case 0xe000: {
4090 			UPD7759StartWrite(0, d);
4091 			return;
4092 		}
4093 
4094 		default: {
4095 			bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d);
4096 		}
4097 	}
4098 }
4099 
MiaZ80Read(UINT16 a)4100 UINT8 __fastcall MiaZ80Read(UINT16 a)
4101 {
4102 	if (a >= 0xb000 && a <= 0xb00d) {
4103 		return K007232ReadReg(0, a - 0xb000);
4104 	}
4105 
4106 	switch (a) {
4107 		case 0xa000: {
4108 			ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
4109 			return DrvSoundLatch;
4110 		}
4111 
4112 		case 0xc001: {
4113 			return BurnYM2151Read();
4114 		}
4115 
4116 		case 0xf000: return 0; // NOP
4117 
4118 		default: {
4119 			bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a);
4120 		}
4121 	}
4122 
4123 	return 0;
4124 }
4125 
MiaZ80Write(UINT16 a,UINT8 d)4126 void __fastcall MiaZ80Write(UINT16 a, UINT8 d)
4127 {
4128 	if (a >= 0xb000 && a <= 0xb00d) {
4129 		K007232WriteReg(0, (a - 0xb000), d);
4130 		return;
4131 	}
4132 
4133 	switch (a) {
4134 		case 0xc000: {
4135 			BurnYM2151SelectRegister(d);
4136 			return;
4137 		}
4138 
4139 		case 0xc001: {
4140 			BurnYM2151WriteRegister(d);
4141 			return;
4142 		}
4143 
4144 		case 0xf000: return; // NOP
4145 
4146 		default: {
4147 			bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d);
4148 		}
4149 	}
4150 }
4151 
BlswhstlZ80Read(UINT16 a)4152 UINT8 __fastcall BlswhstlZ80Read(UINT16 a)
4153 {
4154 	if (a >= 0xfa00 && a <= 0xfa2f) {
4155 		if (a == 0xfa00) ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
4156 		return K053260Read(0, a - 0xfa00);
4157 	}
4158 
4159 	switch (a) {
4160 		case 0xf801: {
4161 			return BurnYM2151Read();
4162 		}
4163 
4164 		default: {
4165 			bprintf(PRINT_NORMAL, _T("Z80 Read => %04X\n"), a);
4166 		}
4167 	}
4168 
4169 	return 0;
4170 }
4171 
BlswhstlZ80Write(UINT16 a,UINT8 d)4172 void __fastcall BlswhstlZ80Write(UINT16 a, UINT8 d)
4173 {
4174 	if (a >= 0xfa00 && a <= 0xfa2f) {
4175 		K053260Write(0, (a - 0xfa00), d);
4176 		return;
4177 	}
4178 
4179 	switch (a) {
4180 		case 0xf800: {
4181 			BurnYM2151SelectRegister(d);
4182 			return;
4183 		}
4184 
4185 		case 0xf801: {
4186 			BurnYM2151WriteRegister(d);
4187 			return;
4188 		}
4189 
4190 		case 0xfc00: { // tmnt2 needs this
4191 			ZetRun(100);
4192 			ZetNmi();
4193 			return;
4194 		}
4195 
4196 		default: {
4197 			bprintf(PRINT_NORMAL, _T("Z80 Write => %04X, %02X\n"), a, d);
4198 		}
4199 	}
4200 }
4201 
Thndrx2Z80Write(UINT16 a,UINT8 d)4202 void __fastcall Thndrx2Z80Write(UINT16 a, UINT8 d)
4203 {
4204 	if (a >= 0xfc00 && a <= 0xfc2f) {
4205 		K053260Write(0, (a - 0xfc00), d);
4206 		return;
4207 	}
4208 
4209 	switch (a)
4210 	{
4211 		case 0xf800:
4212 		case 0xf810:
4213 			BurnYM2151SelectRegister(d);
4214 		return;
4215 
4216 		case 0xf801:
4217 		case 0xf811:
4218 			BurnYM2151WriteRegister(d);
4219 		return;
4220 
4221 		case 0xfa00:
4222 			ZetRun(100);
4223 			ZetNmi();
4224 		return;
4225 	}
4226 }
4227 
Thndrx2Z80Read(UINT16 a)4228 UINT8 __fastcall Thndrx2Z80Read(UINT16 a)
4229 {
4230 	if (a >= 0xfc00 && a <= 0xfc2f) {
4231 		if (a == 0xfc00) ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
4232 		return K053260Read(0, a - 0xfc00);
4233 	}
4234 
4235 	switch (a)
4236 	{
4237 		case 0xf801:
4238 		case 0xf811:
4239 			return BurnYM2151Read();
4240 	}
4241 
4242 	return 0;
4243 }
4244 
LgtnfghtZ80Write(UINT16 a,UINT8 d)4245 void __fastcall LgtnfghtZ80Write(UINT16 a, UINT8 d)
4246 {
4247 	if (a >= 0xc000 && a <= 0xc02f) {
4248 		K053260Write(0, (a - 0xc000), d);
4249 		return;
4250 	}
4251 
4252 	switch (a)
4253 	{
4254 		case 0xa000:
4255 			BurnYM2151SelectRegister(d);
4256 		return;
4257 
4258 		case 0xa001:
4259 			BurnYM2151WriteRegister(d);
4260 		return;
4261 	}
4262 }
4263 
LgtnfghtZ80Read(UINT16 a)4264 UINT8 __fastcall LgtnfghtZ80Read(UINT16 a)
4265 {
4266 	if (a >= 0xc000 && a <= 0xc02f) {
4267 		if (a == 0xc000) ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
4268 		return K053260Read(0, a - 0xc000);
4269 	}
4270 
4271 	switch (a)
4272 	{
4273 		case 0xa001:
4274 			return BurnYM2151Read();
4275 	}
4276 
4277 	return 0;
4278 }
4279 
shuffle(UINT16 * buf,INT32 len)4280 static void shuffle(UINT16 *buf, INT32 len)
4281 {
4282 	INT32 i;
4283 	UINT16 t;
4284 
4285 	if (len == 2) return;
4286 
4287 	if (len % 4) return;
4288 
4289 	len /= 2;
4290 
4291 	for (i = 0;i < len/2;i++) {
4292 		t = buf[len/2 + i];
4293 		buf[len/2 + i] = buf[len + i];
4294 		buf[len + i] = t;
4295 	}
4296 
4297 	shuffle(buf,len);
4298 	shuffle(buf + len,len);
4299 }
4300 
byte_shuffle(UINT8 * buf,INT32 len)4301 static void byte_shuffle(UINT8 *buf, INT32 len)
4302 {
4303 	INT32 i;
4304 	UINT8 t;
4305 
4306 	if (len == 2) return;
4307 
4308 	if (len % 4) return;
4309 
4310 	len /= 2;
4311 
4312 	for (i = 0;i < len/2;i++) {
4313 		t = buf[len/2 + i];
4314 		buf[len/2 + i] = buf[len + i];
4315 		buf[len + i] = t;
4316 	}
4317 
4318 	byte_shuffle(buf,len);
4319 	byte_shuffle(buf + len,len);
4320 }
4321 
TmntUnscrambleGfx(UINT8 * pSrc,INT32 nLength)4322 static void TmntUnscrambleGfx(UINT8 *pSrc, INT32 nLength)
4323 {
4324 	INT32 bits[32];
4325 	for (INT32 i = 0; i < nLength; i += 4) {
4326 		for (INT32 j = 0; j < 4; j++) {
4327 			for (INT32 k = 0; k < 8; k++) {
4328 				bits[8*j + k] = (pSrc[i + j] >> k) & 1;
4329 			}
4330 		}
4331 
4332 		for (INT32 j = 0; j < 4; j++) {
4333 			pSrc[i + j] = 0;
4334 			for (INT32 k = 0; k < 8; k++) {
4335 				pSrc[i + j] |= bits[j + 4*k] << k;
4336 			}
4337 		}
4338 	}
4339 }
4340 
TmntUnscrambleSprites()4341 static void TmntUnscrambleSprites()
4342 {
4343 	BurnLoadRom(DrvTempRom + 0x200000, 11, 1);
4344 	UINT8 *SpriteConvTable = DrvTempRom + 0x200000;
4345 
4346 	memcpy(DrvTempRom, DrvSpriteRom, 0x200000);
4347 
4348 	for (INT32 A = 0; A < 0x80000; A++) {
4349 		INT32 B, i, entry;
4350 		INT32 bits[10];
4351 
4352 		static const UINT8 bit_pick_table[10][8] = {
4353 			{ 3,   3,   3,   3,   3,   3,   3,   3 },
4354 			{ 0,   0,   5,   5,   5,   5,   5,   5 },
4355 			{ 1,   1,   0,   0,   0,   7,   7,   7 },
4356 			{ 2,   2,   1,   1,   1,   0,   0,   9 },
4357 			{ 4,   4,   2,   2,   2,   1,   1,   0 },
4358 			{ 5,   6,   4,   4,   4,   2,   2,   1 },
4359 			{ 6,   5,   6,   6,   6,   4,   4,   2 },
4360 			{ 7,   7,   7,   7,   8,   6,   6,   4 },
4361 			{ 8,   8,   8,   8,   7,   8,   8,   6 },
4362 			{ 9,   9,   9,   9,   9,   9,   9,   8 }
4363 		};
4364 
4365 		entry = SpriteConvTable[(A & 0x7f800) >> 11] & 7;
4366 
4367 		for (i = 0;i < 10;i++)
4368 			bits[i] = (A >> i) & 0x01;
4369 
4370 		B = A & 0x7fc00;
4371 
4372 		for (i = 0; i < 10;i++) B |= bits[bit_pick_table[i][entry]] << i;
4373 
4374 		DrvSpriteRom[4*A+0] = DrvTempRom[4*B+0];
4375 		DrvSpriteRom[4*A+1] = DrvTempRom[4*B+1];
4376 		DrvSpriteRom[4*A+2] = DrvTempRom[4*B+2];
4377 		DrvSpriteRom[4*A+3] = DrvTempRom[4*B+3];
4378 	}
4379 }
4380 
MiaUnscrambleSprites()4381 static void MiaUnscrambleSprites()
4382 {
4383 	memcpy(DrvTempRom, DrvSpriteRom, 0x100000);
4384 
4385 	for (INT32 A = 0; A < 0x40000; A++) {
4386 		INT32 B, i;
4387 		INT32 bits[8];
4388 		for (i = 0; i < 8; i++) bits[i] = (A >> i) & 0x01;
4389 
4390 		B = A & 0x3ff00;
4391 
4392 		if ((A & 0x3c000) == 0x3c000) {
4393 			B |= bits[3] << 0;
4394 			B |= bits[5] << 1;
4395 			B |= bits[0] << 2;
4396 			B |= bits[1] << 3;
4397 			B |= bits[2] << 4;
4398 			B |= bits[4] << 5;
4399 			B |= bits[6] << 6;
4400 			B |= bits[7] << 7;
4401 		} else {
4402 			B |= bits[3] << 0;
4403 			B |= bits[5] << 1;
4404 			B |= bits[7] << 2;
4405 			B |= bits[0] << 3;
4406 			B |= bits[1] << 4;
4407 			B |= bits[2] << 5;
4408 			B |= bits[4] << 6;
4409 			B |= bits[6] << 7;
4410 		}
4411 
4412 		DrvSpriteRom[4*A+0] = DrvTempRom[4*B+0];
4413 		DrvSpriteRom[4*A+1] = DrvTempRom[4*B+1];
4414 		DrvSpriteRom[4*A+2] = DrvTempRom[4*B+2];
4415 		DrvSpriteRom[4*A+3] = DrvTempRom[4*B+3];
4416 	}
4417 }
4418 
TmntDecodeTitleSample()4419 static void TmntDecodeTitleSample()
4420 {
4421 	for (INT32 i = 0; i < 0x40000; i++) {
4422 		INT32 val = DrvTempRom[2 * i + 0] + (DrvTempRom[(2 * i) + 1] << 8);
4423 		INT32 expo = val >> 13;
4424 
4425 	  	val = (val >> 3) & (0x3ff);
4426 		val -= 0x200;
4427 
4428 		val <<= (expo-3);
4429 
4430 		DrvTitleSample[i] = val;
4431 	}
4432 }
4433 
TmntTitleSampleSetRoute(double nVolume,INT32 nRouteDir)4434 static void TmntTitleSampleSetRoute(double nVolume, INT32 nRouteDir)
4435 {
4436 	TitleSampleGain = nVolume;
4437 	TitleSampleOutputDir = nRouteDir;
4438 }
4439 
4440 static INT32 TilePlaneOffsets[4]     = { 24, 16, 8, 0 };
4441 static INT32 TileXOffsets[8]         = { 0, 1, 2, 3, 4, 5, 6, 7 };
4442 static INT32 TileYOffsets[8]         = { 0, 32, 64, 96, 128, 160, 192, 224 };
4443 static INT32 SpritePlaneOffsets[4]   = { 24, 16, 8, 0 };
4444 static INT32 SpritePlaneOffsets2[4]  = { 0, 8, 16, 24 };
4445 static INT32 SpriteXOffsets[16]      = { 0, 1, 2, 3, 4, 5, 6, 7, 256, 257, 258, 259, 260, 261, 262, 263 };
4446 static INT32 SpriteYOffsets[16]      = { 0, 32, 64, 96, 128, 160, 192, 224, 512, 544, 576, 608, 640, 672, 704, 736 };
4447 
K052109TmntCallback(INT32 Layer,INT32 Bank,INT32 * Code,INT32 * Colour,INT32 *,INT32 *)4448 static void K052109TmntCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32*, INT32 *)
4449 {
4450 	*Code |= ((*Colour & 0x03) << 8) | ((*Colour & 0x10) << 6) | ((*Colour & 0x0c) << 9) | (Bank << 13);
4451 	*Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5);
4452 }
4453 
K052109MiaCallback(INT32 Layer,INT32 Bank,INT32 * Code,INT32 * Colour,INT32 * xFlip,INT32 *)4454 static void K052109MiaCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32 *xFlip, INT32 *)
4455 {
4456 	*xFlip = *Colour & 0x04;
4457 
4458 	if (Layer == 0) {
4459 		*Code |= ((*Colour & 0x01) << 8);
4460 		*Colour = LayerColourBase[Layer] + ((*Colour & 0x80) >> 5) + ((*Colour & 0x10) >> 1);
4461 	} else {
4462 		*Code |= ((*Colour & 0x01) << 8) | ((*Colour & 0x18) << 6) | (Bank << 11);
4463 		*Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5);
4464 	}
4465 }
4466 
K052109CuebrickCallback(INT32 Layer,INT32,INT32 * Code,INT32 * Colour,INT32 *,INT32 *)4467 static void K052109CuebrickCallback(INT32 Layer, INT32, INT32 *Code, INT32 *Colour, INT32 *, INT32 *)
4468 {
4469 	if (K052109RMRDLine == 0 && Layer == 0) {
4470 		*Code |= ((*Colour & 0x01) << 8);
4471 		*Colour = LayerColourBase[Layer] + ((*Colour & 0x0e) >> 1);
4472 
4473 	} else {
4474 		*Code |= ((*Colour & 0x0f) << 8);
4475 		*Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5);
4476 	}
4477 }
4478 
K052109BlswhstlCallback(INT32 Layer,INT32 Bank,INT32 * Code,INT32 * Colour,INT32 *,INT32 *)4479 static void K052109BlswhstlCallback(INT32 Layer, INT32 Bank, INT32 *Code, INT32 *Colour, INT32 *, INT32 *)
4480 {
4481 	*Code |= ((*Colour & 0x01) << 8) | ((*Colour & 0x10) << 5) | ((*Colour & 0x0c) << 8) | (Bank << 12) | (BlswhstlTileRomBank << 14);
4482 	*Colour = LayerColourBase[Layer] + ((*Colour & 0xe0) >> 5);
4483 }
4484 
K051960TmntCallback(INT32 * Code,INT32 * Colour,INT32 *,INT32 *)4485 static void K051960TmntCallback(INT32 *Code, INT32 *Colour, INT32*, INT32*)
4486 {
4487 	*Code |= (*Colour & 0x10) << 9;
4488 	*Colour = SpriteColourBase + (*Colour & 0x0f);
4489 }
4490 
K051960MiaCallback(INT32 *,INT32 * Colour,INT32 *,INT32 *)4491 static void K051960MiaCallback(INT32* /*Code*/, INT32 *Colour, INT32*, INT32*)
4492 {
4493 	*Colour = SpriteColourBase + (*Colour & 0x0f);
4494 }
4495 
K051960CuebrickCallback(INT32 * Code,INT32 * Colour,INT32 *,INT32 *)4496 static void K051960CuebrickCallback(INT32* Code, INT32 *Colour, INT32*, INT32*)
4497 {
4498 	*Colour = SpriteColourBase + (*Colour & 0x0f);
4499 	*Code &= 0xfff;
4500 }
4501 
K051960Thndrx2Callback(INT32 * code,INT32 * color,INT32 * priority,INT32 *)4502 static void K051960Thndrx2Callback(INT32* code, INT32 *color, INT32* priority, INT32*)
4503 {
4504 	INT32 pri = 0x20 | ((*color & 0x60) >> 2);
4505 	if (pri <= LayerPri[2])					*priority = 0x00;
4506 	else if (pri > LayerPri[2] && pri <= LayerPri[1])	*priority = 0xf0;
4507 	else if (pri > LayerPri[1] && pri <= LayerPri[0])	*priority = 0xfc;
4508 	else 							*priority = 0xfe;
4509 
4510 	*code &= 0x1fff;
4511 	*color = SpriteColourBase + (*color & 0x0f);
4512 }
4513 
K051960PunkshotCallback(INT32 * code,INT32 * color,INT32 * priority,INT32 *)4514 static void K051960PunkshotCallback(INT32 *code, INT32 *color, INT32 *priority, INT32 *)
4515 {
4516 	INT32 pri = 0x20 | ((*color & 0x60) >> 2);
4517 	if (pri <= LayerPri[2])					*priority = 0x00;
4518 	else if (pri > LayerPri[2] && pri <= LayerPri[1])	*priority = 0xf0;
4519 	else if (pri > LayerPri[1] && pri <= LayerPri[0])	*priority = 0xfc;
4520 	else 							*priority = 0xfe;
4521 
4522 	*code |= (*color & 0x10) << 9;
4523 	*code &= 0x3fff;
4524 	*color = SpriteColourBase + (*color & 0x0f);
4525 }
4526 
K053245BlswhstlCallback(INT32 * Code,INT32 * Colour,INT32 * Priority)4527 static void K053245BlswhstlCallback(INT32 *Code, INT32 *Colour, INT32 *Priority)
4528 {
4529 	INT32 Pri = 0x20 | ((*Colour & 0x60) >> 2);
4530 	if (Pri <= LayerPri[2])                           	*Priority = 0x00;
4531 	else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) 	*Priority = 0xf0;
4532 	else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) 	*Priority = 0xfc;
4533 	else 	                                          	*Priority = 0xfe;
4534 
4535 	*Code &= 0x1fff;
4536 	*Colour = SpriteColourBase + (*Colour & 0x1f);
4537 }
4538 
K053245SsridersCallback(INT32 *,INT32 * Colour,INT32 * Priority)4539 static void K053245SsridersCallback(INT32 *, INT32 *Colour, INT32 *Priority)
4540 {
4541 	INT32 Pri = 0x20 | ((*Colour & 0x60) >> 2);
4542 	if (Pri <= LayerPri[2])                           	*Priority = 0x00;
4543 	else if (Pri > LayerPri[2] && Pri <= LayerPri[1]) 	*Priority = 0xf0;
4544 	else if (Pri > LayerPri[1] && Pri <= LayerPri[0]) 	*Priority = 0xfc;
4545 	else 	                                          	*Priority = 0xfe;
4546 
4547 	*Colour = SpriteColourBase + (*Colour & 0x1f);
4548 }
4549 
K053245LgtnfghtCallback(INT32 * code,INT32 * color,INT32 * priority)4550 static void K053245LgtnfghtCallback(INT32 *code, INT32 *color, INT32 *priority)
4551 {
4552 	INT32 pri = 0x20 | ((*color & 0x60) >> 2);
4553 	if (pri <= LayerPri[2])					*priority = 0x00;
4554 	else if (pri > LayerPri[2] && pri <= LayerPri[1])	*priority = 0xf0;
4555 	else if (pri > LayerPri[1] && pri <= LayerPri[0])	*priority = 0xfc;
4556 	else 							*priority = 0xfe;
4557 
4558 	*color = SpriteColourBase + (*color & 0x1f);
4559 	*code &= 0x3fff;
4560 }
4561 
DrvK007232VolCallback(INT32 v)4562 static void DrvK007232VolCallback(INT32 v)
4563 {
4564 	K007232SetVolume(0, 0, (v >> 4) * 0x11, 0);
4565 	K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11);
4566 }
4567 
CuebrickYM2151IrqHandler(INT32 Irq)4568 static void CuebrickYM2151IrqHandler(INT32 Irq)
4569 {
4570 	CuebrickSndIrqFire = Irq;
4571 }
4572 
TmntInit()4573 static INT32 TmntInit()
4574 {
4575 	GenericTilesInit();
4576 
4577 	INT32 nRet = 0, nLen;
4578 
4579 	// Allocate and Blank all required memory
4580 	Mem = NULL;
4581 	TmntMemIndex();
4582 	nLen = MemEnd - (UINT8 *)0;
4583 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
4584 	memset(Mem, 0, nLen);
4585 	TmntMemIndex();
4586 
4587 	K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
4588 	K052109SetCallback(K052109TmntCallback);
4589 	K051960Init(DrvSpriteRom, DrvSprites, 0x1fffff);
4590 	K051960SetCallback(K051960TmntCallback);
4591 
4592 	// Load 68000 Program Roms
4593 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
4594 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
4595 	nRet = BurnLoadRom(Drv68KRom + 0x040001, 2, 2); if (nRet != 0) return 1;
4596 	nRet = BurnLoadRom(Drv68KRom + 0x040000, 3, 2); if (nRet != 0) return 1;
4597 
4598 	// Load Z80 Program Roms
4599 	nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1;
4600 
4601 	// Load and decode the tiles
4602 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1;
4603 	nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1;
4604 	shuffle((UINT16*)DrvTileRom, 0x080000);
4605 	TmntUnscrambleGfx(DrvTileRom, 0x100000);
4606 	GfxDecode(0x100000 / 32, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
4607 
4608 	// Load the sprites
4609 	DrvTempRom = (UINT8 *)BurnMalloc(0x200100);
4610 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000,  7, 1); if (nRet != 0) return 1;
4611 	nRet = BurnLoadRom(DrvSpriteRom + 0x080000,  8, 1); if (nRet != 0) return 1;
4612 	nRet = BurnLoadRom(DrvSpriteRom + 0x100000,  9, 1); if (nRet != 0) return 1;
4613 	nRet = BurnLoadRom(DrvSpriteRom + 0x180000, 10, 1); if (nRet != 0) return 1;
4614 	shuffle((UINT16*)DrvSpriteRom, 0x100000);
4615 	TmntUnscrambleGfx(DrvSpriteRom, 0x200000);
4616 	TmntUnscrambleSprites();
4617 
4618 	// Decode the sprites
4619 	GfxDecode(0x200000 / 128, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites);
4620 
4621 	// Load K007232 Sample Roms
4622 	nRet = BurnLoadRom(DrvSoundRom + 0x00000, 13, 1); if (nRet != 0) return 1;
4623 
4624 	// Load UPD7759C Sample Roms
4625 	nRet = BurnLoadRom(DrvUPD7759CRom + 0x00000, 14, 1); if (nRet != 0) return 1;
4626 
4627 	// Load title sample
4628 	memset(DrvTempRom, 0, 0x080000);
4629 	nRet = BurnLoadRom(DrvTempRom + 0x00000, 15, 1); if (nRet != 0) return 1;
4630 	TmntDecodeTitleSample();
4631 
4632 	BurnFree(DrvTempRom);
4633 
4634 	// Setup the 68000 emulation
4635 	SekInit(0, 0x68000);
4636 	SekOpen(0);
4637 	SekMapMemory(Drv68KRom           , 0x000000, 0x05ffff, MAP_ROM);
4638 	SekMapMemory(Drv68KRam           , 0x060000, 0x063fff, MAP_RAM);
4639 	SekMapMemory(DrvPaletteRam       , 0x080000, 0x080fff, MAP_RAM);
4640 	SekSetReadWordHandler(0, Tmnt68KReadWord);
4641 	SekSetWriteWordHandler(0, Tmnt68KWriteWord);
4642 	SekSetReadByteHandler(0, Tmnt68KReadByte);
4643 	SekSetWriteByteHandler(0, Tmnt68KWriteByte);
4644 	SekClose();
4645 
4646 	// Setup the Z80 emulation
4647 	ZetInit(0);
4648 	ZetOpen(0);
4649 	ZetSetReadHandler(TmntZ80Read);
4650 	ZetSetWriteHandler(TmntZ80Write);
4651 	ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom                );
4652 	ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom                );
4653 	ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram                );
4654 	ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram                );
4655 	ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram                );
4656 	ZetClose();
4657 
4658 	// Setup the YM2151 emulation
4659 	BurnYM2151Init(3579545);
4660 	BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH);
4661 
4662 	K007232Init(0, 3579545, DrvSoundRom, 0x20000);
4663 	K007232SetPortWriteHandler(0, DrvK007232VolCallback);
4664 	K007232PCMSetAllRoutes(0, 0.33, BURN_SND_ROUTE_BOTH);
4665 	uses_k007232 = 1;
4666 
4667 	UPD7759Init(0, UPD7759_STANDARD_CLOCK, DrvUPD7759CRom);
4668 	UPD7759SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH);
4669 
4670 	TmntTitleSampleSetRoute(1.00, BURN_SND_ROUTE_BOTH);
4671 
4672 	LayerColourBase[0] = 0;
4673 	LayerColourBase[1] = 32;
4674 	LayerColourBase[2] = 40;
4675 	SpriteColourBase = 16;
4676 
4677 	// Reset the driver
4678 	TmntDoReset();
4679 
4680 	return 0;
4681 }
4682 
MiaInit()4683 static INT32 MiaInit()
4684 {
4685 	GenericTilesInit();
4686 
4687 	INT32 nRet = 0, nLen;
4688 
4689 	// Allocate and Blank all required memory
4690 	Mem = NULL;
4691 	MiaMemIndex();
4692 	nLen = MemEnd - (UINT8 *)0;
4693 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
4694 	memset(Mem, 0, nLen);
4695 	MiaMemIndex();
4696 
4697 	K052109Init(DrvTileRom, DrvTiles, 0x03ffff);
4698 	K052109SetCallback(K052109MiaCallback);
4699 	K051960Init(DrvSpriteRom, DrvSprites, 0x0fffff);
4700 	K051960SetCallback(K051960MiaCallback);
4701 
4702 	// Load 68000 Program Roms
4703 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
4704 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
4705 
4706 	// Load Z80 Program Roms
4707 	nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1;
4708 
4709 	// Load and decode the tiles
4710 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 2); if (nRet != 0) return 1;
4711 	nRet = BurnLoadRom(DrvTileRom + 0x000001, 4, 2); if (nRet != 0) return 1;
4712 	nRet = BurnLoadRom(DrvTileRom + 0x020000, 5, 2); if (nRet != 0) return 1;
4713 	nRet = BurnLoadRom(DrvTileRom + 0x020001, 6, 2); if (nRet != 0) return 1;
4714 	shuffle((UINT16*)DrvTileRom, 0x020000);
4715 	TmntUnscrambleGfx(DrvTileRom, 0x040000);
4716 	GfxDecode(0x2000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
4717 
4718 	// Load the sprites
4719 	DrvTempRom = (UINT8 *)BurnMalloc(0x100000);
4720 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000,  7, 1); if (nRet != 0) return 1;
4721 	nRet = BurnLoadRom(DrvSpriteRom + 0x080000,  8, 1); if (nRet != 0) return 1;
4722 	shuffle((UINT16*)DrvSpriteRom, 0x080000);
4723 	TmntUnscrambleGfx(DrvSpriteRom, 0x100000);
4724 	MiaUnscrambleSprites();
4725 
4726 	// Decode the sprites
4727 	GfxDecode(0x2000, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites);
4728 
4729 	// Load K007232 Sample Roms
4730 	nRet = BurnLoadRom(DrvSoundRom + 0x00000, 10, 1); if (nRet != 0) return 1;
4731 
4732 	BurnFree(DrvTempRom);
4733 
4734 	// Setup the 68000 emulation
4735 	SekInit(0, 0x68000);
4736 	SekOpen(0);
4737 	SekMapMemory(Drv68KRom           , 0x000000, 0x03ffff, MAP_ROM);
4738 	SekMapMemory(Drv68KRam + 0x0000  , 0x040000, 0x043fff, MAP_RAM);
4739 	SekMapMemory(Drv68KRam + 0x4000  , 0x060000, 0x063fff, MAP_RAM);
4740 	SekMapMemory(DrvPaletteRam       , 0x080000, 0x080fff, MAP_RAM);
4741 	SekSetReadWordHandler(0, Mia68KReadWord);
4742 	SekSetWriteWordHandler(0, Mia68KWriteWord);
4743 	SekSetReadByteHandler(0, Mia68KReadByte);
4744 	SekSetWriteByteHandler(0, Mia68KWriteByte);
4745 	SekClose();
4746 
4747 	// Setup the Z80 emulation
4748 	ZetInit(0);
4749 	ZetOpen(0);
4750 	ZetSetReadHandler(MiaZ80Read);
4751 	ZetSetWriteHandler(MiaZ80Write);
4752 	ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom                );
4753 	ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom                );
4754 	ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram                );
4755 	ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram                );
4756 	ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram                );
4757 	ZetClose();
4758 
4759 	// Setup the YM2151 emulation
4760 	BurnYM2151Init(3579545);
4761 	BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH);
4762 
4763 	K007232Init(0, 3579545, DrvSoundRom, 0x20000);
4764 	K007232SetPortWriteHandler(0, DrvK007232VolCallback);
4765 	K007232PCMSetAllRoutes(0, 0.20, BURN_SND_ROUTE_BOTH);
4766 	uses_k007232 = 1;
4767 
4768 	LayerColourBase[0] = 0;
4769 	LayerColourBase[1] = 32;
4770 	LayerColourBase[2] = 40;
4771 	SpriteColourBase = 16;
4772 
4773 	// Reset the driver
4774 	DrvDoReset();
4775 
4776 	return 0;
4777 }
4778 
CuebrickInit()4779 static INT32 CuebrickInit()
4780 {
4781 	GenericTilesInit();
4782 
4783 	INT32 nRet = 0, nLen;
4784 
4785 	// Allocate and Blank all required memory
4786 	Mem = NULL;
4787 	CuebrickMemIndex();
4788 	nLen = MemEnd - (UINT8 *)0;
4789 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
4790 	memset(Mem, 0, nLen);
4791 	CuebrickMemIndex();
4792 
4793 	K052109Init(DrvTileRom, DrvTiles, 0x03ffff);
4794 	K052109SetCallback(K052109CuebrickCallback);
4795 
4796 	K051960Init(DrvSpriteRom, DrvSprites, 0x03ffff);
4797 	K051960SetCallback(K051960CuebrickCallback);
4798 
4799 	// Load 68000 Program Roms
4800 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
4801 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
4802 
4803 	// Load and decode the tiles
4804 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 2, 2); if (nRet != 0) return 1;
4805 	nRet = BurnLoadRom(DrvTileRom + 0x000001, 3, 2); if (nRet != 0) return 1;
4806 	nRet = BurnLoadRom(DrvTileRom + 0x020000, 4, 2); if (nRet != 0) return 1;
4807 	nRet = BurnLoadRom(DrvTileRom + 0x020001, 5, 2); if (nRet != 0) return 1;
4808 	byte_shuffle(DrvTileRom, 0x040000);
4809 	GfxDecode(0x2000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
4810 
4811 	// Load the sprites
4812 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 6, 2); if (nRet != 0) return 1;
4813 	nRet = BurnLoadRom(DrvSpriteRom + 0x000001, 7, 2); if (nRet != 0) return 1;
4814 	nRet = BurnLoadRom(DrvSpriteRom + 0x020000, 8, 2); if (nRet != 0) return 1;
4815 	nRet = BurnLoadRom(DrvSpriteRom + 0x020001, 9, 2); if (nRet != 0) return 1;
4816 	byte_shuffle(DrvSpriteRom, 0x040000);
4817 	GfxDecode(0x0800, 4, 16, 16, SpritePlaneOffsets, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites);
4818 
4819 	// Setup the 68000 emulation
4820 	SekInit(0, 0x68000);
4821 	SekOpen(0);
4822 	SekMapMemory(Drv68KRom           , 0x000000, 0x01ffff, MAP_ROM);
4823 	SekMapMemory(Drv68KRam + 0x0000  , 0x040000, 0x043fff, MAP_RAM);
4824 	SekMapMemory(DrvPaletteRam       , 0x080000, 0x080fff, MAP_RAM);
4825 	SekSetReadWordHandler(0, Cuebrick68KReadWord);
4826 	SekSetWriteWordHandler(0, Cuebrick68KWriteWord);
4827 	SekSetReadByteHandler(0, Cuebrick68KReadByte);
4828 	SekSetWriteByteHandler(0, Cuebrick68KWriteByte);
4829 	SekClose();
4830 
4831 	// Setup the YM2151 emulation
4832 	BurnYM2151Init(3579545);
4833 	BurnYM2151SetIrqHandler(&CuebrickYM2151IrqHandler);
4834 	BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH);
4835 
4836 	LayerColourBase[0] = 0;
4837 	LayerColourBase[1] = 32;
4838 	LayerColourBase[2] = 40;
4839 	SpriteColourBase = 16;
4840 
4841 	// Reset the driver
4842 	CuebrickDoReset();
4843 
4844 	return 0;
4845 }
4846 
BlswhstlInit()4847 static INT32 BlswhstlInit()
4848 {
4849 	GenericTilesInit();
4850 
4851 	INT32 nRet = 0, nLen;
4852 
4853 	// Allocate and Blank all required memory
4854 	Mem = NULL;
4855 	BlswhstlMemIndex();
4856 	nLen = MemEnd - (UINT8 *)0;
4857 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
4858 	memset(Mem, 0, nLen);
4859 	BlswhstlMemIndex();
4860 
4861 	K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
4862 	K052109SetCallback(K052109BlswhstlCallback);
4863 	K052109AdjustScroll(8, 0);
4864 
4865 	K053245Init(0, DrvSpriteRom, DrvSprites, 0xfffff, K053245BlswhstlCallback);
4866 	K053245SetSpriteOffset(0, -112, 16);
4867 
4868 	// Load 68000 Program Roms
4869 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
4870 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
4871 	nRet = BurnLoadRom(Drv68KRom + 0x040001, 2, 2); if (nRet != 0) return 1;
4872 	nRet = BurnLoadRom(Drv68KRom + 0x040000, 3, 2); if (nRet != 0) return 1;
4873 
4874 	// Load Z80 Program Roms
4875 	nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1;
4876 
4877 	// Load and decode the tiles
4878 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1;
4879 	nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1;
4880 	BurnByteswap(DrvTileRom, 0x100000);
4881 	konami_rom_deinterleave_2(DrvTileRom, 0x100000);
4882 	GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
4883 
4884 	// Load the sprites
4885 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000,  7, 1); if (nRet != 0) return 1;
4886 	nRet = BurnLoadRom(DrvSpriteRom + 0x080000,  8, 1); if (nRet != 0) return 1;
4887 	BurnByteswap(DrvSpriteRom, 0x100000);
4888 	konami_rom_deinterleave_2(DrvSpriteRom, 0x100000);
4889 	K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x100000);
4890 
4891 	// Load K053260 Sample Roms
4892 	nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1;
4893 
4894 	// Setup the 68000 emulation
4895 	SekInit(0, 0x68000);
4896 	SekOpen(0);
4897 	SekMapMemory(Drv68KRom           , 0x000000, 0x07ffff, MAP_ROM);
4898 	SekMapMemory(Drv68KRam           , 0x204000, 0x207fff, MAP_RAM);
4899 	SekMapMemory(DrvPaletteRam       , 0x400000, 0x400fff, MAP_RAM);
4900 	SekSetReadWordHandler(0, Blswhstl68KReadWord);
4901 	SekSetWriteWordHandler(0, Blswhstl68KWriteWord);
4902 	SekSetReadByteHandler(0, Blswhstl68KReadByte);
4903 	SekSetWriteByteHandler(0, Blswhstl68KWriteByte);
4904 	SekClose();
4905 
4906 	// Setup the Z80 emulation
4907 	ZetInit(0);
4908 	ZetOpen(0);
4909 	ZetSetReadHandler(BlswhstlZ80Read);
4910 	ZetSetWriteHandler(BlswhstlZ80Write);
4911 	ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom                );
4912 	ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom                );
4913 	ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram                );
4914 	ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram                );
4915 	ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram                );
4916 	ZetClose();
4917 
4918 	// Setup the YM2151 emulation
4919 	BurnYM2151Init(3579545);
4920 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT);
4921 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT);
4922 
4923 	K053260Init(0, 3579545, DrvSoundRom, 0x100000);
4924 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.50, BURN_SND_ROUTE_RIGHT);
4925 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.50, BURN_SND_ROUTE_LEFT);
4926 
4927 	EEPROMInit(&BlswhstlEEPROMInterface);
4928 
4929 	// Reset the driver
4930 	BlswhstlDoReset();
4931 
4932 	return 0;
4933 }
4934 
SsridersInit()4935 static INT32 SsridersInit()
4936 {
4937 	GenericTilesInit();
4938 
4939 	INT32 nRet = 0, nLen;
4940 
4941 	// Allocate and Blank all required memory
4942 	Mem = NULL;
4943 	SsridersMemIndex();
4944 	nLen = MemEnd - (UINT8 *)0;
4945 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
4946 	memset(Mem, 0, nLen);
4947 	SsridersMemIndex();
4948 
4949 	K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
4950 	K052109SetCallback(K052109TmntCallback);
4951 	K052109AdjustScroll(8, 0);
4952 
4953 	K053245Init(0, DrvSpriteRom, DrvSprites, 0x1fffff, K053245LgtnfghtCallback);
4954 	K053245SetSpriteOffset(0, -112, 16);
4955 	K05324xSetZRejection(0);
4956 
4957 	// Load 68000 Program Roms
4958 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
4959 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
4960 	nRet = BurnLoadRom(Drv68KRom + 0x080001, 2, 2); if (nRet != 0) return 1;
4961 	nRet = BurnLoadRom(Drv68KRom + 0x080000, 3, 2); if (nRet != 0) return 1;
4962 
4963 	// Load Z80 Program Roms
4964 	nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1;
4965 
4966 	// Load and decode the tiles
4967 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1;
4968 	nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1;
4969 	konami_rom_deinterleave_2(DrvTileRom, 0x100000);
4970 	GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
4971 
4972 	// Load the sprites
4973 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000,  7, 1); if (nRet != 0) return 1;
4974 	nRet = BurnLoadRom(DrvSpriteRom + 0x100000,  8, 1); if (nRet != 0) return 1;
4975 	konami_rom_deinterleave_2(DrvSpriteRom, 0x200000);
4976 	K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x200000);
4977 
4978 	// Load K053260 Sample Roms
4979 	nRet = BurnLoadRom(DrvSoundRom + 0x00000, 9, 1); if (nRet != 0) return 1;
4980 
4981 	// Setup the 68000 emulation
4982 	SekInit(0, 0x68000);
4983 	SekOpen(0);
4984 	SekMapMemory(Drv68KRom           , 0x000000, 0x0bffff, MAP_ROM);
4985 	SekMapMemory(Drv68KRam           , 0x104000, 0x107fff, MAP_RAM);
4986 	SekMapMemory(DrvPaletteRam       , 0x140000, 0x140fff, MAP_RAM);
4987 	SekSetReadWordHandler(0, Ssriders68KReadWord);
4988 	SekSetWriteWordHandler(0, Ssriders68KWriteWord);
4989 	SekSetReadByteHandler(0, Ssriders68KReadByte);
4990 	SekSetWriteByteHandler(0, Ssriders68KWriteByte);
4991 	SekClose();
4992 
4993 	// Setup the Z80 emulation
4994 	ZetInit(0);
4995 	ZetOpen(0);
4996 	ZetSetReadHandler(BlswhstlZ80Read);
4997 	ZetSetWriteHandler(BlswhstlZ80Write);
4998 	ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom                );
4999 	ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom                );
5000 	ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram                );
5001 	ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram                );
5002 	ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram                );
5003 	ZetClose();
5004 
5005 	// Setup the YM2151 emulation
5006 	BurnYM2151Init(3579545);
5007 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
5008 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
5009 
5010 	K053260Init(0, 3579545, DrvSoundRom, 0x100000);
5011 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT);
5012 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT);
5013 
5014 	EEPROMInit(&BlswhstlEEPROMInterface);
5015 
5016 	// Reset the driver
5017 	SsridersDoReset();
5018 
5019 	return 0;
5020 }
5021 
Thndrx2Init()5022 static INT32 Thndrx2Init()
5023 {
5024 	GenericTilesInit();
5025 
5026 	INT32 nRet = 0, nLen;
5027 
5028 	// Allocate and Blank all required memory
5029 	Mem = NULL;
5030 	Thndrx2MemIndex();
5031 	nLen = MemEnd - (UINT8 *)0;
5032 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
5033 	memset(Mem, 0, nLen);
5034 	Thndrx2MemIndex();
5035 
5036 	K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
5037 	K052109SetCallback(K052109TmntCallback);
5038 	K052109AdjustScroll(8, 0);
5039 
5040 	K051960Init(DrvSpriteRom, DrvSprites, 0x0fffff);
5041 	K051960SetCallback(K051960Thndrx2Callback);
5042 	K051960SetSpriteOffset(8, 0);
5043 
5044 	// Load 68000 Program Roms
5045 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
5046 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
5047 
5048 	// Load Z80 Program Roms
5049 	nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1;
5050 
5051 	// Load and decode the tiles
5052 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 1); if (nRet != 0) return 1;
5053 	nRet = BurnLoadRom(DrvTileRom + 0x080000, 4, 1); if (nRet != 0) return 1;
5054 	konami_rom_deinterleave_2(DrvTileRom, 0x100000);
5055 	GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
5056 
5057 	// Load the sprites
5058 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000,  5, 1); if (nRet != 0) return 1;
5059 	nRet = BurnLoadRom(DrvSpriteRom + 0x080000,  6, 1); if (nRet != 0) return 1;
5060 	konami_rom_deinterleave_2(DrvSpriteRom, 0x100000);
5061 	GfxDecode(0x2000, 4, 16, 16, SpritePlaneOffsets2, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites);
5062 
5063 	// Load K053260 Sample Roms
5064 	nRet = BurnLoadRom(DrvSoundRom + 0x00000, 7, 1); if (nRet != 0) return 1;
5065 
5066 	// Setup the 68000 emulation
5067 	SekInit(0, 0x68000);
5068 	SekOpen(0);
5069 	SekMapMemory(Drv68KRom           , 0x000000, 0x03ffff, MAP_ROM);
5070 	SekMapMemory(Drv68KRam           , 0x100000, 0x103fff, MAP_RAM);
5071 	SekMapMemory(DrvPaletteRam       , 0x200000, 0x200fff, MAP_RAM);
5072 	SekSetWriteWordHandler(0, Thndrx268KWriteWord);
5073 	SekSetReadByteHandler(0, Thndrx268KReadByte);
5074 	SekSetWriteByteHandler(0, Thndrx268KWriteByte);
5075 	SekClose();
5076 
5077 	// Setup the Z80 emulation
5078 	ZetInit(0);
5079 	ZetOpen(0);
5080 	ZetSetReadHandler(Thndrx2Z80Read);
5081 	ZetSetWriteHandler(Thndrx2Z80Write);
5082 	ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom                );
5083 	ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom                );
5084 	ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram                );
5085 	ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram                );
5086 	ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram                );
5087 	ZetClose();
5088 
5089 	// Setup the YM2151 emulation
5090 	BurnYM2151Init(3579545);
5091 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
5092 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
5093 
5094 	K053260Init(0, 3579545, DrvSoundRom, 0x80000);
5095 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT);
5096 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT);
5097 
5098 	EEPROMInit(&thndrx2_eeprom_interface);
5099 
5100 	// Reset the driver
5101 	SsridersDoReset();
5102 
5103 	return 0;
5104 }
5105 
LgtnfghtInit()5106 static INT32 LgtnfghtInit()
5107 {
5108 	GenericTilesInit();
5109 
5110 	INT32 nRet = 0, nLen;
5111 
5112 	// Allocate and Blank all required memory
5113 	Mem = NULL;
5114 	LgtnfghtMemIndex();
5115 	nLen = MemEnd - (UINT8 *)0;
5116 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
5117 	memset(Mem, 0, nLen);
5118 	LgtnfghtMemIndex();
5119 
5120 	K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
5121 	K052109SetCallback(K052109TmntCallback);
5122 	K052109AdjustScroll(8, 0);
5123 
5124 	K053245Init(0, DrvSpriteRom, DrvSprites, 0x0fffff, K053245LgtnfghtCallback);
5125 	K053245SetSpriteOffset(0, -112, 16);
5126 	K05324xSetZRejection(0);
5127 
5128 	// Load 68000 Program Roms
5129 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
5130 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
5131 
5132 	// Load Z80 Program Roms
5133 	nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1;
5134 
5135 	// Load and decode the tiles
5136 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 1); if (nRet != 0) return 1;
5137 	nRet = BurnLoadRom(DrvTileRom + 0x080000, 4, 1); if (nRet != 0) return 1;
5138 	konami_rom_deinterleave_2(DrvTileRom, 0x100000);
5139 	GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
5140 
5141 	// Load the sprites
5142 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000,  5, 1); if (nRet != 0) return 1;
5143 	nRet = BurnLoadRom(DrvSpriteRom + 0x080000,  6, 1); if (nRet != 0) return 1;
5144 	konami_rom_deinterleave_2(DrvSpriteRom, 0x100000);
5145 	K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x100000);
5146 
5147 	// Load K053260 Sample Roms
5148 	nRet = BurnLoadRom(DrvSoundRom + 0x00000, 7, 1); if (nRet != 0) return 1;
5149 
5150 	// Setup the 68000 emulation
5151 	SekInit(0, 0x68000);
5152 	SekOpen(0);
5153 	SekMapMemory(Drv68KRom           , 0x000000, 0x03ffff, MAP_ROM);
5154 	SekMapMemory(DrvPaletteRam       , 0x080000, 0x080fff, MAP_RAM);
5155 	SekMapMemory(Drv68KRam           , 0x090000, 0x093fff, MAP_RAM);
5156 	SekSetReadWordHandler(0, Lgtnfght68KReadWord);
5157 	SekSetWriteWordHandler(0, Lgtnfght68KWriteWord);
5158 	SekSetReadByteHandler(0, Lgtnfght68KReadByte);
5159 	SekSetWriteByteHandler(0, Lgtnfght68KWriteByte);
5160 	SekClose();
5161 
5162 	// Setup the Z80 emulation
5163 	ZetInit(0);
5164 	ZetOpen(0);
5165 	ZetSetReadHandler(LgtnfghtZ80Read);
5166 	ZetSetWriteHandler(LgtnfghtZ80Write);
5167 	ZetMapArea(0x0000, 0x7fff, 0, DrvZ80Rom                );
5168 	ZetMapArea(0x0000, 0x7fff, 2, DrvZ80Rom                );
5169 	ZetMapArea(0x8000, 0x87ff, 0, DrvZ80Ram                );
5170 	ZetMapArea(0x8000, 0x87ff, 1, DrvZ80Ram                );
5171 	ZetMapArea(0x8000, 0x87ff, 2, DrvZ80Ram                );
5172 	ZetClose();
5173 
5174 	// Setup the YM2151 emulation
5175 	BurnYM2151Init(3579545);
5176 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
5177 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
5178 
5179 	K053260Init(0, 3579545, DrvSoundRom, 0x80000);
5180 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.70, BURN_SND_ROUTE_LEFT);
5181 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.70, BURN_SND_ROUTE_RIGHT);
5182 
5183 	EEPROMInit(&thndrx2_eeprom_interface);
5184 
5185 	NoDim = 1;
5186 
5187 	// Reset the driver
5188 	SsridersDoReset();
5189 
5190 	return 0;
5191 }
5192 
Tmnt2Init()5193 static INT32 Tmnt2Init()
5194 {
5195 	GenericTilesInit();
5196 
5197 	INT32 nRet = 0, nLen;
5198 
5199 	// Allocate and Blank all required memory
5200 	Mem = NULL;
5201 	Tmnt2MemIndex();
5202 	nLen = MemEnd - (UINT8 *)0;
5203 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
5204 	memset(Mem, 0, nLen);
5205 	Tmnt2MemIndex();
5206 
5207 	K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
5208 	K052109SetCallback(K052109TmntCallback);
5209 	K052109AdjustScroll(8, 0);
5210 
5211 	K053245Init(0, DrvSpriteRom, DrvSprites, 0x3fffff, K053245SsridersCallback);
5212 	K053245SetSpriteOffset(0, -112, 16);
5213 	K05324xSetZRejection(0);
5214 
5215 	// Load 68000 Program Roms
5216 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
5217 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
5218 	nRet = BurnLoadRom(Drv68KRom + 0x040001, 2, 2); if (nRet != 0) return 1;
5219 	nRet = BurnLoadRom(Drv68KRom + 0x040000, 3, 2); if (nRet != 0) return 1;
5220 
5221 	// Load Z80 Program Roms
5222 	nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1;
5223 
5224 	// Load and decode the tiles
5225 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1;
5226 	nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1;
5227 	konami_rom_deinterleave_2(DrvTileRom, 0x100000);
5228 	GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
5229 
5230 	// Load the sprites
5231 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000,   7, 1); if (nRet != 0) return 1;
5232 	nRet = BurnLoadRom(DrvSpriteRom + 0x100000,   8, 1); if (nRet != 0) return 1;
5233 	nRet = BurnLoadRom(DrvSpriteRom + 0x200000,   9, 1); if (nRet != 0) return 1;
5234 	nRet = BurnLoadRom(DrvSpriteRom + 0x300000,  10, 1); if (nRet != 0) return 1;
5235 	konami_rom_deinterleave_2(DrvSpriteRom, 0x400000);
5236 	K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x400000);
5237 
5238 	// Load K053260 Sample Roms
5239 	nRet = BurnLoadRom(DrvSoundRom + 0x00000, 11, 1); if (nRet != 0) return 1;
5240 
5241 	// Setup the 68000 emulation
5242 	SekInit(0, 0x68000);
5243 	SekOpen(0);
5244 	SekMapMemory(Drv68KRom           , 0x000000, 0x0fffff, MAP_ROM);
5245 	SekMapMemory(Drv68KRam           , 0x104000, 0x107fff, MAP_RAM);
5246 	SekMapMemory(DrvPaletteRam       , 0x140000, 0x140fff, MAP_RAM);
5247 	SekSetReadWordHandler(0, Ssriders68KReadWord);
5248 	SekSetWriteWordHandler(0, Ssriders68KWriteWord);
5249 	SekSetReadByteHandler(0, Ssriders68KReadByte);
5250 	SekSetWriteByteHandler(0, Ssriders68KWriteByte);
5251 
5252 	SekMapHandler(1,		  0x1c0800, 0x1c081f, MAP_WRITE);
5253 	SekSetWriteWordHandler(1, 	Tmnt268KProtWord);
5254 	SekSetWriteByteHandler(1, 	Tmnt268KProtByte);
5255 	SekClose();
5256 
5257 	// Setup the Z80 emulation
5258 	ZetInit(0);
5259 	ZetOpen(0);
5260 	ZetSetReadHandler(BlswhstlZ80Read);
5261 	ZetSetWriteHandler(BlswhstlZ80Write);
5262 	ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom                );
5263 	ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom                );
5264 	ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram                );
5265 	ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram                );
5266 	ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram                );
5267 	ZetClose();
5268 
5269 	// Setup the YM2151 emulation
5270 	BurnYM2151Init(3579545);
5271 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
5272 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
5273 
5274 	K053260Init(0, 3579545, DrvSoundRom, 0x200000);
5275 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT);
5276 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT);
5277 
5278 	EEPROMInit(&BlswhstlEEPROMInterface);
5279 
5280 	// Reset the driver
5281 	SsridersDoReset();
5282 
5283 	return 0;
5284 }
5285 
QgakumonInit()5286 static INT32 QgakumonInit()
5287 {
5288 	GenericTilesInit();
5289 
5290 	INT32 nRet = 0, nLen;
5291 
5292 	// Allocate and Blank all required memory
5293 	Mem = NULL;
5294 	Tmnt2MemIndex();
5295 	nLen = MemEnd - (UINT8 *)0;
5296 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
5297 	memset(Mem, 0, nLen);
5298 	Tmnt2MemIndex();
5299 
5300 	K052109Init(DrvTileRom, DrvTiles, 0x0fffff);
5301 	K052109SetCallback(K052109TmntCallback);
5302 	K052109AdjustScroll(0, 0);
5303 
5304 	K053245Init(0, DrvSpriteRom, DrvSprites, 0x3fffff, K053245SsridersCallback);
5305 	K053245SetSpriteOffset(0, -112, 16);
5306 	K05324xSetZRejection(0);
5307 
5308 	// Load 68000 Program Roms
5309 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
5310 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
5311 	nRet = BurnLoadRom(Drv68KRom + 0x080001, 2, 2); if (nRet != 0) return 1;
5312 	nRet = BurnLoadRom(Drv68KRom + 0x080000, 3, 2); if (nRet != 0) return 1;
5313 
5314 	// Load Z80 Program Roms
5315 	nRet = BurnLoadRom(DrvZ80Rom, 4, 1); if (nRet != 0) return 1;
5316 
5317 	// Load and decode the tiles
5318 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 5, 1); if (nRet != 0) return 1;
5319 	nRet = BurnLoadRom(DrvTileRom + 0x080000, 6, 1); if (nRet != 0) return 1;
5320 	konami_rom_deinterleave_2(DrvTileRom, 0x100000);
5321 	GfxDecode(0x8000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
5322 
5323 	// Load the sprites
5324 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000,   7, 1); if (nRet != 0) return 1;
5325 	nRet = BurnLoadRom(DrvSpriteRom + 0x200000,   8, 1); if (nRet != 0) return 1;
5326 	konami_rom_deinterleave_2(DrvSpriteRom, 0x400000);
5327 	K053245GfxDecode(DrvSpriteRom, DrvSprites, 0x400000);
5328 
5329 	// Load K053260 Sample Roms
5330 	nRet = BurnLoadRom(DrvSoundRom + 0x00000,  9, 1); if (nRet != 0) return 1;
5331 
5332 	// Setup the 68000 emulation
5333 	SekInit(0, 0x68000);
5334 	SekOpen(0);
5335 	SekMapMemory(Drv68KRom           , 0x000000, 0x0fffff, MAP_ROM);
5336 	SekMapMemory(Drv68KRam           , 0x104000, 0x107fff, MAP_RAM);
5337 	SekMapMemory(DrvPaletteRam       , 0x140000, 0x140fff, MAP_RAM);
5338 	SekSetReadWordHandler(0, Ssriders68KReadWord);
5339 	SekSetWriteWordHandler(0, Ssriders68KWriteWord);
5340 	SekSetReadByteHandler(0, Ssriders68KReadByte);
5341 	SekSetWriteByteHandler(0, Ssriders68KWriteByte);
5342 
5343 	SekMapHandler(1,		  0x1c0800, 0x1c081f, MAP_WRITE);
5344 	SekSetWriteWordHandler(1, 	Tmnt268KProtWord);
5345 	SekSetWriteByteHandler(1, 	Tmnt268KProtByte);
5346 	SekClose();
5347 
5348 	// Setup the Z80 emulation
5349 	ZetInit(0);
5350 	ZetOpen(0);
5351 	ZetSetReadHandler(BlswhstlZ80Read);
5352 	ZetSetWriteHandler(BlswhstlZ80Write);
5353 	ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom                );
5354 	ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom                );
5355 	ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram                );
5356 	ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram                );
5357 	ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram                );
5358 	ZetClose();
5359 
5360 	// Setup the YM2151 emulation
5361 	BurnYM2151Init(3579545);
5362 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
5363 	BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
5364 
5365 	K053260Init(0, 3579545, DrvSoundRom, 0x200000);
5366 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT);
5367 	K053260SetRoute(0, BURN_SND_K053260_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT);
5368 
5369 	EEPROMInit(&BlswhstlEEPROMInterface);
5370 
5371 	// Reset the driver
5372 	SsridersDoReset();
5373 
5374 	return 0;
5375 }
5376 
PunkshotInit()5377 static INT32 PunkshotInit()
5378 {
5379 	GenericTilesInit();
5380 
5381 	INT32 nRet = 0, nLen;
5382 
5383 	// Allocate and Blank all required memory
5384 	Mem = NULL;
5385 	PunkshotMemIndex();
5386 	nLen = MemEnd - (UINT8 *)0;
5387 	if ((Mem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
5388 	memset(Mem, 0, nLen);
5389 	PunkshotMemIndex();
5390 
5391 	K052109Init(DrvTileRom, DrvTiles, 0x07ffff);
5392 	K052109SetCallback(K052109TmntCallback);
5393 	K052109AdjustScroll(8, 0);
5394 
5395 	K051960Init(DrvSpriteRom, DrvSprites, 0x1fffff);
5396 	K051960SetCallback(K051960PunkshotCallback);
5397 	K051960SetSpriteOffset(8, 0);
5398 
5399 	// Load 68000 Program Roms
5400 	nRet = BurnLoadRom(Drv68KRom + 0x000001, 0, 2); if (nRet != 0) return 1;
5401 	nRet = BurnLoadRom(Drv68KRom + 0x000000, 1, 2); if (nRet != 0) return 1;
5402 
5403 	// Load Z80 Program Roms
5404 	nRet = BurnLoadRom(DrvZ80Rom, 2, 1); if (nRet != 0) return 1;
5405 
5406 	// Load and decode the tiles
5407 	nRet = BurnLoadRom(DrvTileRom + 0x000000, 3, 1); if (nRet != 0) return 1;
5408 	nRet = BurnLoadRom(DrvTileRom + 0x040000, 4, 1); if (nRet != 0) return 1;
5409 	konami_rom_deinterleave_2(DrvTileRom, 0x80000);
5410 	GfxDecode(0x4000, 4, 8, 8, TilePlaneOffsets, TileXOffsets, TileYOffsets, 0x100, DrvTileRom, DrvTiles);
5411 
5412 	// Load the sprites
5413 	nRet = BurnLoadRom(DrvSpriteRom + 0x000000, 5, 1); if (nRet != 0) return 1;
5414 	nRet = BurnLoadRom(DrvSpriteRom + 0x100000, 6, 1); if (nRet != 0) return 1;
5415 	konami_rom_deinterleave_2(DrvSpriteRom, 0x200000);
5416 	GfxDecode(0x4000, 4, 16, 16, SpritePlaneOffsets2, SpriteXOffsets, SpriteYOffsets, 0x400, DrvSpriteRom, DrvSprites);
5417 
5418 	// Load K053260 Sample Roms
5419 	nRet = BurnLoadRom(DrvSoundRom + 0x00000, 7, 1); if (nRet != 0) return 1;
5420 
5421 	// Setup the 68000 emulation
5422 	SekInit(0, 0x68000);
5423 	SekOpen(0);
5424 	SekMapMemory(Drv68KRom           , 0x000000, 0x03ffff, MAP_ROM);
5425 	SekMapMemory(Drv68KRam  	 , 0x080000, 0x083fff, MAP_RAM);
5426 	SekMapMemory(DrvPaletteRam       , 0x090000, 0x090fff, MAP_RAM);
5427 	SekSetReadWordHandler(0, 	Punkshot68KReadWord);
5428 	SekSetWriteWordHandler(0, 	Punkshot68KWriteWord);
5429 	SekSetReadByteHandler(0, 	Punkshot68KReadByte);
5430 	SekSetWriteByteHandler(0, 	Punkshot68KWriteByte);
5431 	SekClose();
5432 
5433 	ZetInit(0);
5434 	ZetOpen(0);
5435 	ZetSetReadHandler(Thndrx2Z80Read);
5436 	ZetSetWriteHandler(Thndrx2Z80Write);
5437 	ZetMapArea(0x0000, 0xefff, 0, DrvZ80Rom                );
5438 	ZetMapArea(0x0000, 0xefff, 2, DrvZ80Rom                );
5439 	ZetMapArea(0xf000, 0xf7ff, 0, DrvZ80Ram                );
5440 	ZetMapArea(0xf000, 0xf7ff, 1, DrvZ80Ram                );
5441 	ZetMapArea(0xf000, 0xf7ff, 2, DrvZ80Ram                );
5442 	ZetClose();
5443 
5444 	// Setup the YM2151 emulation
5445 	BurnYM2151Init(3579545);
5446 	BurnYM2151SetAllRoutes(1.00, BURN_SND_ROUTE_BOTH);
5447 
5448 	K053260Init(0, 3579545, DrvSoundRom, 0x80000);
5449 	K053260PCMSetAllRoutes(0, 0.70, BURN_SND_ROUTE_BOTH);
5450 
5451 	// Reset the driver
5452 	PunkshotDoReset();
5453 
5454 	return 0;
5455 }
5456 
CommonExit()5457 static INT32 CommonExit()
5458 {
5459 	SekExit();
5460 
5461 	BurnYM2151Exit();
5462 
5463 	GenericTilesExit();
5464 
5465 	KonamiICExit();
5466 
5467 	BurnFree(Mem);
5468 
5469 	bIrqEnable = 0;
5470 	DrvSoundLatch = 0;
5471 	TitleSoundLatch = 0;
5472 	PlayTitleSample = 0;
5473 	TitleSamplePos = 0;
5474 	SpriteColourBase = 0;
5475 	memset(LayerColourBase, 0, sizeof(LayerColourBase));
5476 	memset(LayerPri, 0, sizeof(LayerPri));
5477 	PriorityFlag = 0;
5478 
5479 	DrvNvRamBank = 0;
5480 	CuebrickSndIrqFire = 0;
5481 	BlswhstlTileRomBank = 0;
5482 	DrvVBlank = 0;
5483 	InitEEPROMCount = 0;
5484 	uses_k007232 = 0;
5485 
5486 	return 0;
5487 }
5488 
CommonZ80Exit()5489 static INT32 CommonZ80Exit()
5490 {
5491 	ZetExit();
5492 
5493 	return CommonExit();
5494 }
5495 
TmntExit()5496 static INT32 TmntExit()
5497 {
5498 	UPD7759Exit();
5499 	K007232Exit();
5500 
5501 	return CommonZ80Exit();
5502 }
5503 
MiaExit()5504 static INT32 MiaExit()
5505 {
5506 	K007232Exit();
5507 
5508 	return CommonZ80Exit();
5509 }
5510 
BlswhstlExit()5511 static INT32 BlswhstlExit()
5512 {
5513 	K053260Exit();
5514 	EEPROMExit();
5515 	NoDim = 0;
5516 
5517 	return CommonZ80Exit();
5518 }
5519 
PunkshotExit()5520 static INT32 PunkshotExit()
5521 {
5522 	K053260Exit();
5523 
5524 	return CommonZ80Exit();
5525 }
5526 
pal5bit(UINT8 bits)5527 static inline UINT8 pal5bit(UINT8 bits)
5528 {
5529 	bits &= 0x1f;
5530 	return (bits << 3) | (bits >> 2);
5531 }
5532 
DrvCalcPalette()5533 static void DrvCalcPalette()
5534 {
5535 	UINT16 *PaletteRam = (UINT16*)DrvPaletteRam;
5536 
5537 	for (INT32 i = 0; i < 0x800; i += 2) {
5538 		INT32 Offset = i & ~1;
5539 		UINT32 Data = (BURN_ENDIAN_SWAP_INT16(PaletteRam[Offset]) << 8) | BURN_ENDIAN_SWAP_INT16(PaletteRam[Offset + 1]);
5540 
5541 		DrvPalette[Offset >> 1] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10);
5542 	}
5543 }
5544 
BlswhstlCalcPalette()5545 static void BlswhstlCalcPalette()
5546 {
5547 	UINT16 *PaletteRam = (UINT16*)DrvPaletteRam;
5548 
5549 	for (INT32 i = 0; i < 0x800; i++) {
5550 		UINT32 Data = BURN_ENDIAN_SWAP_INT16(PaletteRam[i]);
5551 
5552 		DrvPalette[i] = (pal5bit(Data >> 0) << 16) | (pal5bit(Data >> 5) << 8) | pal5bit(Data >> 10);
5553 	}
5554 }
5555 
sortlayers(INT32 * layer,INT32 * pri)5556 static void sortlayers(INT32 *layer,INT32 *pri)
5557 {
5558 #define SWAP(a,b) \
5559 	if (pri[a] < pri[b]) \
5560 	{ \
5561 		INT32 t; \
5562 		t = pri[a]; pri[a] = pri[b]; pri[b] = t; \
5563 		t = layer[a]; layer[a] = layer[b]; layer[b] = t; \
5564 	}
5565 
5566 	SWAP(0,1)
5567 	SWAP(0,2)
5568 	SWAP(1,2)
5569 }
5570 
BlswhstlCalcPaletteWithContrast(INT32 i,INT32 brt)5571 static inline void BlswhstlCalcPaletteWithContrast(INT32 i, INT32 brt)
5572 {
5573 	INT32 r,g,b;
5574 	UINT16 *PaletteRam = (UINT16*)DrvPaletteRam;
5575 
5576 	UINT32 Data = BURN_ENDIAN_SWAP_INT16(PaletteRam[i]);
5577 
5578 	r = pal5bit(Data >> 0);
5579 	g = pal5bit(Data >> 5);
5580 	b = pal5bit(Data >> 10);
5581 
5582 	r = (r * brt) / 100;
5583 	g = (g * brt) / 100;
5584 	b = (b * brt) / 100;
5585 
5586 	DrvPalette[i] = (r<<16) | (g<<8) | b;
5587 }
5588 
PaletteDim(INT32 dimslayer)5589 static void PaletteDim(INT32 dimslayer)
5590 {
5591 	INT32 i, dim, en, cb, ce, brt;
5592 
5593 	dim = dim_v | ((~dim_c & 0x10) >> 1);
5594 	en  = (K053251GetPriority(5) && K053251GetPriority(5) != 0x3e);
5595 
5596 	brt = 100;
5597 	if (en) brt -= 40*dim/8;
5598 
5599 	if (brt < 100 && !NoDim) {
5600 		cb = LayerColourBase[dimslayer] << 4;
5601 		ce = cb + 128;
5602 
5603 		for (i =  0; i < cb; i++)
5604 			BlswhstlCalcPaletteWithContrast(i, brt);
5605 
5606 		for (i = cb; i < ce; i++) // text
5607 			BlswhstlCalcPaletteWithContrast(i, 100);
5608 
5609 		for (i = ce; i < 2048; i++)
5610 			BlswhstlCalcPaletteWithContrast(i, brt);
5611 
5612 		if (~dim_c & 0x10) {
5613 			konami_set_highlight_over_sprites_mode(1);
5614 			konami_set_highlight_mode(1);
5615 		} else {
5616 			konami_set_highlight_over_sprites_mode(0);
5617 			konami_set_highlight_mode(0);
5618 		}
5619 
5620 	} else {
5621 		BlswhstlCalcPalette();
5622 	}
5623 }
5624 
TmntDraw()5625 static INT32 TmntDraw()
5626 {
5627 	DrvCalcPalette();
5628 	K052109UpdateScroll();
5629 
5630 	K052109RenderLayer(2, K052109_OPAQUE, 0);
5631 	if ((PriorityFlag & 1) == 1) K051960SpritesRender(0, 0);
5632 	K052109RenderLayer(1, 0, 0);
5633 	if ((PriorityFlag & 1) == 0) K051960SpritesRender(0, 0);
5634 	K052109RenderLayer(0, 0, 0);
5635 
5636 	KonamiBlendCopy(DrvPalette);
5637 
5638 	return 0;
5639 }
5640 
BlswhstlDraw()5641 static INT32 BlswhstlDraw()
5642 {
5643 	INT32 Layer[3];
5644 
5645 	K052109UpdateScroll();
5646 
5647 	INT32 BGColourBase   = K053251GetPaletteIndex(0);
5648 	SpriteColourBase   = K053251GetPaletteIndex(1);
5649 	LayerColourBase[0] = K053251GetPaletteIndex(2);
5650 	LayerColourBase[1] = K053251GetPaletteIndex(4);
5651 	LayerColourBase[2] = K053251GetPaletteIndex(3);
5652 
5653 	LayerPri[0] = K053251GetPriority(2);
5654 	LayerPri[1] = K053251GetPriority(4);
5655 	LayerPri[2] = K053251GetPriority(3);
5656 	Layer[0] = 0;
5657 	Layer[1] = 1;
5658 	Layer[2] = 2;
5659 
5660 	KonamiClearBitmaps(DrvPalette[16 * BGColourBase]);
5661 
5662 	sortlayers(Layer, LayerPri);
5663 
5664 	PaletteDim(Layer[2]);
5665 
5666 	if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, 1);
5667 	if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, 2);
5668 	if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, 4);
5669 
5670 	if (nSpriteEnable & 1) K053245SpritesRender(0);
5671 
5672 	KonamiBlendCopy(DrvPalette);
5673 
5674 	return 0;
5675 }
5676 
Thndrx2Draw()5677 static INT32 Thndrx2Draw()
5678 {
5679 	INT32 Layer[3];
5680 
5681 	BlswhstlCalcPalette();
5682 	K052109UpdateScroll();
5683 
5684 	INT32 BGColourBase   = K053251GetPaletteIndex(0);
5685 	SpriteColourBase   = K053251GetPaletteIndex(1);
5686 	LayerColourBase[0] = K053251GetPaletteIndex(2);
5687 	LayerColourBase[1] = K053251GetPaletteIndex(4);
5688 	LayerColourBase[2] = K053251GetPaletteIndex(3);
5689 
5690 	LayerPri[0] = K053251GetPriority(2);
5691 	LayerPri[1] = K053251GetPriority(4);
5692 	LayerPri[2] = K053251GetPriority(3);
5693 	Layer[0] = 0;
5694 	Layer[1] = 1;
5695 	Layer[2] = 2;
5696 
5697 	KonamiClearBitmaps(DrvPalette[16 * BGColourBase]);
5698 
5699 	sortlayers(Layer, LayerPri);
5700 
5701 	if (nBurnLayer & 1) K052109RenderLayer(Layer[0], 0, 1);
5702 	if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, 2);
5703 	if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, 4);
5704 
5705 	if (nSpriteEnable & 1) K051960SpritesRender(-1, -1);
5706 
5707 	KonamiBlendCopy(DrvPalette);
5708 
5709 	return 0;
5710 }
5711 
PunkshotDraw()5712 static INT32 PunkshotDraw()
5713 {
5714 	INT32 Layer[3];
5715 
5716 	BlswhstlCalcPalette();
5717 	K052109UpdateScroll();
5718 
5719 //	INT32 BGColourBase   = K053251GetPaletteIndex(0);
5720 	SpriteColourBase   = K053251GetPaletteIndex(1);
5721 	LayerColourBase[0] = K053251GetPaletteIndex(2);
5722 	LayerColourBase[1] = K053251GetPaletteIndex(4);
5723 	LayerColourBase[2] = K053251GetPaletteIndex(3);
5724 
5725 	LayerPri[0] = K053251GetPriority(2);
5726 	LayerPri[1] = K053251GetPriority(4);
5727 	LayerPri[2] = K053251GetPriority(3);
5728 	Layer[0] = 0;
5729 	Layer[1] = 1;
5730 	Layer[2] = 2;
5731 
5732 	sortlayers(Layer, LayerPri);
5733 
5734 	if (nBurnLayer & 1) K052109RenderLayer(Layer[0], K052109_OPAQUE, 1);
5735 	if (nBurnLayer & 2) K052109RenderLayer(Layer[1], 0, 2);
5736 	if (nBurnLayer & 4) K052109RenderLayer(Layer[2], 0, 4);
5737 
5738 	if (nSpriteEnable & 1) K051960SpritesRender(-1, -1);
5739 
5740 	KonamiBlendCopy(DrvPalette);
5741 
5742 	return 0;
5743 }
5744 
RenderTitleSample(INT16 * pSoundBuf,INT32 nLength)5745 static void RenderTitleSample(INT16 *pSoundBuf, INT32 nLength)
5746 {
5747 	double Addr = TitleSamplePos;
5748 	double Step = (double)20000 / nBurnSoundRate;
5749 
5750 	for (INT32 i = 0; i < nLength; i += 2) {
5751 		if (Addr > 0x3ffff) break;
5752 		INT16 Sample = DrvTitleSample[(INT32)Addr];
5753 
5754 		INT16 nLeftSample = 0, nRightSample = 0;
5755 
5756 		if ((TitleSampleOutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) {
5757 			nLeftSample += (INT32)(Sample * TitleSampleGain);
5758 		}
5759 		if ((TitleSampleOutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) {
5760 			nRightSample += (INT32)(Sample * TitleSampleGain);
5761 		}
5762 
5763 		pSoundBuf[i + 0] += nLeftSample;
5764 		pSoundBuf[i + 1] += nRightSample;
5765 
5766 		Addr += Step;
5767 	}
5768 
5769 	TitleSamplePos = Addr;
5770 }
5771 
TmntFrame()5772 static INT32 TmntFrame()
5773 {
5774 	INT32 nInterleave = nBurnSoundLen;
5775 	INT32 nSoundBufferPos = 0;
5776 
5777 	if (DrvReset) TmntDoReset();
5778 
5779 	DrvMakeInputs();
5780 
5781 	nCyclesTotal[0] = 8000000 / 60;
5782 	nCyclesTotal[1] = 3579545 / 60;
5783 	nCyclesDone[0] = nCyclesDone[1] = 0;
5784 
5785 	SekNewFrame();
5786 	ZetNewFrame();
5787 
5788 	for (INT32 i = 0; i < nInterleave; i++) {
5789 		INT32 nCurrentCPU, nNext;
5790 
5791 		// Run 68000
5792 		nCurrentCPU = 0;
5793 		SekOpen(0);
5794 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
5795 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
5796 		nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
5797 		if (i == (nInterleave - 1) && bIrqEnable) SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
5798 		SekClose();
5799 
5800 		// Run Z80
5801 		nCurrentCPU = 1;
5802 		ZetOpen(0);
5803 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
5804 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
5805 		nCyclesSegment = ZetRun(nCyclesSegment);
5806 		nCyclesDone[nCurrentCPU] += nCyclesSegment;
5807 		ZetClose();
5808 
5809 		if (pBurnSoundOut) {
5810 			INT32 nSegmentLength = nBurnSoundLen / nInterleave;
5811 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
5812 			BurnYM2151Render(pSoundBuf, nSegmentLength);
5813 			K007232Update(0, pSoundBuf, nSegmentLength);
5814 			UPD7759Update(0, pSoundBuf, nSegmentLength);
5815 			if (PlayTitleSample) RenderTitleSample(pSoundBuf, nSegmentLength);
5816 			nSoundBufferPos += nSegmentLength;
5817 		}
5818 	}
5819 
5820 	// Make sure the buffer is entirely filled.
5821 	if (pBurnSoundOut) {
5822 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
5823 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
5824 
5825 		if (nSegmentLength) {
5826 			BurnYM2151Render(pSoundBuf, nSegmentLength);
5827 			K007232Update(0, pSoundBuf, nSegmentLength);
5828 			UPD7759Update(0, pSoundBuf, nSegmentLength);
5829 			if (PlayTitleSample) RenderTitleSample(pSoundBuf, nSegmentLength);
5830 		}
5831 	}
5832 
5833 	if (pBurnDraw) TmntDraw();
5834 
5835 	return 0;
5836 }
5837 
MiaFrame()5838 static INT32 MiaFrame()
5839 {
5840 	INT32 nInterleave = nBurnSoundLen;
5841 	INT32 nSoundBufferPos = 0;
5842 
5843 	if (DrvReset) DrvDoReset();
5844 
5845 	DrvMakeInputs();
5846 
5847 	nCyclesTotal[0] = 8000000 / 60;
5848 	nCyclesTotal[1] = 3579545 / 60;
5849 	nCyclesDone[0] = nCyclesDone[1] = 0;
5850 
5851 	SekNewFrame();
5852 	ZetNewFrame();
5853 
5854 	for (INT32 i = 0; i < nInterleave; i++) {
5855 		INT32 nCurrentCPU, nNext;
5856 
5857 		// Run 68000
5858 		nCurrentCPU = 0;
5859 		SekOpen(0);
5860 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
5861 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
5862 		nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
5863 		if (i == (nInterleave - 1) && bIrqEnable) SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
5864 		SekClose();
5865 
5866 		// Run Z80
5867 		nCurrentCPU = 1;
5868 		ZetOpen(0);
5869 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
5870 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
5871 		nCyclesSegment = ZetRun(nCyclesSegment);
5872 		nCyclesDone[nCurrentCPU] += nCyclesSegment;
5873 		ZetClose();
5874 
5875 		if (pBurnSoundOut) {
5876 			INT32 nSegmentLength = nBurnSoundLen / nInterleave;
5877 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
5878 			BurnYM2151Render(pSoundBuf, nSegmentLength);
5879 			K007232Update(0, pSoundBuf, nSegmentLength);
5880 			nSoundBufferPos += nSegmentLength;
5881 		}
5882 	}
5883 
5884 	// Make sure the buffer is entirely filled.
5885 	if (pBurnSoundOut) {
5886 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
5887 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
5888 
5889 		if (nSegmentLength) {
5890 			BurnYM2151Render(pSoundBuf, nSegmentLength);
5891 			K007232Update(0, pSoundBuf, nSegmentLength);
5892 		}
5893 	}
5894 
5895 	if (pBurnDraw) TmntDraw();
5896 
5897 	return 0;
5898 }
5899 
CuebrickFrame()5900 static INT32 CuebrickFrame()
5901 {
5902 	INT32 nInterleave = 10;
5903 	INT32 nSoundBufferPos = 0;
5904 
5905 	if (DrvReset) CuebrickDoReset();
5906 
5907 	DrvMakeInputs();
5908 
5909 	nCyclesTotal[0] = 8000000 / 60;
5910 	nCyclesDone[0] = 0;
5911 
5912 	SekNewFrame();
5913 	SekOpen(0);
5914 
5915 	for (INT32 i = 0; i < nInterleave; i++) {
5916 		INT32 nCurrentCPU, nNext;
5917 
5918 		// Run 68000
5919 		nCurrentCPU = 0;
5920 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
5921 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
5922 		nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
5923 		if (i == (nInterleave - 1) && bIrqEnable) SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
5924 		if (CuebrickSndIrqFire) SekSetIRQLine(6, CPU_IRQSTATUS_AUTO);
5925 
5926 		if (pBurnSoundOut) {
5927 			INT32 nSegmentLength = nBurnSoundLen / nInterleave;
5928 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
5929 			BurnYM2151Render(pSoundBuf, nSegmentLength);
5930 			nSoundBufferPos += nSegmentLength;
5931 		}
5932 	}
5933 
5934 	// Make sure the buffer is entirely filled.
5935 	if (pBurnSoundOut) {
5936 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
5937 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
5938 
5939 		if (nSegmentLength) {
5940 			BurnYM2151Render(pSoundBuf, nSegmentLength);
5941 		}
5942 	}
5943 
5944 	SekClose();
5945 
5946 	if (pBurnDraw) TmntDraw();
5947 
5948 	return 0;
5949 }
5950 
BlswhstlFrame()5951 static INT32 BlswhstlFrame()
5952 {
5953 	INT32 nInterleave = 32;
5954 	INT32 nSoundBufferPos = 0;
5955 
5956 	if (DrvReset) BlswhstlDoReset();
5957 
5958 	DrvMakeInputs();
5959 
5960 	nCyclesTotal[0] = 16000000 / 60;
5961 	nCyclesTotal[1] = 3579545 / 60;
5962 	nCyclesDone[0] = nCyclesDone[1] = 0;
5963 
5964 	SekNewFrame();
5965 	ZetNewFrame();
5966 
5967 	for (INT32 i = 0; i < nInterleave; i++) {
5968 		INT32 nCurrentCPU, nNext;
5969 
5970 		// Run 68000
5971 		nCurrentCPU = 0;
5972 		SekOpen(0);
5973 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
5974 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
5975 		nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
5976 		if (i == (nInterleave - 1) && K052109_irq_enabled) SekSetIRQLine(4, CPU_IRQSTATUS_AUTO);
5977 		SekClose();
5978 
5979 		// Run Z80
5980 		nCurrentCPU = 1;
5981 		ZetOpen(0);
5982 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
5983 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
5984 		nCyclesSegment = ZetRun(nCyclesSegment);
5985 		nCyclesDone[nCurrentCPU] += nCyclesSegment;
5986 		ZetClose();
5987 
5988 		if (pBurnSoundOut) {
5989 			INT32 nSegmentLength = nBurnSoundLen / nInterleave;
5990 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
5991 			BurnYM2151Render(pSoundBuf, nSegmentLength);
5992 			K053260Update(0, pSoundBuf, nSegmentLength);
5993 			nSoundBufferPos += nSegmentLength;
5994 		}
5995 	}
5996 
5997 	// Make sure the buffer is entirely filled.
5998 	if (pBurnSoundOut) {
5999 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
6000 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6001 
6002 		if (nSegmentLength) {
6003 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6004 			K053260Update(0, pSoundBuf, nSegmentLength);
6005 		}
6006 	}
6007 
6008 	if (pBurnDraw) BlswhstlDraw();
6009 
6010 	K053245ClearBuffer(0);
6011 
6012 	return 0;
6013 }
6014 
SsridersFrame()6015 static INT32 SsridersFrame()
6016 {
6017 	INT32 nInterleave = 256;
6018 	INT32 nSoundBufferPos = 0;
6019 
6020 	if (DrvReset) SsridersDoReset();
6021 
6022 	SsridersMakeInputs();
6023 
6024 	nCyclesTotal[0] = 16000000 / 60;
6025 	nCyclesTotal[1] = 8000000 / 60;
6026 	nCyclesDone[0] = nCyclesDone[1] = 0;
6027 
6028 	SekNewFrame();
6029 	ZetNewFrame();
6030 
6031 	for (INT32 i = 0; i < nInterleave; i++) {
6032 		INT32 nCurrentCPU, nNext;
6033 
6034 		// Run 68000
6035 		nCurrentCPU = 0;
6036 		SekOpen(0);
6037 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6038 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6039 		nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
6040 		if (i == 19) DrvVBlank = 0;
6041 		if (i == 240) DrvVBlank = 1;
6042 		SekClose();
6043 
6044 		// Run Z80
6045 		nCurrentCPU = 1;
6046 		ZetOpen(0);
6047 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6048 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6049 		nCyclesSegment = ZetRun(nCyclesSegment);
6050 		nCyclesDone[nCurrentCPU] += nCyclesSegment;
6051 		ZetClose();
6052 
6053 		if (pBurnSoundOut) {
6054 			INT32 nSegmentLength = nBurnSoundLen / nInterleave;
6055 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6056 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6057 			K053260Update(0, pSoundBuf, nSegmentLength);
6058 			nSoundBufferPos += nSegmentLength;
6059 		}
6060 	}
6061 
6062 	SekOpen(0);
6063 	if (K052109_irq_enabled) SekSetIRQLine(4, CPU_IRQSTATUS_AUTO);
6064 	SekClose();
6065 
6066 	// Make sure the buffer is entirely filled.
6067 	if (pBurnSoundOut) {
6068 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
6069 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6070 
6071 		if (nSegmentLength) {
6072 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6073 			K053260Update(0, pSoundBuf, nSegmentLength);
6074 		}
6075 	}
6076 
6077 	if (pBurnDraw) BlswhstlDraw();
6078 
6079 	return 0;
6080 }
6081 
Thndrx2Frame()6082 static INT32 Thndrx2Frame()
6083 {
6084 	INT32 nInterleave = 100;
6085 	INT32 nSoundBufferPos = 0;
6086 
6087 	if (DrvReset) SsridersDoReset();
6088 
6089 	DrvMakeInputs();
6090 
6091 	nCyclesTotal[0] = 12000000 / 60;
6092 	nCyclesTotal[1] = 3579545 / 60;
6093 	nCyclesDone[0] = nCyclesDone[1] = 0;
6094 
6095 	SekNewFrame();
6096 	ZetNewFrame();
6097 
6098 	SekOpen(0);
6099 	ZetOpen(0);
6100 
6101 	for (INT32 i = 0; i < nInterleave; i++) {
6102 		INT32 nCurrentCPU, nNext;
6103 
6104 		// Run 68000
6105 		nCurrentCPU = 0;
6106 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6107 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6108 		nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
6109 
6110 		// Run Z80
6111 		nCurrentCPU = 1;
6112 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6113 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6114 		nCyclesSegment = ZetRun(nCyclesSegment);
6115 		nCyclesDone[nCurrentCPU] += nCyclesSegment;
6116 
6117 		if (pBurnSoundOut) {
6118 			INT32 nSegmentLength = nBurnSoundLen / nInterleave;
6119 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6120 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6121 			K053260Update(0, pSoundBuf, nSegmentLength);
6122 			nSoundBufferPos += nSegmentLength;
6123 		}
6124 	}
6125 
6126 	if (K052109_irq_enabled) SekSetIRQLine(4, CPU_IRQSTATUS_AUTO);
6127 
6128 	// Make sure the buffer is entirely filled.
6129 	if (pBurnSoundOut) {
6130 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
6131 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6132 
6133 		if (nSegmentLength) {
6134 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6135 			K053260Update(0, pSoundBuf, nSegmentLength);
6136 		}
6137 	}
6138 
6139 	ZetClose();
6140 	SekClose();
6141 
6142 	if (pBurnDraw) Thndrx2Draw();
6143 
6144 	return 0;
6145 }
6146 
LgtnfghtFrame()6147 static INT32 LgtnfghtFrame()
6148 {
6149 	INT32 nInterleave = 100;
6150 	INT32 nSoundBufferPos = 0;
6151 
6152 	if (DrvReset) SsridersDoReset();
6153 
6154 	DrvMakeInputs();
6155 
6156 	nCyclesTotal[0] = 12000000 / 60;
6157 	nCyclesTotal[1] = 3579545 / 60;
6158 	nCyclesDone[0] = nCyclesDone[1] = 0;
6159 
6160 	SekNewFrame();
6161 	ZetNewFrame();
6162 
6163 	SekOpen(0);
6164 	ZetOpen(0);
6165 
6166 	for (INT32 i = 0; i < nInterleave; i++) {
6167 		INT32 nCurrentCPU, nNext;
6168 
6169 		// Run 68000
6170 		nCurrentCPU = 0;
6171 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6172 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6173 		nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
6174 
6175 		// Run Z80
6176 		nCurrentCPU = 1;
6177 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6178 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6179 		nCyclesSegment = ZetRun(nCyclesSegment);
6180 		nCyclesDone[nCurrentCPU] += nCyclesSegment;
6181 
6182 		if (pBurnSoundOut) {
6183 			INT32 nSegmentLength = nBurnSoundLen / nInterleave;
6184 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6185 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6186 			K053260Update(0, pSoundBuf, nSegmentLength);
6187 			nSoundBufferPos += nSegmentLength;
6188 		}
6189 	}
6190 
6191 	if (K052109_irq_enabled) SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
6192 
6193 	// Make sure the buffer is entirely filled.
6194 	if (pBurnSoundOut) {
6195 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
6196 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6197 
6198 		if (nSegmentLength) {
6199 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6200 			K053260Update(0, pSoundBuf, nSegmentLength);
6201 		}
6202 	}
6203 
6204 	ZetClose();
6205 	SekClose();
6206 
6207 	if (pBurnDraw) BlswhstlDraw();
6208 
6209 	return 0;
6210 }
6211 
Tmnt2Frame()6212 static INT32 Tmnt2Frame()
6213 {
6214 	INT32 nInterleave = 262;
6215 	INT32 nSoundBufferPos = 0;
6216 
6217 	if (DrvReset) SsridersDoReset();
6218 
6219 	SsridersMakeInputs();
6220 
6221 	nCyclesTotal[0] = 16000000 / 60;
6222 	nCyclesTotal[1] = 8000000 / 60;
6223 	nCyclesDone[0] = nCyclesDone[1] = 0;
6224 
6225 	SekNewFrame();
6226 	ZetNewFrame();
6227 
6228 	for (INT32 i = 0; i < nInterleave; i++) {
6229 		INT32 nCurrentCPU, nNext;
6230 
6231 		// Run 68000
6232 		nCurrentCPU = 0;
6233 		SekOpen(0);
6234 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6235 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6236 		nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
6237 		if (i == 19) DrvVBlank = 0;
6238 		if (i == 243) DrvVBlank = 1;
6239 		if (i == 243 && K052109_irq_enabled) SekSetIRQLine(4, CPU_IRQSTATUS_AUTO);
6240 		SekClose();
6241 
6242 		// Run Z80
6243 		nCurrentCPU = 1;
6244 		ZetOpen(0);
6245 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6246 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6247 		nCyclesSegment = ZetRun(nCyclesSegment);
6248 		nCyclesDone[nCurrentCPU] += nCyclesSegment;
6249 		ZetClose();
6250 
6251 		if (pBurnSoundOut) {
6252 			INT32 nSegmentLength = nBurnSoundLen / nInterleave;
6253 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6254 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6255 			K053260Update(0, pSoundBuf, nSegmentLength);
6256 			nSoundBufferPos += nSegmentLength;
6257 		}
6258 	}
6259 
6260 	// Make sure the buffer is entirely filled.
6261 	if (pBurnSoundOut) {
6262 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
6263 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6264 
6265 		if (nSegmentLength) {
6266 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6267 			K053260Update(0, pSoundBuf, nSegmentLength);
6268 		}
6269 	}
6270 
6271 	if (pBurnDraw) BlswhstlDraw();
6272 
6273 	return 0;
6274 }
6275 
PunkshotFrame()6276 static INT32 PunkshotFrame()
6277 {
6278 	INT32 nInterleave = 256;
6279 	INT32 nSoundBufferPos = 0;
6280 
6281 	if (DrvReset) PunkshotDoReset();
6282 
6283 	DrvMakeInputs();
6284 
6285 	nCyclesTotal[0] = 12000000 / 60;
6286 	nCyclesTotal[1] = 3579545 / 60;
6287 	nCyclesDone[0] = nCyclesDone[1] = 0;
6288 
6289 	SekNewFrame();
6290 	ZetNewFrame();
6291 
6292 	SekOpen(0);
6293 	ZetOpen(0);
6294 
6295 	for (INT32 i = 0; i < nInterleave; i++) {
6296 		INT32 nCurrentCPU, nNext;
6297 
6298 		// Run 68000
6299 		nCurrentCPU = 0;
6300 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6301 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6302 		nCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
6303 
6304 		// Run Z80
6305 		nCurrentCPU = 1;
6306 		nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
6307 		nCyclesSegment = nNext - nCyclesDone[nCurrentCPU];
6308 		nCyclesSegment = ZetRun(nCyclesSegment);
6309 		nCyclesDone[nCurrentCPU] += nCyclesSegment;
6310 
6311 		if (pBurnSoundOut) {
6312 			INT32 nSegmentLength = nBurnSoundLen / nInterleave;
6313 			INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6314 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6315 			K053260Update(0, pSoundBuf, nSegmentLength);
6316 			nSoundBufferPos += nSegmentLength;
6317 		}
6318 	}
6319 
6320 	if (K052109_irq_enabled) SekSetIRQLine(4, CPU_IRQSTATUS_AUTO);
6321 
6322 	// Make sure the buffer is entirely filled.
6323 	if (pBurnSoundOut) {
6324 		INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
6325 		INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
6326 
6327 		if (nSegmentLength) {
6328 			BurnYM2151Render(pSoundBuf, nSegmentLength);
6329 			K053260Update(0, pSoundBuf, nSegmentLength);
6330 		}
6331 	}
6332 
6333 	ZetClose();
6334 	SekClose();
6335 
6336 	if (pBurnDraw) PunkshotDraw();
6337 
6338 	return 0;
6339 }
6340 
DrvScan(INT32 nAction,INT32 * pnMin)6341 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
6342 {
6343 	struct BurnArea ba;
6344 
6345 	if (pnMin != NULL) {			// Return minimum compatible version
6346 		*pnMin = 0x029693;
6347 	}
6348 
6349 	if (nAction & ACB_MEMORY_RAM) {
6350 		memset(&ba, 0, sizeof(ba));
6351 		ba.Data	  = RamStart;
6352 		ba.nLen	  = RamEnd-RamStart;
6353 		ba.szName = "All Ram";
6354 		BurnAcb(&ba);
6355 	}
6356 
6357 	KonamiICScan(nAction);
6358 
6359 	if (nAction & ACB_DRIVER_DATA) {
6360 		SekScan(nAction);
6361 
6362 		BurnYM2151Scan(nAction, pnMin);
6363 
6364 		// Scan critical driver variables
6365 		SCAN_VAR(nCyclesDone);
6366 		SCAN_VAR(nCyclesSegment);
6367 		SCAN_VAR(DrvDip);
6368 		SCAN_VAR(DrvInput);
6369 		SCAN_VAR(bIrqEnable);
6370 		SCAN_VAR(DrvSoundLatch);
6371 		SCAN_VAR(TitleSoundLatch);
6372 		SCAN_VAR(PlayTitleSample);
6373 		SCAN_VAR(TitleSamplePos);
6374 		SCAN_VAR(PriorityFlag);
6375 
6376 		BurnRandomScan(nAction);
6377 	}
6378 
6379 	return 0;
6380 }
6381 
TmntScan(INT32 nAction,INT32 * pnMin)6382 static INT32 TmntScan(INT32 nAction, INT32 *pnMin)
6383 {
6384 	if (nAction & ACB_DRIVER_DATA) {
6385 		ZetScan(nAction);
6386 		K007232Scan(nAction, pnMin);
6387 		UPD7759Scan(nAction, pnMin);
6388 	}
6389 
6390 	return DrvScan(nAction, pnMin);
6391 }
6392 
MiaScan(INT32 nAction,INT32 * pnMin)6393 static INT32 MiaScan(INT32 nAction, INT32 *pnMin)
6394 {
6395 	if (nAction & ACB_DRIVER_DATA) {
6396 		ZetScan(nAction);
6397 		K007232Scan(nAction, pnMin);
6398 	}
6399 
6400 	return DrvScan(nAction, pnMin);
6401 }
6402 
CuebrickScan(INT32 nAction,INT32 * pnMin)6403 static INT32 CuebrickScan(INT32 nAction, INT32 *pnMin)
6404 {
6405 	struct BurnArea ba;
6406 
6407 	if (nAction & ACB_NVRAM) {
6408 		memset(&ba, 0, sizeof(ba));
6409 		ba.Data = DrvNvRam;
6410 		ba.nLen = 0x400 * 0x20;
6411 		ba.szName = "NV RAM";
6412 		BurnAcb(&ba);
6413 	}
6414 
6415 	if (nAction & ACB_DRIVER_DATA) {
6416 		KonamiICScan(nAction);
6417 		SCAN_VAR(CuebrickSndIrqFire);
6418 	}
6419 
6420 	return DrvScan(nAction, pnMin);
6421 }
6422 
BlswhstlScan(INT32 nAction,INT32 * pnMin)6423 static INT32 BlswhstlScan(INT32 nAction, INT32 *pnMin)
6424 {
6425 	if (nAction & ACB_DRIVER_DATA) {
6426 		ZetScan(nAction);
6427 		K053260Scan(nAction, pnMin);
6428 
6429 		SCAN_VAR(InitEEPROMCount);
6430 	}
6431 
6432 	EEPROMScan(nAction, pnMin);
6433 
6434 	return DrvScan(nAction, pnMin);
6435 }
6436 
SsridersScan(INT32 nAction,INT32 * pnMin)6437 static INT32 SsridersScan(INT32 nAction, INT32 *pnMin)
6438 {
6439 	if (nAction & ACB_DRIVER_DATA) {
6440 		ZetScan(nAction);
6441 		K053260Scan(nAction, pnMin);
6442 
6443 		SCAN_VAR(InitEEPROMCount);
6444 		SCAN_VAR(DrvVBlank);
6445 	}
6446 
6447 	EEPROMScan(nAction, pnMin);
6448 
6449 	return DrvScan(nAction, pnMin);
6450 }
6451 
Thndrx2aScan(INT32 nAction,INT32 * pnMin)6452 static INT32 Thndrx2aScan(INT32 nAction, INT32 *pnMin)
6453 {
6454 	if (nAction & ACB_DRIVER_DATA) {
6455 		ZetScan(nAction);
6456 		K053260Scan(nAction, pnMin);
6457 	}
6458 
6459 	return DrvScan(nAction, pnMin);
6460 }
6461 
6462 struct BurnDriver BurnDrvTmnt = {
6463 	"tmnt", NULL, NULL, NULL, "1989",
6464 	"Teenage Mutant Ninja Turtles (World 4 Players, version X)\0", NULL, "Konami", "GX963",
6465 	NULL, NULL, NULL, NULL,
6466 	BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6467 	NULL, TmntRomInfo, TmntRomName, NULL, NULL, NULL, NULL, TmntInputInfo, TmntDIPInfo,
6468 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6469 	NULL, 0x400, 304, 224, 4, 3
6470 };
6471 
6472 struct BurnDriver BurnDrvTmntu = {
6473 	"tmntu", "tmnt", NULL, NULL, "1989",
6474 	"Teenage Mutant Ninja Turtles (US 4 Players, version R)\0", NULL, "Konami", "GX963",
6475 	NULL, NULL, NULL, NULL,
6476 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6477 	NULL, TmntuRomInfo, TmntuRomName, NULL, NULL, NULL, NULL, TmntInputInfo, TmntDIPInfo,
6478 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6479 	NULL, 0x400, 304, 224, 4, 3
6480 };
6481 
6482 struct BurnDriver BurnDrvTmntua = {
6483 	"tmntua", "tmnt", NULL, NULL, "1989",
6484 	"Teenage Mutant Ninja Turtles (US 4 Players, version J)\0", NULL, "Konami", "GX963",
6485 	NULL, NULL, NULL, NULL,
6486 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6487 	NULL, TmntuaRomInfo, TmntuaRomName, NULL, NULL, NULL, NULL, TmntInputInfo, TmntDIPInfo,
6488 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6489 	NULL, 0x400, 304, 224, 4, 3
6490 };
6491 
6492 struct BurnDriver BurnDrvTmntub = {
6493 	"tmntub", "tmnt", NULL, NULL, "1989",
6494 	"Teenage Mutant Ninja Turtles (US 4 Players, version H)\0", NULL, "Konami", "GX963",
6495 	NULL, NULL, NULL, NULL,
6496 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6497 	NULL, TmntubRomInfo, TmntubRomName, NULL, NULL, NULL, NULL, TmntInputInfo, TmntDIPInfo,
6498 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6499 	NULL, 0x400, 304, 224, 4, 3
6500 };
6501 
6502 struct BurnDriver BurnDrvTmht = {
6503 	"tmht", "tmnt", NULL, NULL, "1989",
6504 	"Teenage Mutant Hero Turtles (UK 4 Players, version F)\0", NULL, "Konami", "GX963",
6505 	NULL, NULL, NULL, NULL,
6506 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6507 	NULL, TmhtRomInfo, TmhtRomName, NULL, NULL, NULL, NULL, TmntInputInfo, TmntDIPInfo,
6508 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6509 	NULL, 0x400, 304, 224, 4, 3
6510 };
6511 
6512 struct BurnDriver BurnDrvTmhta = {
6513 	"tmhta", "tmnt", NULL, NULL, "1989",
6514 	"Teenage Mutant Hero Turtles (UK 4 Players, version S)\0", NULL, "Konami", "GX963",
6515 	NULL, NULL, NULL, NULL,
6516 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6517 	NULL, TmhtaRomInfo, TmhtaRomName, NULL, NULL, NULL, NULL, TmntInputInfo, TmntDIPInfo,
6518 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6519 	NULL, 0x400, 304, 224, 4, 3
6520 };
6521 
6522 struct BurnDriver BurnDrvTmhtb = {
6523 	"tmhtb", "tmnt", NULL, NULL, "1989",
6524 	"Teenage Mutant Hero Turtles (UK 4 Players, version ?)\0", NULL, "Konami", "GX963",
6525 	NULL, NULL, NULL, NULL,
6526 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6527 	NULL, TmhtbRomInfo, TmhtbRomName, NULL, NULL, NULL, NULL, TmntInputInfo, TmntDIPInfo,
6528 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6529 	NULL, 0x400, 304, 224, 4, 3
6530 };
6531 
6532 struct BurnDriver BurnDrvTmntj = {
6533 	"tmntj", "tmnt", NULL, NULL, "1990",
6534 	"Teenage Mutant Ninja Turtles (Japan 4 Players, version 2)\0", NULL, "Konami", "GX963",
6535 	NULL, NULL, NULL, NULL,
6536 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6537 	NULL, TmntjRomInfo, TmntjRomName, NULL, NULL, NULL, NULL, TmntInputInfo, TmntDIPInfo,
6538 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6539 	NULL, 0x400, 304, 224, 4, 3
6540 };
6541 
6542 struct BurnDriver BurnDrvTmnta = {
6543 	"tmnta", "tmnt", NULL, NULL, "1990",
6544 	"Teenage Mutant Ninja Turtles (Asia 4 Players, version ?)\0", NULL, "Konami", "GX963",
6545 	NULL, NULL, NULL, NULL,
6546 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6547 	NULL, TmntaRomInfo, TmntaRomName, NULL, NULL, NULL, NULL, TmntInputInfo, TmntDIPInfo,
6548 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6549 	NULL, 0x400, 304, 224, 4, 3
6550 };
6551 
6552 struct BurnDriver BurnDrvTmht2p = {
6553 	"tmht2p", "tmnt", NULL, NULL, "1989",
6554 	"Teenage Mutant Hero Turtles (UK 2 Players, version U)\0", NULL, "Konami", "GX963",
6555 	NULL, NULL, NULL, NULL,
6556 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6557 	NULL, Tmht2pRomInfo, Tmht2pRomName, NULL, NULL, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo,
6558 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6559 	NULL, 0x400, 304, 224, 4, 3
6560 };
6561 
6562 struct BurnDriver BurnDrvTmht2pa = {
6563 	"tmht2pa", "tmnt", NULL, NULL, "1989",
6564 	"Teenage Mutant Hero Turtles (UK 2 Players, version ?)\0", NULL, "Konami", "GX963",
6565 	NULL, NULL, NULL, NULL,
6566 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6567 	NULL, Tmht2paRomInfo, Tmht2paRomName, NULL, NULL, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo,
6568 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6569 	NULL, 0x400, 304, 224, 4, 3
6570 };
6571 
6572 struct BurnDriver BurnDrvTmht2pj = {
6573 	"tmnt2pj", "tmnt", NULL, NULL, "1990",
6574 	"Teenage Mutant Ninja Turtles (Japan 2 Players, version 1)\0", NULL, "Konami", "GX963",
6575 	NULL, NULL, NULL, NULL,
6576 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6577 	NULL, Tmnt2pjRomInfo, Tmnt2pjRomName, NULL, NULL, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo,
6578 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6579 	NULL, 0x400, 304, 224, 4, 3
6580 };
6581 
6582 struct BurnDriver BurnDrvTmht2po = {
6583 	"tmnt2po", "tmnt", NULL, NULL, "1989",
6584 	"Teenage Mutant Ninja Turtles (Oceania 2 Players, version ?)\0", NULL, "Konami", "GX963",
6585 	NULL, NULL, NULL, NULL,
6586 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6587 	NULL, Tmnt2poRomInfo, Tmnt2poRomName, NULL, NULL, NULL, NULL, Tmnt2pInputInfo, Tmnt2pDIPInfo,
6588 	TmntInit, TmntExit, TmntFrame, TmntDraw, TmntScan,
6589 	NULL, 0x400, 304, 224, 4, 3
6590 };
6591 
6592 struct BurnDriver BurnDrvMia = {
6593 	"mia", NULL, NULL, NULL, "1989",
6594 	"M.I.A. - Missing in Action (version T)\0", NULL, "Konami", "GX808",
6595 	NULL, NULL, NULL, NULL,
6596 	BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6597 	NULL, MiaRomInfo, MiaRomName, NULL, NULL, NULL, NULL, MiaInputInfo, MiaDIPInfo,
6598 	MiaInit, MiaExit, MiaFrame, TmntDraw, MiaScan,
6599 	NULL, 0x400, 304, 224, 4, 3
6600 };
6601 
6602 struct BurnDriver BurnDrvMia2 = {
6603 	"mia2", "mia", NULL, NULL, "1989",
6604 	"M.I.A. - Missing in Action (version S)\0", NULL, "Konami", "GX808",
6605 	NULL, NULL, NULL, NULL,
6606 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6607 	NULL, Mia2RomInfo, Mia2RomName, NULL, NULL, NULL, NULL, MiaInputInfo, MiaDIPInfo,
6608 	MiaInit, MiaExit, MiaFrame, TmntDraw, MiaScan,
6609 	NULL, 0x400, 304, 224, 4, 3
6610 };
6611 
6612 struct BurnDriver BurnDrvCuebrick = {
6613 	"cuebrick", NULL, NULL, NULL, "1989",
6614 	"Cue Brick (World, version D)\0", NULL, "Konami", "GX903",
6615 	NULL, NULL, NULL, NULL,
6616 	BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_PUZZLE, 0,
6617 	NULL, CuebrickRomInfo, CuebrickRomName, NULL, NULL, NULL, NULL, MiaInputInfo, MiaDIPInfo,
6618 	CuebrickInit, CommonExit, CuebrickFrame, TmntDraw, CuebrickScan,
6619 	NULL, 0x400, 304, 224, 4, 3
6620 };
6621 
6622 struct BurnDriver BurnDrvBlswhstl = {
6623 	"blswhstl", NULL, NULL, NULL, "1991",
6624 	"Bells & Whistles (World, version L)\0", NULL, "Konami", "GX060",
6625 	NULL, NULL, NULL, NULL,
6626 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0,
6627 	NULL, BlswhstlRomInfo, BlswhstlRomName, NULL, NULL, NULL, NULL, BlswhstlInputInfo, NULL,
6628 	BlswhstlInit, BlswhstlExit, BlswhstlFrame, BlswhstlDraw, BlswhstlScan,
6629 	NULL, 0x810, 224, 280, 3, 4
6630 };
6631 
6632 struct BurnDriver BurnDrvBlswhstla = {
6633 	"blswhstla", "blswhstl", NULL, NULL, "1991",
6634 	"Bells & Whistles (Asia, version M)\0", NULL, "Konami", "GX060",
6635 	NULL, NULL, NULL, NULL,
6636 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0,
6637 	NULL, BlswhstlaRomInfo, BlswhstlaRomName, NULL, NULL, NULL, NULL, BlswhstlInputInfo, NULL,
6638 	BlswhstlInit, BlswhstlExit, BlswhstlFrame, BlswhstlDraw, BlswhstlScan,
6639 	NULL, 0x810, 224, 280, 3, 4
6640 };
6641 
6642 struct BurnDriver BurnDrvDetatwin = {
6643 	"detatwin", "blswhstl", NULL, NULL, "1991",
6644 	"Detana!! Twin Bee (Japan ver. J)\0", NULL, "Konami", "GX060",
6645 	L"\u51FA\u305F\u306A!! Twin Bee \u30C4\u30A4\u30F3\u30D3\u30FC (Japan, version J)\0", NULL, NULL, NULL,
6646 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0,
6647 	NULL, DetatwinRomInfo, DetatwinRomName, NULL, NULL, NULL, NULL, BlswhstlInputInfo, NULL,
6648 	BlswhstlInit, BlswhstlExit, BlswhstlFrame, BlswhstlDraw, BlswhstlScan,
6649 	NULL, 0x810, 224, 280, 3, 4
6650 };
6651 
6652 struct BurnDriver BurnDrvSsriders = {
6653 	"ssriders", NULL, NULL, NULL, "1991",
6654 	"Sunset Riders (4 Players ver. EAC)\0", NULL, "Konami", "GX064",
6655 	NULL, NULL, NULL, NULL,
6656 	BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6657 	NULL, SsridersRomInfo, SsridersRomName, NULL, NULL, NULL, NULL, Ssriders4pInputInfo, NULL,
6658 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6659 	NULL, 0x810, 288, 224, 4, 3
6660 };
6661 
6662 struct BurnDriver BurnDrvSsridersebd = {
6663 	"ssridersebd", "ssriders", NULL, NULL, "1991",
6664 	"Sunset Riders (2 Players ver. EBD)\0", NULL, "Konami", "GX064",
6665 	NULL, NULL, NULL, NULL,
6666 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6667 	NULL, SsridersebdRomInfo, SsridersebdRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6668 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6669 	NULL, 0x810, 288, 224, 4, 3
6670 };
6671 
6672 struct BurnDriver BurnDrvSsridersebc = {
6673 	"ssridersebc", "ssriders", NULL, NULL, "1991",
6674 	"Sunset Riders (2 Players ver. EBC)\0", NULL, "Konami", "GX064",
6675 	NULL, NULL, NULL, NULL,
6676 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6677 	NULL, SsridersebcRomInfo, SsridersebcRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6678 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6679 	NULL, 0x810, 288, 224, 4, 3
6680 };
6681 
6682 struct BurnDriver BurnDrvSsridersuda = {
6683 	"ssridersuda", "ssriders", NULL, NULL, "1991",
6684 	"Sunset Riders (4 Players ver. UDA)\0", NULL, "Konami", "GX064",
6685 	NULL, NULL, NULL, NULL,
6686 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6687 	NULL, SsridersudaRomInfo, SsridersudaRomName, NULL, NULL, NULL, NULL, Ssriders4psInputInfo, NULL,
6688 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6689 	NULL, 0x810, 288, 224, 4, 3
6690 };
6691 
6692 struct BurnDriver BurnDrvSsriderseaa = {
6693 	"ssriderseaa", "ssriders", NULL, NULL, "1991",
6694 	"Sunset Riders (4 Players ver. EAA)\0", NULL, "Konami", "GX064",
6695 	NULL, NULL, NULL, NULL,
6696 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6697 	NULL, SsriderseaaRomInfo, SsriderseaaRomName, NULL, NULL, NULL, NULL, Ssriders4psInputInfo, NULL,
6698 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6699 	NULL, 0x810, 288, 224, 4, 3
6700 };
6701 
6702 struct BurnDriver BurnDrvSsridersuab = {
6703 	"ssridersuab", "ssriders", NULL, NULL, "1991",
6704 	"Sunset Riders (4 Players ver. UAB)\0", NULL, "Konami", "GX064",
6705 	NULL, NULL, NULL, NULL,
6706 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6707 	NULL, SsridersuabRomInfo, SsridersuabRomName, NULL, NULL, NULL, NULL, Ssriders4pInputInfo, NULL,
6708 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6709 	NULL, 0x810, 288, 224, 4, 3
6710 };
6711 
6712 struct BurnDriver BurnDrvSsridersuac = {
6713 	"ssridersuac", "ssriders", NULL, NULL, "1991",
6714 	"Sunset Riders (4 Players ver. UAC)\0", NULL, "Konami", "GX064",
6715 	NULL, NULL, NULL, NULL,
6716 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6717 	NULL, SsridersuacRomInfo, SsridersuacRomName, NULL, NULL, NULL, NULL, Ssriders4pInputInfo, NULL,
6718 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6719 	NULL, 0x810, 288, 224, 4, 3
6720 };
6721 
6722 struct BurnDriver BurnDrvSsridersubc = {
6723 	"ssridersubc", "ssriders", NULL, NULL, "1991",
6724 	"Sunset Riders (2 Players ver. UBC)\0", NULL, "Konami", "GX064",
6725 	NULL, NULL, NULL, NULL,
6726 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6727 	NULL, SsridersubcRomInfo, SsridersubcRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6728 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6729 	NULL, 0x810, 288, 224, 4, 3
6730 };
6731 
6732 struct BurnDriver BurnDrvSsridersabd = {
6733 	"ssridersabd", "ssriders", NULL, NULL, "1991",
6734 	"Sunset Riders (2 Players ver. ABD)\0", NULL, "Konami", "GX064",
6735 	NULL, NULL, NULL, NULL,
6736 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6737 	NULL, SsridersabdRomInfo, SsridersabdRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6738 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6739 	NULL, 0x810, 288, 224, 4, 3
6740 };
6741 
6742 struct BurnDriver BurnDrvSsridersadd = {
6743 	"ssridersadd", "ssriders", NULL, NULL, "1991",
6744 	"Sunset Riders (4 Players ver. ADD)\0", NULL, "Konami", "GX064",
6745 	NULL, NULL, NULL, NULL,
6746 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6747 	NULL, SsridersaddRomInfo, SsridersaddRomName, NULL, NULL, NULL, NULL, Ssriders4psInputInfo, NULL,
6748 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6749 	NULL, 0x810, 288, 224, 4, 3
6750 };
6751 
6752 struct BurnDriver BurnDrvSsridersjac = {
6753 	"ssridersjac", "ssriders", NULL, NULL, "1991",
6754 	"Sunset Riders (4 Players ver. JAC)\0", NULL, "Konami", "GX064",
6755 	NULL, NULL, NULL, NULL,
6756 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6757 	NULL, SsridersjacRomInfo, SsridersjacRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6758 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6759 	NULL, 0x810, 288, 224, 4, 3
6760 };
6761 
6762 struct BurnDriver BurnDrvSsridersjad = {
6763 	"ssridersjad", "ssriders", NULL, NULL, "1991",
6764 	"Sunset Riders (4 Players ver. JAD)\0", NULL, "Konami", "GX064",
6765 	NULL, NULL, NULL, NULL,
6766 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6767 	NULL, SsridersjadRomInfo, SsridersjadRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6768 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6769 	NULL, 0x810, 288, 224, 4, 3
6770 };
6771 
6772 struct BurnDriver BurnDrvSsridersjbd = {
6773 	"ssridersjbd", "ssriders", NULL, NULL, "1991",
6774 	"Sunset Riders (2 Players ver. JBD)\0", NULL, "Konami", "GX064",
6775 	NULL, NULL, NULL, NULL,
6776 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6777 	NULL, SsridersjbdRomInfo, SsridersjbdRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6778 	SsridersInit, BlswhstlExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6779 	NULL, 0x810, 288, 224, 4, 3
6780 };
6781 
SsridersbInit()6782 static INT32 SsridersbInit()
6783 {
6784 	return 1;
6785 }
6786 
6787 struct BurnDriverD BurnDrvSsridersb = {
6788 	"ssridersb", "ssriders", NULL, NULL, "1991",
6789 	"Sunset Riders (bootleg 4 Players ver. ADD)\0", NULL, "Konami", "GX064",
6790 	NULL, NULL, NULL, NULL,
6791 	BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_KONAMI_68K_Z80, GBF_RUNGUN, 0,
6792 	NULL, ssridersbRomInfo, ssridersbRomName, NULL, NULL, NULL, NULL, Ssriders4psInputInfo, NULL,
6793 	SsridersbInit, CommonExit, SsridersFrame, BlswhstlDraw, SsridersScan,
6794 	NULL, 0x810, 288, 224, 4, 3
6795 };
6796 
6797 struct BurnDriver BurnDrvThndrx2 = {
6798 	"thndrx2", NULL, NULL, NULL, "1991",
6799 	"Thunder Cross II (World)\0", NULL, "Konami", "GX073",
6800 	NULL, NULL, NULL, NULL,
6801 	BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_HORSHOOT, 0,
6802 	NULL, thndrx2RomInfo, thndrx2RomName, NULL, NULL, NULL, NULL, Thndrx2InputInfo, NULL,
6803 	Thndrx2Init, BlswhstlExit, Thndrx2Frame, Thndrx2Draw, Thndrx2aScan,
6804 	NULL, 0x800, 288, 224, 4, 3
6805 };
6806 
6807 struct BurnDriver BurnDrvThndrx2a = {
6808 	"thndrx2a", "thndrx2", NULL, NULL, "1991",
6809 	"Thunder Cross II (Asia)\0", NULL, "Konami", "GX073",
6810 	NULL, NULL, NULL, NULL,
6811 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_HORSHOOT, 0,
6812 	NULL, thndrx2aRomInfo, thndrx2aRomName, NULL, NULL, NULL, NULL, Thndrx2InputInfo, NULL,
6813 	Thndrx2Init, BlswhstlExit, Thndrx2Frame, Thndrx2Draw, Thndrx2aScan,
6814 	NULL, 0x800, 288, 224, 4, 3
6815 };
6816 
6817 struct BurnDriver BurnDrvThndrx2j = {
6818 	"thndrx2j", "thndrx2", NULL, NULL, "1991",
6819 	"Thunder Cross II (Japan)\0", NULL, "Konami", "GX073",
6820 	NULL, NULL, NULL, NULL,
6821 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_HORSHOOT, 0,
6822 	NULL, thndrx2jRomInfo, thndrx2jRomName, NULL, NULL, NULL, NULL, Thndrx2InputInfo, NULL,
6823 	Thndrx2Init, BlswhstlExit, Thndrx2Frame, Thndrx2Draw, Thndrx2aScan,
6824 	NULL, 0x800, 288, 224, 4, 3
6825 };
6826 
6827 struct BurnDriver BurnDrvLgtnfght = {
6828 	"lgtnfght", NULL, NULL, NULL, "1990",
6829 	"Lightning Fighters (World)\0", NULL, "Konami", "GX939",
6830 	NULL, NULL, NULL, NULL,
6831 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0,
6832 	NULL, lgtnfghtRomInfo, lgtnfghtRomName, NULL, NULL, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo,
6833 	LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, BlswhstlDraw, Thndrx2aScan,
6834 	NULL, 0x800, 224, 288, 3, 4
6835 };
6836 
6837 struct BurnDriver BurnDrvLgtnfghtu = {
6838 	"lgtnfghtu", "lgtnfght", NULL, NULL, "1990",
6839 	"Lightning Fighters (US)\0", NULL, "Konami", "GX939",
6840 	NULL, NULL, NULL, NULL,
6841 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0,
6842 	NULL, lgtnfghtuRomInfo, lgtnfghtuRomName, NULL, NULL, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo,
6843 	LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, BlswhstlDraw, Thndrx2aScan,
6844 	NULL, 0x800, 224, 288, 3, 4
6845 };
6846 
6847 struct BurnDriver BurnDrvLgtnfghta = {
6848 	"lgtnfghta", "lgtnfght", NULL, NULL, "1990",
6849 	"Lightning Fighters (Asia)\0", NULL, "Konami", "GX939",
6850 	NULL, NULL, NULL, NULL,
6851 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0,
6852 	NULL, lgtnfghtaRomInfo, lgtnfghtaRomName, NULL, NULL, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo,
6853 	LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, BlswhstlDraw, Thndrx2aScan,
6854 	NULL, 0x800, 224, 288, 3, 4
6855 };
6856 
6857 struct BurnDriver BurnDrvTrigon = {
6858 	"trigon", "lgtnfght", NULL, NULL, "1990",
6859 	"Trigon (Japan)\0", NULL, "Konami", "GX939",
6860 	NULL, NULL, NULL, NULL,
6861 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_KONAMI_68K_Z80, GBF_VERSHOOT, 0,
6862 	NULL, trigonRomInfo, trigonRomName, NULL, NULL, NULL, NULL, LgtnfghtInputInfo, LgtnfghtDIPInfo,
6863 	LgtnfghtInit, BlswhstlExit, LgtnfghtFrame, BlswhstlDraw, Thndrx2aScan,
6864 	NULL, 0x800, 224, 288, 3, 4
6865 };
6866 
6867 struct BurnDriver BurnDrvTmnt2 = {
6868 	"tmnt2", NULL, NULL, NULL, "1991",
6869 	"Teenage Mutant Ninja Turtles - Turtles in Time (4 Players ver. UAA)\0", NULL, "Konami", "GX063",
6870 	NULL, NULL, NULL, NULL,
6871 	BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6872 	NULL, tmnt2RomInfo, tmnt2RomName, NULL, NULL, NULL, NULL, Ssriders4pInputInfo, NULL,
6873 	Tmnt2Init, BlswhstlExit, Tmnt2Frame, BlswhstlDraw, SsridersScan,
6874 	NULL, 0x800, 288, 224, 4, 3
6875 };
6876 
6877 struct BurnDriver BurnDrvTmnt22pu = {
6878 	"tmnt22pu", "tmnt2", NULL, NULL, "1991",
6879 	"Teenage Mutant Ninja Turtles - Turtles in Time (2 Players ver. UDA)\0", NULL, "Konami", "GX063",
6880 	NULL, NULL, NULL, NULL,
6881 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6882 	NULL, tmnt22puRomInfo, tmnt22puRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6883 	Tmnt2Init, BlswhstlExit, Tmnt2Frame, BlswhstlDraw, SsridersScan,
6884 	NULL, 0x800, 288, 224, 4, 3
6885 };
6886 
6887 struct BurnDriver BurnDrvTmht22pe = {
6888 	"tmht22pe", "tmnt2", NULL, NULL, "1991",
6889 	"Teenage Mutant Hero Turtles - Turtles in Time (2 Players ver. EBA)\0", NULL, "Konami", "GX063",
6890 	NULL, NULL, NULL, NULL,
6891 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6892 	NULL, tmht22peRomInfo, tmht22peRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6893 	Tmnt2Init, BlswhstlExit, Tmnt2Frame, BlswhstlDraw, SsridersScan,
6894 	NULL, 0x800, 288, 224, 4, 3
6895 };
6896 
6897 struct BurnDriver BurnDrvTmht24pe = {
6898 	"tmht24pe", "tmnt2", NULL, NULL, "1991",
6899 	"Teenage Mutant Hero Turtles - Turtles in Time (4 Players ver. EAA)\0", NULL, "Konami", "GX063",
6900 	NULL, NULL, NULL, NULL,
6901 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6902 	NULL, tmht24peRomInfo, tmht24peRomName, NULL, NULL, NULL, NULL, SsridersInputInfo, NULL,
6903 	Tmnt2Init, BlswhstlExit, Tmnt2Frame, BlswhstlDraw, SsridersScan,
6904 	NULL, 0x800, 288, 224, 4, 3
6905 };
6906 
6907 struct BurnDriver BurnDrvTmnt2a = {
6908 	"tmnt2a", "tmnt2", NULL, NULL, "1991",
6909 	"Teenage Mutant Ninja Turtles - Turtles in Time (4 Players ver. ADA)\0", NULL, "Konami", "GX063",
6910 	NULL, NULL, NULL, NULL,
6911 	BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_KONAMI_68K_Z80, GBF_SCRFIGHT, 0,
6912 	NULL, tmnt2aRomInfo, tmnt2aRomName, NULL, NULL, NULL, NULL, Ssriders4psInputInfo, NULL,
6913 	Tmnt2Init, BlswhstlExit, Tmnt2Frame, BlswhstlDraw, SsridersScan,
6914 	NULL, 0x800, 288, 224, 4, 3
6915 };
6916 
6917 struct BurnDriver BurnDrvQgakumon = {
6918 	"qgakumon", NULL, NULL, NULL, "1993",
6919 	"Quiz Gakumon no Susume (Japan ver. JA2 Type L)\0", NULL, "Konami", "GX248",
6920 	L"\u30AF\u30A4\u30BA \u5B66\u554F\u30CE\u30B9\u30B9\u30E1 Gakumon no Susume (Japan ver. JA2 Type L)\0", NULL, NULL, NULL,
6921 	BDF_GAME_WORKING, 2, HARDWARE_KONAMI_68K_Z80, GBF_QUIZ, 0,
6922 	NULL, qgakumonRomInfo, qgakumonRomName, NULL, NULL, NULL, NULL, QgakumonInputInfo, NULL,
6923 	QgakumonInit, BlswhstlExit, Tmnt2Frame, BlswhstlDraw, SsridersScan,
6924 	NULL, 0x800, 304, 224, 4, 3
6925 };
6926 
6927 struct BurnDriver BurnDrvPunkshot = {
6928 	"punkshot", NULL, NULL, NULL, "1990",
6929 	"Punk Shot (US 4 Players)\0", NULL, "Konami", "GX907",
6930 	NULL, NULL, NULL, NULL,
6931 	BDF_GAME_WORKING, 4, HARDWARE_KONAMI_68K_Z80, GBF_SPORTSMISC, 0,
6932 	NULL, punkshotRomInfo, punkshotRomName, NULL, NULL, NULL, NULL, PunkshotInputInfo, PunkshotDIPInfo,
6933 	PunkshotInit, PunkshotExit, PunkshotFrame, PunkshotDraw, Thndrx2aScan,
6934 	NULL, 0x800, 288, 224, 4, 3
6935 };
6936 
6937 struct BurnDriver BurnDrvPunkshot2 = {
6938 	"punkshot2", "punkshot", NULL, NULL, "1990",
6939 	"Punk Shot (US 2 Players)\0", NULL, "Konami", "GX907",
6940 	NULL, NULL, NULL, NULL,
6941 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SPORTSMISC, 0,
6942 	NULL, punkshot2RomInfo, punkshot2RomName, NULL, NULL, NULL, NULL, Punkshot2InputInfo, Punkshot2DIPInfo,
6943 	PunkshotInit, PunkshotExit, PunkshotFrame, PunkshotDraw, Thndrx2aScan,
6944 	NULL, 0x800, 288, 224, 4, 3
6945 };
6946 
6947 struct BurnDriver BurnDrvPunkshotj = {
6948 	"punkshotj", "punkshot", NULL, NULL, "1990",
6949 	"Punk Shot (Japan 2 Players)\0", NULL, "Konami", "GX907",
6950 	NULL, NULL, NULL, NULL,
6951 	BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KONAMI_68K_Z80, GBF_SPORTSMISC, 0,
6952 	NULL, punkshotjRomInfo, punkshotjRomName, NULL, NULL, NULL, NULL, Punkshot2InputInfo, PunkshotjDIPInfo,
6953 	PunkshotInit, PunkshotExit, PunkshotFrame, PunkshotDraw, Thndrx2aScan,
6954 	NULL, 0x800, 288, 224, 4, 3
6955 };
6956