1 // Crazy Climber FBA Driver
2 // Based on MAME driver by Nicola Salmoria
3
4 #include "tiles_generic.h"
5 #include "z80_intf.h"
6 #include "ay8910.h"
7
8 static UINT8 *AllMem;
9 static UINT8 *MemEnd;
10 static UINT8 *AllRam;
11 static UINT8 *RamEnd;
12 static UINT8 *DrvZ80ROM;
13 static UINT8 *DrvZ80OPS;
14 static UINT8 *DrvGfxROM0;
15 static UINT8 *DrvGfxROM1;
16 static UINT8 *DrvGfxROM2;
17 static UINT8 *DrvColPROM;
18 static UINT8 *DrvSndROM;
19 static UINT8 *DrvUser1;
20 static UINT8 *DrvZ80RAM0;
21 static UINT8 *DrvZ80RAM1;
22 static UINT8 *DrvZ80RAM2;
23 static UINT8 *DrvZ80RAM1_0;
24 static UINT8 *DrvBGSprRAM;
25 static UINT8 *DrvSprRAM;
26 static UINT8 *DrvVidRAM;
27 static UINT8 *DrvColRAM;
28 static INT16 *samplebuf;
29
30 static UINT32 *DrvPalette;
31 static UINT8 DrvRecalc;
32
33 static INT32 DrvGfxROM0Len;
34 static INT32 DrvGfxROM1Len;
35
36 static INT32 flipscreen[2];
37 static INT32 interrupt_enable;
38 static UINT8 yamato_p0;
39 static UINT8 yamato_p1;
40 static UINT8 swimmer_background_color;
41 static UINT8 swimmer_sidebg;
42 static UINT8 swimmer_palettebank;
43 static UINT8 soundlatch;
44
45 static UINT8 DrvReset;
46 static UINT8 DrvJoy1[8];
47 static UINT8 DrvJoy2[8];
48 static UINT8 DrvJoy3[8];
49 static UINT8 DrvJoy4[8];
50 static UINT8 DrvInputs[4];
51 static UINT8 DrvDips[2];
52
53 // per-game constants
54 static INT32 game_select;
55 static INT32 silvland = 0;
56 static INT32 ckong = 0;
57 static INT32 ckongb = 0;
58 static INT32 gfx0_cont800 = 0;
59 static INT32 uses_sub;
60 static UINT8 bigsprite_index;
61
62 static INT32 uses_samples = 0;
63
64 static struct BurnInputInfo CclimberInputList[] = {
65 {"P1 Coin" , BIT_DIGITAL , DrvJoy3 + 0, "p1 coin" },
66 {"P1 Start" , BIT_DIGITAL , DrvJoy3 + 2, "p1 start" },
67
68 {"P1 Up (left)" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" },
69 {"P1 Down (left)" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" },
70 {"P1 Left (left)" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" },
71 {"P1 Right (left)" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" },
72 {"P1 Up (right)" , BIT_DIGITAL , DrvJoy1 + 4, "p3 up" },
73 {"P1 Down (right)" , BIT_DIGITAL , DrvJoy1 + 5, "p3 down" },
74 {"P1 Left (right)" , BIT_DIGITAL , DrvJoy1 + 6, "p3 left" },
75 {"P1 Right (right)" , BIT_DIGITAL , DrvJoy1 + 7, "p3 right" },
76
77 {"P2 Coin" , BIT_DIGITAL , DrvJoy3 + 1, "p2 coin" },
78 {"P2 Start" , BIT_DIGITAL , DrvJoy3 + 3, "p2 start" },
79
80 {"P2 Up (left)" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" },
81 {"P2 Down (left)" , BIT_DIGITAL , DrvJoy2 + 1, "p2 down" },
82 {"P2 Left (left)" , BIT_DIGITAL , DrvJoy2 + 2, "p2 left" },
83 {"P2 Right (left)" , BIT_DIGITAL , DrvJoy2 + 3, "p2 right" },
84 {"P2 Up (right)" , BIT_DIGITAL , DrvJoy2 + 4, "p4 up" },
85 {"P2 Down (right)" , BIT_DIGITAL , DrvJoy2 + 5, "p4 down" },
86 {"P2 Left (right)" , BIT_DIGITAL , DrvJoy2 + 6, "p4 left" },
87 {"P2 Right (right)" , BIT_DIGITAL , DrvJoy2 + 7, "p4 right" },
88
89 {"Reset" , BIT_DIGITAL , &DrvReset , "reset" },
90 {"Dip A" , BIT_DIPSWITCH, DrvDips + 0, "dip" },
91 {"Dip B" , BIT_DIPSWITCH, DrvDips + 1, "dip" },
92 };
93
94 STDINPUTINFO(Cclimber)
95
96 static struct BurnDIPInfo CclimberDIPList[]=
97 {
98 {0x15, 0xff, 0xff, 0x00, NULL },
99 {0x16, 0xff, 0xff, 0xf0, NULL },
100
101 {0 , 0xfe, 0 , 4, "Lives" },
102 {0x15, 0x01, 0x03, 0x00, "3" },
103 {0x15, 0x01, 0x03, 0x01, "4" },
104 {0x15, 0x01, 0x03, 0x02, "5" },
105 {0x15, 0x01, 0x03, 0x03, "6" },
106
107 {0 , 0xfe, 0 , 2, "Rack Test (Cheat)" },
108 {0x15, 0x01, 0x08, 0x00, "Off" },
109 {0x15, 0x01, 0x08, 0x08, "On" },
110
111 {0 , 0xfe, 0 , 4, "Coin A" },
112 {0x15, 0x01, 0x30, 0x30, "4 Coins 1 Credits" },
113 {0x15, 0x01, 0x30, 0x20, "3 Coins 1 Credits" },
114 {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" },
115 {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Credits" },
116
117 {0 , 0xfe, 0 , 4, "Coin B" },
118 {0x15, 0x01, 0xc0, 0x00, "1 Coin 1 Credits" },
119 {0x15, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" },
120 {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" },
121 {0x15, 0x01, 0xc0, 0xc0, "Free Play" },
122
123 {0 , 0xfe, 0 , 2, "Cabinet" },
124 {0x16, 0x01, 0x10, 0x10, "Upright" },
125 {0x16, 0x01, 0x10, 0x00, "Cocktail" },
126 };
127
128 STDDIPINFO(Cclimber)
129
130 static struct BurnDIPInfo CclimberjDIPList[]=
131 {
132 {0x15, 0xff, 0xff, 0x00, NULL },
133 {0x16, 0xff, 0xff, 0xf0, NULL },
134
135 {0 , 0xfe, 0 , 4, "Lives" },
136 {0x15, 0x01, 0x03, 0x00, "3" },
137 {0x15, 0x01, 0x03, 0x01, "4" },
138 {0x15, 0x01, 0x03, 0x02, "5" },
139 {0x15, 0x01, 0x03, 0x03, "6" },
140
141 {0 , 0xfe, 0 , 2, "Bonus_Life" },
142 {0x15, 0x01, 0x04, 0x00, "30000" },
143 {0x15, 0x01, 0x04, 0x04, "50000" },
144
145 {0 , 0xfe, 0 , 2, "Rack Test (Cheat)" },
146 {0x15, 0x01, 0x08, 0x00, "Off" },
147 {0x15, 0x01, 0x08, 0x08, "On" },
148
149 {0 , 0xfe, 0 , 4, "Coin A" },
150 {0x15, 0x01, 0x30, 0x30, "4 Coins 1 Credits" },
151 {0x15, 0x01, 0x30, 0x20, "3 Coins 1 Credits" },
152 {0x15, 0x01, 0x30, 0x10, "2 Coins 1 Credits" },
153 {0x15, 0x01, 0x30, 0x00, "1 Coin 1 Credits" },
154
155 {0 , 0xfe, 0 , 4, "Coin B" },
156 {0x15, 0x01, 0xc0, 0x00, "1 Coin 1 Credits" },
157 {0x15, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" },
158 {0x15, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" },
159 {0x15, 0x01, 0xc0, 0xc0, "Free Play" },
160
161 {0 , 0xfe, 0 , 2, "Cabinet" },
162 {0x16, 0x01, 0x10, 0x10, "Upright" },
163 {0x16, 0x01, 0x10, 0x00, "Cocktail" },
164 };
165
166 STDDIPINFO(Cclimberj)
167
168 static struct BurnInputInfo RpatrolInputList[] = {
169 {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin"},
170 {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start"},
171 {"P1 Left", BIT_DIGITAL, DrvJoy2 + 6, "p1 left"},
172 {"P1 Right", BIT_DIGITAL, DrvJoy2 + 7, "p1 right"},
173 {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 1"},
174
175 {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start"},
176 {"P2 Left", BIT_DIGITAL, DrvJoy1 + 6, "p2 left"},
177 {"P2 Right", BIT_DIGITAL, DrvJoy1 + 7, "p2 right"},
178 {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p2 fire 1"},
179
180 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
181 {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"},
182 };
183
184 STDINPUTINFO(Rpatrol)
185
186 static struct BurnDIPInfo RpatrolDIPList[]=
187 {
188 {0x0a, 0xff, 0xff, 0x90, NULL },
189
190 {0 , 0xfe, 0 , 4, "Coinage" },
191 {0x0a, 0x01, 0x03, 0x02, "2 Coins 1 Credits" },
192 {0x0a, 0x01, 0x03, 0x00, "1 Coin 1 Credits" },
193 {0x0a, 0x01, 0x03, 0x01, "1 Coin 2 Credits" },
194 {0x0a, 0x01, 0x03, 0x03, "Free Play" },
195
196 {0 , 0xfe, 0 , 4, "Lives" },
197 {0x0a, 0x01, 0x0c, 0x00, "3" },
198 {0x0a, 0x01, 0x0c, 0x04, "4" },
199 {0x0a, 0x01, 0x0c, 0x08, "5" },
200 {0x0a, 0x01, 0x0c, 0x0c, "6" },
201
202 {0 , 0xfe, 0 , 2, "Cabinet" },
203 {0x0a, 0x01, 0x10, 0x10, "Upright" },
204 {0x0a, 0x01, 0x10, 0x00, "Cocktail" },
205
206 {0 , 0xfe, 0 , 2, "Unknown 1" },
207 {0x0a, 0x01, 0x20, 0x00, "Off" },
208 {0x0a, 0x01, 0x20, 0x20, "On" },
209
210 {0 , 0xfe, 0 , 2, "Unknown 2" },
211 {0x0a, 0x01, 0x40, 0x00, "Off" },
212 {0x0a, 0x01, 0x40, 0x40, "On" },
213
214 {0 , 0xfe, 0 , 2, "Memory Test" },
215 {0x0a, 0x01, 0x80, 0x00, "Retry on Error" },
216 {0x0a, 0x01, 0x80, 0x80, "Stop on Error" },
217 };
218
219 STDDIPINFO(Rpatrol)
220
221 static struct BurnInputInfo CkongInputList[] = {
222 {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p1 coin"},
223 {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start"},
224 {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up"},
225 {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down"},
226 {"P1 Left", BIT_DIGITAL, DrvJoy1 + 6, "p1 left"},
227 {"P1 Right", BIT_DIGITAL, DrvJoy1 + 7, "p1 right"},
228 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 1"},
229
230 {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p2 coin"},
231 {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start"},
232 {"P2 Up", BIT_DIGITAL, DrvJoy2 + 4, "p2 up"},
233 {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down"},
234 {"P2 Left", BIT_DIGITAL, DrvJoy2 + 6, "p2 left"},
235 {"P2 Right", BIT_DIGITAL, DrvJoy2 + 7, "p2 right"},
236 {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 1"},
237
238 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
239 {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"},
240 };
241
242 STDINPUTINFO(Ckong)
243
244
245 static struct BurnDIPInfo CkongDIPList[]=
246 {
247 {0x0f, 0xff, 0xff, 0x80, NULL },
248
249 {0 , 0xfe, 0 , 4, "Lives" },
250 {0x0f, 0x01, 0x03, 0x00, "3" },
251 {0x0f, 0x01, 0x03, 0x01, "4" },
252 {0x0f, 0x01, 0x03, 0x02, "5" },
253 {0x0f, 0x01, 0x03, 0x03, "6" },
254
255 {0 , 0xfe, 0 , 4, "Bonus Life" },
256 {0x0f, 0x01, 0x0c, 0x00, "7000" },
257 {0x0f, 0x01, 0x0c, 0x04, "10000" },
258 {0x0f, 0x01, 0x0c, 0x08, "15000" },
259 {0x0f, 0x01, 0x0c, 0x0c, "20000" },
260
261 {0 , 0xfe, 0 , 8, "Coinage" },
262 {0x0f, 0x01, 0x70, 0x70, "5 Coins 1 Credits" },
263 {0x0f, 0x01, 0x70, 0x50, "4 Coins 1 Credits" },
264 {0x0f, 0x01, 0x70, 0x30, "3 Coins 1 Credits" },
265 {0x0f, 0x01, 0x70, 0x10, "2 Coins 1 Credits" },
266 {0x0f, 0x01, 0x70, 0x00, "1 Coin 1 Credits" },
267 {0x0f, 0x01, 0x70, 0x20, "1 Coin 2 Credits" },
268 {0x0f, 0x01, 0x70, 0x40, "1 Coin 3 Credits" },
269 {0x0f, 0x01, 0x70, 0x60, "1 Coin 4 Credits" },
270
271 {0 , 0xfe, 0 , 2, "Cabinet" },
272 {0x0f, 0x01, 0x80, 0x80, "Upright" },
273 {0x0f, 0x01, 0x80, 0x00, "Cocktail" },
274 };
275
276 STDDIPINFO(Ckong)
277
278 static struct BurnDIPInfo CkongbDIPList[]=
279 {
280 {0x0f, 0xff, 0xff, 0x82, NULL },
281
282 {0 , 0xfe, 0 , 4, "Lives" },
283 {0x0f, 0x01, 0x03, 0x00, "1" },
284 {0x0f, 0x01, 0x03, 0x01, "2" },
285 {0x0f, 0x01, 0x03, 0x02, "3" },
286 {0x0f, 0x01, 0x03, 0x03, "4" },
287
288 {0 , 0xfe, 0 , 4, "Bonus Life" },
289 {0x0f, 0x01, 0x0c, 0x00, "7000" },
290 {0x0f, 0x01, 0x0c, 0x04, "10000" },
291 {0x0f, 0x01, 0x0c, 0x08, "15000" },
292 {0x0f, 0x01, 0x0c, 0x0c, "20000" },
293
294 {0 , 0xfe, 0 , 8, "Coinage" },
295 {0x0f, 0x01, 0x70, 0x70, "5 Coins 1 Credits" },
296 {0x0f, 0x01, 0x70, 0x50, "4 Coins 1 Credits" },
297 {0x0f, 0x01, 0x70, 0x30, "3 Coins 1 Credits" },
298 {0x0f, 0x01, 0x70, 0x10, "2 Coins 1 Credits" },
299 {0x0f, 0x01, 0x70, 0x00, "1 Coin 1 Credits" },
300 {0x0f, 0x01, 0x70, 0x20, "1 Coin 2 Credits" },
301 {0x0f, 0x01, 0x70, 0x40, "1 Coin 3 Credits" },
302 {0x0f, 0x01, 0x70, 0x60, "1 Coin 4 Credits" },
303
304 {0 , 0xfe, 0 , 2, "Cabinet" },
305 {0x0f, 0x01, 0x80, 0x80, "Upright" },
306 {0x0f, 0x01, 0x80, 0x00, "Cocktail" },
307 };
308
309 STDDIPINFO(Ckongb)
310
311 static struct BurnDIPInfo Ckongb2DIPList[]=
312 {
313 {0x0f, 0xff, 0xff, 0x81, NULL },
314
315 {0 , 0xfe, 0 , 4, "Lives" },
316 {0x0f, 0x01, 0x03, 0x00, "2" },
317 {0x0f, 0x01, 0x03, 0x01, "3" },
318 {0x0f, 0x01, 0x03, 0x02, "4" },
319 {0x0f, 0x01, 0x03, 0x03, "5" },
320
321 {0 , 0xfe, 0 , 4, "Bonus Life" },
322 {0x0f, 0x01, 0x0c, 0x00, "7000" },
323 {0x0f, 0x01, 0x0c, 0x04, "10000" },
324 {0x0f, 0x01, 0x0c, 0x08, "15000" },
325 {0x0f, 0x01, 0x0c, 0x0c, "20000" },
326
327 {0 , 0xfe, 0 , 8, "Coinage" },
328 {0x0f, 0x01, 0x70, 0x70, "5 Coins 1 Credits" },
329 {0x0f, 0x01, 0x70, 0x50, "4 Coins 1 Credits" },
330 {0x0f, 0x01, 0x70, 0x30, "3 Coins 1 Credits" },
331 {0x0f, 0x01, 0x70, 0x10, "2 Coins 1 Credits" },
332 {0x0f, 0x01, 0x70, 0x00, "1 Coin 1 Credits" },
333 {0x0f, 0x01, 0x70, 0x20, "1 Coin 2 Credits" },
334 {0x0f, 0x01, 0x70, 0x40, "1 Coin 3 Credits" },
335 {0x0f, 0x01, 0x70, 0x60, "1 Coin 4 Credits" },
336
337 {0 , 0xfe, 0 , 2, "Cabinet" },
338 {0x0f, 0x01, 0x80, 0x80, "Upright" },
339 {0x0f, 0x01, 0x80, 0x00, "Cocktail" },
340 };
341
342 STDDIPINFO(Ckongb2)
343
344
345
346 static struct BurnInputInfo GuzzlerInputList[] = {
347 {"P1 Coin", BIT_DIGITAL, DrvJoy4 + 0, "p1 coin"},
348 {"P1 Start", BIT_DIGITAL, DrvJoy4 + 2, "p1 start"},
349 {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up"},
350 {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"},
351 {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"},
352 {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right"},
353 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"},
354
355 {"P2 Coin", BIT_DIGITAL, DrvJoy4 + 1, "p2 coin"},
356 {"P2 Start", BIT_DIGITAL, DrvJoy4 + 3, "p2 start"},
357 {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up"},
358 {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"},
359 {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"},
360 {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right"},
361 {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"},
362
363 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
364 {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"},
365 {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"},
366 };
367
368 STDINPUTINFO(Guzzler)
369
370
371 static struct BurnDIPInfo GuzzlerDIPList[]=
372 {
373 {0x0f, 0xff, 0xff, 0x00, NULL },
374 {0x10, 0xff, 0xff, 0x10, NULL },
375
376 {0 , 0xfe, 0 , 4, "Lives" },
377 {0x0f, 0x01, 0x03, 0x00, "3" },
378 {0x0f, 0x01, 0x03, 0x01, "4" },
379 {0x0f, 0x01, 0x03, 0x02, "5" },
380 {0x0f, 0x01, 0x03, 0x03, "Infinite (Cheat)" },
381
382 {0 , 0xfe, 0 , 4, "Bonus Life" },
383 {0x0f, 0x01, 0x0c, 0x04, "20K, every 50K" },
384 {0x0f, 0x01, 0x0c, 0x00, "30K, every 100K" },
385 {0x0f, 0x01, 0x0c, 0x08, "30K only" },
386 {0x0f, 0x01, 0x0c, 0x0c, "None" },
387
388 {0 , 0xfe, 0 , 4, "Coin A" },
389 {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Credits" },
390 {0x0f, 0x01, 0x30, 0x00, "1 Coin 1 Credits" },
391 {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Credits" },
392 {0x0f, 0x01, 0x30, 0x30, "1 Coin 3 Credits" },
393
394 {0 , 0xfe, 0 , 4, "Coin B" },
395 {0x0f, 0x01, 0xc0, 0x00, "1 Coin 1 Credits" },
396 {0x0f, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" },
397 {0x0f, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" },
398 {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" },
399
400 {0 , 0xfe, 0 , 2, "Cabinet" },
401 {0x10, 0x01, 0x10, 0x10, "Upright" },
402 {0x10, 0x01, 0x10, 0x00, "Cocktail" },
403
404 {0 , 0xfe, 0 , 2, "High Score Names" },
405 {0x10, 0x01, 0x20, 0x20, "3 Letters" },
406 {0x10, 0x01, 0x20, 0x00, "10 Letters" },
407
408 {0 , 0xfe, 0 , 4, "Difficulty" },
409 {0x10, 0x01, 0xc0, 0x00, "Easy" },
410 {0x10, 0x01, 0xc0, 0x40, "Medium" },
411 {0x10, 0x01, 0xc0, 0x80, "Hard" },
412 {0x10, 0x01, 0xc0, 0xc0, "Hardest" },
413 };
414
415 STDDIPINFO(Guzzler)
416
417
418 static struct BurnInputInfo YamatoInputList[] = {
419 {"P1 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p1 coin"},
420 {"P1 Start", BIT_DIGITAL, DrvJoy4 + 2, "p1 start"},
421 {"P1 Up", BIT_DIGITAL, DrvJoy1 + 4, "p1 up"},
422 {"P1 Down", BIT_DIGITAL, DrvJoy1 + 5, "p1 down"},
423 {"P1 Left", BIT_DIGITAL, DrvJoy1 + 6, "p1 left"},
424 {"P1 Right", BIT_DIGITAL, DrvJoy1 + 7, "p1 right"},
425 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 1"},
426 {"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 2"},
427
428 {"P2 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p2 coin"},
429 {"P2 Start", BIT_DIGITAL, DrvJoy4 + 3, "p2 start"},
430 {"P2 Up", BIT_DIGITAL, DrvJoy2 + 4, "p2 up"},
431 {"P2 Down", BIT_DIGITAL, DrvJoy2 + 5, "p2 down"},
432 {"P2 Left", BIT_DIGITAL, DrvJoy2 + 6, "p2 left"},
433 {"P2 Right", BIT_DIGITAL, DrvJoy2 + 7, "p2 right"},
434 {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 1"},
435 {"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 2"},
436
437 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
438 {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"},
439 };
440
441 STDINPUTINFO(Yamato)
442
443
444 static struct BurnDIPInfo YamatoDIPList[]=
445 {
446 {0x11, 0xff, 0xff, 0x80, NULL },
447
448 {0 , 0xfe, 0 , 4, "Lives" },
449 {0x11, 0x01, 0x03, 0x00, "3" },
450 {0x11, 0x01, 0x03, 0x01, "4" },
451 {0x11, 0x01, 0x03, 0x02, "5" },
452 {0x11, 0x01, 0x03, 0x03, "6" },
453
454 {0 , 0xfe, 0 , 8, "Coin A" },
455 {0x11, 0x01, 0x1c, 0x0c, "4 Coins 1 Credits" },
456 {0x11, 0x01, 0x1c, 0x08, "3 Coins 1 Credits" },
457 {0x11, 0x01, 0x1c, 0x04, "2 Coins 1 Credits" },
458 {0x11, 0x01, 0x1c, 0x00, "1 Coin 1 Credits" },
459 {0x11, 0x01, 0x1c, 0x18, "2 Coins 3 Credits" },
460 {0x11, 0x01, 0x1c, 0x10, "1 Coin 2 Credits" },
461 {0x11, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" },
462 {0x11, 0x01, 0x1c, 0x1c, "Free Play" },
463
464 {0 , 0xfe, 0 , 2, "Bonus Life" },
465 {0x11, 0x01, 0x20, 0x00, "Every 30000" },
466 {0x11, 0x01, 0x20, 0x20, "Every 50000" },
467
468 {0 , 0xfe, 0 , 2, "Speed" },
469 {0x11, 0x01, 0x40, 0x00, "Slow" },
470 {0x11, 0x01, 0x40, 0x40, "Fast" },
471
472 {0 , 0xfe, 0 , 2, "Cabinet" },
473 {0x11, 0x01, 0x80, 0x80, "Upright" },
474 {0x11, 0x01, 0x80, 0x00, "Cocktail" },
475 };
476
477 STDDIPINFO(Yamato)
478
479 static struct BurnInputInfo SwimmerInputList[] = {
480 {"P1 Coin", BIT_DIGITAL, DrvJoy4 + 0, "p1 coin"},
481 {"P1 Start", BIT_DIGITAL, DrvJoy3 + 2, "p1 start"},
482 {"P1 Up", BIT_DIGITAL, DrvJoy1 + 2, "p1 up"},
483 {"P1 Down", BIT_DIGITAL, DrvJoy1 + 3, "p1 down"},
484 {"P1 Left", BIT_DIGITAL, DrvJoy1 + 1, "p1 left"},
485 {"P1 Right", BIT_DIGITAL, DrvJoy1 + 0, "p1 right"},
486 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"},
487
488 {"P2 Coin", BIT_DIGITAL, DrvJoy4 + 1, "p2 coin"},
489 {"P2 Start", BIT_DIGITAL, DrvJoy3 + 3, "p2 start"},
490 {"P2 Up", BIT_DIGITAL, DrvJoy2 + 2, "p2 up"},
491 {"P2 Down", BIT_DIGITAL, DrvJoy2 + 3, "p2 down"},
492 {"P2 Left", BIT_DIGITAL, DrvJoy2 + 1, "p2 left"},
493 {"P2 Right", BIT_DIGITAL, DrvJoy2 + 0, "p2 right"},
494 {"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1"},
495
496 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
497 {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip"},
498 {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip"},
499 };
500
501 STDINPUTINFO(Swimmer)
502
503
504 static struct BurnDIPInfo SwimmerDIPList[]=
505 {
506 {0x0f, 0xff, 0xff, 0x00, NULL },
507 {0x10, 0xff, 0xff, 0x30, NULL },
508
509 {0 , 0xfe, 0 , 4, "Lives" },
510 {0x0f, 0x01, 0x03, 0x00, "3" },
511 {0x0f, 0x01, 0x03, 0x01, "4" },
512 {0x0f, 0x01, 0x03, 0x02, "5" },
513 {0x0f, 0x01, 0x03, 0x03, "Infinite (Cheat)" },
514
515 {0 , 0xfe, 0 , 4, "Bonus Life" },
516 {0x0f, 0x01, 0x0c, 0x00, "10000" },
517 {0x0f, 0x01, 0x0c, 0x04, "20000" },
518 {0x0f, 0x01, 0x0c, 0x08, "30000" },
519 {0x0f, 0x01, 0x0c, 0x0c, "None" },
520
521 {0 , 0xfe, 0 , 4, "Coin A" },
522 {0x0f, 0x01, 0x30, 0x10, "2 Coins 1 Credits" },
523 {0x0f, 0x01, 0x30, 0x00, "1 Coin 1 Credits" },
524 {0x0f, 0x01, 0x30, 0x20, "1 Coin 2 Credits" },
525 {0x0f, 0x01, 0x30, 0x30, "1 Coin 3 Credits" },
526
527 {0 , 0xfe, 0 , 4, "Coin B" },
528 {0x0f, 0x01, 0xc0, 0x00, "1 Coin 1 Credits" },
529 {0x0f, 0x01, 0xc0, 0x40, "1 Coin 2 Credits" },
530 {0x0f, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" },
531 {0x0f, 0x01, 0xc0, 0xc0, "1 Coin 6 Credits" },
532
533 {0 , 0xfe, 0 , 2, "Cabinet" },
534 {0x10, 0x01, 0x10, 0x10, "Upright" },
535 {0x10, 0x01, 0x10, 0x00, "Cocktail" },
536
537 {0 , 0xfe, 0 , 2, "Demo Sounds" },
538 {0x10, 0x01, 0x20, 0x00, "Off" },
539 {0x10, 0x01, 0x20, 0x20, "On" },
540
541 {0 , 0xfe, 0 , 4, "Difficulty" },
542 {0x10, 0x01, 0xc0, 0x00, "Easy" },
543 {0x10, 0x01, 0xc0, 0x40, "Hard" },
544 {0x10, 0x01, 0xc0, 0x80, "Harder" },
545 {0x10, 0x01, 0xc0, 0xc0, "Hardest" },
546 };
547
548 STDDIPINFO(Swimmer)
549
550 // cclimber sample player
551 static INT32 sample_num = 0;
552 static INT32 sample_freq = 0;
553 static INT32 sample_vol = 0;
554
555 static INT32 sample_len = 0;
556 static INT32 sample_pos = -1; // -1 not playing, 0 start
557
cclimber_render(INT16 * buffer,INT32 nLen)558 static void cclimber_render(INT16 *buffer, INT32 nLen)
559 {
560 if (sample_pos < 0) return; // stopped
561
562 if ((sample_pos >> 16) >= 0x10000 ) {
563 sample_pos = -1; // stop
564 return;
565 }
566
567 INT32 step = (sample_freq << 16) / nBurnSoundRate;
568 INT32 pos = 0;
569 INT16 *rom = samplebuf;
570
571 while (pos < nLen)
572 {
573 INT32 sample = (INT32)(rom[(sample_pos >> 16)] * 0.2);
574
575 buffer[0] = BURN_SND_CLIP((INT32)(buffer[0] + sample));
576 buffer[1] = BURN_SND_CLIP((INT32)(buffer[1] + sample));
577
578 sample_pos += step;
579
580 buffer+=2;
581 pos++;
582
583 if (sample_pos >= 0xfff0000 || (sample_pos >> 16) >= sample_len) {
584 sample_pos = -1; // stop
585 break;
586 }
587 }
588 }
589
590 // 4bit decoder from mame
591 #define SAMPLE_CONV4(a) (0x1111*((a&0x0f))-0x8000)
592
sample_start()593 static void sample_start()
594 {
595 const UINT8 *rom = DrvSndROM;
596
597 if (!rom || !uses_samples) return;
598
599 INT32 len = 0;
600 INT32 start = 32 * sample_num;
601
602 while (start + len < 0x2000 && rom[start+len] != 0x70)
603 {
604 INT32 sample;
605
606 sample = (rom[start + len] & 0xf0) >> 4;
607 samplebuf[2*len] = SAMPLE_CONV4(sample) * sample_vol / 31;
608
609 sample = rom[start + len] & 0x0f;
610 samplebuf[2*len + 1] = SAMPLE_CONV4(sample) * sample_vol / 31;
611
612 len++;
613 }
614 sample_len = len * 2;
615 sample_pos = 0;
616 }
617
618 // end sample player
619
cclimber_write(UINT16 address,UINT8 data)620 static void __fastcall cclimber_write(UINT16 address, UINT8 data)
621 {
622 if (address >= 0x9c00 && address <= 0x9fff) {
623 INT32 offset = (address - 0x9c00) & 0x0fdf;
624 DrvColRAM[offset] = data;
625 DrvColRAM[offset + 0x20] = data;
626 return;
627 }
628
629 switch (address)
630 {
631 case 0xa000:
632 interrupt_enable = data;
633 return;
634
635 case 0xa001:
636 case 0xa002:
637 // Note: coctail can't be unflipped without breaking other games :(
638 // Note2: find a better way..
639 flipscreen[address & 1] = data & 1;
640 return;
641
642 case 0xa003:
643 if (game_select == 6) {
644 swimmer_sidebg = data;
645 }
646 if (ckongb) interrupt_enable = data;
647 return;
648
649 case 0xa004:
650 if (data != 0) sample_start();
651 if (game_select == 6) {
652 swimmer_palettebank = data;
653 }
654 return;
655
656 case 0xa800:
657 sample_freq = 3072000 / 4 / (256 - data);
658 if (game_select == 6) {
659 soundlatch = data;
660 ZetClose();
661 ZetOpen(1);
662 ZetSetVector(0xff);
663 ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
664 ZetClose();
665 ZetOpen(0);
666 }
667 return;
668
669 case 0xb000:
670 sample_vol = data & 0x1f;
671 return;
672
673 case 0xb800:
674 if (game_select == 6) {
675 swimmer_background_color = data;
676 }
677 return;
678 }
679
680 return;
681 }
682
cclimber_read(UINT16 address)683 static UINT8 __fastcall cclimber_read(UINT16 address)
684 {
685 if (game_select == 6) { // swimmer hack for lazy.
686 switch (address)
687 {
688 case 0xa000:
689 return DrvInputs[1];
690 case 0xa800:
691 return DrvInputs[0];
692 case 0xb000:
693 return DrvDips[0];
694 case 0xb800:
695 return DrvDips[1] | DrvInputs[2];
696 case 0xb880:
697 return DrvInputs[3];
698 }
699
700 return 0;
701 }
702
703 switch (address)
704 {
705 case 0xa000:
706 return DrvInputs[0];
707 case 0xa800:
708 return DrvInputs[1];
709 case 0xb000:
710 return DrvDips[0];
711 case 0xb800:
712 return (DrvDips[1] & 0x10) | (DrvInputs[2] & ~0x10);
713 case 0xba00:
714 return DrvInputs[3];
715
716 }
717
718 return 0;
719 }
720
swimmer_sub_read(UINT16 address)721 static UINT8 __fastcall swimmer_sub_read(UINT16 address)
722 {
723 switch (address)
724 {
725 case 0x3000:
726 ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
727 return soundlatch;
728 }
729
730 return 0;
731 }
732
cclimber_out(UINT16 port,UINT8 data)733 static void __fastcall cclimber_out(UINT16 port, UINT8 data)
734 {
735 switch (port & 0xff)
736 {
737 case 0x08:
738 case 0x09:
739 if (game_select != 5) AY8910Write(0, port & 1, data);
740 return;
741 case 0x00:
742 yamato_p0 = data;
743 return;
744 case 0x01:
745 yamato_p1 = data;
746 return;
747 }
748
749 return;
750 }
751
cclimber_in(UINT16 port)752 static UINT8 __fastcall cclimber_in(UINT16 port)
753 {
754 switch (port & 0xff)
755 {
756 case 0x0c:
757 return AY8910Read(0);
758 }
759
760 return 0;
761 }
762
sub_out(UINT16 port,UINT8 data)763 static void __fastcall sub_out(UINT16 port, UINT8 data)
764 {
765 port &= 0xff;
766
767 if (game_select == 6) { // swimmer / guzzler
768 switch (port)
769 {
770 case 0x00:
771 case 0x01:
772 case 0x80:
773 case 0x81:
774 AY8910Write((port)>>7, ~port & 1, data);
775 return;
776 }
777
778 return;
779 }
780
781 switch (port)
782 {
783 case 0x00:
784 case 0x01:
785 case 0x02:
786 case 0x03:
787 AY8910Write((port&2)>>1, port & 1, data);
788 return;
789 }
790
791 return;
792 }
793
sub_in(UINT16 port)794 static UINT8 __fastcall sub_in(UINT16 port)
795 {
796 switch (port & 0xff)
797 {
798 case 0x04:
799 return yamato_p0;
800 case 0x08:
801 return yamato_p1;
802 }
803
804 return 0;
805 }
806
807
DrvDoReset()808 static INT32 DrvDoReset()
809 {
810 DrvReset = 0;
811
812 memset(AllRam, 0, RamEnd - AllRam);
813
814 flipscreen[0] = flipscreen[1] = 0;
815 interrupt_enable = 0;
816
817 bigsprite_index = (game_select == 6) ? 0xfc : 0xdc;
818
819 yamato_p0 = yamato_p1 = 0;
820 swimmer_background_color = swimmer_sidebg = swimmer_palettebank = soundlatch = 0;
821
822 ZetOpen(0);
823 ZetReset();
824 ZetClose();
825
826 if (uses_sub) {
827 ZetOpen(1);
828 ZetReset();
829 ZetClose();
830 }
831
832 AY8910Reset(0);
833 AY8910Reset(1);
834
835 return 0;
836 }
837
cclimber_sample_select_w(UINT32,UINT32 data)838 static void cclimber_sample_select_w(UINT32, UINT32 data)
839 {
840 sample_num = data;
841 }
842
MemIndex()843 static INT32 MemIndex()
844 {
845 UINT8 *Next; Next = AllMem;
846
847 DrvZ80ROM = Next; Next += 0x0010000;
848 DrvZ80OPS = Next; Next += 0x0010000;
849
850 DrvGfxROM0 = Next; Next += 0x0060000;
851 DrvGfxROM1 = Next; Next += 0x0060000;
852 DrvGfxROM2 = Next; Next += 0x0060000;
853
854 DrvColPROM = Next; Next += 0x0000300;
855
856 DrvSndROM = Next; Next += 0x0012000;
857
858 samplebuf = (INT16*)Next; Next += 0x0010000 * sizeof(INT16); //decoded sample
859
860 DrvUser1 = Next; Next += 0x0010000;
861
862 DrvPalette = (UINT32*)Next; Next += 0x0200 * sizeof(UINT32);
863
864 AllRam = Next;
865
866 DrvZ80RAM0 = Next; Next += 0x0000c00;
867 DrvZ80RAM1 = Next; Next += 0x0000800;
868 DrvZ80RAM2 = Next; Next += 0x0000800;
869 DrvZ80RAM1_0 = Next; Next += 0x0001000;
870 DrvBGSprRAM = Next; Next += 0x0000100;
871 DrvSprRAM = Next; Next += 0x0000400;
872 DrvColRAM = Next; Next += 0x0000400;
873 DrvVidRAM = Next; Next += 0x0000400;
874
875 RamEnd = Next;
876 MemEnd = Next;
877
878 return 0;
879 }
880
DrvGfxDecode(UINT8 * gfx_base,UINT8 * gfx_dest,INT32 len,INT32 size)881 static INT32 DrvGfxDecode(UINT8 *gfx_base, UINT8 *gfx_dest, INT32 len, INT32 size)
882 {
883 INT32 Plane[2] = { 0, (len / 2) * 8 };
884 INT32 PlaneSwimmer[3] = { 0, RGN_FRAC(len, 1, 3), RGN_FRAC(len, 2, 3) };
885 INT32 XOffs[16] = { STEP8(0,1), STEP8(64,1) };
886 INT32 YOffs[16] = { STEP8(0,8), STEP8(128,8) };
887
888 UINT8 *tmp = (UINT8*)BurnMalloc(len);
889 if (tmp == NULL) {
890 return 1;
891 }
892
893 memcpy (tmp, gfx_base, len);
894 if (game_select == 6) { // swimmer, guzzler
895 GfxDecode(((len * 8) / 3) / (size * size), 3, size, size, PlaneSwimmer, XOffs, YOffs, (size * size), tmp, gfx_dest);
896 } else {
897 GfxDecode(((len * 8) / 2) / (size * size), 2, size, size, Plane, XOffs, YOffs, (size * size), tmp, gfx_dest);
898 }
899
900 BurnFree (tmp);
901
902 return 0;
903 }
904
DrvPaletteInit()905 static void DrvPaletteInit()
906 {
907 for (INT32 i = 0;i < 96; i++)
908 {
909 INT32 bit0, bit1, bit2;
910 INT32 r, g, b;
911
912 bit0 = (DrvColPROM[i] >> 0) & 0x01;
913 bit1 = (DrvColPROM[i] >> 1) & 0x01;
914 bit2 = (DrvColPROM[i] >> 2) & 0x01;
915 r = bit0 * 33 + bit1 * 71 + bit2 * 151;
916 r = (int)(r + 0.5);
917
918 bit0 = (DrvColPROM[i] >> 3) & 0x01;
919 bit1 = (DrvColPROM[i] >> 4) & 0x01;
920 bit2 = (DrvColPROM[i] >> 5) & 0x01;
921 g = bit0 * 33 + bit1 * 71 + bit2 * 151;
922 g = (int)(g + 0.5);
923
924 bit0 = (DrvColPROM[i] >> 6) & 0x01;
925 bit1 = (DrvColPROM[i] >> 7) & 0x01;
926 b = bit0 * 71 + bit1 * 151;
927 b = (int)(b + 0.5);
928
929 DrvPalette[i] = BurnHighCol(r, g, b, 0);
930 }
931 if (silvland) {
932 bprintf(0, _T("silvlandpalette"));
933 DrvPalette[0x42] = BurnHighCol(0xff, 0xce, 0xce, 0);
934 }
935 }
936
YamatoPaletteInit()937 static void YamatoPaletteInit()
938 {
939 const UINT8 *color_prom = DrvColPROM;
940 int i;
941
942 /* chars - 12 bits RGB */
943 for (i = 0; i < 0x40; i++)
944 {
945 int bit0, bit1, bit2, bit3;
946 int r, g, b;
947
948 /* red component */
949 bit0 = (color_prom[i + 0x00] >> 0) & 0x01;
950 bit1 = (color_prom[i + 0x00] >> 1) & 0x01;
951 bit2 = (color_prom[i + 0x00] >> 2) & 0x01;
952 bit3 = (color_prom[i + 0x00] >> 3) & 0x01;
953 r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
954
955 /* green component */
956 bit0 = (color_prom[i + 0x00] >> 4) & 0x01;
957 bit1 = (color_prom[i + 0x00] >> 5) & 0x01;
958 bit2 = (color_prom[i + 0x00] >> 6) & 0x01;
959 bit3 = (color_prom[i + 0x00] >> 7) & 0x01;
960 g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
961
962 /* blue component */
963 bit0 = (color_prom[i + 0x40] >> 0) & 0x01;
964 bit1 = (color_prom[i + 0x40] >> 1) & 0x01;
965 bit2 = (color_prom[i + 0x40] >> 2) & 0x01;
966 bit3 = (color_prom[i + 0x40] >> 3) & 0x01;
967 b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
968
969 DrvPalette[i] = BurnHighCol(r, g, b, 0);
970 }
971
972 /* big sprite - 8 bits RGB */
973 for (i = 0; i < 0x20; i++)
974 {
975 int bit0, bit1, bit2;
976 int r, g, b;
977
978 /* red component */
979 bit0 = (color_prom[i + 0x80] >> 0) & 0x01;
980 bit1 = (color_prom[i + 0x80] >> 1) & 0x01;
981 bit2 = (color_prom[i + 0x80] >> 2) & 0x01;
982 r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
983
984 /* green component */
985 bit0 = (color_prom[i + 0x80] >> 3) & 0x01;
986 bit1 = (color_prom[i + 0x80] >> 4) & 0x01;
987 bit2 = (color_prom[i + 0x80] >> 5) & 0x01;
988 g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
989
990 /* blue component */
991 bit0 = 0;
992 bit1 = (color_prom[i + 0x80] >> 6) & 0x01;
993 bit2 = (color_prom[i + 0x80] >> 7) & 0x01;
994 b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
995
996 DrvPalette[i + 0x40] = BurnHighCol(r, g, b, 0);
997 }
998
999 /* fake colors for bg gradient */
1000 for (i = 0; i < 0x100; i++)
1001 DrvPalette[i + 0x60] = BurnHighCol(0, 0, i, 0);
1002 }
1003
swimmer_set_background_pen()1004 void swimmer_set_background_pen()
1005 {
1006 int bit0, bit1, bit2;
1007 int r, g, b;
1008
1009 /* red component */
1010 bit0 = 0;
1011 bit1 = (swimmer_background_color >> 6) & 0x01;
1012 bit2 = (swimmer_background_color >> 7) & 0x01;
1013 r = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
1014
1015 /* green component */
1016 bit0 = (swimmer_background_color >> 3) & 0x01;
1017 bit1 = (swimmer_background_color >> 4) & 0x01;
1018 bit2 = (swimmer_background_color >> 5) & 0x01;
1019 g = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
1020
1021 /* blue component */
1022 bit0 = (swimmer_background_color >> 0) & 0x01;
1023 bit1 = (swimmer_background_color >> 1) & 0x01;
1024 bit2 = (swimmer_background_color >> 2) & 0x01;
1025 b = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
1026
1027 DrvPalette[0x00] = BurnHighCol(r, g, b, 0);
1028 }
1029
SwimmerPaletteInit()1030 static void SwimmerPaletteInit()
1031 {
1032 const UINT8 *color_prom = DrvColPROM;
1033 int i;
1034
1035 for (i = 0; i < 0x100; i++)
1036 {
1037 int bit0, bit1, bit2;
1038 int r, g, b;
1039
1040 /* red component */
1041 bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
1042 bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
1043 bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
1044 r = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
1045
1046 /* green component */
1047 bit0 = (color_prom[i + 0x000] >> 3) & 0x01;
1048 bit1 = (color_prom[i + 0x100] >> 0) & 0x01;
1049 bit2 = (color_prom[i + 0x100] >> 1) & 0x01;
1050 g = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
1051
1052 /* blue component */
1053 bit0 = 0;
1054 bit1 = (color_prom[i + 0x100] >> 2) & 0x01;
1055 bit2 = (color_prom[i + 0x100] >> 3) & 0x01;
1056 b = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
1057
1058 DrvPalette[i] = BurnHighCol(r, g, b, 0);
1059 }
1060
1061 color_prom += 0x200;
1062
1063 /* big sprite */
1064 for (i = 0; i < 0x20; i++)
1065 {
1066 int bit0, bit1, bit2;
1067 int r, g, b;
1068
1069 /* red component */
1070 bit0 = (color_prom[i] >> 0) & 0x01;
1071 bit1 = (color_prom[i] >> 1) & 0x01;
1072 bit2 = (color_prom[i] >> 2) & 0x01;
1073 r = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
1074
1075 /* green component */
1076 bit0 = (color_prom[i] >> 3) & 0x01;
1077 bit1 = (color_prom[i] >> 4) & 0x01;
1078 bit2 = (color_prom[i] >> 5) & 0x01;
1079 g = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
1080
1081 /* blue component */
1082 bit0 = 0;
1083 bit1 = (color_prom[i] >> 6) & 0x01;
1084 bit2 = (color_prom[i] >> 7) & 0x01;
1085 b = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
1086
1087 DrvPalette[i + 0x100] = BurnHighCol(r, g, b, 0);
1088 }
1089
1090 /* side panel backgrond pen */
1091 DrvPalette[0x120] = BurnHighCol(0x20, 0x98, 0x79, 0);
1092
1093 swimmer_set_background_pen();
1094 }
1095
cclimber_decode(const INT8 convtable[8][16])1096 static void cclimber_decode(const INT8 convtable[8][16])
1097 {
1098 UINT8 *rom = DrvZ80ROM;
1099 UINT8 *decrypt = DrvZ80OPS;
1100 INT32 A;
1101
1102 ZetOpen(0);
1103 ZetMapArea(0x0000, 0x5fff, 2, DrvZ80OPS, DrvZ80ROM);
1104 ZetClose();
1105
1106 for (A = 0x0000;A < 0x10000;A++)
1107 {
1108 INT32 i,j;
1109 UINT8 src;
1110
1111 src = rom[A];
1112
1113 /* pick the translation table from bit 0 of the address */
1114 /* and from bits 1 7 of the source data */
1115 i = (A & 1) | (src & 0x02) | ((src & 0x80) >> 5);
1116
1117 /* pick the offset in the table from bits 0 2 4 6 of the source data */
1118 j = (src & 0x01) | ((src & 0x04) >> 1) | ((src & 0x10) >> 2) | ((src & 0x40) >> 3);
1119
1120 /* decode the opcodes */
1121 decrypt[A] = (src & 0xaa) | convtable[i][j];
1122 }
1123 }
1124
1125
GetRoms()1126 static INT32 GetRoms()
1127 {
1128 char* pRomName;
1129 struct BurnRomInfo ri;
1130 UINT8 *Load0 = DrvZ80ROM;
1131 UINT8 *Loadg0 = DrvGfxROM0;
1132 UINT8 *Loadg1 = DrvGfxROM2;
1133 UINT8 *Loadc = DrvColPROM;
1134 UINT8 *Loads = DrvSndROM;
1135 UINT8 *LoadU = DrvUser1;
1136 DrvGfxROM0Len = 0;
1137 DrvGfxROM1Len = 0;
1138 INT32 samples_romlen = 0;
1139
1140 for (INT32 i = 0; !BurnDrvGetRomName(&pRomName, i, 0); i++) {
1141
1142 BurnDrvGetRomInfo(&ri, i);
1143
1144 if ((ri.nType & 7) == 1) {
1145 if (BurnLoadRom(Load0, i, 1)) return 1;
1146 Load0 += ri.nLen;
1147
1148 continue;
1149 }
1150
1151 if ((ri.nType & 7) == 2) {
1152 if (BurnLoadRom(Loadg0, i, 1)) return 1;
1153 if (gfx0_cont800) { // loads 0x800 bytes at 0x0000 and 0x1000
1154 UINT8 *tmp = (UINT8*)BurnMalloc(0x4000);
1155 memmove(tmp, Loadg0, 0x1000);
1156 memset(Loadg0, 0, 0x1000);
1157 memmove(Loadg0 + 0x00000, tmp + 0x00000, 0x800);
1158 memmove(Loadg0 + 0x01000, tmp + 0x00800, 0x800);
1159 BurnFree(tmp);
1160 Loadg0 += 0x2000;
1161 DrvGfxROM0Len += 0x2000;
1162 } else {
1163 Loadg0 += (game_select == 1) ? 0x1000 : ri.nLen;
1164 DrvGfxROM0Len += (game_select == 1) ? 0x1000 : ri.nLen;
1165 }
1166
1167 continue;
1168 }
1169
1170 if ((ri.nType & 7) == 3) {
1171 if (BurnLoadRom(Loadg1, i, 1)) return 1;
1172 Loadg1 += ri.nLen;
1173 DrvGfxROM1Len += ri.nLen;
1174
1175 continue;
1176 }
1177
1178 if ((ri.nType & 7) == 4) {
1179 if (BurnLoadRom(LoadU, i, 1)) return 1;
1180 LoadU += ri.nLen;
1181
1182 continue;
1183 }
1184
1185 if ((ri.nType & 7) == 6) {
1186 if (BurnLoadRom(Loadc, i, 1)) return 1;
1187 Loadc += ri.nLen;
1188
1189 continue;
1190 }
1191
1192 if ((ri.nType & 7) == 7) {
1193 if (BurnLoadRom(Loads, i, 1)) return 1;
1194 Loads += ri.nLen;
1195 samples_romlen += ri.nLen;
1196 continue;
1197 }
1198 }
1199
1200 if (samples_romlen == 0x2000) {
1201 bprintf(0, _T(" * Game has built-in rom samples.\n"));
1202 uses_samples = 1;
1203 }
1204
1205 return 0;
1206 }
1207
DrvInit()1208 static INT32 DrvInit()
1209 {
1210 AllMem = NULL;
1211 MemIndex();
1212 INT32 nLen = MemEnd - (UINT8 *)0;
1213 if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1214 memset(AllMem, 0, nLen);
1215 MemIndex();
1216
1217 {
1218 if (GetRoms()) return 1;
1219
1220 DrvGfxDecode(DrvGfxROM0, DrvGfxROM1, DrvGfxROM0Len, 16);
1221 DrvGfxDecode(DrvGfxROM0, DrvGfxROM0, DrvGfxROM0Len, 8);
1222 DrvGfxDecode(DrvGfxROM2, DrvGfxROM2, DrvGfxROM1Len, 8);
1223
1224 DrvPaletteInit();
1225 }
1226
1227 ZetInit(0);
1228 ZetOpen(0);
1229
1230 if (game_select == 6) { // swimmer, guzzler
1231 ZetMapMemory(DrvZ80ROM, 0x0000, 0x7fff, MAP_ROM);
1232 ZetMapMemory(DrvZ80ROM + 0x8000,0xe000, 0xffff, MAP_ROM);
1233 ZetMapMemory(DrvZ80RAM0, 0x8000, 0x87ff, MAP_RAM);
1234 ZetMapMemory(DrvZ80RAM1, 0xc000, 0xc7ff, MAP_RAM);
1235 ZetMapMemory(DrvBGSprRAM, 0x8800, 0x88ff, MAP_RAM);
1236 ZetMapMemory(DrvBGSprRAM, 0x8900, 0x89ff, MAP_RAM); // mirror
1237 } else {
1238 ZetMapMemory(DrvZ80ROM, 0x0000, 0x5fff, MAP_ROM);
1239 ZetMapMemory(DrvZ80RAM0, 0x6000, 0x6bff, MAP_RAM);
1240 ZetMapMemory(DrvZ80RAM1, 0x8000, 0x83ff, MAP_RAM);
1241 ZetMapMemory(DrvBGSprRAM, 0x8800, 0x88ff, MAP_RAM);
1242 ZetMapMemory(DrvZ80RAM2, 0x8900, 0x8bff, MAP_RAM);
1243 }
1244 ZetMapMemory(DrvVidRAM, 0x9000, 0x93ff, MAP_RAM);
1245 ZetMapMemory(DrvVidRAM, 0x9400, 0x97ff, MAP_RAM); // mirror
1246 ZetMapMemory(DrvSprRAM, 0x9800, 0x9bff, MAP_RAM); // 9800 - 981f colscroll, 9880 989f sprram, 98dc - 98df bigspritecontrol
1247 ZetMapMemory(DrvColRAM, 0x9c00, 0x9fff, MAP_READ); // special write in handler
1248
1249 ZetSetWriteHandler(cclimber_write);
1250 ZetSetReadHandler(cclimber_read);
1251 ZetSetOutHandler(cclimber_out);
1252 ZetSetInHandler(cclimber_in);
1253 ZetClose();
1254
1255 if (uses_sub) {
1256 ZetInit(1);
1257 ZetOpen(1);
1258 if (game_select == 5) { // yamato
1259 ZetMapMemory(DrvSndROM, 0x0000, 0x07ff, MAP_ROM);
1260 ZetMapMemory(DrvZ80RAM1_0, 0x5000, 0x53ff, MAP_RAM);
1261 ZetSetOutHandler(sub_out);
1262 ZetSetInHandler(sub_in);
1263 }
1264 if (game_select == 6) { // swimmer/guzzler
1265 ZetMapMemory(DrvSndROM, 0x0000, 0x0fff, MAP_ROM);
1266 ZetMapMemory(DrvZ80RAM1_0, 0x2000, 0x23ff, MAP_RAM);
1267 ZetMapMemory(DrvSndROM + 0x1000,0x4000, 0xffff, MAP_RAM);
1268 ZetSetReadHandler(swimmer_sub_read);
1269 ZetSetOutHandler(sub_out);
1270 }
1271 ZetClose();
1272 }
1273
1274 AY8910Init(0, (game_select == 6) ? 2000000 : 1536000, 0);
1275 AY8910SetPorts(0, NULL, NULL, &cclimber_sample_select_w, NULL);
1276 AY8910SetAllRoutes(0, 0.15, BURN_SND_ROUTE_BOTH);
1277 AY8910Init(1, (game_select == 6) ? 2000000 : 1536000, 1);
1278 AY8910SetAllRoutes(1, 0.15, BURN_SND_ROUTE_BOTH);
1279 AY8910SetBuffered(ZetTotalCycles, (game_select == 6) ? 2000000 : 3072000);
1280
1281 GenericTilesInit();
1282
1283 DrvDoReset();
1284
1285 return 0;
1286 }
1287
DrvExit()1288 static INT32 DrvExit()
1289 {
1290 GenericTilesExit();
1291
1292 ZetExit();
1293 AY8910Exit(0);
1294 AY8910Exit(1);
1295
1296 BurnFree (AllMem);
1297
1298 game_select = 0;
1299 uses_sub = 0;
1300 silvland = 0;
1301 ckong = 0;
1302 ckongb = 0;
1303 gfx0_cont800 = 0;
1304 uses_samples = 0;
1305
1306 return 0;
1307 }
1308
cclimber_draw_bigsprite()1309 static void cclimber_draw_bigsprite()
1310 {
1311 UINT8 x = 136 - DrvSprRAM[bigsprite_index + 3];
1312 UINT8 y = 128 - DrvSprRAM[bigsprite_index + 2];
1313 INT32 flipx = (DrvSprRAM[bigsprite_index + 1] & 0x10) >> 4;
1314 INT32 flipy = (DrvSprRAM[bigsprite_index + 1] & 0x20) >> 5;
1315 INT32 bits = (game_select == 6) ? 3 : 2;
1316 INT32 palindex = (game_select == 6) ? 0x100 : 0x40;
1317
1318 if (flipscreen[0] && !ckong) { // flipx
1319 flipx = !flipx;
1320 }
1321
1322 if (flipscreen[1]) { // flipy
1323 y = 128 - y;
1324 flipy = !flipy;
1325 }
1326
1327 for (INT32 offs = 0; offs < 32 * 32; offs++)
1328 {
1329 if ((offs & 0x210) != 0x210) continue; // everything else is transparent, apparently
1330
1331 INT32 ofst = ((offs & 0x1e0) >> 1) | (offs & 0x0f);
1332
1333 INT32 sx = ofst % 0x10;
1334 INT32 sy = ofst / 0x10;
1335 if (flipx) sx = 15 - sx;
1336 if (flipy) sy = 15 - sy;
1337
1338 sx = (x+8*sx) & 0xff;
1339 sy = (y+8*sy) & 0xff;
1340
1341 sy -= 16; //offsets
1342
1343 INT32 code = ((DrvSprRAM[bigsprite_index + 1] & 0x08) << 5) | DrvBGSprRAM[ofst];
1344 code &= 0x3ff;
1345 INT32 color = DrvSprRAM[bigsprite_index + 1] & 0x07;
1346 color &= 0x1ff;
1347
1348 if (flipy) {
1349 if (flipx) {
1350 Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, bits, 0, palindex, DrvGfxROM2);
1351 Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx-256, sy, color, bits, 0, palindex, DrvGfxROM2);
1352 } else {
1353 Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, bits, 0, palindex, DrvGfxROM2);
1354 Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx-256, sy, color, bits, 0, palindex, DrvGfxROM2);
1355 }
1356 } else {
1357 if (flipx) {
1358 Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, bits, 0, palindex, DrvGfxROM2);
1359 Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx-256, sy, color, bits, 0, palindex, DrvGfxROM2);
1360 } else {
1361 Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, bits, 0, palindex, DrvGfxROM2);
1362 Render8x8Tile_Mask_Clip(pTransDraw, code, sx-256, sy, color, bits, 0, palindex, DrvGfxROM2);
1363 }
1364 }
1365
1366 }
1367 }
1368
draw_playfield()1369 static void draw_playfield()
1370 {
1371 INT32 bits = (game_select == 6) ? 3 : 2;
1372
1373 for (INT32 offs = 0; offs < 0x400; offs++)
1374 {
1375 INT32 sx = (offs & 0x1f) << 3;
1376 INT32 sy = (offs >> 5) << 3;
1377
1378 sy -= DrvSprRAM[sx >> 3]; // col scroll
1379 if (ckong) sy += 16; else sy -= 16; //offsets
1380 if (sy < -7) sy += 256;
1381 if (sx < -7) sx += 256;
1382
1383 INT32 flipy = (DrvColRAM[offs] & 0x80) >> 7;
1384 INT32 flipx = (DrvColRAM[offs] & 0x40) >> 6;
1385
1386 INT32 tile_offs = offs ^ (flipy << 5);
1387
1388 if (flipscreen[0]) { // flipx
1389 sx = 248 - sx;
1390 flipx ^= 1;
1391 }
1392
1393 if (flipscreen[1]) { // flipy
1394 sy = 248 - sy;
1395 flipy ^= 1;
1396 }
1397
1398 INT32 code = ((DrvColRAM[tile_offs] & 0x10) << 5) + ((DrvColRAM[tile_offs] & 0x20) << 3) + DrvVidRAM[tile_offs];
1399 INT32 color = DrvColRAM[tile_offs] & 0x0f;
1400
1401 if (game_select == 6) {
1402 code = ((DrvColRAM[tile_offs] & 0x10) << 4) | DrvVidRAM[tile_offs];
1403 color = ((swimmer_palettebank & 0x01) << 4) | (DrvColRAM[tile_offs] & 0x0f);
1404 }
1405
1406 if (sx > nScreenWidth || sy > nScreenHeight) continue;
1407
1408 if (flipy) {
1409 if (flipx) {
1410 Render8x8Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, bits, 0, 0, DrvGfxROM0);
1411 } else {
1412 Render8x8Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, bits, 0, 0, DrvGfxROM0);
1413 }
1414 } else {
1415 if (flipx) {
1416 Render8x8Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, bits, 0, 0, DrvGfxROM0);
1417 } else {
1418 Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, bits, 0, 0, DrvGfxROM0);
1419 }
1420 }
1421 }
1422 }
1423
1424 #if 0
1425 extern int counter;
1426 static void draw_debug()
1427 {
1428 INT32 code = 0;
1429 INT32 color = counter;
1430 for (INT32 sy = 0; sy<31; sy++)
1431 for (INT32 sx = 0; sx<31; sx++) {
1432 Render8x8Tile_Mask_Clip(pTransDraw, code, sx*8, sy*8, color, 2, 0, 0, DrvGfxROM0);
1433 code++;
1434 }
1435 }
1436 #endif
1437
draw_sprites()1438 static void draw_sprites()
1439 {
1440 INT32 bits = (game_select == 6) ? 3 : 2;
1441
1442 for (INT32 offs = 0x9c; offs >= 0x80; offs -= 4)
1443 {
1444 INT32 x = DrvSprRAM[offs + 3];
1445 INT32 y = 240 - DrvSprRAM[offs + 2];
1446
1447 if (ckong) y += 16; else y -= 16; //offsets
1448
1449 INT32 code = ((DrvSprRAM[offs + 1] & 0x10) << 3) |
1450 ((DrvSprRAM[offs + 1] & 0x20) << 1) |
1451 (DrvSprRAM[offs + 0] & 0x3f);
1452
1453 INT32 color = DrvSprRAM[offs + 1] & 0x0f;
1454
1455 if (game_select == 6) {
1456 code = ((DrvSprRAM[offs + 1] & 0x10) << 2) |
1457 (DrvSprRAM[offs + 0] & 0x3f);
1458
1459 color = ((swimmer_palettebank & 0x01) << 4) |
1460 (DrvSprRAM[offs + 1] & 0x0f);
1461
1462 }
1463
1464 INT32 flipx = DrvSprRAM[offs + 0] & 0x40;
1465 INT32 flipy = DrvSprRAM[offs + 0] & 0x80;
1466
1467 if (flipscreen[0] & 1)
1468 {
1469 x = 240 - x;
1470 flipx = !flipx;
1471 }
1472
1473 if (flipscreen[1] & 1)
1474 {
1475 y = 240 - y;
1476 flipy = !flipy;
1477 }
1478
1479 if (flipy) {
1480 if (flipx) {
1481 Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, x, y, color, bits, 0, 0, DrvGfxROM1);
1482 } else {
1483 Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, x, y, color, bits, 0, 0, DrvGfxROM1);
1484 }
1485 } else {
1486 if (flipx) {
1487 Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, x, y, color, bits, 0, 0, DrvGfxROM1);
1488 } else {
1489 Render16x16Tile_Mask_Clip(pTransDraw, code, x, y, color, bits, 0, 0, DrvGfxROM1);
1490 }
1491 }
1492 }
1493 }
1494
1495 #define SWIMMER_SIDE_BG_PEN (0x120)
1496 #define SWIMMER_BG_PEN (0x00)
1497 #define SWIMMER_BG_SPLIT (0x18 * 8)
1498
swimmer_draw_backdrop()1499 void swimmer_draw_backdrop() // background effects for swimmer/guzzler
1500 {
1501 swimmer_set_background_pen();
1502
1503 if (swimmer_sidebg & 1) {
1504 for (INT32 y = 0; y < nScreenHeight; y++)
1505 for (INT32 x = 0; x < nScreenWidth; x++) {
1506 if (flipscreen[0] & 1) {
1507 if (x <= 0xff - SWIMMER_BG_SPLIT) {
1508 pTransDraw[(y*nScreenWidth) + x] = SWIMMER_SIDE_BG_PEN;
1509 } else {
1510 pTransDraw[(y*nScreenWidth) + x] = SWIMMER_BG_PEN;
1511 }
1512 } else {
1513 if (x <= SWIMMER_BG_SPLIT - 1) {
1514 pTransDraw[(y*nScreenWidth) + x] = SWIMMER_BG_PEN;
1515 } else {
1516 pTransDraw[(y*nScreenWidth) + x] = SWIMMER_SIDE_BG_PEN;
1517 }
1518 }
1519 }
1520 } else { // just fill bg
1521 for (INT32 y = 0; y < nScreenHeight; y++)
1522 for (INT32 x = 0; x < nScreenWidth; x++) {
1523 pTransDraw[(y*nScreenWidth) + x] = SWIMMER_BG_PEN;
1524 }
1525 }
1526 }
1527
yamato_draw_backdrop()1528 void yamato_draw_backdrop() // synth yamato backdrop
1529 {
1530 UINT8 *sky_rom = DrvUser1 + 0x1200;
1531
1532 for (INT32 i = 0; i < 0x100; i++) {
1533 INT32 pen = 0x60 + sky_rom[(flipscreen[0] ? 0x80 : 0) + (i >> 1)];
1534
1535 for (INT32 j = 0; j < 0x100; j++) {
1536 INT32 coord = (j * nScreenWidth) + ((i - 8) & 0xff);
1537
1538 if (coord < (nScreenHeight * nScreenWidth))
1539 pTransDraw[coord] = pen;
1540 }
1541 }
1542 }
1543
DrvDraw()1544 static INT32 DrvDraw()
1545 {
1546 if (DrvRecalc) {
1547 if (game_select == 6) {
1548 SwimmerPaletteInit();
1549 } else
1550 if (game_select == 5) {
1551 YamatoPaletteInit();
1552 } else {
1553 DrvPaletteInit();
1554 }
1555 DrvRecalc = 0;
1556 }
1557
1558 BurnTransferClear();
1559
1560 if (game_select == 6) {
1561 swimmer_draw_backdrop();
1562 }
1563
1564 if (game_select == 5) {
1565 yamato_draw_backdrop();
1566 }
1567
1568 if (nBurnLayer & 1) draw_playfield();
1569
1570 if (DrvSprRAM[bigsprite_index] & 1) {
1571 if (nBurnLayer & 2) cclimber_draw_bigsprite();
1572 if (nBurnLayer & 4) draw_sprites();
1573 } else {
1574 if (nBurnLayer & 4) draw_sprites();
1575 if (nBurnLayer & 2) cclimber_draw_bigsprite();
1576 }
1577
1578 BurnTransferCopy(DrvPalette);
1579
1580 return 0;
1581 }
1582
DrvFrame()1583 static INT32 DrvFrame()
1584 {
1585 if (DrvReset) {
1586 DrvDoReset();
1587 }
1588
1589 ZetNewFrame();
1590
1591 {
1592 UINT32 JoyInit[4] = { 0x00, 0x00, 0x00, 0x00 };
1593 UINT8 *DrvJoys[4] = { DrvJoy1, DrvJoy2, DrvJoy3, DrvJoy4 };
1594
1595 CompileInput(DrvJoys, (void*)DrvInputs, 4, 8, JoyInit);
1596
1597 if (game_select == 2)
1598 DrvInputs[2] = 0xff - DrvInputs[2];
1599 }
1600
1601 INT32 nInterleave = 256;
1602 INT32 nCyclesTotal[2] = { 3072000 / 60, ((game_select == 6) ? 2000000 : 3072000) / 60 };
1603 INT32 nCyclesDone[2] = { 0, 0 };
1604
1605 for (INT32 i = 0; i < nInterleave; i++) {
1606 ZetOpen(0);
1607 CPU_RUN(0, Zet);
1608 if (i == nInterleave - 1 && interrupt_enable)
1609 ZetNmi();
1610 ZetClose();
1611
1612 if (uses_sub) {
1613 ZetOpen(1);
1614 CPU_RUN(1, Zet);
1615 if (game_select == 6 && (i%63==0)) // 4x per frame
1616 ZetNmi();
1617 ZetClose();
1618 }
1619 }
1620
1621 if (pBurnSoundOut) {
1622 AY8910Render(pBurnSoundOut, nBurnSoundLen);
1623 cclimber_render(pBurnSoundOut, nBurnSoundLen);
1624 }
1625
1626 if (pBurnDraw) {
1627 DrvDraw();
1628 }
1629
1630 return 0;
1631 }
1632
DrvScan(INT32 nAction,INT32 * pnMin)1633 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
1634 {
1635 struct BurnArea ba;
1636
1637 if (pnMin) {
1638 *pnMin = 0x029735;
1639 }
1640
1641 if (nAction & ACB_VOLATILE) {
1642 memset(&ba, 0, sizeof(ba));
1643 ba.Data = AllRam;
1644 ba.nLen = RamEnd - AllRam;
1645 ba.szName = "All Ram";
1646 BurnAcb(&ba);
1647
1648 ZetScan(nAction);
1649
1650 AY8910Scan(nAction, pnMin);
1651
1652 SCAN_VAR(flipscreen);
1653 SCAN_VAR(interrupt_enable);
1654 SCAN_VAR(yamato_p0);
1655 SCAN_VAR(yamato_p1);
1656 SCAN_VAR(swimmer_background_color);
1657 SCAN_VAR(swimmer_sidebg);
1658 SCAN_VAR(swimmer_palettebank);
1659 SCAN_VAR(soundlatch);
1660 }
1661
1662 return 0;
1663 }
1664
1665
1666 // Crazy Climber (US set 1)
1667
1668 static struct BurnRomInfo cclimberRomDesc[] = {
1669 { "cc11", 0x1000, 0x217ec4ff, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code
1670 { "cc10", 0x1000, 0xb3c26cef, 1 | BRF_PRG | BRF_ESS }, // 1
1671 { "cc09", 0x1000, 0x6db0879c, 1 | BRF_PRG | BRF_ESS }, // 2
1672 { "cc08", 0x1000, 0xf48c5fe3, 1 | BRF_PRG | BRF_ESS }, // 3
1673 { "cc07", 0x1000, 0x3e873baf, 1 | BRF_PRG | BRF_ESS }, // 4
1674
1675 { "cc06", 0x0800, 0x481b64cc, 2 | BRF_GRA }, // 5 - Sprites & Tiles
1676 { "cc05", 0x0800, 0x2c33b760, 2 | BRF_GRA }, // 6
1677 { "cc04", 0x0800, 0x332347cb, 2 | BRF_GRA }, // 7
1678 { "cc03", 0x0800, 0x4e4b3658, 2 | BRF_GRA }, // 8
1679
1680 { "cc02", 0x0800, 0x14f3ecc9, 3 | BRF_GRA }, // 9 - Big Sprites
1681 { "cc01", 0x0800, 0x21c0f9fb, 3 | BRF_GRA }, // 10
1682
1683 { "cclimber.pr1", 0x0020, 0x751c3325, 6 | BRF_GRA }, // 11 - Color Proms
1684 { "cclimber.pr2", 0x0020, 0xab1940fa, 6 | BRF_GRA }, // 12
1685 { "cclimber.pr3", 0x0020, 0x71317756, 6 | BRF_GRA }, // 13
1686
1687 { "cc13", 0x1000, 0xe0042f75, 7 | BRF_SND }, // 14 - Samples
1688 { "cc12", 0x1000, 0x5da13aaa, 7 | BRF_SND }, // 15
1689 };
1690
1691 STD_ROM_PICK(cclimber)
STD_ROM_FN(cclimber)1692 STD_ROM_FN(cclimber)
1693
1694 static void cclimber_decrypt()
1695 {
1696 static const INT8 convtable[8][16] =
1697 {
1698 /* -1 marks spots which are unused and therefore unknown */
1699 { 0x44,0x14,0x54,0x10,0x11,0x41,0x05,0x50,0x51,0x00,0x40,0x55,0x45,0x04,0x01,0x15 },
1700 { 0x44,0x10,0x15,0x55,0x00,0x41,0x40,0x51,0x14,0x45,0x11,0x50,0x01,0x54,0x04,0x05 },
1701 { 0x45,0x10,0x11,0x44,0x05,0x50,0x51,0x04,0x41,0x14,0x15,0x40,0x01,0x54,0x55,0x00 },
1702 { 0x04,0x51,0x45,0x00,0x44,0x10, -1,0x55,0x11,0x54,0x50,0x40,0x05, -1,0x14,0x01 },
1703 { 0x54,0x51,0x15,0x45,0x44,0x01,0x11,0x41,0x04,0x55,0x50, -1,0x00,0x10,0x40, -1 },
1704 { -1,0x54,0x14,0x50,0x51,0x01, -1,0x40,0x41,0x10,0x00,0x55,0x05,0x44,0x11,0x45 },
1705 { 0x51,0x04,0x10, -1,0x50,0x40,0x00, -1,0x41,0x01,0x05,0x15,0x11,0x14,0x44,0x54 },
1706 { -1, -1,0x54,0x01,0x15,0x40,0x45,0x41,0x51,0x04,0x50,0x05,0x11,0x44,0x10,0x14 }
1707 };
1708
1709 cclimber_decode(convtable);
1710 }
1711
cclimberj_decrypt()1712 void cclimberj_decrypt()
1713 {
1714 static const INT8 convtable[8][16] =
1715 {
1716 { 0x41,0x54,0x51,0x14,0x05,0x10,0x01,0x55,0x44,0x11,0x00,0x50,0x15,0x40,0x04,0x45 },
1717 { 0x50,0x11,0x40,0x55,0x51,0x14,0x45,0x04,0x54,0x15,0x10,0x05,0x44,0x01,0x00,0x41 },
1718 { 0x44,0x11,0x00,0x50,0x41,0x54,0x04,0x14,0x15,0x40,0x51,0x55,0x05,0x10,0x01,0x45 },
1719 { 0x10,0x50,0x54,0x55,0x01,0x44,0x40,0x04,0x14,0x11,0x00,0x41,0x45,0x15,0x51,0x05 },
1720 { 0x14,0x41,0x01,0x44,0x04,0x50,0x51,0x45,0x11,0x40,0x54,0x15,0x10,0x00,0x55,0x05 },
1721 { 0x01,0x05,0x41,0x45,0x54,0x50,0x55,0x10,0x11,0x15,0x51,0x14,0x44,0x40,0x04,0x00 },
1722 { 0x05,0x55,0x00,0x50,0x11,0x40,0x54,0x14,0x45,0x51,0x10,0x04,0x44,0x01,0x41,0x15 },
1723 { 0x55,0x50,0x15,0x10,0x01,0x04,0x41,0x44,0x45,0x40,0x05,0x00,0x11,0x14,0x51,0x54 },
1724 };
1725
1726 cclimber_decode(convtable);
1727 }
1728
cclimberInit()1729 static INT32 cclimberInit()
1730 {
1731 INT32 nRet;
1732
1733 game_select = 1;
1734
1735 nRet = DrvInit();
1736
1737 if (nRet == 0) {
1738 cclimber_decrypt();
1739 }
1740
1741 return nRet;
1742 }
1743
1744 struct BurnDriver BurnDrvCclimber = {
1745 "cclimber", NULL, NULL, NULL, "1980",
1746 "Crazy Climber (US set 1)\0", NULL, "Nichibutsu", "Miscellaneous",
1747 NULL, NULL, NULL, NULL,
1748 BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1749 NULL, cclimberRomInfo, cclimberRomName, NULL, NULL, NULL, NULL, CclimberInputInfo, CclimberDIPInfo,
1750 cclimberInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
1751 256, 224, 4, 3
1752 };
1753
1754 // Crazy Climber (US set 2)
1755
1756 static struct BurnRomInfo cclimberaRomDesc[] = {
1757 { "cc11", 0x1000, 0x217ec4ff, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code
1758 { "10", 0x1000, 0x983d0bab, 1 | BRF_PRG | BRF_ESS }, // 1
1759 { "cc9", 0x1000, 0x6db0879c, 1 | BRF_PRG | BRF_ESS }, // 2
1760 { "cc8", 0x1000, 0xf48c5fe3, 1 | BRF_PRG | BRF_ESS }, // 3
1761 { "7", 0x1000, 0xc2e06606, 1 | BRF_PRG | BRF_ESS }, // 4
1762
1763 { "cc6", 0x0800, 0x481b64cc, 2 | BRF_GRA }, // 5 - Sprites & Tiles
1764 { "cc5", 0x0800, 0x2c33b760, 2 | BRF_GRA }, // 6
1765 { "cc4", 0x0800, 0x332347cb, 2 | BRF_GRA }, // 7
1766 { "cc3", 0x0800, 0x4e4b3658, 2 | BRF_GRA }, // 8
1767
1768 { "cc2", 0x0800, 0x14f3ecc9, 3 | BRF_GRA }, // 9 - Big Sprites
1769 { "cc1", 0x0800, 0x21c0f9fb, 3 | BRF_GRA }, // 10
1770
1771 { "cclimber.pr1", 0x0020, 0x751c3325, 6 | BRF_GRA }, // 11 - Color Proms
1772 { "cclimber.pr2", 0x0020, 0xab1940fa, 6 | BRF_GRA }, // 12
1773 { "cclimber.pr3", 0x0020, 0x71317756, 6 | BRF_GRA }, // 13
1774
1775 { "cc13", 0x1000, 0xe0042f75, 7 | BRF_SND }, // 14 - Samples
1776 { "cc12", 0x1000, 0x5da13aaa, 7 | BRF_SND }, // 15
1777 };
1778
1779 STD_ROM_PICK(cclimbera)
1780 STD_ROM_FN(cclimbera)
1781
1782 struct BurnDriver BurnDrvCclimbera = {
1783 "cclimbera", "cclimber", NULL, NULL, "1980",
1784 "Crazy Climber (US set 2)\0", NULL, "Nichibutsu", "Miscellaneous",
1785 NULL, NULL, NULL, NULL,
1786 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1787 NULL, cclimberaRomInfo, cclimberaRomName, NULL, NULL, NULL, NULL, CclimberInputInfo, CclimberDIPInfo,
1788 cclimberInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
1789 256, 224, 4, 3
1790 };
1791
cclimberjInit()1792 static INT32 cclimberjInit()
1793 {
1794 INT32 nRet;
1795
1796 game_select = 1;
1797
1798 nRet = DrvInit();
1799
1800 if (nRet == 0) {
1801 cclimberj_decrypt();
1802 }
1803
1804 return nRet;
1805 }
1806
1807 // Crazy Climber (Japan)
1808
1809 static struct BurnRomInfo cclimberjRomDesc[] = {
1810 { "cc11j.bin", 0x1000, 0x89783959, 1 | BRF_PRG | BRF_ESS }, // 0 - Z80 Code
1811 { "cc10j.bin", 0x1000, 0x14eda506, 1 | BRF_PRG | BRF_ESS }, // 1
1812 { "cc09j.bin", 0x1000, 0x26489069, 1 | BRF_PRG | BRF_ESS }, // 2
1813 { "cc08j.bin", 0x1000, 0xb33c96f8, 1 | BRF_PRG | BRF_ESS }, // 3
1814 { "cc07j.bin", 0x1000, 0xfbc9626c, 1 | BRF_PRG | BRF_ESS }, // 4
1815
1816 { "cc06", 0x0800, 0x481b64cc, 2 | BRF_GRA }, // 5 - Sprites & Tiles
1817 { "cc05", 0x0800, 0x2c33b760, 2 | BRF_GRA }, // 6
1818 { "cc04", 0x0800, 0x332347cb, 2 | BRF_GRA }, // 7
1819 { "cc03", 0x0800, 0x4e4b3658, 2 | BRF_GRA }, // 8
1820
1821 { "cc02", 0x0800, 0x14f3ecc9, 3 | BRF_GRA }, // 9 - Big Sprites
1822 { "cc01", 0x0800, 0x21c0f9fb, 3 | BRF_GRA }, // 10
1823
1824 { "cclimber.pr1", 0x0020, 0x751c3325, 6 | BRF_GRA }, // 11 - Color Proms
1825 { "cclimber.pr2", 0x0020, 0xab1940fa, 6 | BRF_GRA }, // 12
1826 { "cclimber.pr3", 0x0020, 0x71317756, 6 | BRF_GRA }, // 13
1827
1828 { "cc13j.bin", 0x1000, 0x5f0bcdfb, 7 | BRF_SND }, // 14 - Samples
1829 { "cc12j.bin", 0x1000, 0x9003ffbd, 7 | BRF_SND }, // 15
1830 };
1831
1832 STD_ROM_PICK(cclimberj)
1833 STD_ROM_FN(cclimberj)
1834
1835 struct BurnDriver BurnDrvCclimberj = {
1836 "cclimberj", "cclimber", NULL, NULL, "1980",
1837 "Crazy Climber (Japan)\0", NULL, "Nichibutsu", "Miscellaneous",
1838 NULL, NULL, NULL, NULL,
1839 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1840 NULL, cclimberjRomInfo, cclimberjRomName, NULL, NULL, NULL, NULL, CclimberInputInfo, CclimberjDIPInfo,
1841 cclimberjInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
1842 256, 224, 4, 3
1843 };
1844
ckongInit()1845 static INT32 ckongInit()
1846 {
1847 game_select = 2;
1848 ckong = 1;
1849 uses_sub = 0;
1850
1851 return DrvInit();
1852 }
1853
ckongbInit()1854 static INT32 ckongbInit()
1855 {
1856 ckongb = 1;
1857
1858 INT32 rc = ckongInit();
1859 if (!rc) {
1860 for (INT32 i = 0; i < 0x6000; i++) {
1861 DrvZ80ROM[i] = DrvZ80ROM[i] ^ 0xf0;
1862 }
1863 }
1864 return rc;
1865 }
1866
1867 // Crazy Kong Part II (set 1)
1868
1869 static struct BurnRomInfo ckongpt2RomDesc[] = {
1870 { "7.5d", 0x1000, 0xb27df032, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1871 { "8.5e", 0x1000, 0x5dc1aaba, 1 | BRF_PRG | BRF_ESS }, // 1
1872 { "9.5h", 0x1000, 0xc9054c94, 1 | BRF_PRG | BRF_ESS }, // 2
1873 { "10.5k", 0x1000, 0x069c4797, 1 | BRF_PRG | BRF_ESS }, // 3
1874 { "11.5l", 0x1000, 0xae159192, 1 | BRF_PRG | BRF_ESS }, // 4
1875 { "12.5n", 0x1000, 0x966bc9ab, 1 | BRF_PRG | BRF_ESS }, // 5
1876
1877 { "6.11n", 0x1000, 0x2dcedd12, 2 | BRF_GRA }, // 6 gfx1
1878 { "5.11l", 0x1000, 0xfa7cbd91, 2 | BRF_GRA }, // 7
1879 { "4.11k", 0x1000, 0x3375b3bd, 2 | BRF_GRA }, // 8
1880 { "3.11h", 0x1000, 0x5655cc11, 2 | BRF_GRA }, // 9
1881
1882 { "2.11c", 0x0800, 0xd1352c31, 3 | BRF_GRA }, // 10 gfx2
1883 { "1.11a", 0x0800, 0xa7a2fdbd, 3 | BRF_GRA }, // 11
1884
1885 { "prom.v6", 0x0020, 0xb3fc1505, 6 | BRF_GRA }, // 12 proms
1886 { "prom.u6", 0x0020, 0x26aada9e, 6 | BRF_GRA }, // 13
1887 { "prom.t6", 0x0020, 0x676b3166, 6 | BRF_GRA }, // 14
1888
1889 { "14.5s", 0x1000, 0x5f0bcdfb, 7 | BRF_GRA }, // 15 samples
1890 { "13.5p", 0x1000, 0x9003ffbd, 7 | BRF_GRA }, // 16
1891 };
1892
1893 STD_ROM_PICK(ckongpt2)
1894 STD_ROM_FN(ckongpt2)
1895
1896 struct BurnDriver BurnDrvCkongpt2 = {
1897 "ckongpt2", NULL, NULL, NULL, "1981",
1898 "Crazy Kong Part II (set 1)\0", NULL, "Falcon", "Miscellaneous",
1899 NULL, NULL, NULL, NULL,
1900 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1901 NULL, ckongpt2RomInfo, ckongpt2RomName, NULL, NULL, NULL, NULL, CkongInputInfo, CkongDIPInfo,
1902 ckongInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
1903 224, 256, 3, 4
1904 };
1905
1906
1907 // Crazy Kong Part II (set 2)
1908
1909 static struct BurnRomInfo ckongpt2aRomDesc[] = {
1910 { "7.5d", 0x1000, 0xb27df032, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1911 { "8.5e", 0x1000, 0x5dc1aaba, 1 | BRF_PRG | BRF_ESS }, // 1
1912 { "9.5h", 0x1000, 0xc9054c94, 1 | BRF_PRG | BRF_ESS }, // 2
1913 { "10.dat", 0x1000, 0xc3beb501, 1 | BRF_PRG | BRF_ESS }, // 3
1914 { "11.5l", 0x1000, 0xae159192, 1 | BRF_PRG | BRF_ESS }, // 4
1915 { "12.5n", 0x1000, 0x966bc9ab, 1 | BRF_PRG | BRF_ESS }, // 5
1916
1917 { "6.11n", 0x1000, 0x2dcedd12, 2 | BRF_GRA }, // 6 gfx1
1918 { "5.11l", 0x1000, 0xfa7cbd91, 2 | BRF_GRA }, // 7
1919 { "4.11k", 0x1000, 0x3375b3bd, 2 | BRF_GRA }, // 8
1920 { "3.11h", 0x1000, 0x5655cc11, 2 | BRF_GRA }, // 9
1921
1922 { "2.11c", 0x0800, 0xd1352c31, 3 | BRF_GRA }, // 10 gfx2
1923 { "1.11a", 0x0800, 0xa7a2fdbd, 3 | BRF_GRA }, // 11
1924
1925 { "prom.v6", 0x0020, 0xb3fc1505, 6 | BRF_GRA }, // 12 proms
1926 { "prom.u6", 0x0020, 0x26aada9e, 6 | BRF_GRA }, // 13
1927 { "prom.t6", 0x0020, 0x676b3166, 6 | BRF_GRA }, // 14
1928
1929 { "14.5s", 0x1000, 0x5f0bcdfb, 7 | BRF_GRA }, // 15 samples
1930 { "13.5p", 0x1000, 0x9003ffbd, 7 | BRF_GRA }, // 16
1931 };
1932
1933 STD_ROM_PICK(ckongpt2a)
1934 STD_ROM_FN(ckongpt2a)
1935
1936 struct BurnDriver BurnDrvCkongpt2a = {
1937 "ckongpt2a", "ckongpt2", NULL, NULL, "1981",
1938 "Crazy Kong Part II (set 2)\0", NULL, "Falcon", "Miscellaneous",
1939 NULL, NULL, NULL, NULL,
1940 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1941 NULL, ckongpt2aRomInfo, ckongpt2aRomName, NULL, NULL, NULL, NULL, CkongInputInfo, CkongDIPInfo,
1942 ckongInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
1943 224, 256, 3, 4
1944 };
1945
1946
1947 // Crazy Kong Part II (Japan)
1948
1949 static struct BurnRomInfo ckongpt2jRomDesc[] = {
1950 { "7.5d", 0x1000, 0xb27df032, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1951 { "8.5e", 0x1000, 0x5dc1aaba, 1 | BRF_PRG | BRF_ESS }, // 1
1952 { "9.5h", 0x1000, 0xc9054c94, 1 | BRF_PRG | BRF_ESS }, // 2
1953 { "10.dat", 0x1000, 0xc3beb501, 1 | BRF_PRG | BRF_ESS }, // 3
1954 { "11.5l", 0x1000, 0x4164eb4d, 1 | BRF_PRG | BRF_ESS }, // 4
1955 { "12.5n", 0x1000, 0x966bc9ab, 1 | BRF_PRG | BRF_ESS }, // 5
1956
1957 { "6.11n", 0x1000, 0x2dcedd12, 2 | BRF_GRA }, // 6 gfx1
1958 { "5.11l", 0x1000, 0xfa7cbd91, 2 | BRF_GRA }, // 7
1959 { "4.11k", 0x1000, 0x3375b3bd, 2 | BRF_GRA }, // 8
1960 { "3.11h", 0x1000, 0x5655cc11, 2 | BRF_GRA }, // 9
1961
1962 { "2.11c", 0x0800, 0xd1352c31, 3 | BRF_GRA }, // 10 gfx2
1963 { "1.11a", 0x0800, 0xa7a2fdbd, 3 | BRF_GRA }, // 11
1964
1965 { "prom.v6", 0x0020, 0xb3fc1505, 6 | BRF_GRA }, // 12 proms
1966 { "prom.u6", 0x0020, 0x26aada9e, 6 | BRF_GRA }, // 13
1967 { "prom.t6", 0x0020, 0x676b3166, 6 | BRF_GRA }, // 14
1968
1969 { "14.5s", 0x1000, 0x5f0bcdfb, 7 | BRF_GRA }, // 15 samples
1970 { "13.5p", 0x1000, 0x9003ffbd, 7 | BRF_GRA }, // 16
1971 };
1972
1973 STD_ROM_PICK(ckongpt2j)
1974 STD_ROM_FN(ckongpt2j)
1975
1976 struct BurnDriver BurnDrvCkongpt2j = {
1977 "ckongpt2j", "ckongpt2", NULL, NULL, "1981",
1978 "Crazy Kong Part II (Japan)\0", NULL, "Falcon", "Miscellaneous",
1979 NULL, NULL, NULL, NULL,
1980 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1981 NULL, ckongpt2jRomInfo, ckongpt2jRomName, NULL, NULL, NULL, NULL, CkongInputInfo, CkongDIPInfo,
1982 ckongInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
1983 224, 256, 3, 4
1984 };
1985
1986
1987 // Crazy Kong Part II (Jeutel bootleg)
1988
1989 static struct BurnRomInfo ckongpt2jeuRomDesc[] = {
1990 { "7.5d", 0x1000, 0xb27df032, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1991 { "8.5e", 0x1000, 0x5dc1aaba, 1 | BRF_PRG | BRF_ESS }, // 1
1992 { "9.5h", 0x1000, 0xc9054c94, 1 | BRF_PRG | BRF_ESS }, // 2
1993 { "ckjeu10.dat", 0x1000, 0x7e6eeec4, 1 | BRF_PRG | BRF_ESS }, // 3
1994 { "11.5l", 0x1000, 0xae159192, 1 | BRF_PRG | BRF_ESS }, // 4
1995 { "ckjeu12.dat", 0x1000, 0x0532f270, 1 | BRF_PRG | BRF_ESS }, // 5
1996
1997 { "6.11n", 0x1000, 0x2dcedd12, 2 | BRF_GRA }, // 6 gfx1
1998 { "5.11l", 0x1000, 0xfa7cbd91, 2 | BRF_GRA }, // 7
1999 { "4.11k", 0x1000, 0x3375b3bd, 2 | BRF_GRA }, // 8
2000 { "3.11h", 0x1000, 0x5655cc11, 2 | BRF_GRA }, // 9
2001
2002 { "2.11c", 0x0800, 0xd1352c31, 3 | BRF_GRA }, // 10 gfx2
2003 { "1.11a", 0x0800, 0xa7a2fdbd, 3 | BRF_GRA }, // 11
2004
2005 { "prom.v6", 0x0020, 0xb3fc1505, 6 | BRF_GRA }, // 12 proms
2006 { "prom.u6", 0x0020, 0x26aada9e, 6 | BRF_GRA }, // 13
2007 { "prom.t6", 0x0020, 0x676b3166, 6 | BRF_GRA }, // 14
2008
2009 { "14.5s", 0x1000, 0x5f0bcdfb, 7 | BRF_GRA }, // 15 samples
2010 { "13.5p", 0x1000, 0x9003ffbd, 7 | BRF_GRA }, // 16
2011 };
2012
2013 STD_ROM_PICK(ckongpt2jeu)
2014 STD_ROM_FN(ckongpt2jeu)
2015
2016 struct BurnDriver BurnDrvCkongpt2jeu = {
2017 "ckongpt2jeu", "ckongpt2", NULL, NULL, "1981",
2018 "Crazy Kong Part II (Jeutel bootleg)\0", NULL, "bootleg (Jeutel)", "Miscellaneous",
2019 NULL, NULL, NULL, NULL,
2020 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
2021 NULL, ckongpt2jeuRomInfo, ckongpt2jeuRomName, NULL, NULL, NULL, NULL, CkongInputInfo, CkongDIPInfo,
2022 ckongInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
2023 224, 256, 3, 4
2024 };
2025
2026
2027 // Crazy Kong Part II (alternative levels)
2028
2029 static struct BurnRomInfo ckongpt2bRomDesc[] = {
2030 { "d05-7.rom", 0x1000, 0x5d96ee9a, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2031 { "f05-8.rom", 0x1000, 0x74a8435b, 1 | BRF_PRG | BRF_ESS }, // 1
2032 { "h05-9.rom", 0x1000, 0xe06ca575, 1 | BRF_PRG | BRF_ESS }, // 2
2033 { "k05-10.rom", 0x1000, 0x46d83a11, 1 | BRF_PRG | BRF_ESS }, // 3
2034 { "l05-11.rom", 0x1000, 0x07c30f3d, 1 | BRF_PRG | BRF_ESS }, // 4
2035 { "n05-12.rom", 0x1000, 0x151de90a, 1 | BRF_PRG | BRF_ESS }, // 5
2036
2037 { "6.11n", 0x1000, 0x2dcedd12, 2 | BRF_GRA }, // 6 gfx1
2038 { "5.11l", 0x1000, 0xfa7cbd91, 2 | BRF_GRA }, // 7
2039 { "4.11k", 0x1000, 0x3375b3bd, 2 | BRF_GRA }, // 8
2040 { "3.11h", 0x1000, 0x5655cc11, 2 | BRF_GRA }, // 9
2041
2042 { "2.11c", 0x0800, 0xd1352c31, 3 | BRF_GRA }, // 10 gfx2
2043 { "1.11a", 0x0800, 0xa7a2fdbd, 3 | BRF_GRA }, // 11
2044
2045 { "prom.v6", 0x0020, 0xb3fc1505, 6 | BRF_GRA }, // 12 proms
2046 { "prom.u6", 0x0020, 0x26aada9e, 6 | BRF_GRA }, // 13
2047 { "prom.t6", 0x0020, 0x676b3166, 6 | BRF_GRA }, // 14
2048
2049 { "14.5s", 0x1000, 0x5f0bcdfb, 7 | BRF_GRA }, // 15 samples
2050 { "13.5p", 0x1000, 0x9003ffbd, 7 | BRF_GRA }, // 16
2051 };
2052
2053 STD_ROM_PICK(ckongpt2b)
2054 STD_ROM_FN(ckongpt2b)
2055
2056 struct BurnDriver BurnDrvCkongpt2b = {
2057 "ckongpt2b", "ckongpt2", NULL, NULL, "1981",
2058 "Crazy Kong Part II (alternative levels)\0", NULL, "bootleg", "Miscellaneous",
2059 NULL, NULL, NULL, NULL,
2060 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
2061 NULL, ckongpt2bRomInfo, ckongpt2bRomName, NULL, NULL, NULL, NULL, CkongInputInfo, CkongbDIPInfo,
2062 ckongbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
2063 224, 256, 3, 4
2064 };
2065
2066
2067 // Crazy Kong Part II (bootleg)
2068
2069 static struct BurnRomInfo ckongpt2b2RomDesc[] = {
2070 { "0.bin", 0x1000, 0x1c21386f, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2071 { "1.bin", 0x1000, 0x5dc1aaba, 1 | BRF_PRG | BRF_ESS }, // 1
2072 { "2.bin", 0x1000, 0xc9054c94, 1 | BRF_PRG | BRF_ESS }, // 2
2073 { "3.bin", 0x1000, 0x84903b9d, 1 | BRF_PRG | BRF_ESS }, // 3
2074 { "4.bin", 0x1000, 0xae159192, 1 | BRF_PRG | BRF_ESS }, // 4
2075 { "5.bin", 0x1000, 0x966bc9ab, 1 | BRF_PRG | BRF_ESS }, // 5
2076
2077 { "d.bin", 0x1000, 0x2dcedd12, 2 | BRF_GRA }, // 6 gfx1
2078 { "c.bin", 0x1000, 0xfa7cbd91, 2 | BRF_GRA }, // 7
2079 { "b.bin", 0x1000, 0x3375b3bd, 2 | BRF_GRA }, // 8
2080 { "a.bin", 0x1000, 0x5655cc11, 2 | BRF_GRA }, // 9
2081
2082 { "9.bin", 0x0800, 0xd1352c31, 3 | BRF_GRA }, // 10 gfx2
2083 { "8.bin", 0x0800, 0xa7a2fdbd, 3 | BRF_GRA }, // 11
2084
2085 { "prom.bin", 0x0020, 0xd3b84067, 6 | BRF_GRA }, // 12 proms
2086 { "prom.t6", 0x0020, 0x26aada9e, 6 | BRF_GRA }, // 13
2087 { "prom.u6", 0x0020, 0x676b3166, 6 | BRF_GRA }, // 14
2088
2089 { "7.bin", 0x1000, 0x5f0bcdfb, 7 | BRF_GRA }, // 15 samples
2090 { "6.bin", 0x1000, 0x9003ffbd, 7 | BRF_GRA }, // 16
2091 };
2092
2093 STD_ROM_PICK(ckongpt2b2)
2094 STD_ROM_FN(ckongpt2b2)
2095
2096 struct BurnDriver BurnDrvCkongpt2b2 = {
2097 "ckongpt2b2", "ckongpt2", NULL, NULL, "1981",
2098 "Crazy Kong Part II (bootleg)\0", NULL, "bootleg", "Miscellaneous",
2099 NULL, NULL, NULL, NULL,
2100 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
2101 NULL, ckongpt2b2RomInfo, ckongpt2b2RomName, NULL, NULL, NULL, NULL, CkongInputInfo, Ckongb2DIPInfo,
2102 ckongInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
2103 224, 256, 3, 4
2104 };
2105
2106
2107 // Crazy Kong
2108
2109 static struct BurnRomInfo ckongRomDesc[] = {
2110 { "falcon7", 0x1000, 0x2171cac3, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2111 { "falcon8", 0x1000, 0x88b83ff7, 1 | BRF_PRG | BRF_ESS }, // 1
2112 { "falcon9", 0x1000, 0xcff2af47, 1 | BRF_PRG | BRF_ESS }, // 2
2113 { "falcon10", 0x1000, 0x6b2ecf23, 1 | BRF_PRG | BRF_ESS }, // 3
2114 { "falcon11", 0x1000, 0x327dcadf, 1 | BRF_PRG | BRF_ESS }, // 4
2115
2116 { "falcon6", 0x1000, 0xa8916dc8, 2 | BRF_GRA }, // 6 gfx1
2117 { "falcon5", 0x1000, 0xcd3b5dde, 2 | BRF_GRA }, // 7
2118 { "falcon4", 0x1000, 0xb62a0367, 2 | BRF_GRA }, // 8
2119 { "falcon3", 0x1000, 0x61122c5e, 2 | BRF_GRA }, // 9
2120
2121 { "falcon2", 0x0800, 0xf67c80f1, 3 | BRF_GRA }, // 10 gfx2
2122 { "falcon1", 0x0800, 0x80eb517d, 3 | BRF_GRA }, // 11
2123
2124 { "ck6v.bin", 0x0020, 0x751c3325, 6 | BRF_GRA }, // 12 proms
2125 { "ck6u.bin", 0x0020, 0xab1940fa, 6 | BRF_GRA }, // 13
2126 { "ck6t.bin", 0x0020, 0xb4e827a5, 6 | BRF_GRA }, // 14
2127
2128 { "falcon13", 0x1000, 0x5f0bcdfb, 7 | BRF_GRA }, // 15 samples
2129 { "falcon12", 0x1000, 0x9003ffbd, 7 | BRF_GRA }, // 16
2130 };
2131
2132 STD_ROM_PICK(ckong)
2133 STD_ROM_FN(ckong)
2134
2135 struct BurnDriver BurnDrvCkong = {
2136 "ckong", NULL, NULL, NULL, "1981",
2137 "Crazy Kong\0", NULL, "Kyoei / Falcon", "Miscellaneous",
2138 NULL, NULL, NULL, NULL,
2139 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
2140 NULL, ckongRomInfo, ckongRomName, NULL, NULL, NULL, NULL, CkongInputInfo, CkongDIPInfo,
2141 ckongInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x60,
2142 224, 256, 3, 4
2143 };
2144
sega_decode(const UINT8 convtable[32][4])2145 static void sega_decode(const UINT8 convtable[32][4])
2146 {
2147 INT32 A;
2148
2149 INT32 length = 0x10000;
2150 INT32 cryptlen = 0x8000;
2151 UINT8 *rom = DrvZ80ROM;
2152 UINT8 *decrypted = DrvZ80OPS;
2153
2154 for (A = 0x0000;A < cryptlen;A++)
2155 {
2156 INT32 xorval = 0;
2157
2158 UINT8 src = rom[A];
2159
2160 /* pick the translation table from bits 0, 4, 8 and 12 of the address */
2161 INT32 row = (A & 1) + (((A >> 4) & 1) << 1) + (((A >> 8) & 1) << 2) + (((A >> 12) & 1) << 3);
2162
2163 /* pick the offset in the table from bits 3 and 5 of the source data */
2164 INT32 col = ((src >> 3) & 1) + (((src >> 5) & 1) << 1);
2165 /* the bottom half of the translation table is the mirror image of the top */
2166 if (src & 0x80)
2167 {
2168 col = 3 - col;
2169 xorval = 0xa8;
2170 }
2171
2172 /* decode the opcodes */
2173 decrypted[A] = (src & ~0xa8) | (convtable[2*row][col] ^ xorval);
2174
2175 /* decode the data */
2176 rom[A] = (src & ~0xa8) | (convtable[2*row+1][col] ^ xorval);
2177
2178 if (convtable[2*row][col] == 0xff) /* table incomplete! (for development) */
2179 decrypted[A] = 0xee;
2180 if (convtable[2*row+1][col] == 0xff) /* table incomplete! (for development) */
2181 rom[A] = 0xee;
2182 }
2183
2184 /* this is a kludge to catch anyone who has code that crosses the encrypted/ */
2185 /* decrypted boundary. ssanchan does it */
2186 if (length > 0x8000)
2187 {
2188 INT32 bytes = 0x4000;
2189 memcpy(&decrypted[0x8000], &rom[0x8000], bytes);
2190 }
2191 }
2192
2193
yamatoInit()2194 static INT32 yamatoInit()
2195 {
2196 static const UINT8 convtable[32][4] =
2197 {
2198 /* opcode data address */
2199 /* A B C D A B C D */
2200 { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...0 */
2201 { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...0...1 */
2202 { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...0...1...0 */
2203 { 0x88,0xa8,0x80,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...0...1...1 */
2204 { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...0...1...0...0 */
2205 { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...0...1 */
2206 { 0x20,0xa0,0x28,0xa8 }, { 0x20,0xa0,0x28,0xa8 }, /* ...0...1...1...0 */
2207 { 0x88,0xa8,0x80,0xa0 }, { 0x88,0xa8,0x80,0xa0 }, /* ...0...1...1...1 */
2208 { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...0...0...0 */
2209 { 0x20,0xa0,0x28,0xa8 }, { 0x28,0x20,0xa8,0xa0 }, /* ...1...0...0...1 */
2210 { 0xa0,0x20,0x80,0x00 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...0 */
2211 { 0x28,0x20,0xa8,0xa0 }, { 0x20,0xa0,0x28,0xa8 }, /* ...1...0...1...1 */
2212 { 0x20,0xa0,0x28,0xa8 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...0 */
2213 { 0x88,0xa8,0x08,0x28 }, { 0x88,0xa8,0x08,0x28 }, /* ...1...1...0...1 */
2214 { 0xa0,0x20,0x80,0x00 }, { 0x88,0x08,0x80,0x00 }, /* ...1...1...1...0 */
2215 { 0x20,0xa0,0x28,0xa8 }, { 0x00,0x08,0x20,0x28 } /* ...1...1...1...1 */
2216 };
2217
2218 game_select = 5;
2219 uses_sub = 1;
2220
2221 INT32 rc = DrvInit();
2222 if (rc == 0) {
2223 memmove(DrvZ80ROM+0x7000, DrvZ80ROM+0x6000, 0x1000);
2224 memset(DrvZ80ROM+0x6000, 0, 0x1000);
2225 sega_decode(convtable);
2226
2227 ZetOpen(0);
2228 ZetMapArea(0x0000, 0x5fff, 2, DrvZ80OPS, DrvZ80ROM);
2229 ZetMapMemory(DrvZ80ROM+0x7000, 0x7000, 0x7fff, MAP_ROM);
2230 ZetMapArea(0x7000, 0x7fff, 2, DrvZ80OPS+0x7000, DrvZ80ROM+0x7000);
2231
2232 ZetClose();
2233 }
2234
2235 return rc;
2236 }
2237
2238 // Yamato (US)
2239
2240 static struct BurnRomInfo yamatoRomDesc[] = {
2241 { "2.5de", 0x2000, 0x20895096, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2242 { "3.5f", 0x2000, 0x57a696f9, 1 | BRF_PRG | BRF_ESS }, // 1
2243 { "4.5jh", 0x2000, 0x59a468e8, 1 | BRF_PRG | BRF_ESS }, // 2
2244 { "11.5a", 0x1000, 0x35987485, 1 | BRF_PRG | BRF_ESS }, // 3
2245
2246 { "1.5v", 0x0800, 0x3aad9e3c, 7 | BRF_PRG | BRF_ESS }, // 4 audiocpu
2247
2248 { "10.11k", 0x2000, 0x161121f5, 2 | BRF_GRA }, // 5 gfx1
2249 { "9.11h", 0x2000, 0x56e84cc4, 2 | BRF_GRA }, // 6
2250
2251 { "8.11c", 0x1000, 0x28024d9a, 3 | BRF_GRA }, // 7 gfx2
2252 { "7.11a", 0x1000, 0x4a179790, 3 | BRF_GRA }, // 8
2253
2254 { "5.5lm", 0x1000, 0x7761ad24, 4 | BRF_GRA }, // 9 user1
2255 { "6.5n", 0x1000, 0xda48444c, 4 | BRF_GRA }, // 10
2256
2257 { "1.bpr", 0x0020, 0xef2053ab, 6 | BRF_GRA }, // 11 proms
2258 { "2.bpr", 0x0020, 0x2281d39f, 6 | BRF_GRA }, // 12
2259 { "3.bpr", 0x0020, 0x9e6341e3, 6 | BRF_GRA }, // 13
2260 { "4.bpr", 0x0020, 0x1c97dc0b, 6 | BRF_GRA }, // 14
2261 { "5.bpr", 0x0020, 0xedd6c05f, 6 | BRF_GRA }, // 15
2262 };
2263
2264 STD_ROM_PICK(yamato)
2265 STD_ROM_FN(yamato)
2266
2267 struct BurnDriver BurnDrvYamato = {
2268 "yamato", NULL, NULL, NULL, "1983",
2269 "Yamato (US)\0", NULL, "Sega", "Miscellaneous",
2270 NULL, NULL, NULL, NULL,
2271 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
2272 NULL, yamatoRomInfo, yamatoRomName, NULL, NULL, NULL, NULL, YamatoInputInfo, YamatoDIPInfo,
2273 yamatoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
2274 224, 256, 3, 4
2275 };
2276
2277
2278 // Yamato (World?)
2279
2280 static struct BurnRomInfo yamato2RomDesc[] = {
2281 { "2-2.5de",0x2000, 0x93da1d52, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2282 { "3-2.5f", 0x2000, 0x31e73821, 1 | BRF_PRG | BRF_ESS }, // 1
2283 { "4-2.5jh",0x2000, 0xfd7bcfc3, 1 | BRF_PRG | BRF_ESS }, // 2
2284
2285 { "1.5v", 0x0800, 0x3aad9e3c, 7 | BRF_PRG | BRF_ESS }, // 3 audiocpu
2286
2287 { "10.11k", 0x2000, 0x161121f5, 2 | BRF_GRA }, // 4 gfx1
2288 { "9.11h", 0x2000, 0x56e84cc4, 2 | BRF_GRA }, // 5
2289
2290 { "8.11c", 0x1000, 0x28024d9a, 3 | BRF_GRA }, // 6 gfx2
2291 { "7.11a", 0x1000, 0x4a179790, 3 | BRF_GRA }, // 7
2292
2293 { "5.5lm", 0x1000, 0x7761ad24, 4 | BRF_GRA }, // 8 user1
2294 { "6.5n", 0x1000, 0xda48444c, 4 | BRF_GRA }, // 9
2295
2296 { "1.bpr", 0x0020, 0xef2053ab, 6 | BRF_GRA }, // 10 proms
2297 { "2.bpr", 0x0020, 0x2281d39f, 6 | BRF_GRA }, // 11
2298 { "3.bpr", 0x0020, 0x9e6341e3, 6 | BRF_GRA }, // 12
2299 { "4.bpr", 0x0020, 0x1c97dc0b, 6 | BRF_GRA }, // 13
2300 { "5.bpr", 0x0020, 0xedd6c05f, 6 | BRF_GRA }, // 14
2301 };
2302
2303 STD_ROM_PICK(yamato2)
2304 STD_ROM_FN(yamato2)
2305
2306 struct BurnDriver BurnDrvYamato2 = {
2307 "yamato2", "yamato", NULL, NULL, "1983",
2308 "Yamato (World?)\0", NULL, "Sega", "Miscellaneous",
2309 NULL, NULL, NULL, NULL,
2310 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
2311 NULL, yamato2RomInfo, yamato2RomName, NULL, NULL, NULL, NULL, YamatoInputInfo, YamatoDIPInfo,
2312 yamatoInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
2313 224, 256, 3, 4
2314 };
2315
guzzlerInit()2316 static INT32 guzzlerInit()
2317 {
2318 game_select = 6;
2319 uses_sub = 1;
2320
2321 return DrvInit();
2322 }
2323
2324 // Guzzler
2325
2326 static struct BurnRomInfo guzzlerRomDesc[] = {
2327 { "guzz-01.bin", 0x2000, 0x58aaa1e9, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2328 { "guzz-02.bin", 0x2000, 0xf80ceb17, 1 | BRF_PRG | BRF_ESS }, // 1
2329 { "guzz-03.bin", 0x2000, 0xe63c65a2, 1 | BRF_PRG | BRF_ESS }, // 2
2330 { "guzz-04.bin", 0x2000, 0x45be42f5, 1 | BRF_PRG | BRF_ESS }, // 3
2331 { "guzz-16.bin", 0x2000, 0x61ee00b7, 1 | BRF_PRG | BRF_ESS }, // 4
2332
2333 { "guzz-12.bin", 0x1000, 0xf3754d9e, 7 | BRF_PRG | BRF_ESS }, // 5 audiocpu
2334
2335 { "guzz-13.bin", 0x1000, 0xafc464e2, 2 | BRF_GRA }, // 6 gfx1
2336 { "guzz-14.bin", 0x1000, 0xacbdfe1f, 2 | BRF_GRA }, // 7
2337 { "guzz-15.bin", 0x1000, 0x66978c05, 2 | BRF_GRA }, // 8
2338
2339 { "guzz-11.bin", 0x1000, 0xec2e9d86, 3 | BRF_GRA }, // 9 gfx2
2340 { "guzz-10.bin", 0x1000, 0xbd3f0bf7, 3 | BRF_GRA }, // 10
2341 { "guzz-09.bin", 0x1000, 0x18927579, 3 | BRF_GRA }, // 11
2342
2343 { "guzzler.003", 0x0100, 0xf86930c1, 6 | BRF_GRA }, // 12 proms
2344 { "guzzler.002", 0x0100, 0xb566ea9e, 6 | BRF_GRA }, // 13
2345 { "guzzler.001", 0x0020, 0x69089495, 6 | BRF_GRA }, // 14
2346 };
2347
2348 STD_ROM_PICK(guzzler)
2349 STD_ROM_FN(guzzler)
2350
2351 struct BurnDriver BurnDrvGuzzler = {
2352 "guzzler", NULL, NULL, NULL, "1983",
2353 "Guzzler\0", NULL, "Tehkan", "Miscellaneous",
2354 NULL, NULL, NULL, NULL,
2355 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_MAZE | GBF_ACTION, 0,
2356 NULL, guzzlerRomInfo, guzzlerRomName, NULL, NULL, NULL, NULL, GuzzlerInputInfo, GuzzlerDIPInfo,
2357 guzzlerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
2358 224, 256, 3, 4
2359 };
2360
2361 // Swimmer (set 1)
2362
2363 static struct BurnRomInfo swimmerRomDesc[] = {
2364 { "sw1", 0x1000, 0xf12481e7, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2365 { "sw2", 0x1000, 0xa0b6fdd2, 1 | BRF_PRG | BRF_ESS }, // 1
2366 { "sw3", 0x1000, 0xec93d7de, 1 | BRF_PRG | BRF_ESS }, // 2
2367 { "sw4", 0x1000, 0x0107927d, 1 | BRF_PRG | BRF_ESS }, // 3
2368 { "sw5", 0x1000, 0xebd8a92c, 1 | BRF_PRG | BRF_ESS }, // 4
2369 { "sw6", 0x1000, 0xf8539821, 1 | BRF_PRG | BRF_ESS }, // 5
2370 { "sw7", 0x1000, 0x37efb64e, 1 | BRF_PRG | BRF_ESS }, // 6
2371 { "sw8", 0x1000, 0x33d6001e, 1 | BRF_PRG | BRF_ESS }, // 7
2372
2373 { "sw12.4k", 0x1000, 0x2eee9bcb, 7 | BRF_PRG | BRF_ESS }, // 8 audiocpu
2374
2375 { "sw15.18k", 0x1000, 0x4f3608cb, 2 | BRF_GRA }, // 9 gfx1
2376 { "sw14.18l", 0x1000, 0x7181c8b4, 2 | BRF_GRA }, // 10
2377 { "sw13.18m", 0x1000, 0x2eb1af5c, 2 | BRF_GRA }, // 11
2378
2379 { "sw23.6c", 0x0800, 0x9ca67e24, 3 | BRF_GRA }, // 12 gfx2
2380 { "sw22.5c", 0x0800, 0x02c10992, 3 | BRF_GRA }, // 13
2381 { "sw21.4c", 0x0800, 0x7f4993c1, 3 | BRF_GRA }, // 14
2382
2383 { "24s10.13b", 0x0100, 0x8e35b97d, 6 | BRF_GRA }, // 15 proms
2384 { "24s10.13a", 0x0100, 0xc5f24909, 6 | BRF_GRA }, // 16
2385 { "18s030.12c", 0x0020, 0x3b2deb3a, 6 | BRF_GRA }, // 17
2386 };
2387
2388 STD_ROM_PICK(swimmer)
2389 STD_ROM_FN(swimmer)
2390
2391 struct BurnDriver BurnDrvSwimmer = {
2392 "swimmer", NULL, NULL, NULL, "1982",
2393 "Swimmer (set 1)\0", NULL, "Tehkan", "Miscellaneous",
2394 NULL, NULL, NULL, NULL,
2395 BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_ACTION, 0,
2396 NULL, swimmerRomInfo, swimmerRomName, NULL, NULL, NULL, NULL, SwimmerInputInfo, SwimmerDIPInfo,
2397 guzzlerInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
2398 256, 224, 4, 3
2399 };
2400
rpatrolInit()2401 static INT32 rpatrolInit()
2402 {
2403 game_select = 1;
2404 uses_sub = 0;
2405 gfx0_cont800 = 1;
2406
2407 INT32 rc = DrvInit();
2408
2409 if (rc == 0) { // decryption
2410 for (INT32 i = 0x0000; i < 0x5000; i++) {
2411 DrvZ80ROM[i] = DrvZ80ROM[i] ^ 0x79;
2412 i++;
2413 DrvZ80ROM[i] = DrvZ80ROM[i] ^ 0x5b;
2414 }
2415 }
2416
2417 return rc;
2418 }
2419
rpatrolnInit()2420 static INT32 rpatrolnInit()
2421 {
2422 game_select = 1;
2423 uses_sub = 0;
2424 gfx0_cont800 = 1;
2425
2426 return DrvInit();
2427 }
2428
rpatrolbInit()2429 static INT32 rpatrolbInit()
2430 {
2431 game_select = 1;
2432 uses_sub = 0;
2433
2434 return DrvInit();
2435 }
2436
silvlandInit()2437 static INT32 silvlandInit()
2438 {
2439 game_select = 1;
2440 uses_sub = 0;
2441 silvland = 1;
2442
2443 return DrvInit();
2444 }
2445
2446 // River Patrol (Japan)
2447
2448 static struct BurnRomInfo rpatrolRomDesc[] = {
2449 { "1.1h", 0x1000, 0x065197f0, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2450 { "2.1f", 0x1000, 0x3614b820, 1 | BRF_PRG | BRF_ESS }, // 1
2451 { "3.1d", 0x1000, 0xba428bbf, 1 | BRF_PRG | BRF_ESS }, // 2
2452 { "4.1c", 0x1000, 0x41497a94, 1 | BRF_PRG | BRF_ESS }, // 3
2453 { "5.1a", 0x1000, 0xe20ee7e7, 1 | BRF_PRG | BRF_ESS }, // 4
2454
2455 { "6.6l.2732", 0x1000, 0xb38d8aca, 2 | BRF_GRA }, // 5 gfx1
2456 { "7.6p.2732", 0x1000, 0xbc2bddf9, 2 | BRF_GRA }, // 6
2457
2458 { "8.2s", 0x0800, 0x59747c31, 3 | BRF_GRA }, // 7 gfx2
2459 { "9.2t", 0x0800, 0x065651a5, 3 | BRF_GRA }, // 8
2460
2461 { "mb7051.1b", 0x0020, 0xf9a2383b, 6 | BRF_GRA }, // 9 proms
2462 { "mb7051.1c", 0x0020, 0x1743bd26, 6 | BRF_GRA }, // 10
2463 { "mb7051.1u", 0x0020, 0xee03bc96, 6 | BRF_GRA }, // 11
2464 };
2465
2466 STD_ROM_PICK(rpatrol)
2467 STD_ROM_FN(rpatrol)
2468
2469 struct BurnDriver BurnDrvRpatrol = {
2470 "rpatrol", NULL, NULL, NULL, "1981",
2471 "River Patrol (Japan)\0", NULL, "Orca", "Miscellaneous",
2472 NULL, NULL, NULL, NULL,
2473 BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_ACTION, 0,
2474 NULL, rpatrolRomInfo, rpatrolRomName, NULL, NULL, NULL, NULL, RpatrolInputInfo, RpatrolDIPInfo,
2475 rpatrolInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
2476 256, 224, 4, 3
2477 };
2478
2479
2480 // River Patrol (Japan, unprotected)
2481 /* located original ORCA OVG-51A PCB */
2482
2483 static struct BurnRomInfo rpatrolnRomDesc[] = {
2484 { "1_2.3k", 0x1000, 0x33b01c90, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2485 { "2_2.3l", 0x1000, 0x03f53340, 1 | BRF_PRG | BRF_ESS }, // 1
2486 { "3_2.3n", 0x1000, 0x8fa300df, 1 | BRF_PRG | BRF_ESS }, // 2
2487 { "4_2.3p", 0x1000, 0x74a8f1f4, 1 | BRF_PRG | BRF_ESS }, // 3
2488 { "5_2.3r", 0x1000, 0xd7ef6c87, 1 | BRF_PRG | BRF_ESS }, // 4
2489
2490 { "6.6l.2732", 0x1000, 0xb38d8aca, 2 | BRF_GRA }, // 5 gfx1
2491 { "7.6p.2732", 0x1000, 0xbc2bddf9, 2 | BRF_GRA }, // 6
2492
2493 { "8.2s", 0x0800, 0x59747c31, 3 | BRF_GRA }, // 7 gfx2
2494 { "9.2t", 0x0800, 0x065651a5, 3 | BRF_GRA }, // 8
2495
2496 { "mb7051.1b", 0x0020, 0xf9a2383b, 6 | BRF_GRA }, // 9 proms
2497 { "mb7051.1c", 0x0020, 0x1743bd26, 6 | BRF_GRA }, // 10
2498 { "mb7051.1u", 0x0020, 0xee03bc96, 6 | BRF_GRA }, // 11
2499 };
2500
2501 STD_ROM_PICK(rpatroln)
2502 STD_ROM_FN(rpatroln)
2503
2504 struct BurnDriver BurnDrvRpatroln = {
2505 "rpatroln", "rpatrol", NULL, NULL, "1981",
2506 "River Patrol (Japan, unprotected)\0", NULL, "Orca", "Miscellaneous",
2507 NULL, NULL, NULL, NULL,
2508 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_ACTION, 0,
2509 NULL, rpatrolnRomInfo, rpatrolnRomName, NULL, NULL, NULL, NULL, RpatrolInputInfo, RpatrolDIPInfo,
2510 rpatrolnInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
2511 256, 224, 4, 3
2512 };
2513
2514
2515 // River Patrol (bootleg)
2516
2517 static struct BurnRomInfo rpatrolbRomDesc[] = {
2518 { "rp1.4l", 0x1000, 0xbfd7ae7a, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2519 { "rp2.4j", 0x1000, 0x03f53340, 1 | BRF_PRG | BRF_ESS }, // 1
2520 { "rp3.4f", 0x1000, 0x8fa300df, 1 | BRF_PRG | BRF_ESS }, // 2
2521 { "rp4.4e", 0x1000, 0x74a8f1f4, 1 | BRF_PRG | BRF_ESS }, // 3
2522 { "rp5.4c", 0x1000, 0xd7ef6c87, 1 | BRF_PRG | BRF_ESS }, // 4
2523
2524 { "rp6.6n", 0x0800, 0x19f18e9e, 2 | BRF_GRA }, // 5 gfx1
2525 { "rp7.6l", 0x0800, 0x07f2070d, 2 | BRF_GRA }, // 6
2526 { "rp8.6k", 0x0800, 0x008738c7, 2 | BRF_GRA }, // 7
2527 { "rp9.6h", 0x0800, 0xea5aafca, 2 | BRF_GRA }, // 8
2528
2529 { "rp11.6c", 0x0800, 0x065651a5, 3 | BRF_GRA }, // 9 gfx2
2530 { "rp10.6a", 0x0800, 0x59747c31, 3 | BRF_GRA }, // 10
2531
2532 { "bprom1.9n", 0x0020, 0xf9a2383b, 6 | BRF_GRA }, // 9 proms
2533 { "bprom2.9p", 0x0020, 0x1743bd26, 6 | BRF_GRA }, // 10
2534 { "bprom3.9c", 0x0020, 0xee03bc96, 6 | BRF_GRA }, // 11
2535 };
2536
2537 STD_ROM_PICK(rpatrolb)
2538 STD_ROM_FN(rpatrolb)
2539
2540 struct BurnDriver BurnDrvRpatrolb = {
2541 "rpatrolb", "rpatrol", NULL, NULL, "1981",
2542 "River Patrol (bootleg)\0", NULL, "bootleg", "Miscellaneous",
2543 NULL, NULL, NULL, NULL,
2544 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_ACTION, 0,
2545 NULL, rpatrolbRomInfo, rpatrolbRomName, NULL, NULL, NULL, NULL, RpatrolInputInfo, RpatrolDIPInfo,
2546 rpatrolbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
2547 256, 224, 4, 3
2548 };
2549
2550
2551 // Silver Land
2552
2553 static struct BurnRomInfo silvlandRomDesc[] = {
2554 { "7.2r", 0x1000, 0x57e6be62, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
2555 { "8.1n", 0x1000, 0xbbb2b287, 1 | BRF_PRG | BRF_ESS }, // 1
2556 { "rp3.4f", 0x1000, 0x8fa300df, 1 | BRF_PRG | BRF_ESS }, // 2
2557 { "10.2n", 0x1000, 0x5536a65d, 1 | BRF_PRG | BRF_ESS }, // 3
2558 { "11.1r", 0x1000, 0x6f23f66f, 1 | BRF_PRG | BRF_ESS }, // 4
2559 { "12.2k", 0x1000, 0x26f1537c, 1 | BRF_PRG | BRF_ESS }, // 5
2560
2561 { "6.6n", 0x0800, 0xaffb804f, 2 | BRF_GRA }, // 6 gfx1
2562 { "5.6l", 0x0800, 0xad4642e5, 2 | BRF_GRA }, // 7
2563 { "4.6k", 0x0800, 0xe487579d, 2 | BRF_GRA }, // 8
2564 { "3.6h", 0x0800, 0x59125a1a, 2 | BRF_GRA }, // 9
2565
2566 { "2.6c", 0x0800, 0xc8d32b8e, 3 | BRF_GRA }, // 10 gfx2
2567 { "1.6a", 0x0800, 0xee333daf, 3 | BRF_GRA }, // 11
2568
2569 { "mb7051.1v", 0x0020, 0x1d2343b1, 6 | BRF_GRA }, // 12 proms
2570 { "mb7051.1u", 0x0020, 0xc174753c, 6 | BRF_GRA }, // 13
2571 { "mb7051.1t", 0x0020, 0x04a1be01, 6 | BRF_GRA }, // 14
2572 };
2573
2574 STD_ROM_PICK(silvland)
2575 STD_ROM_FN(silvland)
2576
2577 struct BurnDriver BurnDrvSilvland = {
2578 "silvland", "rpatrol", NULL, NULL, "1981",
2579 "Silver Land\0", NULL, "Falcon", "Miscellaneous",
2580 NULL, NULL, NULL, NULL,
2581 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_PRE90S, GBF_ACTION, 0,
2582 NULL, silvlandRomInfo, silvlandRomName, NULL, NULL, NULL, NULL, RpatrolInputInfo, RpatrolDIPInfo,
2583 silvlandInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
2584 256, 224, 4, 3
2585 };
2586