1 // FB Alpha Tecmo driver Module
2 // Based on MAME driver by Nicola Salmoria
3 
4 #include "tiles_generic.h"
5 #include "z80_intf.h"
6 #include "burn_ym3812.h"
7 #include "msm5205.h"
8 
9 static UINT8 DrvJoy1[8];
10 static UINT8 DrvJoy2[8];
11 static UINT8 DrvJoy3[8];
12 static UINT8 DrvJoy4[8];
13 static UINT8 DrvJoy5[8];
14 static UINT8 DrvJoy6[8];
15 static UINT8 DrvJoy11[8];
16 static UINT8 DrvReset;
17 static UINT8 DrvInputs[11];
18 
19 static UINT8 *AllMem;
20 static UINT8 *MemEnd;
21 static UINT8 *AllRam;
22 static UINT8 *RamEnd;
23 static UINT8 *DrvZ80ROM0;
24 static UINT8 *DrvZ80ROM1;
25 static UINT8 *DrvGfxROM0;
26 static UINT8 *DrvGfxROM1;
27 static UINT8 *DrvGfxROM2;
28 static UINT8 *DrvGfxROM3;
29 static UINT8 *DrvSndROM;
30 static UINT8 *DrvZ80RAM0;
31 static UINT8 *DrvZ80RAM1;
32 static UINT8 *DrvPalRAM;
33 static UINT8 *DrvTextRAM;
34 static UINT8 *DrvSprRAM;
35 static UINT8 *DrvForeRAM;
36 static UINT8 *DrvBackRAM;
37 
38 static UINT32 *DrvPalette;
39 static UINT8 DrvRecalc;
40 
41 static UINT16 *DrvBgScroll;
42 static UINT16 *DrvFgScroll;
43 
44 static INT32 tecmo_video_type;
45 
46 static UINT32 adpcm_pos;
47 static UINT32 adpcm_end;
48 static UINT32 adpcm_size;
49 static INT32 adpcm_data;
50 static UINT8 DrvHasADPCM;
51 
52 static UINT32 DrvZ80Bank;
53 static UINT8 soundlatch;
54 static UINT8 flipscreen;
55 static UINT8 DrvEnableNmi;
56 
57 static struct BurnInputInfo RygarInputList[] = {
58 	{"P1 Coin"       , BIT_DIGITAL , DrvJoy5 + 3,	"p1 coin"  },
59 	{"P1 Start"  ,    BIT_DIGITAL  , DrvJoy5 + 1,	"p1 start" },
60 	{"P1 Left"      , BIT_DIGITAL  , DrvJoy1 + 0, 	"p1 left"  },
61 	{"P1 Right"     , BIT_DIGITAL  , DrvJoy1 + 1, 	"p1 right" },
62 	{"P1 Down",	  BIT_DIGITAL  , DrvJoy1 + 2,   "p1 down", },
63 	{"P1 Up",	  BIT_DIGITAL  , DrvJoy1 + 3,   "p1 up",   },
64 	{"P1 Button 1"  , BIT_DIGITAL  , DrvJoy2 + 0,	"p1 fire 1"},
65 	{"P1 Button 2"  , BIT_DIGITAL  , DrvJoy2 + 1,	"p1 fire 2"},
66 
67 	{"P2 Coin"       , BIT_DIGITAL , DrvJoy5 + 2,	"p2 coin"  },
68 	{"P2 Start"  ,    BIT_DIGITAL  , DrvJoy5 + 0,	"p2 start" },
69 	{"P2 Left"      , BIT_DIGITAL  , DrvJoy3 + 0, 	"p2 left"  },
70 	{"P2 Right"     , BIT_DIGITAL  , DrvJoy3 + 1, 	"p2 right" },
71 	{"P2 Down",	  BIT_DIGITAL,   DrvJoy3 + 2,   "p2 down", },
72 	{"P2 Up",	  BIT_DIGITAL,   DrvJoy3 + 3,   "p2 up",   },
73 	{"P2 Button 1"  , BIT_DIGITAL  , DrvJoy4 + 0,	"p2 fire 1"},
74 	{"P2 Button 2"  , BIT_DIGITAL  , DrvJoy4 + 1,	"p2 fire 2"},
75 
76 	{"Service",	  BIT_DIGITAL  , DrvJoy2 + 2,   "diag"     },
77 
78 	{"Reset",	  BIT_DIGITAL  , &DrvReset,	"reset"    },
79 	{"Dip 1",	  BIT_DIPSWITCH, DrvInputs + 6,	"dip"	   },
80 	{"Dip 2",	  BIT_DIPSWITCH, DrvInputs + 7,	"dip"	   },
81 	{"Dip 3",	  BIT_DIPSWITCH, DrvInputs + 8,	"dip"	   },
82 	{"Dip 4",	  BIT_DIPSWITCH, DrvInputs + 9,	"dip"	   },
83 };
84 
85 STDINPUTINFO(Rygar)
86 
87 static struct BurnInputInfo BackfirtInputList[] = {
88 	{"P1 Coin"       , BIT_DIGITAL , DrvJoy6 + 2,	"p1 coin"  },
89 	{"P1 Start"  ,    BIT_DIGITAL  , DrvJoy6 + 1,	"p1 start" },
90 	{"P1 Left"      , BIT_DIGITAL  , DrvJoy1 + 0, 	"p1 left"  },
91 	{"P1 Right"     , BIT_DIGITAL  , DrvJoy1 + 1, 	"p1 right" },
92 	{"P1 Down",	  BIT_DIGITAL  , DrvJoy1 + 2,   "p1 down", },
93 	{"P1 Up",	  BIT_DIGITAL  , DrvJoy1 + 3,   "p1 up",   },
94 	{"P1 Button 1"  , BIT_DIGITAL  , DrvJoy2 + 0,	"p1 fire 1"},
95 	{"P1 Button 2"  , BIT_DIGITAL  , DrvJoy2 + 1,	"p1 fire 2"},
96 	{"P1 Button 3"  , BIT_DIGITAL  , DrvJoy2 + 2,	"p1 fire 3"},
97 
98 	{"P2 Coin"       , BIT_DIGITAL , DrvJoy6 + 3,	"p2 coin"  },
99 	{"P2 Start"  ,    BIT_DIGITAL  , DrvJoy6 + 0,	"p2 start" },
100 	{"P2 Left"      , BIT_DIGITAL  , DrvJoy3 + 1, 	"p2 left"  },
101 	{"P2 Right"     , BIT_DIGITAL  , DrvJoy3 + 0, 	"p2 right" },
102 	{"P2 Down",	  BIT_DIGITAL,   DrvJoy3 + 2,   "p2 down", },
103 	{"P2 Up",	  BIT_DIGITAL,   DrvJoy3 + 3,   "p2 up",   },
104 	{"P2 Button 1"  , BIT_DIGITAL  , DrvJoy4 + 0,	"p2 fire 1"},
105 	{"P2 Button 2"  , BIT_DIGITAL  , DrvJoy4 + 1,	"p2 fire 2"},
106 	{"P2 Button 3"  , BIT_DIGITAL  , DrvJoy4 + 2,	"p2 fire 3"},
107 
108 	{"Reset",	  BIT_DIGITAL  , &DrvReset,	"reset"    },
109 	{"Dip 1",	  BIT_DIPSWITCH, DrvInputs + 6,	"dip"	   },
110 	{"Dip 2",	  BIT_DIPSWITCH, DrvInputs + 7,	"dip"	   },
111 	{"Dip 3",	  BIT_DIPSWITCH, DrvInputs + 8,	"dip"	   },
112 	{"Dip 4",	  BIT_DIPSWITCH, DrvInputs + 9,	"dip"	   },
113 };
114 
115 STDINPUTINFO(Backfirt)
116 
117 static struct BurnInputInfo GeminiInputList[] = {
118 	{"P1 Coin"       , BIT_DIGITAL , DrvJoy6 + 2,	"p1 coin"  },
119 	{"P1 Start"  ,    BIT_DIGITAL  , DrvJoy6 + 0,	"p1 start" },
120 	{"P1 Left"      , BIT_DIGITAL  , DrvJoy1 + 0, 	"p1 left"  },
121 	{"P1 Right"     , BIT_DIGITAL  , DrvJoy1 + 1, 	"p1 right" },
122 	{"P1 Down",	  BIT_DIGITAL  , DrvJoy1 + 2,   "p1 down", },
123 	{"P1 Up",	  BIT_DIGITAL  , DrvJoy1 + 3,   "p1 up",   },
124 	{"P1 Button 1"  , BIT_DIGITAL  , DrvJoy2 + 1,	"p1 fire 1"},
125 	{"P1 Button 2"  , BIT_DIGITAL  , DrvJoy2 + 0,	"p1 fire 2"},
126 
127 	{"P2 Coin"       , BIT_DIGITAL , DrvJoy6 + 3,	"p2 coin"  },
128 	{"P2 Start"  ,    BIT_DIGITAL  , DrvJoy6 + 1,	"p2 start" },
129 	{"P2 Left"      , BIT_DIGITAL  , DrvJoy3 + 0, 	"p2 left"  },
130 	{"P2 Right"     , BIT_DIGITAL  , DrvJoy3 + 1, 	"p2 right" },
131 	{"P2 Down",	  BIT_DIGITAL,   DrvJoy3 + 2,   "p2 down", },
132 	{"P2 Up",	  BIT_DIGITAL,   DrvJoy3 + 3,   "p2 up",   },
133 	{"P2 Button 1"  , BIT_DIGITAL  , DrvJoy4 + 1,	"p2 fire 1"},
134 	{"P2 Button 2"  , BIT_DIGITAL  , DrvJoy4 + 0,	"p2 fire 2"},
135 
136 	{"Reset",	  BIT_DIGITAL  , &DrvReset,	"reset"    },
137 	{"Dip 1",	  BIT_DIPSWITCH, DrvInputs + 6,	"dip"	   },
138 	{"Dip 2",	  BIT_DIPSWITCH, DrvInputs + 7,	"dip"	   },
139 	{"Dip 3",	  BIT_DIPSWITCH, DrvInputs + 8,	"dip"	   },
140 	{"Dip 4",	  BIT_DIPSWITCH, DrvInputs + 9,	"dip"	   },
141 };
142 
143 STDINPUTINFO(Gemini)
144 
145 static struct BurnInputInfo SilkwormInputList[] = {
146 	{"P1 Coin"       , BIT_DIGITAL , DrvJoy11 + 2,	"p1 coin"  },
147 	{"P1 Start"  ,    BIT_DIGITAL  , DrvJoy11 + 0,	"p1 start" },
148 	{"P1 Left"      , BIT_DIGITAL  , DrvJoy1 + 0, 	"p1 left"  },
149 	{"P1 Right"     , BIT_DIGITAL  , DrvJoy1 + 1, 	"p1 right" },
150 	{"P1 Down",	  BIT_DIGITAL  , DrvJoy1 + 2,   "p1 down", },
151 	{"P1 Up",	  BIT_DIGITAL  , DrvJoy1 + 3,   "p1 up",   },
152 	{"P1 Button 1"  , BIT_DIGITAL  , DrvJoy2 + 1,	"p1 fire 1"},
153 	{"P1 Button 2"  , BIT_DIGITAL  , DrvJoy2 + 0,	"p1 fire 2"},
154 	{"P1 Button 3"  , BIT_DIGITAL  , DrvJoy2 + 2,	"p1 fire 3"},
155 
156 	{"P2 Coin"       , BIT_DIGITAL , DrvJoy11 + 3,	"p2 coin"  },
157 	{"P2 Start"  ,    BIT_DIGITAL  , DrvJoy11 + 1,	"p2 start" },
158 	{"P2 Left"      , BIT_DIGITAL  , DrvJoy3 + 0, 	"p2 left"  },
159 	{"P2 Right"     , BIT_DIGITAL  , DrvJoy3 + 1, 	"p2 right" },
160 	{"P2 Down",	  BIT_DIGITAL,   DrvJoy3 + 2,   "p2 down", },
161 	{"P2 Up",	  BIT_DIGITAL,   DrvJoy3 + 3,   "p2 up",   },
162 	{"P2 Button 1"  , BIT_DIGITAL  , DrvJoy4 + 1,	"p2 fire 1"},
163 	{"P2 Button 2"  , BIT_DIGITAL  , DrvJoy4 + 0,	"p2 fire 2"},
164 	{"P2 Button 3"  , BIT_DIGITAL  , DrvJoy4 + 2,	"p2 fire 3"},
165 
166 	{"Reset",	  BIT_DIGITAL  , &DrvReset,	"reset"    },
167 	{"Dip 1",	  BIT_DIPSWITCH, DrvInputs + 6,	"dip"	   },
168 	{"Dip 2",	  BIT_DIPSWITCH, DrvInputs + 7,	"dip"	   },
169 	{"Dip 3",	  BIT_DIPSWITCH, DrvInputs + 8,	"dip"	   },
170 	{"Dip 4",	  BIT_DIPSWITCH, DrvInputs + 9,	"dip"	   },
171 
172 };
173 
174 STDINPUTINFO(Silkworm)
175 
176 static struct BurnDIPInfo RygarDIPList[]=
177 {
178 	{0x12, 0xff, 0xff, 0x00, NULL },
179 	{0x13, 0xff, 0xff, 0x00, NULL },
180 	{0x14, 0xff, 0xff, 0x00, NULL },
181 	{0x15, 0xff, 0xff, 0x00, NULL },
182 
183 	{0x12, 0xfe, 0,       4, "Coin A" },
184 	{0x12, 0x01, 0x03, 0x01, "2C 1C" },
185 	{0x12, 0x01, 0x03, 0x00, "1C 1C" },
186 	{0x12, 0x01, 0x03, 0x02, "1C 2C" },
187 	{0x12, 0x01, 0x03, 0x03, "1C 3C" },
188 
189 	{0x12, 0xfe, 0,       4, "Coin B" },
190 	{0x12, 0x01, 0x0C, 0x04, "2C 1C" },
191 	{0x12, 0x01, 0x0C, 0x00, "1C 1C" },
192 	{0x12, 0x01, 0x0C, 0x08, "1C 2C" },
193 	{0x12, 0x01, 0x0C, 0x0C, "1C 3C" },
194 
195 	{0x13, 0xfe, 0,       4, "Lives" },
196 	{0x13, 0x01, 0x03, 0x03, "2" },
197 	{0x13, 0x01, 0x03, 0x00, "3" },
198 	{0x13, 0x01, 0x03, 0x01, "4" },
199 	{0x13, 0x01, 0x03, 0x02, "5" },
200 
201 	{0x13, 0xfe, 0,       2, "Cabinet" },
202 	{0x13, 0x01, 0x04, 0x04, "Upright" },
203 	{0x13, 0x01, 0x04, 0x00, "Cocktail" },
204 
205 	{0x14, 0xfe, 0,       4, "Bonus Life" },
206 	{0x14, 0x01, 0x03, 0x00, "50000 200000 500000" },
207 	{0x14, 0x01, 0x03, 0x01, "100000 300000 600000" },
208 	{0x14, 0x01, 0x03, 0x02, "200000 500000" },
209 	{0x14, 0x01, 0x03, 0x03, "100000" },
210 
211 	{0x15, 0xfe, 0,       4, "Difficulty" },
212 	{0x15, 0x01, 0x03, 0x00, "Easy" },
213 	{0x15, 0x01, 0x03, 0x01, "Normal" },
214 	{0x15, 0x01, 0x03, 0x02, "Hard" },
215 	{0x15, 0x01, 0x03, 0x03, "Hardest" },
216 
217 	{0x15, 0xfe, 0,       2, "2P Can Start Anytime" },
218 	{0x15, 0x01, 0x04, 0x00, "No" },
219 	{0x15, 0x01, 0x04, 0x04, "Yes" },
220 
221 	{0x15, 0xfe, 0,       2, "Allow Continue" },
222 	{0x15, 0x01, 0x08, 0x00, "No" },
223 	{0x15, 0x01, 0x08, 0x08, "Yes" },
224 };
225 
226 STDDIPINFO(Rygar)
227 
228 static struct BurnDIPInfo GeminiDIPList[]=
229 {
230 	{0x11, 0xff, 0xff, 0x00, NULL },
231 	{0x12, 0xff, 0xff, 0x00, NULL },
232 	{0x13, 0xff, 0xff, 0x00, NULL },
233 	{0x14, 0xff, 0xff, 0x00, NULL },
234 
235 	{0x11, 0xfe, 0,       8, "Coin A" },
236 	{0x11, 0x01, 0x07, 0x06, "2C 1C" },
237 	{0x11, 0x01, 0x07, 0x00, "1C 1C" },
238 	{0x11, 0x01, 0x07, 0x07, "2C 3C" },
239 	{0x11, 0x01, 0x07, 0x01, "1C 2C" },
240 	{0x11, 0x01, 0x07, 0x02, "1C 3C" },
241 	{0x11, 0x01, 0x07, 0x03, "1C 4C" },
242 	{0x11, 0x01, 0x07, 0x04, "1C 5C" },
243 	{0x11, 0x01, 0x07, 0x05, "1C 6C" },
244 
245 	{0x11, 0xfe, 0,       2, "Final Round Continuation" },
246 	{0x11, 0x01, 0x08, 0x00, "Round 6" },
247 	{0x11, 0x01, 0x08, 0x08, "Round 7" },
248 
249 	{0x12, 0xfe, 0,       8, "Coin B" },
250 	{0x12, 0x01, 0x07, 0x06, "2C 1C" },
251 	{0x12, 0x01, 0x07, 0x00, "1C 1C" },
252 	{0x12, 0x01, 0x07, 0x07, "2C 3C" },
253 	{0x12, 0x01, 0x07, 0x01, "1C 2C" },
254 	{0x12, 0x01, 0x07, 0x02, "1C 3C" },
255 	{0x12, 0x01, 0x07, 0x03, "1C 4C" },
256 	{0x12, 0x01, 0x07, 0x04, "1C 5C" },
257 	{0x12, 0x01, 0x07, 0x05, "1C 6C" },
258 
259 	{0x12, 0xfe, 0,       2, "Buy in During Final Round" },
260 	{0x12, 0x01, 0x08, 0x00, "No" },
261 	{0x12, 0x01, 0x08, 0x08, "Yes" },
262 
263 	{0x13, 0xfe, 0,       4, "Lives" },
264 	{0x13, 0x01, 0x03, 0x03, "2" },
265 	{0x13, 0x01, 0x03, 0x00, "3" },
266 	{0x13, 0x01, 0x03, 0x01, "4" },
267 	{0x13, 0x01, 0x03, 0x02, "5" },
268 
269 	{0x13, 0xfe, 0,       4, "Difficulty" },
270 	{0x13, 0x01, 0x0c, 0x00, "Easy" },
271 	{0x13, 0x01, 0x0c, 0x04, "Normal" },
272 	{0x13, 0x01, 0x0c, 0x08, "Hard" },
273 	{0x13, 0x01, 0x0c, 0x0c, "Hardest" },
274 
275 	{0x14, 0xfe, 0,       8, "Bonus Life" },
276 	{0x14, 0x01, 0x07, 0x00, "50000 200000" },
277 	{0x14, 0x01, 0x07, 0x01, "50000 300000" },
278 	{0x14, 0x01, 0x07, 0x02, "100000 500000" },
279 	{0x14, 0x01, 0x07, 0x03, "50000" },
280 	{0x14, 0x01, 0x07, 0x04, "100000" },
281 	{0x14, 0x01, 0x07, 0x05, "200000" },
282 	{0x14, 0x01, 0x07, 0x06, "300000" },
283 	{0x14, 0x01, 0x07, 0x07, "None" },
284 
285 	{0x14, 0xfe, 0,       2, "Demo Sounds" },
286 	{0x14, 0x01, 0x08, 0x08, "Off" },
287 	{0x14, 0x01, 0x08, 0x00, "On" },
288 };
289 
290 STDDIPINFO(Gemini)
291 
292 static struct BurnDIPInfo SilkwormDIPList[]=
293 {
294 	{0x13, 0xff, 0xff, 0x00, NULL },
295 	{0x14, 0xff, 0xff, 0x00, NULL },
296 	{0x15, 0xff, 0xff, 0x00, NULL },
297 	{0x16, 0xff, 0xff, 0x00, NULL },
298 
299 	{0x13, 0xfe, 0,      4, "Coin A" },
300 	{0x13, 0x01, 0x3, 0x01, "2C 1C" },
301 	{0x13, 0x01, 0x3, 0x00, "1C 1C" },
302 	{0x13, 0x01, 0x3, 0x02, "1C 2C" },
303 	{0x13, 0x01, 0x3, 0x03, "1C 3C" },
304 
305 	{0x13, 0xfe, 0,      4, "Coin B" },
306 	{0x13, 0x01, 0xC, 0x04, "2C 1C" },
307 	{0x13, 0x01, 0xC, 0x00, "1C 1C" },
308 	{0x13, 0x01, 0xC, 0x08, "1C 2C" },
309 	{0x13, 0x01, 0xC, 0x0C, "1C 3C" },
310 
311 	{0x14, 0xfe, 0,      4 , "Lives" },
312 	{0x14, 0x01, 0x3, 0x03, "2" },
313 	{0x14, 0x01, 0x3, 0x00, "3" },
314 	{0x14, 0x01, 0x3, 0x01, "4" },
315 	{0x14, 0x01, 0x3, 0x02, "5" },
316 
317 	{0x14, 0xfe, 0,      2 , "Demo Sounds" },
318 	{0x14, 0x01, 0x8, 0x00, "Off" },
319 	{0x14, 0x01, 0x8, 0x08, "On" },
320 
321 	{0x15, 0xfe, 0,      8, "Bonus Life" },
322 	{0x15, 0x01, 0x7, 0x00, "50000 200000 500000" },
323 	{0x15, 0x01, 0x7, 0x01, "100000 300000 800000" },
324 	{0x15, 0x01, 0x7, 0x02, "50000 200000" },
325 	{0x15, 0x01, 0x7, 0x03, "100000 300000" },
326 	{0x15, 0x01, 0x7, 0x04, "50000" },
327 	{0x15, 0x01, 0x7, 0x05, "100000" },
328 	{0x15, 0x01, 0x7, 0x06, "200000" },
329 	{0x15, 0x01, 0x7, 0x07, "None" },
330 
331 	{0x16, 0xfe, 0,      6, "Difficulty" },
332 	{0x16, 0x01, 0x7, 0x00, "0" },
333 	{0x16, 0x01, 0x7, 0x01, "1" },
334 	{0x16, 0x01, 0x7, 0x02, "2" },
335 	{0x16, 0x01, 0x7, 0x03, "3" },
336 	{0x16, 0x01, 0x7, 0x04, "4" },
337 	{0x16, 0x01, 0x7, 0x05, "5" },
338 
339 	{0x16, 0xfe, 0,      2, "Allow Continue" },
340 	{0x16, 0x01, 0x8, 0x08, "No" },
341 	{0x16, 0x01, 0x8, 0x00, "Yes" },
342 };
343 
344 STDDIPINFO(Silkworm)
345 
346 static struct BurnDIPInfo BackfirtDIPList[]=
347 {
348 	{0x13, 0xff, 0xff, 0x00, NULL },
349 	{0x14, 0xff, 0xff, 0x00, NULL },
350 	{0x15, 0xff, 0xff, 0x00, NULL },
351 	{0x16, 0xff, 0xff, 0x00, NULL },
352 
353 	{0x13, 0xfe, 0,      4, "Coin A" },
354 	{0x13, 0x01, 0x3, 0x00, "1C 1C" },
355 	{0x13, 0x01, 0x3, 0x01, "1C 2C" },
356 	{0x13, 0x01, 0x3, 0x02, "1C 3C" },
357 	{0x13, 0x01, 0x3, 0x03, "1C 6C" },
358 
359 	{0x13, 0xfe, 0,      4, "Coin B" },
360 	{0x13, 0x01, 0xC, 0x04, "2C 1C" },
361 	{0x13, 0x01, 0xC, 0x00, "1C 1C" },
362 	{0x13, 0x01, 0xC, 0x08, "1C 2C" },
363 	{0x13, 0x01, 0xC, 0x0C, "1C 3C" },
364 
365 	{0x15, 0xfe, 0,      8, "Bonus Life" },
366 	{0x15, 0x01, 0x07, 0x00, "50000  200000 500000" },
367 	{0x15, 0x01, 0x07, 0x01, "100000 300000 800000" },
368 	{0x15, 0x01, 0x07, 0x02, "50000  200000" },
369 	{0x15, 0x01, 0x07, 0x03, "100000 300000" },
370 	{0x15, 0x01, 0x07, 0x04, "50000" },
371 	{0x15, 0x01, 0x07, 0x05, "100000" },
372 	{0x15, 0x01, 0x07, 0x06, "200000" },
373 	{0x15, 0x01, 0x07, 0x07, "None" },
374 
375 	{0x15, 0xfe, 0,       8, "Difficulty" },
376 	{0x15, 0x01, 0x38, 0x00, "0" },
377 	{0x15, 0x01, 0x38, 0x08, "1" },
378 	{0x15, 0x01, 0x38, 0x10, "2" },
379 	{0x15, 0x01, 0x38, 0x18, "3" },
380 	{0x15, 0x01, 0x38, 0x20, "4" },
381 	{0x15, 0x01, 0x38, 0x28, "5" },
382 	{0x15, 0x01, 0x38, 0x30, "6" },
383 	{0x15, 0x01, 0x38, 0x38, "7" },
384 
385 	{0x16, 0xfe, 0,      2, "Allow Continue" },
386 	{0x16, 0x01, 0x04, 0x04, "No" },
387 	{0x16, 0x01, 0x04, 0x00, "Yes" },
388 
389 	{0x16, 0xfe, 0,      2, "Invincibility (Cheat)" },
390 	{0x16, 0x01, 0x08, 0x08, "No" },
391 	{0x16, 0x01, 0x08, 0x00, "Yes" },
392 };
393 
STDDIPINFO(Backfirt)394 STDDIPINFO(Backfirt)
395 
396 static UINT8 __fastcall rygar_main_read(UINT16 address)
397 {
398 	switch (address)
399 	{
400 		case 0xf800:
401 		case 0xf801:
402 		case 0xf802:
403 		case 0xf803:
404 		case 0xf804:
405 		case 0xf805:
406 		case 0xf806:
407 		case 0xf807:
408 		case 0xf808:
409 		case 0xf809:
410 			return DrvInputs[address & 0x0f];
411 
412 		case 0xf80f:
413 			return DrvInputs[10];
414 	}
415 
416 	return 0;
417 }
418 
bank_switch(INT32 data)419 static void bank_switch(INT32 data)
420 {
421 	DrvZ80Bank = data;
422 
423 	INT32 bank = 0x10000 + ((data & 0xf8) << 8);
424 
425 	ZetMapMemory(DrvZ80ROM0 + bank, 0xf000, 0xf7ff, MAP_ROM);
426 }
427 
palette_write(INT32 offset)428 static inline void palette_write(INT32 offset)
429 {
430 	UINT16 data;
431 	UINT8 r,g,b;
432 
433 	data = *((UINT16*)(DrvPalRAM + (offset & ~1)));
434 
435 #ifdef LSB_FIRST
436 	data = (data << 8) | (data >> 8);
437 #endif
438 
439 	r = (data >> 4) & 0x0f;
440 	g = (data >> 0) & 0x0f;
441 	b = (data >> 8) & 0x0f;
442 
443 	r |= r << 4;
444 	g |= g << 4;
445 	b |= b << 4;
446 
447 	DrvPalette[offset >> 1] = BurnHighCol(r, g, b, 0);
448 }
449 
rygar_main_write(UINT16 address,UINT8 data)450 static void __fastcall rygar_main_write(UINT16 address, UINT8 data)
451 {
452 	if ((address & 0xf000) == 0xe000) {
453 		DrvPalRAM[address & 0x7ff] = data;
454 		palette_write(address & 0x7ff);
455 		return;
456 	}
457 
458 	switch (address)
459 	{
460 		case 0xf800:
461 			DrvFgScroll[0] = (DrvFgScroll[0] & 0xff00) | data;
462 		return;
463 
464 		case 0xf801:
465 			DrvFgScroll[0] = (DrvFgScroll[0] & 0x00ff) | (data << 8);
466 		return;
467 
468 		case 0xf802:
469 			DrvFgScroll[1] = data;
470 		return;
471 
472 		case 0xf803:
473 			DrvBgScroll[0] = (DrvBgScroll[0] & 0xff00) | data;
474 		return;
475 
476 		case 0xf804:
477 			DrvBgScroll[0] = (DrvBgScroll[0] & 0x00ff) | (data << 8);
478 		return;
479 
480 		case 0xf805:
481 			DrvBgScroll[1] = data;
482 		return;
483 
484 		case 0xf806:
485 			soundlatch = data;
486 			DrvEnableNmi = 1;
487 		return;
488 
489 		case 0xf807:
490 			flipscreen = data & 1;
491 		return;
492 
493 		case 0xf808:
494 			bank_switch(data);
495 		return;
496 
497 		case 0xf80b:
498 			// watchdog reset
499 		return;
500 	}
501 
502 	return;
503 }
504 
rygar_sound_read(UINT16 address)505 static UINT8 __fastcall rygar_sound_read(UINT16 address)
506 {
507 	switch (address)
508 	{
509 		case 0xc000:
510 			return soundlatch;
511 	}
512 
513 	return 0;
514 }
515 
rygar_sound_write(UINT16 address,UINT8 data)516 static void __fastcall rygar_sound_write(UINT16 address, UINT8 data)
517 {
518 	if ((address & 0xff80) == 0x2000) {
519 		// 2000 - 207f ram / self-modifying code area
520 		DrvZ80ROM1[address] = data;
521 		return;
522 	}
523 
524 	switch (address)
525 	{
526 		case 0x8000:
527 		case 0xa000:
528 			BurnYM3812Write(0, 0, data);
529 		return;
530 
531 		case 0x8001:
532 		case 0xa001:
533 			BurnYM3812Write(0, 1, data);
534 		return;
535 
536 		case 0xc000:
537 			if (DrvHasADPCM) {
538 				adpcm_pos = data << 8;
539 				MSM5205ResetWrite(0, 0);
540 			}
541 		return;
542 
543 		case 0xc400:
544 		case 0xd000:
545 			adpcm_end = (data + 1) << 8;
546 		return;
547 
548 		case 0xc800:
549 		case 0xe000:
550 			if (DrvHasADPCM) {
551 				MSM5205SetRoute(0, (double)(data & 0x0f) / 0x2f, BURN_SND_ROUTE_BOTH);
552 			}
553 		return;
554 
555 		case 0xf000:
556 		return;
557 	}
558 
559 	return;
560 }
561 
MemIndex()562 static INT32 MemIndex()
563 {
564 	UINT8 *Next; Next = AllMem;
565 
566 	DrvZ80ROM0	= Next; Next += 0x20000;
567 	DrvZ80ROM1	= Next; Next += 0x08000;
568 
569 	DrvSndROM	= Next; Next += adpcm_size;
570 
571 	DrvGfxROM0	= Next; Next += 0x10000;
572 	DrvGfxROM1	= Next; Next += 0x80000;
573 	DrvGfxROM2	= Next; Next += 0x80000;
574 	DrvGfxROM3	= Next; Next += 0x80000;
575 
576 	AllRam		= Next;
577 
578 	DrvZ80RAM0	= Next; Next += 0x01000;
579 	DrvZ80RAM1	= Next; Next += 0x00800;
580 
581 	DrvPalRAM	= Next; Next += 0x00800;
582 	DrvTextRAM	= Next; Next += 0x00800;
583 	DrvBackRAM	= Next; Next += 0x00400;
584 	DrvForeRAM	= Next; Next += 0x00400;
585 	DrvSprRAM	= Next; Next += 0x00800;
586 
587 	DrvBgScroll	= (UINT16*)Next; Next += 0x00002 * sizeof(UINT16);
588 	DrvFgScroll	= (UINT16*)Next; Next += 0x00002 * sizeof(UINT16);
589 
590 	DrvPalette	= (UINT32*)Next; Next += 0x00400 * sizeof(UINT32);
591 
592 	RamEnd		= Next;
593 	MemEnd		= Next;
594 
595 	return 0;
596 }
597 
DrvGfxDecode()598 static INT32 DrvGfxDecode()
599 {
600 	UINT8 *tmp = (UINT8*)BurnMalloc(0x40000);
601 	if (tmp == NULL) {
602 		return 1;
603 	}
604 
605 	static INT32 Planes[4] = {
606 		0x000, 0x001, 0x002, 0x003
607 	};
608 
609 	static INT32 XOffs[16] = {
610 		0x000, 0x004, 0x008, 0x00c, 0x010, 0x014, 0x018, 0x01c,
611 		0x100, 0x104, 0x108, 0x10c, 0x110, 0x114, 0x118, 0x11c
612 	};
613 
614 	static INT32 YOffs[16] = {
615 		0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0,
616 		0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0
617 	};
618 
619 	memcpy (tmp, DrvGfxROM0, 0x08000);
620 
621 	GfxDecode(0x0400, 4,  8,  8, Planes, XOffs, YOffs, 0x100, tmp, DrvGfxROM0);
622 
623 	memcpy (tmp, DrvGfxROM1, 0x40000);
624 
625 	GfxDecode(0x2000, 4,  8,  8, Planes, XOffs, YOffs, 0x100, tmp, DrvGfxROM1);
626 
627 	memcpy (tmp, DrvGfxROM2, 0x40000);
628 
629 	GfxDecode(0x0800, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM2);
630 
631 	memcpy (tmp, DrvGfxROM3, 0x40000);
632 
633 	GfxDecode(0x0800, 4, 16, 16, Planes, XOffs, YOffs, 0x400, tmp, DrvGfxROM3);
634 
635 	BurnFree (tmp);
636 
637 	return 0;
638 }
639 
DrvDoReset()640 static INT32 DrvDoReset()
641 {
642 	DrvReset = 0;
643 
644 	memset (AllRam, 0, RamEnd - AllRam);
645 
646 	ZetOpen(0);
647 	ZetReset();
648 	bank_switch(0);
649 	ZetClose();
650 
651 	ZetOpen(1);
652 	ZetReset();
653 	if (DrvHasADPCM) MSM5205Reset();
654 	BurnYM3812Reset();
655 	ZetClose();
656 
657 	if (tecmo_video_type) {
658 		memset (DrvZ80ROM1 + 0x2000, 0, 0x80);
659 	}
660 
661 	soundlatch = 0;
662 	flipscreen = 0;
663 
664 	adpcm_pos = 0;
665 	adpcm_end = 0;
666 	adpcm_data = -1;
667 
668 	HiscoreReset();
669 
670 	return 0;
671 }
672 
TecmoFMIRQHandler(INT32,INT32 nStatus)673 static void TecmoFMIRQHandler(INT32, INT32 nStatus)
674 {
675 	ZetSetIRQLine(0, (nStatus) ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
676 }
677 
TecmoSynchroniseStream(INT32 nSoundRate)678 static INT32 TecmoSynchroniseStream(INT32 nSoundRate)
679 {
680 	return (INT64)(double)ZetTotalCycles() * nSoundRate / 4000000;
681 }
682 
TecmoMSM5205Vck()683 static void TecmoMSM5205Vck()
684 {
685 	if (adpcm_pos >= adpcm_end || adpcm_pos >= adpcm_size) {
686 		MSM5205ResetWrite(0, 1);
687 	} else {
688 		if (adpcm_data != -1) {
689 			MSM5205DataWrite(0, adpcm_data & 0x0f);
690 			adpcm_data = -1;
691 		} else {
692 			adpcm_data = DrvSndROM[adpcm_pos++ & (adpcm_size - 1)];
693 			MSM5205DataWrite(0, adpcm_data >> 4);
694 		}
695 	}
696 }
697 
RygarInit()698 static INT32 RygarInit()
699 {
700 	tecmo_video_type = 0;
701 	DrvHasADPCM = 1;
702 	adpcm_size = 0x4000;
703 
704 	AllMem = NULL;
705 	MemIndex();
706 	INT32 nLen = MemEnd - (UINT8 *)0;
707 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
708 	memset(AllMem, 0, nLen);
709 	MemIndex();
710 
711 	ZetInit(0);
712 	ZetOpen(0);
713 	ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0);
714 	ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0);
715 	ZetMapArea(0xc000, 0xcfff, 0, DrvZ80RAM0);
716 	ZetMapArea(0xc000, 0xcfff, 1, DrvZ80RAM0);
717 	ZetMapArea(0xc000, 0xcfff, 2, DrvZ80RAM0);
718 	ZetMapArea(0xd000, 0xd7ff, 0, DrvTextRAM);
719 	ZetMapArea(0xd000, 0xd7ff, 1, DrvTextRAM);
720 	ZetMapArea(0xd800, 0xdbff, 0, DrvForeRAM);
721 	ZetMapArea(0xd800, 0xdbff, 1, DrvForeRAM);
722 	ZetMapArea(0xdc00, 0xdfff, 0, DrvBackRAM);
723 	ZetMapArea(0xdc00, 0xdfff, 1, DrvBackRAM);
724 	ZetMapArea(0xe000, 0xe7ff, 0, DrvSprRAM);
725 	ZetMapArea(0xe000, 0xe7ff, 1, DrvSprRAM);
726 	ZetMapArea(0xe800, 0xefff, 0, DrvPalRAM);
727 	ZetSetWriteHandler(rygar_main_write);
728 	ZetSetReadHandler(rygar_main_read);
729 	ZetClose();
730 
731 	ZetInit(1);
732 	ZetOpen(1);
733 	ZetMapArea(0x0000, 0x3fff, 0, DrvZ80ROM1);
734 	ZetMapArea(0x0000, 0x3fff, 2, DrvZ80ROM1);
735 	ZetMapArea(0x4000, 0x47ff, 0, DrvZ80RAM1);
736 	ZetMapArea(0x4000, 0x47ff, 1, DrvZ80RAM1);
737 	ZetMapArea(0x4000, 0x47ff, 2, DrvZ80RAM1);
738 	ZetSetWriteHandler(rygar_sound_write);
739 	ZetSetReadHandler(rygar_sound_read);
740 	ZetClose();
741 
742 	{
743 		for (INT32 i = 0; i < 3; i++) {
744 			if (BurnLoadRom(DrvZ80ROM0 + i * 0x8000, i +  0, 1)) return 1;
745 		}
746 
747 		if (BurnLoadRom(DrvZ80ROM1,	3, 1)) return 1;
748 
749 		if (BurnLoadRom(DrvGfxROM0,	4, 1)) return 1;
750 
751 		for (INT32 i = 0; i < 4; i++) {
752 			if (BurnLoadRom(DrvGfxROM1 + i * 0x8000, i +  5, 1)) return 1;
753 			if (BurnLoadRom(DrvGfxROM2 + i * 0x8000, i +  9, 1)) return 1;
754 			if (BurnLoadRom(DrvGfxROM3 + i * 0x8000, i + 13, 1)) return 1;
755 		}
756 
757 		if (BurnLoadRom(DrvSndROM,	17, 1)) return 1;
758 
759 		DrvGfxDecode();
760 	}
761 
762 	BurnYM3812Init(1, 4000000, &TecmoFMIRQHandler, &TecmoSynchroniseStream, 0);
763 	BurnTimerAttachYM3812(&ZetConfig, 4000000);
764 	BurnYM3812SetRoute(0, BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH);
765 
766 	MSM5205Init(0, TecmoSynchroniseStream, 400000, TecmoMSM5205Vck, MSM5205_S48_4B, 1);
767 	MSM5205SetRoute(0, 0.25, BURN_SND_ROUTE_BOTH);
768 	MSM5205DCBlock(0, 1);
769 	MSM5205LPFilter(0, 1);
770 
771 	GenericTilesInit();
772 
773 	DrvDoReset();
774 
775 	return 0;
776 }
777 
778 
SilkwormInit()779 static INT32 SilkwormInit()
780 {
781 	tecmo_video_type = 1;
782 	DrvHasADPCM = 1;
783 	adpcm_size = 0x8000;
784 
785 	AllMem = NULL;
786 	MemIndex();
787 	INT32 nLen = MemEnd - (UINT8 *)0;
788 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
789 	memset(AllMem, 0, nLen);
790 	MemIndex();
791 
792 	ZetInit(0);
793 	ZetOpen(0);
794 	ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0);
795 	ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0);
796 	ZetMapArea(0xc000, 0xc3ff, 0, DrvBackRAM);
797 	ZetMapArea(0xc000, 0xc3ff, 1, DrvBackRAM);
798 	ZetMapArea(0xc400, 0xc7ff, 0, DrvForeRAM);
799 	ZetMapArea(0xc400, 0xc7ff, 1, DrvForeRAM);
800 	ZetMapArea(0xc800, 0xcfff, 0, DrvTextRAM);
801 	ZetMapArea(0xc800, 0xcfff, 1, DrvTextRAM);
802 	ZetMapArea(0xd000, 0xdfff, 0, DrvZ80RAM0);
803 	ZetMapArea(0xd000, 0xdfff, 1, DrvZ80RAM0);
804 	ZetMapArea(0xd000, 0xdfff, 2, DrvZ80RAM0);
805 	ZetMapArea(0xe000, 0xe7ff, 0, DrvSprRAM);
806 	ZetMapArea(0xe000, 0xe7ff, 1, DrvSprRAM);
807 	ZetMapArea(0xe800, 0xefff, 0, DrvPalRAM);
808 	ZetSetWriteHandler(rygar_main_write);
809 	ZetSetReadHandler(rygar_main_read);
810 	ZetClose();
811 
812 	ZetInit(1);
813 	ZetOpen(1);
814 	ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1);
815 	ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1);
816 	ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1);
817 	ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1);
818 	ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1);
819 	ZetSetWriteHandler(rygar_sound_write);
820 	ZetSetReadHandler(rygar_sound_read);
821 	ZetClose();
822 
823 	{
824 		for (INT32 i = 0; i < 2; i++) {
825 			if (BurnLoadRom(DrvZ80ROM0 + i * 0x10000, i +  0, 1)) return 1;
826 		}
827 
828 		if (BurnLoadRom(DrvZ80ROM1,	2, 1)) return 1;
829 
830 		if (BurnLoadRom(DrvGfxROM0,	3, 1)) return 1;
831 
832 		for (INT32 i = 0; i < 4; i++) {
833 			if (BurnLoadRom(DrvGfxROM1 + i * 0x10000, i +  4, 1)) return 1;
834 			if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, i +  8, 1)) return 1;
835 			if (BurnLoadRom(DrvGfxROM3 + i * 0x10000, i + 12, 1)) return 1;
836 		}
837 
838 		if (!strcmp(BurnDrvGetTextA(DRV_NAME), "silkwormb") || !strcmp(BurnDrvGetTextA(DRV_NAME), "silkwormb2")) {
839 			bprintf(0, _T("silkwormb fix\n"));
840 			if (BurnLoadRom(DrvGfxROM3 + 0x38000, 15, 1)) return 1;
841 		}
842 
843 		if (BurnLoadRom(DrvSndROM,	16, 1)) return 1;
844 
845 		DrvGfxDecode();
846 	}
847 
848 	BurnYM3812Init(1, 4000000, &TecmoFMIRQHandler, &TecmoSynchroniseStream, 0);
849 	BurnTimerAttachYM3812(&ZetConfig, 4000000);
850 	BurnYM3812SetRoute(0, BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH);
851 
852 	MSM5205Init(0, TecmoSynchroniseStream, 400000, TecmoMSM5205Vck, MSM5205_S48_4B, 1);
853 	MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH);
854 
855 	GenericTilesInit();
856 
857 	DrvDoReset();
858 
859 	return 0;
860 }
861 
GeminiInit()862 static INT32 GeminiInit()
863 {
864 	tecmo_video_type = 2;
865 	DrvHasADPCM = 1;
866 	if (!strcmp(BurnDrvGetTextA(DRV_NAME), "backfirt")) DrvHasADPCM = 0;
867 	if (DrvHasADPCM) adpcm_size = 0x8000;
868 
869 	AllMem = NULL;
870 	MemIndex();
871 	INT32 nLen = MemEnd - (UINT8 *)0;
872 	if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
873 	memset(AllMem, 0, nLen);
874 	MemIndex();
875 
876 	ZetInit(0);
877 	ZetOpen(0);
878 	ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM0);
879 	ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM0);
880 	ZetMapArea(0xc000, 0xcfff, 0, DrvZ80RAM0);
881 	ZetMapArea(0xc000, 0xcfff, 1, DrvZ80RAM0);
882 	ZetMapArea(0xc000, 0xcfff, 2, DrvZ80RAM0);
883 	ZetMapArea(0xd000, 0xd7ff, 0, DrvTextRAM);
884 	ZetMapArea(0xd000, 0xd7ff, 1, DrvTextRAM);
885 	ZetMapArea(0xd800, 0xdbff, 0, DrvForeRAM);
886 	ZetMapArea(0xd800, 0xdbff, 1, DrvForeRAM);
887 	ZetMapArea(0xdc00, 0xdfff, 0, DrvBackRAM);
888 	ZetMapArea(0xdc00, 0xdfff, 1, DrvBackRAM);
889 	ZetMapArea(0xe000, 0xe7ff, 0, DrvPalRAM);
890 	ZetMapArea(0xe800, 0xefff, 0, DrvSprRAM);
891 	ZetMapArea(0xe800, 0xefff, 1, DrvSprRAM);
892 	ZetSetWriteHandler(rygar_main_write);
893 	ZetSetReadHandler(rygar_main_read);
894 	ZetClose();
895 
896 	ZetInit(1);
897 	ZetOpen(1);
898 	ZetMapArea(0x0000, 0x7fff, 0, DrvZ80ROM1);
899 	ZetMapArea(0x0000, 0x7fff, 2, DrvZ80ROM1);
900 	ZetMapArea(0x8000, 0x87ff, 0, DrvZ80RAM1);
901 	ZetMapArea(0x8000, 0x87ff, 1, DrvZ80RAM1);
902 	ZetMapArea(0x8000, 0x87ff, 2, DrvZ80RAM1);
903 	ZetSetWriteHandler(rygar_sound_write);
904 	ZetSetReadHandler(rygar_sound_read);
905 	ZetClose();
906 
907 	{
908 		for (INT32 i = 0; i < 2; i++) {
909 			if (BurnLoadRom(DrvZ80ROM0 + i * 0x10000, i +  0, 1)) return 1;
910 		}
911 
912 		if (BurnLoadRom(DrvZ80ROM1,	2, 1)) return 1;
913 
914 		if (BurnLoadRom(DrvGfxROM0,	3, 1)) return 1;
915 
916 		for (INT32 i = 0; i < 4; i++) {
917 			if (BurnLoadRom(DrvGfxROM1 + i * 0x10000, i +  4, 1)) return 1;
918 			if (BurnLoadRom(DrvGfxROM2 + i * 0x10000, i +  8, 1)) return 1;
919 			if (BurnLoadRom(DrvGfxROM3 + i * 0x10000, i + 12, 1)) return 1;
920 		}
921 
922 		BurnLoadRom(DrvSndROM,	16, 1);
923 
924 		DrvGfxDecode();
925 	}
926 
927 	BurnYM3812Init(1, 4000000, &TecmoFMIRQHandler, &TecmoSynchroniseStream, 0);
928 	BurnTimerAttachYM3812(&ZetConfig, 4000000);
929 	BurnYM3812SetRoute(0, BURN_SND_YM3812_ROUTE, 1.00, BURN_SND_ROUTE_BOTH);
930 
931 	if (DrvHasADPCM) {
932 		MSM5205Init(0, TecmoSynchroniseStream, 400000, TecmoMSM5205Vck, MSM5205_S48_4B, 1);
933 		MSM5205SetRoute(0, 0.50, BURN_SND_ROUTE_BOTH);
934 	}
935 
936 	GenericTilesInit();
937 
938 	DrvDoReset();
939 
940 	return 0;
941 }
942 
DrvExit()943 static INT32 DrvExit()
944 {
945 	if (DrvHasADPCM) MSM5205Exit();
946 	BurnYM3812Exit();
947 
948 	GenericTilesExit();
949 
950 	ZetExit();
951 
952 	BurnFree (AllMem);
953 
954 	DrvHasADPCM = 0;
955 
956 	return 0;
957 }
958 
calc_sprite_offset(INT32 code,INT32 x,INT32 y)959 static inline INT32 calc_sprite_offset(INT32 code, INT32 x, INT32 y)
960 {
961 	INT32 ofst = 0;
962 	if (x & 0x001) ofst |= 0x01;
963 	if (y & 0x001) ofst |= 0x02;
964 	if (x & 0x002) ofst |= 0x04;
965 	if (y & 0x002) ofst |= 0x08;
966 	if (x & 0x004) ofst |= 0x10;
967 	if (y & 0x004) ofst |= 0x20;
968 
969 	return (ofst + code) & 0x1fff;
970 }
971 
draw_sprites(INT32 priority)972 static void draw_sprites(INT32 priority)
973 {
974 	for (INT32 offs = 0; offs < 0x800; offs += 8)
975 	{
976 		INT32 flags = DrvSprRAM[offs+3];
977 		if (priority != (flags >> 6)) continue;
978 
979 		INT32 bank = DrvSprRAM[offs+0];
980 
981 		if (bank & 4)
982 		{
983 			INT32 which = DrvSprRAM[offs+1];
984 			INT32 code, xpos, ypos, flipx, flipy, x, y;
985 			INT32 size = DrvSprRAM[offs + 2] & 3;
986 
987 			if (tecmo_video_type)
988 				code = which + ((bank & 0xf8) << 5);
989 			else
990 				code = which + ((bank & 0xf0) << 4);
991 
992 			code &= ~((1 << (size << 1)) - 1);
993 			size = 1 << size;
994 
995 			xpos = DrvSprRAM[offs + 5] - ((flags & 0x10) << 4);
996 			ypos = DrvSprRAM[offs + 4] - ((flags & 0x20) << 3);
997 			flipx = bank & 1;
998 			flipy = bank & 2;
999 
1000 			for (y = 0; y < size; y++)
1001 			{
1002 				for (x = 0; x < size; x++)
1003 				{
1004 					INT32 sx = xpos + ((flipx ? (size - 1 - x) : x) << 3);
1005 					INT32 sy = ypos + ((flipy ? (size - 1 - y) : y) << 3);
1006 					sy -= 16;
1007 
1008 					if (sy < -7 || sx < -7 || sx > 255 || sy > 223) continue;
1009 
1010 					if (flipy) {
1011 						if (flipx) {
1012 							Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1);
1013 						} else {
1014 							Render8x8Tile_Mask_FlipY_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1);
1015 						}
1016 					} else {
1017 						if (flipx) {
1018 							Render8x8Tile_Mask_FlipX_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1);
1019 						} else {
1020 							Render8x8Tile_Mask_Clip(pTransDraw, calc_sprite_offset(code, x, y), sx, sy, flags & 0x0f, 4, 0, 0, DrvGfxROM1);
1021 						}
1022 					}
1023 				}
1024 			}
1025 		}
1026 	}
1027 }
1028 
draw_layer(UINT8 * vidram,UINT8 * gfx_base,INT32 paloffs,UINT16 * scroll)1029 static INT32 draw_layer(UINT8 *vidram, UINT8 *gfx_base, INT32 paloffs, UINT16 *scroll)
1030 {
1031 	for (INT32 offs = 0; offs < 32 * 16; offs++)
1032 	{
1033 		INT32 sx = (offs & 0x1f) << 4;
1034 		INT32 sy = (offs >> 5) << 4;
1035 
1036 		sx -= scroll[0] & 0x1ff;
1037 
1038 		if (flipscreen) {
1039 			sx += 48 + 256;
1040 		} else {
1041 			sx -= 48;
1042 		}
1043 
1044 		if (sx <   -15) sx += 0x200;
1045 		if (sx >   511) sx -= 0x200;
1046 
1047 		sy -= scroll[1] + 16;
1048 		if (sy <   -15) sy += 0x100;
1049 
1050 		//if (sx > nScreenWidth || sy > nScreenHeight) continue; breaks backfirt's buggy 2p scrolling
1051 
1052 		UINT8 color = vidram[0x200 | offs];
1053 		INT32 code  = vidram[offs];
1054 
1055 		if (tecmo_video_type == 2) {
1056 			color = (color << 4) | (color >> 4);
1057 		}
1058 
1059 		code  |= ((color & 7) << 8);
1060 		color >>= 4;
1061 
1062 		Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, paloffs, gfx_base);
1063 		if (DrvHasADPCM == 0) // backfirt
1064 			Render16x16Tile_Mask_Clip(pTransDraw, code, sx-0x200, sy, color, 4, 0, paloffs, gfx_base);
1065 	}
1066 
1067 	return 0;
1068 }
1069 
draw_text_layer()1070 static void draw_text_layer()
1071 {
1072 	for (INT32 offs = 0; offs < 0x400; offs++)
1073 	{
1074 		INT32 sx = (offs & 0x1f) << 3;
1075 		INT32 sy = (offs >> 5) << 3;
1076 
1077 		INT32 color = DrvTextRAM[offs | 0x400];
1078 
1079 		INT32 code = DrvTextRAM[offs] | ((color & 3) << 8);
1080 
1081 		color >>= 4;
1082 
1083 		if (sy < 16 || sy > 239) continue;
1084 
1085 		Render8x8Tile_Mask(pTransDraw, code, sx, sy-16, color, 4, 0, 0x100, DrvGfxROM0);
1086 	}
1087 }
1088 
DrvDraw()1089 static INT32 DrvDraw()
1090 {
1091 	if (DrvRecalc) {
1092 		for (INT32 i = 0; i < 0x800; i+=2) {
1093 			palette_write(i);
1094 		}
1095 		DrvRecalc = 0;
1096 	}
1097 
1098 	BurnTransferClear(0x100);
1099 
1100 	if (nSpriteEnable & 1) draw_sprites(3);
1101 
1102 	if (nBurnLayer & 2) draw_layer(DrvBackRAM, DrvGfxROM3, 0x300, DrvBgScroll);
1103 
1104 	if (nSpriteEnable & 2) draw_sprites(2);
1105 
1106 	if (nBurnLayer & 4) draw_layer(DrvForeRAM, DrvGfxROM2, 0x200, DrvFgScroll);
1107 
1108 	if (nSpriteEnable & 4) draw_sprites(1);
1109 
1110 	if (nBurnLayer & 8) draw_text_layer();
1111 
1112 	if (nSpriteEnable & 8) draw_sprites(0);
1113 
1114 	if (flipscreen && DrvHasADPCM) { // backfirt is the only one w/o ADPCM & buggy flipping
1115 		INT32 nSize = (nScreenWidth * nScreenHeight) - 1;
1116 		for (INT32 i = 0; i < nSize >> 1; i++) {
1117 			INT32 n = pTransDraw[i];
1118 			pTransDraw[i] = pTransDraw[nSize - i];
1119 			pTransDraw[nSize - i] = n;
1120 		}
1121 	}
1122 
1123 	BurnTransferCopy(DrvPalette);
1124 
1125 	return 0;
1126 }
1127 
DrvFrame()1128 static INT32 DrvFrame()
1129 {
1130 	if (DrvReset) {
1131 		DrvDoReset();
1132 	}
1133 
1134 	{
1135 		memset (DrvInputs, 0, 6);
1136 		DrvInputs[10] = 0;
1137 
1138 		for (INT32 i = 0; i < 8; i++) {
1139 			DrvInputs[ 0] ^= DrvJoy1[i] << i;
1140 			DrvInputs[ 1] ^= DrvJoy2[i] << i;
1141 			DrvInputs[ 2] ^= DrvJoy3[i] << i;
1142 			DrvInputs[ 3] ^= DrvJoy4[i] << i;
1143 			DrvInputs[ 4] ^= DrvJoy5[i] << i;
1144 			DrvInputs[ 5] ^= DrvJoy6[i] << i;
1145 			DrvInputs[10] ^= DrvJoy11[i] << i;
1146 		}
1147 	}
1148 
1149 	ZetNewFrame();
1150 
1151 	INT32 nInterleave = 10;
1152 	if (DrvHasADPCM) nInterleave = MSM5205CalcInterleave(0, 4000000);
1153 	INT32 nCyclesTotal[2] = { 6000000 / 60, 4000000 / 60 };
1154 	INT32 nCyclesDone[2] = { 0, 0 };
1155 
1156 	for (INT32 i = 0; i < nInterleave; i++)
1157 	{
1158 		ZetOpen(0);
1159 		CPU_RUN(0, Zet);
1160 		if (i == (nInterleave-1)) ZetSetIRQLine(0, CPU_IRQSTATUS_HOLD);
1161 		ZetClose();
1162 
1163 		ZetOpen(1);
1164 		if (DrvEnableNmi) {
1165 			ZetNmi();
1166 			DrvEnableNmi = 0;
1167 		}
1168 		BurnTimerUpdateYM3812((i + 1) * (nCyclesTotal[1] / nInterleave));
1169 		if (DrvHasADPCM)  MSM5205Update();
1170 		ZetClose();
1171 	}
1172 
1173 	ZetOpen(1);
1174 	BurnTimerEndFrameYM3812(nCyclesTotal[1]);
1175 	if (pBurnSoundOut) {
1176 		BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
1177 		if (DrvHasADPCM) MSM5205Render(0, pBurnSoundOut, nBurnSoundLen);
1178 	}
1179 	ZetClose();
1180 
1181 	if (pBurnDraw) {
1182 		DrvDraw();
1183 	}
1184 
1185 	return 0;
1186 }
1187 
DrvScan(INT32 nAction,INT32 * pnMin)1188 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
1189 {
1190 	struct BurnArea ba;
1191 
1192 	if (pnMin) {
1193 		*pnMin = 0x029622;
1194 	}
1195 
1196 	if (nAction & ACB_VOLATILE) {
1197 		memset(&ba, 0, sizeof(ba));
1198 
1199 		ba.Data	  = AllRam;
1200 		ba.nLen	  = RamEnd - AllRam;
1201 		ba.szName = "All Ram";
1202 		BurnAcb(&ba);
1203 
1204 		ba.Data   = DrvZ80ROM1 + 0x2000;
1205 		ba.nLen	  = 0x80;
1206 		ba.szName = "Sound Z80 RAM";
1207 		BurnAcb(&ba);
1208 
1209 		ZetScan(nAction);
1210 		BurnYM3812Scan(nAction, pnMin);
1211 		if (DrvHasADPCM) MSM5205Scan(nAction, pnMin);
1212 
1213 		SCAN_VAR(DrvEnableNmi);
1214 
1215 		SCAN_VAR(flipscreen);
1216 		SCAN_VAR(soundlatch);
1217 		SCAN_VAR(DrvZ80Bank);
1218 
1219 		SCAN_VAR(adpcm_pos);
1220 		SCAN_VAR(adpcm_end);
1221 		SCAN_VAR(adpcm_data);
1222 	}
1223 
1224 	if (nAction & ACB_WRITE) {
1225 		ZetOpen(0);
1226 		bank_switch(DrvZ80Bank);
1227 		ZetClose();
1228 	}
1229 
1230 	return 0;
1231 }
1232 
1233 
1234 // Rygar (US set 1)
1235 
1236 static struct BurnRomInfo rygarRomDesc[] = {
1237 	{ "5.5p",      	0x08000, 0x062cd55d, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1238 	{ "cpu_5m.bin",	0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, //  1
1239 	{ "cpu_5j.bin",	0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, //  2
1240 
1241 	{ "cpu_4h.bin",	0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, //  3 - Z80 Code
1242 
1243 	{ "cpu_8k.bin",	0x08000, 0x4d482fb6, 3 | BRF_GRA },	      //  4 - Characters
1244 
1245 	{ "vid_6k.bin",	0x08000, 0xaba6db9e, 4 | BRF_GRA },	      //  5 - Sprites
1246 	{ "vid_6j.bin",	0x08000, 0xae1f2ed6, 4 | BRF_GRA },	      //  6
1247 	{ "vid_6h.bin",	0x08000, 0x46d9e7df, 4 | BRF_GRA },	      //  7
1248 	{ "vid_6g.bin",	0x08000, 0x45839c9a, 4 | BRF_GRA },	      //  8
1249 
1250 	{ "vid_6p.bin",	0x08000, 0x9eae5f8e, 5 | BRF_GRA },	      //  9 - Foreground Tiles
1251 	{ "vid_6o.bin",	0x08000, 0x5a10a396, 5 | BRF_GRA },	      // 10
1252 	{ "vid_6n.bin",	0x08000, 0x7b12cf3f, 5 | BRF_GRA },	      // 11
1253 	{ "vid_6l.bin",	0x08000, 0x3cea7eaa, 5 | BRF_GRA },	      // 12
1254 
1255 	{ "vid_6f.bin",	0x08000, 0x9840edd8, 6 | BRF_GRA },	      // 13 - Background Tiles
1256 	{ "vid_6e.bin",	0x08000, 0xff65e074, 6 | BRF_GRA },	      // 14
1257 	{ "vid_6c.bin",	0x08000, 0x89868c85, 6 | BRF_GRA },	      // 15
1258 	{ "vid_6b.bin",	0x08000, 0x35389a7b, 6 | BRF_GRA },	      // 16
1259 
1260 	{ "cpu_1f.bin",	0x04000, 0x3cc98c5a, 7 | BRF_SND },	      // 17 - Samples
1261 };
1262 
1263 STD_ROM_PICK(rygar)
1264 STD_ROM_FN(rygar)
1265 
1266 struct BurnDriver BurnDrvRygar = {
1267 	"rygar", NULL, NULL, NULL, "1986",
1268 	"Rygar (US set 1)\0", NULL, "Tecmo", "Miscellaneous",
1269 	NULL, NULL, NULL, NULL,
1270 	BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1271 	NULL, rygarRomInfo, rygarRomName, NULL, NULL, NULL, NULL, RygarInputInfo, RygarDIPInfo,
1272 	RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1273 	256, 224, 4, 3
1274 };
1275 
1276 
1277 // Rygar (US set 2)
1278 
1279 static struct BurnRomInfo rygar2RomDesc[] = {
1280 	{ "5p.bin",     0x08000, 0x151ffc0b, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1281 	{ "cpu_5m.bin",	0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, //  1
1282 	{ "cpu_5j.bin",	0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, //  2
1283 
1284 	{ "cpu_4h.bin",	0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, //  3 - Z80 Code
1285 
1286 	{ "cpu_8k.bin",	0x08000, 0x4d482fb6, 3 | BRF_GRA },	      //  4 - Characters
1287 
1288 	{ "vid_6k.bin",	0x08000, 0xaba6db9e, 4 | BRF_GRA },	      //  5 - Sprites
1289 	{ "vid_6j.bin",	0x08000, 0xae1f2ed6, 4 | BRF_GRA },	      //  6
1290 	{ "vid_6h.bin",	0x08000, 0x46d9e7df, 4 | BRF_GRA },	      //  7
1291 	{ "vid_6g.bin",	0x08000, 0x45839c9a, 4 | BRF_GRA },	      //  8
1292 
1293 	{ "vid_6p.bin",	0x08000, 0x9eae5f8e, 5 | BRF_GRA },	      //  9 - Foreground Tiles
1294 	{ "vid_6o.bin",	0x08000, 0x5a10a396, 5 | BRF_GRA },	      // 10
1295 	{ "vid_6n.bin",	0x08000, 0x7b12cf3f, 5 | BRF_GRA },	      // 11
1296 	{ "vid_6l.bin",	0x08000, 0x3cea7eaa, 5 | BRF_GRA },	      // 12
1297 
1298 	{ "vid_6f.bin",	0x08000, 0x9840edd8, 6 | BRF_GRA },	      // 13 - Background Tiles
1299 	{ "vid_6e.bin",	0x08000, 0xff65e074, 6 | BRF_GRA },	      // 14
1300 	{ "vid_6c.bin",	0x08000, 0x89868c85, 6 | BRF_GRA },	      // 15
1301 	{ "vid_6b.bin",	0x08000, 0x35389a7b, 6 | BRF_GRA },	      // 16
1302 
1303 	{ "cpu_1f.bin",	0x04000, 0x3cc98c5a, 7 | BRF_SND },	      // 17 - Samples
1304 };
1305 
1306 STD_ROM_PICK(rygar2)
1307 STD_ROM_FN(rygar2)
1308 
1309 struct BurnDriver BurnDrvRygar2 = {
1310 	"rygar2", "rygar", NULL, NULL, "1986",
1311 	"Rygar (US set 2)\0", NULL, "Tecmo", "Miscellaneous",
1312 	NULL, NULL, NULL, NULL,
1313 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1314 	NULL, rygar2RomInfo, rygar2RomName, NULL, NULL, NULL, NULL, RygarInputInfo, RygarDIPInfo,
1315 	RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1316 	256, 224, 4, 3
1317 };
1318 
1319 
1320 // Rygar (US set 3 Old Version)
1321 
1322 static struct BurnRomInfo rygar3RomDesc[] = {
1323 	{ "cpu_5p.bin", 0x08000, 0xe79c054a, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1324 	{ "cpu_5m.bin",	0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, //  1
1325 	{ "cpu_5j.bin",	0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, //  2
1326 
1327 	{ "cpu_4h.bin",	0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, //  3 - Z80 Code
1328 
1329 	{ "cpu_8k.bin",	0x08000, 0x4d482fb6, 3 | BRF_GRA },	      //  4 - Characters
1330 
1331 	{ "vid_6k.bin",	0x08000, 0xaba6db9e, 4 | BRF_GRA },	      //  5 - Sprites
1332 	{ "vid_6j.bin",	0x08000, 0xae1f2ed6, 4 | BRF_GRA },	      //  6
1333 	{ "vid_6h.bin",	0x08000, 0x46d9e7df, 4 | BRF_GRA },	      //  7
1334 	{ "vid_6g.bin",	0x08000, 0x45839c9a, 4 | BRF_GRA },	      //  8
1335 
1336 	{ "vid_6p.bin",	0x08000, 0x9eae5f8e, 5 | BRF_GRA },	      //  9 - Foreground Tiles
1337 	{ "vid_6o.bin",	0x08000, 0x5a10a396, 5 | BRF_GRA },	      // 10
1338 	{ "vid_6n.bin",	0x08000, 0x7b12cf3f, 5 | BRF_GRA },	      // 11
1339 	{ "vid_6l.bin",	0x08000, 0x3cea7eaa, 5 | BRF_GRA },	      // 12
1340 
1341 	{ "vid_6f.bin",	0x08000, 0x9840edd8, 6 | BRF_GRA },	      // 13 - Background Tiles
1342 	{ "vid_6e.bin",	0x08000, 0xff65e074, 6 | BRF_GRA },	      // 14
1343 	{ "vid_6c.bin",	0x08000, 0x89868c85, 6 | BRF_GRA },	      // 15
1344 	{ "vid_6b.bin",	0x08000, 0x35389a7b, 6 | BRF_GRA },	      // 16
1345 
1346 	{ "cpu_1f.bin",	0x04000, 0x3cc98c5a, 7 | BRF_SND },	      // 17 - Samples
1347 };
1348 
1349 STD_ROM_PICK(rygar3)
1350 STD_ROM_FN(rygar3)
1351 
1352 struct BurnDriver BurnDrvRygar3 = {
1353 	"rygar3", "rygar", NULL, NULL, "1986",
1354 	"Rygar (US set 3 Old Version)\0", NULL, "Tecmo", "Miscellaneous",
1355 	NULL, NULL, NULL, NULL,
1356 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1357 	NULL, rygar3RomInfo, rygar3RomName, NULL, NULL, NULL, NULL, RygarInputInfo, RygarDIPInfo,
1358 	RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1359 	256, 224, 4, 3
1360 };
1361 
1362 
1363 // Argus no Senshi (Japan)
1364 
1365 static struct BurnRomInfo rygarjRomDesc[] = {
1366 	{ "cpuj_5p.bin",0x08000, 0xb39698ba, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1367 	{ "cpuj_5m.bin",0x04000, 0x3f180979, 1 | BRF_PRG | BRF_ESS }, //  1
1368 	{ "cpuj_5j.bin",0x08000, 0x69e44e8f, 1 | BRF_PRG | BRF_ESS }, //  2
1369 
1370 	{ "cpu_4h.bin",	0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, //  3 - Z80 Code
1371 
1372 	{ "cpuj_8k.bin",0x08000, 0x45047707, 3 | BRF_GRA },	      //  4 - Characters
1373 
1374 	{ "vid_6k.bin",	0x08000, 0xaba6db9e, 4 | BRF_GRA },	      //  5 - Sprites
1375 	{ "vid_6j.bin",	0x08000, 0xae1f2ed6, 4 | BRF_GRA },	      //  6
1376 	{ "vid_6h.bin",	0x08000, 0x46d9e7df, 4 | BRF_GRA },	      //  7
1377 	{ "vid_6g.bin",	0x08000, 0x45839c9a, 4 | BRF_GRA },	      //  8
1378 
1379 	{ "vid_6p.bin",	0x08000, 0x9eae5f8e, 5 | BRF_GRA },	      //  9 - Foreground Tiles
1380 	{ "vid_6o.bin",	0x08000, 0x5a10a396, 5 | BRF_GRA },	      // 10
1381 	{ "vid_6n.bin",	0x08000, 0x7b12cf3f, 5 | BRF_GRA },	      // 11
1382 	{ "vid_6l.bin",	0x08000, 0x3cea7eaa, 5 | BRF_GRA },	      // 12
1383 
1384 	{ "vid_6f.bin",	0x08000, 0x9840edd8, 6 | BRF_GRA },	      // 13 - Background Tiles
1385 	{ "vid_6e.bin",	0x08000, 0xff65e074, 6 | BRF_GRA },	      // 14
1386 	{ "vid_6c.bin",	0x08000, 0x89868c85, 6 | BRF_GRA },	      // 15
1387 	{ "vid_6b.bin",	0x08000, 0x35389a7b, 6 | BRF_GRA },	      // 16
1388 
1389 	{ "cpu_1f.bin",	0x04000, 0x3cc98c5a, 7 | BRF_SND },	      // 17 - Samples
1390 };
1391 
1392 STD_ROM_PICK(rygarj)
1393 STD_ROM_FN(rygarj)
1394 
1395 struct BurnDriver BurnDrvRygarj = {
1396 	"rygarj", "rygar", NULL, NULL, "1986",
1397 	"Argus no Senshi (Japan)\0", NULL, "Tecmo", "Miscellaneous",
1398 	NULL, NULL, NULL, NULL,
1399 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1400 	NULL, rygarjRomInfo, rygarjRomName, NULL, NULL, NULL, NULL, RygarInputInfo, RygarDIPInfo,
1401 	RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1402 	256, 224, 4, 3
1403 };
1404 
1405 
1406 // Rygar (US, bootleg)
1407 
1408 static struct BurnRomInfo rygarbRomDesc[] = {
1409 	{ "5.u64", 		0x08000, 0x0e13e0e4, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1410 	{ "4.u63",		0x04000, 0x7ac5191b, 1 | BRF_PRG | BRF_ESS }, //  1
1411 	{ "3.u61",		0x08000, 0xed76d606, 1 | BRF_PRG | BRF_ESS }, //  2
1412 
1413 	{ "2.u72",		0x02000, 0xe4a2fa87, 2 | BRF_PRG | BRF_ESS }, //  3 - Z80 Code
1414 
1415 	{ "6.u19",		0x08000, 0x4d482fb6, 3 | BRF_GRA },	      //  4 - Characters
1416 
1417 	{ "11.u82",		0x08000, 0xaba6db9e, 4 | BRF_GRA },	      //  5 - Sprites
1418 	{ "12.u81",		0x08000, 0xae1f2ed6, 4 | BRF_GRA },	      //  6
1419 	{ "13.u80",		0x08000, 0x46d9e7df, 4 | BRF_GRA },	      //  7
1420 	{ "14.u79",		0x08000, 0x45839c9a, 4 | BRF_GRA },	      //  8
1421 
1422 	{ "7.u86",		0x08000, 0x9eae5f8e, 5 | BRF_GRA },	      //  9 - Foreground Tiles
1423 	{ "8.u85",		0x08000, 0x5a10a396, 5 | BRF_GRA },	      // 10
1424 	{ "9.u84",		0x08000, 0x7b12cf3f, 5 | BRF_GRA },	      // 11
1425 	{ "10.u83",		0x08000, 0x3cea7eaa, 5 | BRF_GRA },	      // 12
1426 
1427 	{ "15.u78",		0x08000, 0x9840edd8, 6 | BRF_GRA },	      // 13 - Background Tiles
1428 	{ "16.u77",		0x08000, 0xff65e074, 6 | BRF_GRA },	      // 14
1429 	{ "17.u76",		0x08000, 0x89868c85, 6 | BRF_GRA },	      // 15
1430 	{ "18.u75",		0x08000, 0x35389a7b, 6 | BRF_GRA },	      // 16
1431 
1432 	{ "1.u102",		0x04000, 0x3cc98c5a, 7 | BRF_SND },	      // 17 - Samples
1433 };
1434 
1435 STD_ROM_PICK(rygarb)
1436 STD_ROM_FN(rygarb)
1437 
1438 struct BurnDriver BurnDrvRygarb = {
1439 	"rygarb", "rygar", NULL, NULL, "1986",
1440 	"Rygar (US, bootleg)\0", NULL, "Tecmo", "Miscellaneous",
1441 	NULL, NULL, NULL, NULL,
1442 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1443 	NULL, rygarbRomInfo, rygarbRomName, NULL, NULL, NULL, NULL, RygarInputInfo, RygarDIPInfo,
1444 	RygarInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1445 	256, 224, 4, 3
1446 };
1447 
1448 
1449 // Silk Worm (World)
1450 
1451 static struct BurnRomInfo silkwormRomDesc[] = {
1452 	{ "4.5s",		0x10000, 0xa5277cce, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1453 	{ "5.6s",		0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, //  1
1454 
1455 	{ "3.5j",		0x08000, 0xb589f587, 2 | BRF_PRG | BRF_ESS }, //  2 - Z80 Code
1456 
1457 	{ "2.3j",		0x08000, 0xe80a1cd9, 3 | BRF_GRA },	      //  3 - Characters
1458 
1459 	{ "6.1c",		0x10000, 0x1138d159, 4 | BRF_GRA },	      //  4 - Sprites
1460 	{ "7.1d",		0x10000, 0xd96214f7, 4 | BRF_GRA },	      //  5
1461 	{ "8.1f",		0x10000, 0x0494b38e, 4 | BRF_GRA },	      //  6
1462 	{ "9.1h",		0x10000, 0x8ce3cdf5, 4 | BRF_GRA },	      //  7
1463 
1464 	{ "10.1p",		0x10000, 0x8c7138bb, 5 | BRF_GRA },	      //  8 - Foreground Tiles
1465 	{ "11.12p",		0x10000, 0x6c03c476, 5 | BRF_GRA },	      //  9
1466 	{ "12.2p",		0x10000, 0xbb0f568f, 5 | BRF_GRA },	      // 10
1467 	{ "13.3p",		0x10000, 0x773ad0a4, 5 | BRF_GRA },	      // 11
1468 
1469 	{ "14.1s",		0x10000, 0x409df64b, 6 | BRF_GRA },	      // 12 - Background Tiles
1470 	{ "15.12s",		0x10000, 0x6e4052c9, 6 | BRF_GRA },	      // 13
1471 	{ "16.2s",		0x10000, 0x9292ed63, 6 | BRF_GRA },	      // 14
1472 	{ "17.3s",		0x10000, 0x3fa4563d, 6 | BRF_GRA },	      // 15
1473 
1474 	{ "1.6b",		0x08000, 0x5b553644, 7 | BRF_SND },	      // 16 - Samples
1475 };
1476 
1477 STD_ROM_PICK(silkworm)
1478 STD_ROM_FN(silkworm)
1479 
1480 struct BurnDriver BurnDrvSilkworm = {
1481 	"silkworm", NULL, NULL, NULL, "1988",
1482 	"Silk Worm (World)\0", NULL, "Tecmo", "Miscellaneous",
1483 	NULL, NULL, NULL, NULL,
1484 	BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1485 	NULL, silkwormRomInfo, silkwormRomName, NULL, NULL, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo,
1486 	SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1487 	256, 224, 4, 3
1488 };
1489 
1490 
1491 // Silk Worm (Japan)
1492 
1493 static struct BurnRomInfo silkwrmjRomDesc[] = {
1494 	{ "silkwormj.4",	0x10000, 0x6df3df22, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1495 	{ "silkworm.5",		0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, //  1
1496 
1497 	{ "silkwormj.3",	0x08000, 0xb79848d0, 2 | BRF_PRG | BRF_ESS }, //  2 - Z80 Code
1498 
1499 	{ "silkworm.2",		0x08000, 0xe80a1cd9, 3 | BRF_GRA },	      //  3 - Characters
1500 
1501 	{ "silkworm.6",		0x10000, 0x1138d159, 4 | BRF_GRA },	      //  4 - Sprites
1502 	{ "silkworm.7",		0x10000, 0xd96214f7, 4 | BRF_GRA },	      //  5
1503 	{ "silkworm.8",		0x10000, 0x0494b38e, 4 | BRF_GRA },	      //  6
1504 	{ "silkworm.9",		0x10000, 0x8ce3cdf5, 4 | BRF_GRA },	      //  7
1505 
1506 	{ "silkworm.10",	0x10000, 0x8c7138bb, 5 | BRF_GRA },	      //  8 - Foreground Tiles
1507 	{ "silkworm.11",	0x10000, 0x6c03c476, 5 | BRF_GRA },	      //  9
1508 	{ "silkworm.12",	0x10000, 0xbb0f568f, 5 | BRF_GRA },	      // 10
1509 	{ "silkworm.13",	0x10000, 0x773ad0a4, 5 | BRF_GRA },	      // 11
1510 
1511 	{ "silkworm.14",	0x10000, 0x409df64b, 6 | BRF_GRA },	      // 12 - Background Tiles
1512 	{ "silkworm.15",	0x10000, 0x6e4052c9, 6 | BRF_GRA },	      // 13
1513 	{ "silkworm.16",	0x10000, 0x9292ed63, 6 | BRF_GRA },	      // 14
1514 	{ "silkworm.17",	0x10000, 0x3fa4563d, 6 | BRF_GRA },	      // 15
1515 
1516 	{ "silkworm.1",		0x08000, 0x5b553644, 7 | BRF_SND },	      // 16 - Samples
1517 };
1518 
1519 STD_ROM_PICK(silkwrmj)
1520 STD_ROM_FN(silkwrmj)
1521 
1522 struct BurnDriver BurnDrvSilkwrmj = {
1523 	"silkwormj", "silkworm", NULL, NULL, "1988",
1524 	"Silk Worm (Japan)\0", NULL, "Tecmo", "Miscellaneous",
1525 	NULL, NULL, NULL, NULL,
1526 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1527 	NULL, silkwrmjRomInfo, silkwrmjRomName, NULL, NULL, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo,
1528 	SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1529 	256, 224, 4, 3
1530 };
1531 
1532 // Silk Worm (prototype?)
1533 // 6217A
1534 // SILKWORM H T737
1535 // board have Japanese label "ADONO"
1536 
1537 static struct BurnRomInfo silkwrmpRomDesc[] = {
1538 	{ "silkworm_pr4ma.4",	0x10000, 0x5e2a39cc, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1539 	{ "silkworm.5",			0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, //  1
1540 
1541 	{ "silkworm_sound.3",	0x08000, 0xc67c5644, 2 | BRF_PRG | BRF_ESS }, //  2 - Z80 Code
1542 
1543 	{ "sw.2",				0x08000, 0x1acc54be, 3 | BRF_GRA },	      //  3 - Characters
1544 
1545 	{ "silkworm.6",			0x10000, 0x1138d159, 4 | BRF_GRA },	      //  4 - Sprites
1546 	{ "silkworm.7",			0x10000, 0xd96214f7, 4 | BRF_GRA },	      //  5
1547 	{ "silkworm.8",			0x10000, 0x0494b38e, 4 | BRF_GRA },	      //  6
1548 	{ "silkworm.9",			0x10000, 0x8ce3cdf5, 4 | BRF_GRA },	      //  7
1549 
1550 	{ "silkworm.10",		0x10000, 0x8c7138bb, 5 | BRF_GRA },	      //  8 - Foreground Tiles
1551 	{ "silkworm.11",		0x10000, 0x6c03c476, 5 | BRF_GRA },	      //  9
1552 	{ "silkworm.12",		0x10000, 0xbb0f568f, 5 | BRF_GRA },	      // 10
1553 	{ "silkworm.13",		0x10000, 0x773ad0a4, 5 | BRF_GRA },	      // 11
1554 
1555 	{ "silkworm.14",		0x10000, 0x409df64b, 6 | BRF_GRA },	      // 12 - Background Tiles
1556 	{ "silkworm.15",		0x10000, 0x6e4052c9, 6 | BRF_GRA },	      // 13
1557 	{ "silkworm.16",		0x10000, 0x9292ed63, 6 | BRF_GRA },	      // 14
1558 	{ "silkworm.17",		0x10000, 0x3fa4563d, 6 | BRF_GRA },	      // 15
1559 
1560 #if !defined ROM_VERIFY
1561 	{ "silkworm.1",			0x08000, 0x5b553644, 7 | BRF_SND },	      // 16 - Samples
1562 #endif
1563 };
1564 
1565 STD_ROM_PICK(silkwrmp)
1566 STD_ROM_FN(silkwrmp)
1567 
1568 struct BurnDriver BurnDrvSilkwrmp = {
1569 	"silkwormp", "silkworm", NULL, NULL, "1988",
1570 	"Silk Worm (prototype?)\0", NULL, "Tecmo", "Miscellaneous",
1571 	NULL, NULL, NULL, NULL,
1572 	BDF_GAME_WORKING | BDF_CLONE | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1573 	NULL, silkwrmpRomInfo, silkwrmpRomName, NULL, NULL, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo,
1574 	SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1575 	256, 224, 4, 3
1576 };
1577 
1578 // Silk Worm (bootleg, set 1)
1579 
1580 static struct BurnRomInfo silkwormbRomDesc[] = {
1581 	{ "e3.4",		    0x10000, 0x3d86fd58, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1582 	{ "silkworm.5",		0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, //  1
1583 
1584 	{ "e2.3",		    0x08000, 0xb7a3fb80, 2 | BRF_PRG | BRF_ESS }, //  2 - Z80 Code
1585 
1586 	{ "silkworm.2",		0x08000, 0xe80a1cd9, 3 | BRF_GRA },	      //  3 - Characters
1587 
1588 	{ "silkworm.6",		0x10000, 0x1138d159, 4 | BRF_GRA },	      //  4 - Sprites
1589 	{ "silkworm.7",		0x10000, 0xd96214f7, 4 | BRF_GRA },	      //  5
1590 	{ "silkworm.8",		0x10000, 0x0494b38e, 4 | BRF_GRA },	      //  6
1591 	{ "silkworm.9",		0x10000, 0x8ce3cdf5, 4 | BRF_GRA },	      //  7
1592 
1593 	{ "silkworm.10",	0x10000, 0x8c7138bb, 5 | BRF_GRA },	      //  8 - Foreground Tiles
1594 	{ "e10.11",	        0x08000, 0xc0c4687d, 5 | BRF_GRA },	      //  9
1595 	{ "silkworm.12",	0x10000, 0xbb0f568f, 5 | BRF_GRA },	      // 10
1596 	{ "e12.13",	        0x08000, 0xfc472811, 5 | BRF_GRA },	      // 11
1597 
1598 	{ "silkworm.14",	0x10000, 0x409df64b, 6 | BRF_GRA },	      // 12 - Background Tiles
1599 	{ "e14.15",	        0x08000, 0xb02acdb6, 6 | BRF_GRA },	      // 13
1600 	{ "e15.16",	        0x08000, 0xcaf7b25e, 6 | BRF_GRA },	      // 14
1601 	{ "e16.17",	        0x08000, 0x7ec93873, 6 | BRF_GRA },	      // 15
1602 
1603 };
1604 
1605 STD_ROM_PICK(silkwormb)
1606 STD_ROM_FN(silkwormb)
1607 
1608 struct BurnDriver BurnDrvSilkwormb = {
1609 	"silkwormb", "silkworm", NULL, NULL, "1988",
1610 	"Silk Worm (bootleg, set 1)\0", NULL, "bootleg", "Miscellaneous",
1611 	NULL, NULL, NULL, NULL,
1612 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1613 	NULL, silkwormbRomInfo, silkwormbRomName, NULL, NULL, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo,
1614 	SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1615 	256, 224, 4, 3
1616 };
1617 
1618 // Silk Worm (bootleg, set 2)
1619 
1620 static struct BurnRomInfo silkwormb2RomDesc[] = {
1621 	{ "280100_pc-4.4",		0x10000, 0xa10f2414, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1622 	{ "280100_pc-5.5",		0x10000, 0xa6c7bb51, 1 | BRF_PRG | BRF_ESS }, //  1
1623 
1624 	{ "280100_pc-3.3",		0x08000, 0x5a880df9, 2 | BRF_PRG | BRF_ESS }, //  2 - Z80 Code
1625 
1626 	{ "280100_pc-2.2",		0x08000, 0xe80a1cd9, 3 | BRF_GRA },	          //  3 - Characters
1627 
1628 	{ "280100_pc-6.6",		0x10000, 0x1138d159, 4 | BRF_GRA },	      	  //  4 - Sprites
1629 	{ "280100_pc-7.7",		0x10000, 0xd96214f7, 4 | BRF_GRA },	          //  5
1630 	{ "280100_pc-8.8",		0x10000, 0x0494b38e, 4 | BRF_GRA },	          //  6
1631 	{ "280100_pc-9.9",		0x10000, 0x8ce3cdf5, 4 | BRF_GRA },	          //  7
1632 
1633 	{ "280100_pc-10.10",	0x10000, 0x8c7138bb, 5 | BRF_GRA },	          //  8 - Foreground Tiles
1634 	{ "280100_pc-11.11",	0x08000, 0xc0c4687d, 5 | BRF_GRA },	          //  9
1635 	{ "280100_pc-12.12",	0x10000, 0xbb0f568f, 5 | BRF_GRA },	          // 10
1636 	{ "280100_pc-13.13",	0x08000, 0xfc472811, 5 | BRF_GRA },	          // 11
1637 
1638 	{ "280100_pc-14.14",	0x10000, 0x409df64b, 6 | BRF_GRA },	      	  // 12 - Background Tiles
1639 	{ "280100_pc-15.15",	0x08000, 0xb02acdb6, 6 | BRF_GRA },	      	  // 13
1640 	{ "280100_pc-16.16",	0x08000, 0xcaf7b25e, 6 | BRF_GRA },	      	  // 14
1641 	{ "280100_pc-17.17",	0x08000, 0x7ec93873, 6 | BRF_GRA },	          // 15
1642 
1643 };
1644 
1645 STD_ROM_PICK(silkwormb2)
1646 STD_ROM_FN(silkwormb2)
1647 
1648 struct BurnDriver BurnDrvSilkwormb2 = {
1649 	"silkwormb2", "silkworm", NULL, NULL, "1988",
1650 	"Silk Worm (bootleg, set 2)\0", NULL, "Tecmo", "Miscellaneous",
1651 	NULL, NULL, NULL, NULL,
1652 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1653 	NULL, silkwormb2RomInfo, silkwormb2RomName, NULL, NULL, NULL, NULL, SilkwormInputInfo, SilkwormDIPInfo,
1654 	SilkwormInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1655 	256, 224, 4, 3
1656 };
1657 
1658 // Back Fire (Tecmo, bootleg)
1659 
1660 static struct BurnRomInfo backfirtRomDesc[] = {
1661 	{ "b5-e3.bin",		0x10000, 0x0ab3bd4d, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1662 	{ "b4-f3.bin",		0x10000, 0x150B6949, 1 | BRF_PRG | BRF_ESS }, //  1
1663 
1664 	{ "b2-e10.bin",		0x08000, 0x9b2ac54f, 2 | BRF_PRG | BRF_ESS }, //  2 - Z80 Code
1665 
1666 	{ "b3-c10.bin",		0x08000, 0x08ce729f, 3 | BRF_GRA },	      //  3 - Characters
1667 
1668 	{ "b6-c2.bin",		0x10000, 0xc8c25e45, 4 | BRF_GRA },	      //  4 - Sprites
1669 	{ "b7-d2.bin",		0x10000, 0x25fb6a57, 4 | BRF_GRA },	      //  5
1670 	{ "b8-e2.bin",		0x10000, 0x6bccac4e, 4 | BRF_GRA },	      //  6
1671 	{ "b9-h2.bin",		0x10000, 0x566a99b8, 4 | BRF_GRA },	      //  7
1672 
1673 	{ "b13-p1.bin",		0x10000, 0x8c7138bb, 5 | BRF_GRA },	      //  8 - Foreground Tiles
1674 	{ "b12-p2.bin",		0x10000, 0x6c03c476, 5 | BRF_GRA },	      //  9
1675 	{ "b11-p2.bin",		0x10000, 0x0bc84b4b, 5 | BRF_GRA },	      // 10
1676 	{ "b10-p3.bin",		0x10000, 0xec149ec3, 5 | BRF_GRA },	      // 11
1677 
1678 	{ "b17-s1.bin",		0x10000, 0x409df64b, 6 | BRF_GRA },	      // 12 - Background Tiles
1679 	{ "b16-s2.bin",		0x10000, 0x6e4052c9, 6 | BRF_GRA },	      // 13
1680 	{ "b15-s2.bin",		0x10000, 0x2b6cc20e, 6 | BRF_GRA },	      // 14
1681 	{ "b14-s3.bin",		0x08000, 0x4d29637a, 6 | BRF_GRA },	      // 15
1682 };
1683 
1684 STD_ROM_PICK(backfirt)
1685 STD_ROM_FN(backfirt)
1686 
1687 struct BurnDriver BurnDrvbackfirt = {
1688 	"backfirt", NULL, NULL, NULL, "1988",
1689 	"Back Fire (Tecmo, bootleg)\0", NULL, "Tecmo", "Miscellaneous",
1690 	NULL, NULL, NULL, NULL,
1691 	BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_HORSHOOT, 0,
1692 	NULL, backfirtRomInfo, backfirtRomName, NULL, NULL, NULL, NULL, BackfirtInputInfo, BackfirtDIPInfo,
1693 	GeminiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1694 	256, 224, 4, 3
1695 };
1696 
1697 
1698 // Gemini Wing (World)
1699 
1700 static struct BurnRomInfo geminiRomDesc[] = {
1701 	{ "4-5s",			0x10000, 0xce71e27a, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1702 	{ "5-6s",			0x10000, 0x216784a9, 1 | BRF_PRG | BRF_ESS }, //  1
1703 
1704 	{ "gw03-5h.rom",	0x08000, 0x9bc79596, 2 | BRF_PRG | BRF_ESS }, //  2 - Z80 Code
1705 
1706 	{ "gw02-3h.rom",	0x08000, 0x7acc8d35, 3 | BRF_GRA },	      //  3 - Characters
1707 
1708 	{ "gw06-1c.rom",	0x10000, 0x4ea51631, 4 | BRF_GRA },	      //  4 - Sprites
1709 	{ "gw07-1d.rom",	0x10000, 0xda42637e, 4 | BRF_GRA },	      //  5
1710 	{ "gw08-1f.rom",	0x10000, 0x0b4e8d70, 4 | BRF_GRA },	      //  6
1711 	{ "gw09-1h.rom",	0x10000, 0xb65c5e4c, 4 | BRF_GRA },	      //  7
1712 
1713 	{ "gw10-1n.rom",	0x10000, 0x5e84cd4f, 5 | BRF_GRA },	      //  8 - Foreground Tiles
1714 	{ "gw11-2na.rom",	0x10000, 0x08b458e1, 5 | BRF_GRA },	      //  9
1715 	{ "gw12-2nb.rom",	0x10000, 0x229c9714, 5 | BRF_GRA },	      // 10
1716 	{ "gw13-3n.rom",	0x10000, 0xc5dfaf47, 5 | BRF_GRA },	      // 11
1717 
1718 	{ "gw14-1r.rom",	0x10000, 0x9c10e5b5, 6 | BRF_GRA },	      // 12 - Background Tiles
1719 	{ "gw15-2ra.rom",	0x10000, 0x4cd18cfa, 6 | BRF_GRA },	      // 13
1720 	{ "gw16-2rb.rom",	0x10000, 0xf911c7be, 6 | BRF_GRA },	      // 14
1721 	{ "gw17-3r.rom",	0x10000, 0x79a9ce25, 6 | BRF_GRA },	      // 15
1722 
1723 	{ "gw01-6a.rom",	0x08000, 0xd78afa05, 7 | BRF_SND },	      // 16 - Samples
1724 };
1725 
1726 STD_ROM_PICK(gemini)
1727 STD_ROM_FN(gemini)
1728 
1729 struct BurnDriver BurnDrvGemini = {
1730 	"gemini", NULL, NULL, NULL, "1987",
1731 	"Gemini Wing (World)\0", NULL, "Tecmo", "Miscellaneous",
1732 	NULL, NULL, NULL, NULL,
1733 	BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0,
1734 	NULL, geminiRomInfo, geminiRomName, NULL, NULL, NULL, NULL, GeminiInputInfo, GeminiDIPInfo,
1735 	GeminiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1736 	224, 256, 3, 4
1737 };
1738 
1739 
1740 // Gemini Wing (Japan)
1741 
1742 static struct BurnRomInfo geminijRomDesc[] = {
1743 	{ "gw04-5s.rom",	0x10000, 0xff9de855, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1744 	{ "gw05-6s.rom",	0x10000, 0x5a6947a9, 1 | BRF_PRG | BRF_ESS }, //  1
1745 
1746 	{ "gw03-5h.rom",	0x08000, 0x9bc79596, 2 | BRF_PRG | BRF_ESS }, //  2 - Z80 Code
1747 
1748 	{ "gw02-3h.rom",	0x08000, 0x7acc8d35, 3 | BRF_GRA },	      //  3 - Characters
1749 
1750 	{ "gw06-1c.rom",	0x10000, 0x4ea51631, 4 | BRF_GRA },	      //  4 - Sprites
1751 	{ "gw07-1d.rom",	0x10000, 0xda42637e, 4 | BRF_GRA },	      //  5
1752 	{ "gw08-1f.rom",	0x10000, 0x0b4e8d70, 4 | BRF_GRA },	      //  6
1753 	{ "gw09-1h.rom",	0x10000, 0xb65c5e4c, 4 | BRF_GRA },	      //  7
1754 
1755 	{ "gw10-1n.rom",	0x10000, 0x5e84cd4f, 5 | BRF_GRA },	      //  8 - Foreground Tiles
1756 	{ "gw11-2na.rom",	0x10000, 0x08b458e1, 5 | BRF_GRA },	      //  9
1757 	{ "gw12-2nb.rom",	0x10000, 0x229c9714, 5 | BRF_GRA },	      // 10
1758 	{ "gw13-3n.rom",	0x10000, 0xc5dfaf47, 5 | BRF_GRA },	      // 11
1759 
1760 	{ "gw14-1r.rom",	0x10000, 0x9c10e5b5, 6 | BRF_GRA },	      // 12 - Background Tiles
1761 	{ "gw15-2ra.rom",	0x10000, 0x4cd18cfa, 6 | BRF_GRA },	      // 13
1762 	{ "gw16-2rb.rom",	0x10000, 0xf911c7be, 6 | BRF_GRA },	      // 14
1763 	{ "gw17-3r.rom",	0x10000, 0x79a9ce25, 6 | BRF_GRA },	      // 15
1764 
1765 	{ "gw01-6a.rom",	0x08000, 0xd78afa05, 7 | BRF_SND },	      // 16 - Samples
1766 };
1767 
1768 STD_ROM_PICK(geminij)
1769 STD_ROM_FN(geminij)
1770 
1771 struct BurnDriver BurnDrvGeminij = {
1772 	"geminij", "gemini", NULL, NULL, "1987",
1773 	"Gemini Wing (Japan)\0", NULL, "Tecmo", "Miscellaneous",
1774 	NULL, NULL, NULL, NULL,
1775 	BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0,
1776 	NULL, geminijRomInfo, geminijRomName, NULL, NULL, NULL, NULL, GeminiInputInfo, GeminiDIPInfo,
1777 	GeminiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1778 	224, 256, 3, 4
1779 };
1780 
1781 
1782 // Gemini Wing (World, bootleg)
1783 // f205v id 1293
1784 
1785 static struct BurnRomInfo geminibRomDesc[] = {
1786 	{ "g-2.6d",			0x10000, 0xcd79c5b3, 1 | BRF_PRG | BRF_ESS }, //  0 - Z80 Code
1787 	{ "gw05-6s.rom",	0x10000, 0x5a6947a9, 1 | BRF_PRG | BRF_ESS }, //  1
1788 
1789 	{ "gw03-5h.rom",	0x08000, 0x9bc79596, 2 | BRF_PRG | BRF_ESS }, //  2 - Z80 Code
1790 
1791 	{ "gw02-3h.rom",	0x08000, 0x7acc8d35, 3 | BRF_GRA },	      //  3 - Characters
1792 
1793 	{ "gw06-1c.rom",	0x10000, 0x4ea51631, 4 | BRF_GRA },	      //  4 - Sprites
1794 	{ "gw07-1d.rom",	0x10000, 0xda42637e, 4 | BRF_GRA },	      //  5
1795 	{ "gw08-1f.rom",	0x10000, 0x0b4e8d70, 4 | BRF_GRA },	      //  6
1796 	{ "gw09-1h.rom",	0x10000, 0xb65c5e4c, 4 | BRF_GRA },	      //  7
1797 
1798 	{ "gw10-1n.rom",	0x10000, 0x5e84cd4f, 5 | BRF_GRA },	      //  8 - Foreground Tiles
1799 	{ "gw11-2na.rom",	0x10000, 0x08b458e1, 5 | BRF_GRA },	      //  9
1800 	{ "gw12-2nb.rom",	0x10000, 0x229c9714, 5 | BRF_GRA },	      // 10
1801 	{ "gw13-3n.rom",	0x10000, 0xc5dfaf47, 5 | BRF_GRA },	      // 11
1802 
1803 	{ "gw14-1r.rom",	0x10000, 0x9c10e5b5, 6 | BRF_GRA },	      // 12 - Background Tiles
1804 	{ "gw15-2ra.rom",	0x10000, 0x4cd18cfa, 6 | BRF_GRA },	      // 13
1805 	{ "gw16-2rb.rom",	0x10000, 0xf911c7be, 6 | BRF_GRA },	      // 14
1806 	{ "gw17-3r.rom",	0x10000, 0x79a9ce25, 6 | BRF_GRA },	      // 15
1807 
1808 	{ "gw01-6a.rom",	0x08000, 0xd78afa05, 7 | BRF_SND },	      // 16 - Samples
1809 };
1810 
1811 STD_ROM_PICK(geminib)
1812 STD_ROM_FN(geminib)
1813 
1814 struct BurnDriver BurnDrvGeminib = {
1815 	"geminib", "gemini", NULL, NULL, "1987",
1816 	"Gemini Wing (World, bootleg)\0", NULL, "Tecmo", "Miscellaneous",
1817 	NULL, NULL, NULL, NULL,
1818 	BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0,
1819 	NULL, geminibRomInfo, geminibRomName, NULL, NULL, NULL, NULL, GeminiInputInfo, GeminiDIPInfo,
1820 	GeminiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x400,
1821 	224, 256, 3, 4
1822 };
1823