1 // FB Alpha ESD 16-bit hardware driver module
2 // Based on MAME driver by Luca Elia
3
4 #include "tiles_generic.h"
5 #include "m68000_intf.h"
6 #include "z80_intf.h"
7 #include "eeprom.h"
8 #include "burn_ym3812.h"
9 #include "msm6295.h"
10
11 static UINT8 *AllMem;
12 static UINT8 *MemEnd;
13 static UINT8 *AllRam;
14 static UINT8 *RamEnd;
15 static UINT8 *Drv68KROM;
16 static UINT8 *DrvZ80ROM;
17 static UINT8 *DrvGfxROM0;
18 static UINT8 *DrvGfxROM1;
19 static UINT8 *DrvGfxROM2;
20 static UINT8 *DrvGfx0Trans;
21 static UINT8 *DrvGfx1Trans;
22 static UINT8 *DrvGfx2Trans;
23 static UINT8 *DrvSndROM;
24 static UINT8 *Drv68KRAM;
25 static UINT8 *DrvZ80RAM;
26 static UINT8 *DrvPalRAM;
27 static UINT8 *DrvVidRAM0;
28 static UINT8 *DrvVidRAM1;
29 static UINT8 *DrvSprRAM;
30 static UINT8 *DrvEepROM;
31
32 static UINT32 *DrvPalette;
33 static UINT32 *Palette;
34 static UINT8 DrvRecalc;
35 static UINT16 *esd16_scroll_0;
36 static UINT16 *esd16_scroll_1;
37
38 static UINT8 DrvReset;
39 static UINT8 DrvJoy1[16];
40 static UINT8 DrvJoy2[16];
41 static UINT8 DrvJoy3[16];
42 static UINT8 DrvDips[2];
43 static UINT16 DrvInputs[3];
44
45 static UINT8 flipscreen;
46 static UINT8 soundlatch;
47 static UINT8 esd16_tilemap0_color;
48 static UINT16 head_layersize;
49 static UINT16 headpanic_platform_x;
50 static UINT16 headpanic_platform_y;
51 static UINT8 esd16_z80_bank;
52
53 static INT32 game_select;
54 static INT32 weird_offsets = 0;
55
56 static struct BurnInputInfo MultchmpInputList[] = {
57 {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" },
58 {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" },
59
60 {"P1 Start" , BIT_DIGITAL , DrvJoy2 + 2, "p1 start" },
61 {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" },
62 {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" },
63 {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" },
64 {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" },
65 {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"},
66 {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"},
67
68 {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 3, "p2 start" },
69 {"P2 Up" , BIT_DIGITAL , DrvJoy1 + 8, "p2 up" },
70 {"P2 Down" , BIT_DIGITAL , DrvJoy1 + 9, "p2 down" },
71 {"P2 Left" , BIT_DIGITAL , DrvJoy1 + 10, "p2 left" },
72 {"P2 Right" , BIT_DIGITAL , DrvJoy1 + 11, "p2 right" },
73 {"P2 Button 1" , BIT_DIGITAL , DrvJoy1 + 12, "p2 fire 1"},
74 {"P2 Button 2" , BIT_DIGITAL , DrvJoy1 + 13, "p2 fire 2"},
75
76 {"Service" , BIT_DIGITAL , DrvJoy3 + 0, "service" },
77
78 {"Reset", BIT_DIGITAL , &DrvReset, "reset" },
79 {"Dip 1", BIT_DIPSWITCH, DrvDips + 0, "dip" },
80 {"Dip 2", BIT_DIPSWITCH, DrvDips + 1, "dip" },
81 };
82
83 STDINPUTINFO(Multchmp)
84
85 static struct BurnInputInfo HedpanicInputList[] = {
86 {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" },
87 {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" },
88
89 {"P1 Start" , BIT_DIGITAL , DrvJoy2 + 2, "p1 start" },
90 {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" },
91 {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" },
92 {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" },
93 {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" },
94 {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"},
95 {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"},
96
97 {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 3, "p2 start" },
98 {"P2 Up" , BIT_DIGITAL , DrvJoy1 + 8, "p2 up" },
99 {"P2 Down" , BIT_DIGITAL , DrvJoy1 + 9, "p2 down" },
100 {"P2 Left" , BIT_DIGITAL , DrvJoy1 + 10, "p2 left" },
101 {"P2 Right" , BIT_DIGITAL , DrvJoy1 + 11, "p2 right" },
102 {"P2 Button 1" , BIT_DIGITAL , DrvJoy1 + 12, "p2 fire 1"},
103 {"P2 Button 2" , BIT_DIGITAL , DrvJoy1 + 13, "p2 fire 2"},
104
105 {"Service" , BIT_DIGITAL , DrvJoy2 + 4, "service" },
106
107 {"Reset", BIT_DIGITAL , &DrvReset, "reset" },
108 };
109
110 STDINPUTINFO(Hedpanic)
111
112 static struct BurnInputInfo SwatpolcInputList[] = {
113 {"Coin 1" , BIT_DIGITAL , DrvJoy2 + 0, "p1 coin" },
114 {"Coin 2" , BIT_DIGITAL , DrvJoy2 + 1, "p2 coin" },
115
116 {"P1 Start" , BIT_DIGITAL , DrvJoy2 + 2, "p1 start" },
117 {"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" },
118 {"P1 Down" , BIT_DIGITAL , DrvJoy1 + 1, "p1 down" },
119 {"P1 Left" , BIT_DIGITAL , DrvJoy1 + 2, "p1 left" },
120 {"P1 Right" , BIT_DIGITAL , DrvJoy1 + 3, "p1 right" },
121 {"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 1"},
122 {"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 5, "p1 fire 2"},
123 {"P1 Button 3" , BIT_DIGITAL , DrvJoy1 + 6, "p1 fire 3"},
124
125 {"P2 Start" , BIT_DIGITAL , DrvJoy2 + 3, "p2 start" },
126 {"P2 Up" , BIT_DIGITAL , DrvJoy1 + 8, "p2 up" },
127 {"P2 Down" , BIT_DIGITAL , DrvJoy1 + 9, "p2 down" },
128 {"P2 Left" , BIT_DIGITAL , DrvJoy1 + 10, "p2 left" },
129 {"P2 Right" , BIT_DIGITAL , DrvJoy1 + 11, "p2 right" },
130 {"P2 Button 1" , BIT_DIGITAL , DrvJoy1 + 12, "p2 fire 1"},
131 {"P2 Button 2" , BIT_DIGITAL , DrvJoy1 + 13, "p2 fire 2"},
132 {"P2 Button 3" , BIT_DIGITAL , DrvJoy1 + 14, "p2 fire 3"},
133
134 {"Service" , BIT_DIGITAL , DrvJoy2 + 4, "service" },
135
136 {"Reset", BIT_DIGITAL , &DrvReset, "reset" },
137 };
138
139 STDINPUTINFO(Swatpolc)
140
141 static struct BurnDIPInfo MultchmpDIPList[]=
142 {
143 {0x12, 0xff, 0xff, 0xff, NULL},
144 {0x13, 0xff, 0xff, 0xff, NULL},
145
146 {0x12, 0xfe, 0, 2, "Coinage Type" },
147 {0x12, 0x01, 0x02, 0x02, "1" },
148 {0x12, 0x01, 0x02, 0x00, "2" },
149
150 {0x12, 0xfe, 0, 2, "Demo Sounds" },
151 {0x12, 0x01, 0x04, 0x04, "Off" },
152 {0x12, 0x01, 0x04, 0x00, "On" },
153
154 {0x12, 0xfe, 0, 2, "Flip Screen" },
155 {0x12, 0x01, 0x08, 0x08, "Off" },
156 {0x12, 0x01, 0x08, 0x00, "On" },
157
158 {0x12, 0xfe, 0, 4, "Coin A" },
159 {0x12, 0x01, 0x30, 0x10, "2C 1C" },
160 {0x12, 0x01, 0x30, 0x30, "1C 1C" },
161 {0x12, 0x01, 0x30, 0x00, "2C 3C" },
162 {0x12, 0x01, 0x30, 0x20, "1C 2C" },
163
164 {0x12, 0xfe, 0, 4, "Coin B" },
165 {0x12, 0x01, 0xc0, 0x40, "2C 1C" },
166 {0x12, 0x01, 0xc0, 0xc0, "1C 1C" },
167 {0x12, 0x01, 0xc0, 0x00, "2C 3C" },
168 {0x12, 0x01, 0xc0, 0x80, "1C 2C" },
169
170 {0x13, 0xfe, 0, 4, "Difficulty" },
171 {0x13, 0x01, 0x03, 0x02, "Easy" },
172 {0x13, 0x01, 0x03, 0x03, "Normal" },
173 {0x13, 0x01, 0x03, 0x01, "Hard" },
174 {0x13, 0x01, 0x03, 0x00, "Hardest" },
175
176 {0x13, 0xfe, 0, 4, "Lives" },
177 {0x13, 0x01, 0x0c, 0x00, "2" },
178 {0x13, 0x01, 0x0c, 0x0c, "3" },
179 {0x13, 0x01, 0x0c, 0x08, "4" },
180 {0x13, 0x01, 0x0c, 0x04, "5" },
181
182 {0x13, 0xfe, 0, 2, "Selectable Games" },
183 {0x13, 0x01, 0x10, 0x10, "3" },
184 {0x13, 0x01, 0x10, 0x00, "4" },
185
186 {0x13, 0xfe, 0, 2, "Free Play" },
187 {0x13, 0x01, 0x20, 0x20, "Off" },
188 {0x13, 0x01, 0x20, 0x00, "On" },
189 };
190
STDDIPINFO(Multchmp)191 STDDIPINFO(Multchmp)
192
193 //----------------------------------------------------------------------------------------------------------
194
195 static void palette_write(INT32 offset, UINT16 data)
196 {
197 *((UINT16*)(DrvPalRAM + offset)) = data;
198
199 INT32 r = (data >> 10) & 0x1f;
200 INT32 g = (data >> 5) & 0x1f;
201 INT32 b = (data >> 0) & 0x1f;
202
203 r = (r << 3) | (r >> 2);
204 g = (g << 3) | (g >> 2);
205 b = (b << 3) | (b >> 2);
206
207 Palette[offset>>1] = (r << 16) | (g << 8) | b;
208 DrvPalette[offset>>1] = BurnHighCol(r, g, b, 0);
209 }
210
esd_sound_command_w(UINT8 data)211 static inline void esd_sound_command_w(UINT8 data)
212 {
213 soundlatch = data;
214 ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
215 }
216
217 //----------------------------------------------------------------------------------------------------------
218
multchmp_write_byte(UINT32,UINT8)219 void __fastcall multchmp_write_byte(UINT32, UINT8)
220 {
221 return;
222 }
223
multchmp_write_word(UINT32 address,UINT16 data)224 void __fastcall multchmp_write_word(UINT32 address, UINT16 data)
225 {
226 if ((address & 0xfffff800) == 0x200000) {
227 palette_write(address & 0x7ff, data);
228 return;
229 }
230
231 switch (address)
232 {
233 case 0x500000:
234 case 0x500002:
235 esd16_scroll_0[(address>>1)&1] = data;
236 return;
237
238 case 0x500004:
239 case 0x500006:
240 esd16_scroll_1[(address>>1)&1] = data;
241 return;
242
243 case 0x600008:
244 esd16_tilemap0_color = data & 3;
245 flipscreen = data & 0x80;
246 return;
247
248 case 0x60000c:
249 esd_sound_command_w(data);
250 return;
251 }
252 return;
253 }
254
multchmp_read_byte(UINT32 address)255 UINT8 __fastcall multchmp_read_byte(UINT32 address)
256 {
257 switch (address)
258 {
259 case 0x600002:
260 case 0x600003:
261 case 0x600004:
262 case 0x600005:
263 case 0x600006:
264 case 0x600007:
265 return DrvInputs[(address - 0x600002) >> 1] >> ((~address & 1) << 3);
266 }
267
268 return 0;
269 }
270
multchmp_read_word(UINT32 address)271 UINT16 __fastcall multchmp_read_word(UINT32 address)
272 {
273 switch (address)
274 {
275 case 0x600002:
276 case 0x600004:
277 case 0x600006:
278 return DrvInputs[(address - 0x600002) >> 1];
279 }
280
281 return 0;
282 }
283
284 //----------------------------------------------------------------------------------------------------------
285
hedpanic_write_byte(UINT32 address,UINT8 data)286 void __fastcall hedpanic_write_byte(UINT32 address, UINT8 data)
287 {
288 switch (address)
289 {
290 case 0xc0000e:
291 EEPROMWrite(data & 0x02, data & 0x01, (data & 0x04) >> 2);
292 return;
293 }
294
295 return;
296 }
297
hedpanic_write_word(UINT32 address,UINT16 data)298 void __fastcall hedpanic_write_word(UINT32 address, UINT16 data)
299 {
300 if ((address & 0xfffff000) == 0x800000) {
301 palette_write(address & 0xfff, data);
302 return;
303 }
304
305 switch (address)
306 {
307 case 0xb00000:
308 case 0xb00002:
309 esd16_scroll_0[(address>>1)&1] = data;
310 return;
311
312 case 0xb00004:
313 case 0xb00006:
314 esd16_scroll_1[(address>>1)&1] = data;
315 return;
316
317 case 0xb00008:
318 headpanic_platform_x = data;
319 return;
320
321 case 0xb0000a:
322 headpanic_platform_y = data;
323 return;
324
325 case 0xb0000e:
326 head_layersize = data;
327 return;
328
329 case 0xc00008:
330 esd16_tilemap0_color = data & 3;
331 flipscreen = data & 0x80;
332 return;
333
334 case 0xc0000c:
335 esd_sound_command_w(data);
336 return;
337
338 case 0xd00008:
339 INT32 ofst = (headpanic_platform_x + 0x40 * headpanic_platform_y) << 1;
340
341 *((UINT16*)(DrvVidRAM1 + ofst)) = BURN_ENDIAN_SWAP_INT16(data);
342 return;
343 }
344 return;
345 }
346
hedpanic_read_byte(UINT32 address)347 UINT8 __fastcall hedpanic_read_byte(UINT32 address)
348 {
349 switch (address)
350 {
351 case 0xc00002:
352 case 0xc00003:
353 case 0xc00004:
354 case 0xc00005:
355 return DrvInputs[(address - 0xc00002) >> 1] >> ((~address & 1) << 3);
356
357 case 0xc00006:
358 return (EEPROMRead() & 1) << 7;
359 }
360 //bprintf(0, _T("rb %X.\n"), address);
361 return 0;
362 }
363
hedpanic_read_word(UINT32)364 UINT16 __fastcall hedpanic_read_word(UINT32 /*address*/)
365 {
366 //bprintf(0, _T("rw %X.\n"), address);
367 return 0;
368 }
369
370 //----------------------------------------------------------------------------------------------------------
371
mchampdx_write_byte(UINT32 address,UINT8 data)372 void __fastcall mchampdx_write_byte(UINT32 address, UINT8 data)
373 {
374 switch (address)
375 {
376 case 0x50000e:
377 EEPROMWrite(data & 0x02, data & 0x01, (data & 0x04) >> 6);
378 return;
379 }
380
381 return;
382 }
383
mchampdx_write_word(UINT32 address,UINT16 data)384 void __fastcall mchampdx_write_word(UINT32 address, UINT16 data)
385 {
386 if ((address & 0xfffff000) == 0x400000) {
387 palette_write(address & 0xfff, data);
388 return;
389 }
390
391 switch (address)
392 {
393 case 0x500008:
394 esd16_tilemap0_color = data & 3;
395 flipscreen = data & 0x80;
396 return;
397
398 case 0x50000c:
399 esd_sound_command_w(data);
400 return;
401
402 case 0x700000:
403 case 0x700002:
404 esd16_scroll_0[(address>>1)&1] = data;
405 return;
406
407 case 0x700004:
408 case 0x700006:
409 esd16_scroll_1[(address>>1)&1] = data;
410 return;
411
412 case 0x700008:
413 headpanic_platform_x = data;
414 return;
415
416 case 0x70000a:
417 headpanic_platform_y = data;
418 return;
419
420 case 0x70000e:
421 head_layersize = data;
422 return;
423
424 case 0xd00008:
425 INT32 ofst = (headpanic_platform_x + 0x40 * headpanic_platform_y) << 1;
426
427 *((UINT16*)(DrvVidRAM1 + ofst)) = BURN_ENDIAN_SWAP_INT16(data);
428 return;
429 }
430 return;
431 }
432
mchampdx_read_byte(UINT32 address)433 UINT8 __fastcall mchampdx_read_byte(UINT32 address)
434 {
435 switch (address)
436 {
437 case 0x500002:
438 case 0x500003:
439 case 0x500004:
440 case 0x500005:
441 return DrvInputs[(address - 0x500002) >> 1] >> ((~address & 1) << 3);
442
443 case 0x500006:
444 return (EEPROMRead() & 1) << 7;
445
446 }
447
448 return 0;
449 }
450
mchampdx_read_word(UINT32 address)451 UINT16 __fastcall mchampdx_read_word(UINT32 address)
452 {
453 switch (address)
454 {
455 case 0x500002:
456 case 0x500004:
457 return DrvInputs[(address - 0x500002) >> 1];
458 }
459
460 return 0;
461 }
462
463 //----------------------------------------------------------------------------------------------------------
464
tangtang_write_byte(UINT32 address,UINT8 data)465 void __fastcall tangtang_write_byte(UINT32 address, UINT8 data)
466 {
467 switch (address)
468 {
469 case 0x50000e:
470 EEPROMWrite(data & 0x02, data & 0x01, (data & 0x04) >> 6);
471 return;
472 }
473 return;
474 }
475
tangtang_write_word(UINT32 address,UINT16 data)476 void __fastcall tangtang_write_word(UINT32 address, UINT16 data)
477 {
478 if ((address & 0xfffff000) == 0x100000) {
479 palette_write(address & 0xfff, data);
480 return;
481 }
482
483 switch (address)
484 {
485 case 0x400000:
486 case 0x400002:
487 esd16_scroll_0[(address>>1)&1] = data;
488 return;
489
490 case 0x400004:
491 case 0x400006:
492 esd16_scroll_1[(address>>1)&1] = data;
493 return;
494
495 case 0x400008:
496 headpanic_platform_x = data;
497 return;
498
499 case 0x40000a:
500 headpanic_platform_y = data;
501 return;
502
503 case 0x40000e:
504 head_layersize = data;
505 return;
506
507 case 0x500008:
508 esd16_tilemap0_color = data & 3;
509 flipscreen = data & 0x80;
510 return;
511
512 case 0x50000c:
513 esd_sound_command_w(data);
514 return;
515
516 case 0x600008:
517 INT32 ofst = (headpanic_platform_x + 0x40 * headpanic_platform_y) << 1;
518
519 *((UINT16*)(DrvVidRAM1 + ofst)) = BURN_ENDIAN_SWAP_INT16(data);
520 return;
521 }
522 return;
523 }
524
tangtang_read_byte(UINT32 address)525 UINT8 __fastcall tangtang_read_byte(UINT32 address)
526 {
527 switch (address)
528 {
529 case 0x500002:
530 case 0x500003:
531 case 0x500004:
532 case 0x500005:
533 return DrvInputs[(address - 0x500002) >> 1] >> ((~address & 1) << 3);
534
535 case 0x500006:
536 return (EEPROMRead() & 1) << 7;
537 }
538
539 return 0;
540 }
541
tangtang_read_word(UINT32 address)542 UINT16 __fastcall tangtang_read_word(UINT32 address)
543 {
544 switch (address)
545 {
546 case 0x500002:
547 case 0x500004:
548 return DrvInputs[(address - 0x500002) >> 1];
549 }
550
551 return 0;
552 }
553
554 //----------------------------------------------------------------------------------------------------------
555
esd16_sound_rombank_w(INT32 data)556 static void esd16_sound_rombank_w(INT32 data)
557 {
558 esd16_z80_bank = data & 0xf;
559
560 ZetMapArea(0x8000, 0xbfff, 0, DrvZ80ROM + 0x4000 * esd16_z80_bank);
561 ZetMapArea(0x8000, 0xbfff, 2, DrvZ80ROM + 0x4000 * esd16_z80_bank);
562 }
563
esd16_sound_write(UINT16,UINT8)564 void __fastcall esd16_sound_write(UINT16, UINT8)
565 {
566 }
567
esd16_sound_read(UINT16)568 UINT8 __fastcall esd16_sound_read(UINT16)
569 {
570 return 0;
571 }
572
esd16_sound_out(UINT16 port,UINT8 data)573 void __fastcall esd16_sound_out(UINT16 port, UINT8 data)
574 {
575 switch (port & 0xff)
576 {
577 case 0x00:
578 BurnYM3812Write(0, 0, data);
579 return;
580
581 case 0x01:
582 BurnYM3812Write(0, 1, data);
583 return;
584
585 case 0x02:
586 MSM6295Write(0, data);
587 return;
588
589 case 0x05:
590 esd16_sound_rombank_w(data);
591 return;
592 }
593 }
594
esd16_sound_in(UINT16 port)595 UINT8 __fastcall esd16_sound_in(UINT16 port)
596 {
597 switch (port & 0xff)
598 {
599 case 0x02:
600 return MSM6295Read(0);
601
602 case 0x03:
603 ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
604 return soundlatch;
605
606 case 0x06:
607 return 0;
608 }
609
610 return 0;
611 }
612
613 //----------------------------------------------------------------------------------------------------------
614
DrvDoReset()615 static INT32 DrvDoReset()
616 {
617 DrvReset = 0;
618
619 memset (AllRam, 0, RamEnd - AllRam);
620
621 EEPROMReset();
622
623 if (game_select == 1 && EEPROMAvailable() == 0) {
624 EEPROMFill(DrvEepROM, 0, 0x80);
625 }
626
627 SekOpen(0);
628 SekReset();
629 SekClose();
630
631 ZetOpen(0);
632 ZetReset();
633 esd16_sound_rombank_w(0);
634 ZetClose();
635
636 MSM6295Reset(0);
637 BurnYM3812Reset();
638
639 soundlatch = 0;
640 flipscreen = 0;
641 esd16_tilemap0_color = 0;
642 esd16_z80_bank = 0;
643 head_layersize = 0;
644 headpanic_platform_x = 0;
645 headpanic_platform_y = 0;
646
647 return 0;
648 }
649
calculate_transparency_tables()650 static void calculate_transparency_tables()
651 {
652 memset (DrvGfx0Trans, 1, 0x08000);
653 memset (DrvGfx1Trans, 1, 0x10000);
654 memset (DrvGfx2Trans, 1, 0x06000);
655
656 for (INT32 i = 0; i < 0x800000; i++) {
657 if (DrvGfxROM0[i]) DrvGfx0Trans[i>>8] = 0;
658 }
659
660 for (INT32 i = 0; i < 0x400000; i++) {
661 if (DrvGfxROM1[i]) DrvGfx1Trans[i>>6] = 0;
662 }
663
664 for (INT32 i = 0; i < 0x600000; i++) {
665 if (DrvGfxROM2[i]) DrvGfx2Trans[i>>8] = 0;
666 }
667 }
668
DrvGfxDecode()669 static INT32 DrvGfxDecode()
670 {
671 static INT32 Planes0[5] = {
672 0x800000, 0x600000, 0x400000, 0x200000, 0x000000
673 };
674
675 static INT32 XOffs0[16] = {
676 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000,
677 0x087, 0x086, 0x085, 0x084, 0x083, 0x082, 0x081, 0x080
678 };
679
680 static INT32 YOffs0[16] = {
681 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038,
682 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078
683 };
684
685 static INT32 Planes1[8] = {
686 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007
687 };
688
689 static INT32 XOffs1[8] = {
690 0x1800000, 0x1000000, 0x0800000, 0x0000000,
691 0x1800008, 0x1000008, 0x0800008, 0x0000008
692 };
693
694 static INT32 YOffs1[8] = {
695 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070
696 };
697
698 UINT8 *tmp = (UINT8*)BurnMalloc(0x400000);
699 if (tmp == NULL) {
700 return 1;
701 }
702
703 memcpy (tmp, DrvGfxROM0, 0x140000);
704
705 GfxDecode(0x02000, 5, 16, 16, Planes0, XOffs0, YOffs0, 0x100, tmp, DrvGfxROM0);
706
707 memcpy (tmp, DrvGfxROM1, 0x400000);
708
709 GfxDecode(0x10000, 8, 8, 8, Planes1, XOffs1, YOffs1, 0x080, tmp, DrvGfxROM1);
710
711 BurnFree (tmp);
712
713 return 0;
714 }
715
HedpanicGfxDecode()716 static INT32 HedpanicGfxDecode()
717 {
718 static INT32 Planes0[5] = { 0x2000000, 0x0000000, 0x0000008, 0x1000000, 0x1000008 };
719
720 static INT32 XOffs0[16] = {
721 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000,
722 0x107, 0x106, 0x105, 0x104, 0x103, 0x102, 0x101, 0x100
723 };
724
725 static INT32 YOffs0[16] = {
726 0x000, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070,
727 0x080, 0x090, 0x0a0, 0x0b0, 0x0c0, 0x0d0, 0x0e0, 0x0f0
728 };
729
730 static INT32 Planes1[8] = {
731 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007
732 };
733
734 static INT32 XOffs1[16] = {
735 0x000, 0x010, 0x008, 0x018, 0x020, 0x030, 0x028, 0x038,
736 0x200, 0x210, 0x208, 0x218, 0x220, 0x230, 0x228, 0x238
737 };
738
739 static INT32 YOffs1[16] = {
740 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0,
741 0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0
742 };
743
744 UINT8 *tmp = (UINT8*)BurnMalloc(0x600000);
745 if (tmp == NULL) {
746 return 1;
747 }
748
749 memcpy (tmp, DrvGfxROM0, 0x500000);
750
751 GfxDecode(0x08000, 5, 16, 16, Planes0, XOffs0, YOffs0, 0x200, tmp, DrvGfxROM0);
752
753 memcpy (tmp, DrvGfxROM1, 0x400000);
754
755 GfxDecode(0x10000, 8, 8, 8, Planes1, XOffs1, YOffs1, 0x200, tmp, DrvGfxROM1);
756 GfxDecode(0x04000, 8, 16, 16, Planes1, XOffs1, YOffs1, 0x800, tmp, DrvGfxROM2);
757
758 BurnFree (tmp);
759
760 return 0;
761 }
762
TangtangGfxDecode()763 static INT32 TangtangGfxDecode()
764 {
765 static INT32 Planes0[5] = {
766 0x1000000, 0x0c00000, 0x0800000, 0x0400000, 0x0000000
767 };
768
769 static INT32 XOffs0[16] = {
770 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000,
771 0x087, 0x086, 0x085, 0x084, 0x083, 0x082, 0x081, 0x080
772 };
773
774 static INT32 YOffs0[16] = {
775 0x000, 0x008, 0x010, 0x018, 0x020, 0x028, 0x030, 0x038,
776 0x040, 0x048, 0x050, 0x058, 0x060, 0x068, 0x070, 0x078
777 };
778
779 static INT32 Planes1[8] = {
780 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007
781 };
782
783 static INT32 XOffs1[16] = {
784 0x000, 0x010, 0x008, 0x018, 0x020, 0x030, 0x028, 0x038,
785 0x200, 0x210, 0x208, 0x218, 0x220, 0x230, 0x228, 0x238
786 };
787
788 static INT32 YOffs1[16] = {
789 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0,
790 0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0
791 };
792
793 UINT8 *tmp = (UINT8*)BurnMalloc(0x600000);
794 if (tmp == NULL) {
795 return 1;
796 }
797
798 memcpy (tmp, DrvGfxROM0, 0x280000);
799
800 GfxDecode(0x04000, 5, 16, 16, Planes0, XOffs0, YOffs0, 0x100, tmp, DrvGfxROM0);
801
802 memcpy (tmp, DrvGfxROM1, 0x400000);
803
804 GfxDecode(0x10000, 8, 8, 8, Planes1, XOffs1, YOffs1, 0x200, tmp, DrvGfxROM1);
805 GfxDecode(0x04000, 8, 16, 16, Planes1, XOffs1, YOffs1, 0x800, tmp, DrvGfxROM2);
806
807 BurnFree (tmp);
808
809 return 0;
810 }
811
MemIndex()812 static INT32 MemIndex()
813 {
814 UINT8 *Next; Next = AllMem;
815
816 Drv68KROM = Next; Next += 0x0080000;
817 DrvZ80ROM = Next; Next += 0x0040000;
818
819 DrvGfxROM0 = Next; Next += 0x0800000;
820 DrvGfxROM1 = Next; Next += 0x0400000;
821 DrvGfxROM2 = Next; Next += 0x0600000;
822
823 DrvGfx0Trans = Next; Next += 0x0008000;
824 DrvGfx1Trans = Next; Next += 0x0010000;
825 DrvGfx2Trans = Next; Next += 0x0006000;
826
827 MSM6295ROM = Next;
828 DrvSndROM = Next; Next += 0x0080000;
829 DrvEepROM = Next; Next += 0x0000100; // from romset
830
831 DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32);
832
833 AllRam = Next;
834
835 Drv68KRAM = Next; Next += 0x0010000;
836 DrvZ80RAM = Next; Next += 0x0000800;
837
838 DrvPalRAM = Next; Next += 0x0001000;
839
840 DrvSprRAM = Next; Next += 0x0000800;
841
842 DrvVidRAM0 = Next; Next += 0x0004000;
843 DrvVidRAM1 = Next; Next += 0x0004000;
844
845 esd16_scroll_0 = (UINT16*)Next; Next += 0x0000004;
846 esd16_scroll_1 = (UINT16*)Next; Next += 0x0000004;
847
848 Palette = (UINT32*)Next; Next += 0x00800 * sizeof(UINT32);
849
850 RamEnd = Next;
851
852 MemEnd = Next;
853
854 return 0;
855 }
856
DrvSynchroniseStream(INT32 nSoundRate)857 static INT32 DrvSynchroniseStream(INT32 nSoundRate)
858 {
859 return (INT64)ZetTotalCycles() * nSoundRate / 4000000;
860 }
861
DrvInit(INT32 (* pInitCallback)())862 static INT32 DrvInit(INT32 (*pInitCallback)())
863 {
864 INT32 nLen;
865
866 AllMem = NULL;
867 MemIndex();
868 nLen = MemEnd - (UINT8 *)0;
869 if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
870 memset(AllMem, 0, nLen);
871 MemIndex();
872
873 if (pInitCallback()) return 1;
874
875 calculate_transparency_tables();
876
877 ZetInit(0);
878 ZetOpen(0);
879 ZetMapArea(0x0000, 0xbfff, 0, DrvZ80ROM);
880 ZetMapArea(0x0000, 0xbfff, 2, DrvZ80ROM);
881 ZetMapArea(0xf800, 0xffff, 0, DrvZ80RAM);
882 ZetMapArea(0xf800, 0xffff, 1, DrvZ80RAM);
883 ZetMapArea(0xf800, 0xffff, 2, DrvZ80RAM);
884 ZetSetWriteHandler(esd16_sound_write);
885 ZetSetReadHandler(esd16_sound_read);
886 ZetSetInHandler(esd16_sound_in);
887 ZetSetOutHandler(esd16_sound_out);
888 ZetClose();
889
890 BurnYM3812Init(1, 4000000, NULL, &DrvSynchroniseStream, 0);
891 BurnTimerAttachYM3812(&ZetConfig, 4000000);
892 BurnYM3812SetRoute(0, BURN_SND_YM3812_ROUTE, 0.30, BURN_SND_ROUTE_BOTH);
893
894 MSM6295Init(0, 1056000 / 132, 1);
895 MSM6295SetRoute(0, 0.60, BURN_SND_ROUTE_BOTH);
896
897 EEPROMInit(&eeprom_interface_93C46); // not used in multchmp
898
899 GenericTilesInit();
900
901 DrvDoReset();
902
903 return 0;
904 }
905
DrvExit()906 static INT32 DrvExit()
907 {
908 EEPROMExit();
909 MSM6295Exit(0);
910 BurnYM3812Exit();
911 SekExit();
912 ZetExit();
913 GenericTilesExit();
914
915 BurnFree (AllMem);
916
917 weird_offsets = 0;
918
919 return 0;
920 }
921
922 //----------------------------------------------------------------------------------------------------------
923
esd16_draw_sprites(INT32 priority)924 static void esd16_draw_sprites(INT32 priority)
925 {
926 UINT16 *spriteram16 = (UINT16*)DrvSprRAM;
927
928 for (INT32 offs = 0; offs < 0x800/2 - 8/2; offs += 8/2 )
929 {
930 INT32 y, starty, endy;
931
932 INT32 sx = BURN_ENDIAN_SWAP_INT16(spriteram16[ offs + 2 ]);
933
934 if ((sx >> 15) != priority) continue;
935
936 int sy = BURN_ENDIAN_SWAP_INT16(spriteram16[ offs ]);
937 int code = BURN_ENDIAN_SWAP_INT16(spriteram16[ offs + 1 ]);
938 int flash = sy & 0x1000;
939
940 if (flash && nCurrentFrame & 1) continue;
941
942 INT32 dimy = 0x10 << ((sy >> 9) & 3);
943
944 INT32 flipx = 0;
945
946 if (game_select) {
947 flipx = sy & 0x2000;
948 }
949
950 INT32 color = (sx >> 9) & 0xf;
951
952 sx = sx & 0x1ff;
953 if (sx >= 0x180) sx -= 0x200;
954
955 if (game_select) {
956 sx -= 24;
957 sy = 0x1ff - (sy & 0x1ff);
958 starty = sy - dimy;
959 endy = sy;
960 } else {
961 sy = 0x100 - ((sy & 0xff) - (sy & 0x100));
962 sy -= dimy;
963 starty = sy;
964 endy = sy + dimy;
965 }
966
967 if (sx >= nScreenWidth || sx < -15) continue;
968
969 for (y = starty - 8; y != endy - 8; y += 16, code++)
970 {
971 if (y >= nScreenHeight || y < -15 || DrvGfx0Trans[code]) continue;
972
973 if (sx >= 0 && y >= 0 && sx <= 303 && y <= 223) {
974
975 if (flipx) {
976 Render16x16Tile_Mask_FlipX(pTransDraw, code, sx, y, color, 5, 0, 0x200, DrvGfxROM0);
977 } else {
978 Render16x16Tile_Mask(pTransDraw, code, sx, y, color, 5, 0, 0x200, DrvGfxROM0);
979 }
980 } else {
981 if (flipx) {
982 Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, y, color, 5, 0, 0x200, DrvGfxROM0);
983 } else {
984 Render16x16Tile_Mask_Clip(pTransDraw, code, sx, y, color, 5, 0, 0x200, DrvGfxROM0);
985 }
986 }
987 }
988 }
989 }
990
draw_layer_8x8(UINT8 * vidram,INT32 color,INT32 transp,INT32 scrollx,INT32 scrolly,INT32 fg)991 static void draw_layer_8x8(UINT8 *vidram, INT32 color, INT32 transp, INT32 scrollx, INT32 scrolly, INT32 fg)
992 {
993 UINT16 *vram = (UINT16*)vidram;
994
995 //scrollx &= 0x3ff; breaks a few frames of scrolling in hedpanic
996 scrolly &= 0x1ff;
997
998 if (weird_offsets && fg == 0) scrollx += -3; //hedpanic
999
1000 for (INT32 offs = 0; offs < 0x4000 / 2; offs++) {
1001 INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]);
1002
1003 if (DrvGfx1Trans[code] && transp) continue;
1004
1005 INT32 sx = (offs & 0x7f) << 3;
1006 INT32 sy = (offs >> 7) << 3;
1007
1008 sx -= scrollx;
1009 sy -= scrolly;
1010 if (sx > 0x3ff) sx -= 0x400;
1011 if (sy > 0x1ff) sy -= 0x200;
1012 if (sx < -0x07) sx += 0x400;
1013 if (sy < -0x07) sy += 0x200;
1014
1015 if (sx < -7 || sy < -7 || sx >= nScreenWidth || sy >= nScreenHeight) continue;
1016
1017 if (sx >= 0 && sy >= 0 && sx <= 311 && sy <= 231) {
1018 if (transp) {
1019 Render8x8Tile_Mask(pTransDraw, code, sx, sy, color, 8, 0, 0, DrvGfxROM1);
1020 } else {
1021 Render8x8Tile(pTransDraw, code, sx, sy, color, 8, 0, DrvGfxROM1);
1022 }
1023 } else {
1024 if (transp) {
1025 Render8x8Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 8, 0, 0, DrvGfxROM1);
1026 } else {
1027 Render8x8Tile_Clip(pTransDraw, code, sx, sy, color, 8, 0, DrvGfxROM1);
1028 }
1029 }
1030 }
1031
1032 return;
1033 }
1034
draw_layer_16x16(UINT8 * vidram,INT32 color,INT32 transp,INT32 scrollx,INT32 scrolly,INT32 fg)1035 static void draw_layer_16x16(UINT8 *vidram, INT32 color, INT32 transp, INT32 scrollx, INT32 scrolly, INT32 fg)
1036 {
1037 UINT16 *vram = (UINT16*)vidram;
1038
1039 scrollx &= 0x3ff;
1040 scrolly &= 0x3ff;
1041
1042 if (weird_offsets && fg == 1) scrollx += 4; //hedpanic
1043
1044 for (INT32 offs = 0; offs < 0x1000 / 2; offs++) {
1045 INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs]) & 0x3fff;
1046
1047 if (DrvGfx2Trans[code] && transp) continue;
1048
1049 INT32 sx = (offs & 0x3f) << 4;
1050 INT32 sy = (offs >> 6) << 4;
1051
1052 sx -= scrollx-4;
1053 sy -= scrolly;
1054
1055 if (sx > 0x3ff) sx -= 0x400;
1056 if (sy > 0x3ff) sy -= 0x400;
1057 if (sx < -0x0f) sx += 0x400;
1058 if (sy < -0x0f) sy += 0x400;
1059
1060 if (sx < -15 || sy < -15 || sx >= nScreenWidth || sy >= nScreenHeight) continue;
1061
1062 if (sx >= 0 && sy >= 0 && sx <= 303 && sy <= 223) {
1063 if (transp) {
1064 Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 8, 0, 0, DrvGfxROM2);
1065 } else {
1066 Render16x16Tile(pTransDraw, code, sx, sy, color, 8, 0, DrvGfxROM2);
1067 }
1068 } else {
1069 if (transp) {
1070 Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 8, 0, 0, DrvGfxROM2);
1071 } else {
1072 Render16x16Tile_Clip(pTransDraw, code, sx, sy, color, 8, 0, DrvGfxROM2);
1073 }
1074 }
1075 }
1076
1077 return;
1078 }
1079
DrvDraw()1080 static INT32 DrvDraw()
1081 {
1082 if (DrvRecalc) {
1083 for (INT32 i = 0; i < 0x800; i++) {
1084 INT32 rgb = Palette[i];
1085 DrvPalette[i] = BurnHighCol(rgb >> 16&0xff, rgb >> 8&0xff, rgb&0xff, 0);
1086 }
1087 }
1088
1089 BurnTransferClear();
1090
1091 if (head_layersize & 0x0001) {
1092 if (nBurnLayer & 1) draw_layer_16x16(DrvVidRAM0, esd16_tilemap0_color, 0, esd16_scroll_0[0] + 0x62, esd16_scroll_0[1]+8, 0);
1093 } else {
1094 if (nBurnLayer & 1) draw_layer_8x8(DrvVidRAM0, esd16_tilemap0_color, 0, esd16_scroll_0[0] + 0x62, esd16_scroll_0[1]+8, 0);
1095 }
1096
1097 if (nSpriteEnable & 1) esd16_draw_sprites(1);
1098
1099 if (head_layersize & 0x0002) {
1100 if (nBurnLayer & 2) draw_layer_16x16(DrvVidRAM1, 0, 1, esd16_scroll_1[0] + 0x60, esd16_scroll_1[1]+8, 1);
1101 } else {
1102 if (nBurnLayer & 2) draw_layer_8x8(DrvVidRAM1, 0, 1, esd16_scroll_1[0] + 0x60, esd16_scroll_1[1]+8, 1);
1103 }
1104
1105 if (nSpriteEnable & 2) esd16_draw_sprites(0);
1106
1107 if (flipscreen) {
1108 INT32 screensize = nScreenWidth * nScreenHeight;
1109 for (INT32 i = 0; i < screensize>>1; i++) {
1110 INT32 t = pTransDraw[i];
1111 pTransDraw[i] = pTransDraw[screensize-(i+1)];
1112 pTransDraw[screensize-(i+1)] = t;
1113 }
1114 }
1115
1116 BurnTransferCopy(DrvPalette);
1117
1118 return 0;
1119 }
1120
DrvFrame()1121 static INT32 DrvFrame()
1122 {
1123 if (DrvReset) {
1124 DrvDoReset();
1125 }
1126
1127 {
1128 DrvInputs[0] = DrvInputs[1] = DrvInputs[2] = ~0;
1129
1130 if (game_select == 0) {
1131 DrvInputs[2] = (DrvDips[1] << 8) | DrvDips[0];
1132 }
1133
1134 for (INT32 i = 0; i < 16; i++) {
1135 DrvInputs[0] ^= DrvJoy1[i] << i;
1136 DrvInputs[1] ^= DrvJoy2[i] << i;
1137 DrvInputs[2] ^= DrvJoy3[i] << i;
1138 }
1139 }
1140
1141 SekNewFrame();
1142 ZetNewFrame();
1143
1144 INT32 nCyclesSegment;
1145 INT32 nInterleave = 64;
1146 INT32 nCyclesTotal[2] = { 16000000 / 60, 4000000 / 60 };
1147 INT32 nCyclesDone[2] = { 0, 0 };
1148
1149 SekOpen(0);
1150 ZetOpen(0);
1151
1152 for (INT32 i = 0; i < nInterleave; i++)
1153 {
1154 nCyclesSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i);
1155
1156 nCyclesDone[0] += SekRun(nCyclesSegment);
1157
1158 nCyclesSegment = (nCyclesTotal[1] - nCyclesDone[1]) / (nInterleave - i);
1159
1160 BurnTimerUpdateYM3812(i * (nCyclesTotal[1] / nInterleave));
1161 if (i & 1) ZetNmi();
1162 }
1163
1164 SekSetIRQLine(6, CPU_IRQSTATUS_AUTO);
1165
1166 BurnTimerEndFrameYM3812(nCyclesTotal[1]);
1167 if (pBurnSoundOut) {
1168 BurnYM3812Update(pBurnSoundOut, nBurnSoundLen);
1169 MSM6295Render(0, pBurnSoundOut, nBurnSoundLen);
1170 }
1171
1172 ZetClose();
1173 SekClose();
1174
1175 if (pBurnDraw) {
1176 DrvDraw();
1177 }
1178
1179 return 0;
1180 }
1181
1182 //----------------------------------------------------------------------------------------------------------
1183
DrvScan(INT32 nAction,INT32 * pnMin)1184 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
1185 {
1186 struct BurnArea ba;
1187
1188 if (pnMin) {
1189 *pnMin = 0x029692;
1190 }
1191
1192 if (nAction & ACB_VOLATILE) {
1193 memset(&ba, 0, sizeof(ba));
1194
1195 ba.Data = AllRam;
1196 ba.nLen = RamEnd - AllRam;
1197 ba.szName = "All Ram";
1198 BurnAcb(&ba);
1199
1200 SekScan(nAction);
1201 ZetScan(nAction);
1202
1203 EEPROMScan(nAction, pnMin);
1204
1205 BurnYM3812Scan(nAction, pnMin);
1206 MSM6295Scan(nAction, pnMin);
1207
1208 SCAN_VAR(flipscreen);
1209 SCAN_VAR(soundlatch);
1210 SCAN_VAR(esd16_tilemap0_color);
1211 SCAN_VAR(head_layersize);
1212 SCAN_VAR(headpanic_platform_x);
1213 SCAN_VAR(headpanic_platform_y);
1214 SCAN_VAR(game_select);
1215 SCAN_VAR(esd16_z80_bank);
1216
1217 ZetOpen(0);
1218 esd16_sound_rombank_w(esd16_z80_bank);
1219 ZetClose();
1220 }
1221
1222 return 0;
1223 }
1224
1225 //----------------------------------------------------------------------------------------------------------
1226
1227 // Multi Champ (World)
1228
1229 static struct BurnRomInfo multchmpRomDesc[] = {
1230 { "esd2.cu02", 0x040000, 0x2d1b098a, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1231 { "esd1.cu03", 0x040000, 0x10974063, 1 | BRF_PRG | BRF_ESS }, // 1
1232
1233 { "esd3.su06", 0x020000, 0x7c178bd7, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1234
1235 { "esd14.ju03", 0x040000, 0xa6122225, 3 | BRF_GRA }, // 3 - Sprites
1236 { "esd15.ju04", 0x040000, 0x88b7a97c, 3 | BRF_GRA }, // 4
1237 { "esd16.ju05", 0x040000, 0xe670a6da, 3 | BRF_GRA }, // 5
1238 { "esd17.ju06", 0x040000, 0xa69d4399, 3 | BRF_GRA }, // 6
1239 { "esd13.ju07", 0x040000, 0x22071594, 3 | BRF_GRA }, // 7
1240
1241 { "esd5.fu27", 0x080000, 0x299f32c2, 4 | BRF_GRA }, // 8 - Tiles
1242 { "esd6.fu32", 0x080000, 0xe2689bb2, 4 | BRF_GRA }, // 9
1243 { "esd11.fu29", 0x080000, 0x9bafd8ee, 4 | BRF_GRA }, // 10
1244 { "esd12.fu33", 0x080000, 0xc6b86001, 4 | BRF_GRA }, // 11
1245 { "esd7.fu26", 0x080000, 0xa783a003, 4 | BRF_GRA }, // 12
1246 { "esd8.fu30", 0x080000, 0x22861af2, 4 | BRF_GRA }, // 13
1247 { "esd9.fu28", 0x080000, 0x6652c04a, 4 | BRF_GRA }, // 14
1248 { "esd10.fu31", 0x080000, 0xd815974b, 4 | BRF_GRA }, // 15
1249
1250 { "esd4.su10", 0x020000, 0x6e741fcd, 5 | BRF_SND }, // 16 - OKI Samples
1251 };
1252
1253 STD_ROM_PICK(multchmp)
STD_ROM_FN(multchmp)1254 STD_ROM_FN(multchmp)
1255
1256 static INT32 multchmpCallback()
1257 {
1258 game_select = 0;
1259 weird_offsets = 1;
1260
1261 {
1262 if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1;
1263 if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1;
1264
1265 if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1;
1266
1267 for (INT32 i = 0; i < 5; i++) {
1268 if (BurnLoadRom(DrvGfxROM0 + i * 0x40000, i + 3, 1)) return 1;
1269 }
1270
1271 for (INT32 i = 0; i < 8; i++) {
1272 if (BurnLoadRom(DrvGfxROM1 + i * 0x80000, i + 8, 1)) return 1;
1273 }
1274
1275 if (BurnLoadRom(DrvSndROM, 16, 1)) return 1;
1276
1277 DrvGfxDecode();
1278 }
1279
1280 SekInit(0, 0x68000);
1281 SekOpen(0);
1282 SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, MAP_ROM);
1283 SekMapMemory(Drv68KRAM, 0x100000, 0x10ffff, MAP_RAM);
1284 SekMapMemory(DrvPalRAM, 0x200000, 0x2005ff, MAP_ROM);
1285 SekMapMemory(DrvSprRAM, 0x300000, 0x3007ff, MAP_RAM);
1286 SekMapMemory(DrvSprRAM, 0x300800, 0x300fff, MAP_RAM); // mirror
1287 SekMapMemory(DrvVidRAM0, 0x400000, 0x403fff, MAP_RAM);
1288 SekMapMemory(DrvVidRAM1, 0x420000, 0x423fff, MAP_RAM);
1289 SekSetWriteByteHandler(0, multchmp_write_byte);
1290 SekSetWriteWordHandler(0, multchmp_write_word);
1291 SekSetReadByteHandler(0, multchmp_read_byte);
1292 SekSetReadWordHandler(0, multchmp_read_word);
1293 SekClose();
1294
1295 return 0;
1296 }
1297
MultchmpInit()1298 static INT32 MultchmpInit()
1299 {
1300 return DrvInit(multchmpCallback);
1301 }
1302
1303 struct BurnDriver BurnDrvMultchmp = {
1304 "multchmp", NULL, NULL, NULL, "1999",
1305 "Multi Champ (World)\0", NULL, "ESD", "Miscellaneous",
1306 NULL, NULL, NULL, NULL,
1307 BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0,
1308 NULL, multchmpRomInfo, multchmpRomName, NULL, NULL, NULL, NULL, MultchmpInputInfo, MultchmpDIPInfo,
1309 MultchmpInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1310 &DrvRecalc, 0x800, 320, 240, 4, 3
1311 };
1312
1313
1314 // Multi Champ (Korea, older)
1315
1316 static struct BurnRomInfo multchmkRomDesc[] = {
1317 { "multchmp.u02", 0x040000, 0x7da8c0df, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1318 { "multchmp.u03", 0x040000, 0x5dc62799, 1 | BRF_PRG | BRF_ESS }, // 1
1319
1320 { "esd3.su06", 0x020000, 0x7c178bd7, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1321
1322 { "multchmp.u36", 0x040000, 0xd8f06fa8, 3 | BRF_GRA }, // 3 - Sprites
1323 { "multchmp.u37", 0x040000, 0xb1ae7f08, 3 | BRF_GRA }, // 4
1324 { "multchmp.u38", 0x040000, 0x88e252e8, 3 | BRF_GRA }, // 5
1325 { "multchmp.u39", 0x040000, 0x51f01067, 3 | BRF_GRA }, // 6
1326 { "multchmp.u35", 0x040000, 0x9d1590a6, 3 | BRF_GRA }, // 7
1327
1328 { "multchmp.u27", 0x080000, 0xdc42704e, 4 | BRF_GRA }, // 8 - Tiles
1329 { "multchmp.u28", 0x080000, 0x449991fa, 4 | BRF_GRA }, // 9
1330 { "multchmp.u33", 0x080000, 0xe4c0ec96, 4 | BRF_GRA }, // 10
1331 { "multchmp.u34", 0x080000, 0xbffaaccc, 4 | BRF_GRA }, // 11
1332 { "multchmp.u29", 0x080000, 0x01bd1399, 4 | BRF_GRA }, // 12
1333 { "multchmp.u30", 0x080000, 0xc6b4cc18, 4 | BRF_GRA }, // 13
1334 { "multchmp.u31", 0x080000, 0xb1e4e9e3, 4 | BRF_GRA }, // 14
1335 { "multchmp.u32", 0x080000, 0xf05cb5b4, 4 | BRF_GRA }, // 15
1336
1337 { "esd4.su10", 0x020000, 0x6e741fcd, 5 | BRF_SND }, // 16 - OKI Samples
1338 };
1339
1340 STD_ROM_PICK(multchmk)
1341 STD_ROM_FN(multchmk)
1342
1343 struct BurnDriver BurnDrvMultchmk = {
1344 "multchmpk", "multchmp", NULL, NULL, "1999",
1345 "Multi Champ (Korea, older)\0", NULL, "ESD", "Miscellaneous",
1346 NULL, NULL, NULL, NULL,
1347 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0,
1348 NULL, multchmkRomInfo, multchmkRomName, NULL, NULL, NULL, NULL, MultchmpInputInfo, MultchmpDIPInfo,
1349 MultchmpInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1350 &DrvRecalc, 0x800, 320, 240, 4, 3
1351 };
1352
1353
1354 // Multi Champ (World, older)
1355
1356 static struct BurnRomInfo multchmaRomDesc[] = {
1357 { "esd2.cu02", 0x040000, 0xbfd39198, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1358 { "esd1.cu03", 0x040000, 0xcd769077, 1 | BRF_PRG | BRF_ESS }, // 1
1359
1360 { "esd3.su01", 0x020000, 0x7c178bd7, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1361
1362 { "esd14.ju03", 0x040000, 0xd8f06fa8, 3 | BRF_GRA }, // 3 - Sprites
1363 { "esd15.ju04", 0x040000, 0xb1ae7f08, 3 | BRF_GRA }, // 4
1364 { "esd16.ju05", 0x040000, 0x88e252e8, 3 | BRF_GRA }, // 5
1365 { "esd17.ju06", 0x040000, 0x51f01067, 3 | BRF_GRA }, // 6
1366 { "esd13.ju07", 0x040000, 0x9d1590a6, 3 | BRF_GRA }, // 7
1367
1368 { "esd5.fu27", 0x080000, 0xed5b4e58, 4 | BRF_GRA }, // 8 - Tiles
1369 { "esd6.fu32", 0x080000, 0x97fde7b1, 4 | BRF_GRA }, // 9
1370 { "esd11.fu29", 0x080000, 0xd3c1855e, 4 | BRF_GRA }, // 10
1371 { "esd12.fu33", 0x080000, 0xa68848a8, 4 | BRF_GRA }, // 11
1372 { "esd7.fu26", 0x080000, 0x042d59ff, 4 | BRF_GRA }, // 12
1373 { "esd8.fu30", 0x080000, 0xfa8cd2d3, 4 | BRF_GRA }, // 13
1374 { "esd9.fu28", 0x080000, 0xa3cfe895, 4 | BRF_GRA }, // 14
1375 { "esd10.fu31", 0x080000, 0x396d77b6, 4 | BRF_GRA }, // 15
1376
1377 { "esd4.su08", 0x020000, 0x6e741fcd, 5 | BRF_SND }, // 16 - OKI Samples
1378 };
1379
1380 STD_ROM_PICK(multchma)
1381 STD_ROM_FN(multchma)
1382
1383 struct BurnDriver BurnDrvMultchma = {
1384 "multchmpa", "multchmp", NULL, NULL, "1999",
1385 "Multi Champ (World, older)\0", NULL, "ESD", "Miscellaneous",
1386 NULL, NULL, NULL, NULL,
1387 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0,
1388 NULL, multchmaRomInfo, multchmaRomName, NULL, NULL, NULL, NULL, MultchmpInputInfo, MultchmpDIPInfo,
1389 MultchmpInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1390 &DrvRecalc, 0x800, 320, 240, 4, 3
1391 };
1392
1393
1394 // Head Panic (ver. 0117, 17/01/2000)
1395
1396 static struct BurnRomInfo hedpanicRomDesc[] = {
1397 { "esd2.cu03", 0x040000, 0x7c7be3bb, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1398 { "esd1.cu02", 0x040000, 0x42405e9d, 1 | BRF_PRG | BRF_ESS }, // 1
1399
1400 { "esd3.su06", 0x040000, 0xa88d4424, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1401
1402 { "esd7.ju02", 0x200000, 0x055d525f, 3 | BRF_GRA }, // 3 - Sprites
1403 { "esd6.ju01", 0x200000, 0x5858372c, 3 | BRF_GRA }, // 4
1404 { "esd5.ju07", 0x080000, 0xbd785921, 3 | BRF_GRA }, // 5
1405
1406 { "esd8.fu35", 0x200000, 0x23aceb4f, 4 | BRF_GRA }, // 6 - Tiles
1407 { "esd9.fu34", 0x200000, 0x76b46cd2, 4 | BRF_GRA }, // 7
1408
1409 { "esd4.su10", 0x020000, 0x3c11c590, 5 | BRF_SND }, // 8 - OKI Samples
1410
1411 { "hedpanic.nv", 0x000080, 0xe91f4038, 6 | BRF_GRA }, // 9 - Default EEPROM
1412 };
1413
1414 STD_ROM_PICK(hedpanic)
STD_ROM_FN(hedpanic)1415 STD_ROM_FN(hedpanic)
1416
1417 static INT32 hedpanicCallback()
1418 {
1419 game_select = 1;
1420 weird_offsets = 1;
1421
1422 {
1423 if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1;
1424 if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1;
1425
1426 if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1;
1427
1428 if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1;
1429 if (BurnLoadRom(DrvGfxROM0 + 0x200000, 4, 1)) return 1;
1430 if (BurnLoadRom(DrvGfxROM0 + 0x400000, 5, 2)) return 1;
1431
1432 if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1;
1433 if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1;
1434
1435 if (BurnLoadRom(DrvSndROM, 8, 1)) return 1;
1436 if (BurnLoadRom(DrvEepROM, 9, 1)) return 1;
1437
1438
1439 HedpanicGfxDecode();
1440 }
1441
1442 SekInit(0, 0x68000);
1443 SekOpen(0);
1444 SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, MAP_ROM);
1445 SekMapMemory(Drv68KRAM, 0x100000, 0x10ffff, MAP_RAM);
1446 SekMapMemory(DrvPalRAM, 0x800000, 0x8007ff, MAP_ROM);
1447 SekMapMemory(DrvSprRAM, 0x900000, 0x9007ff, MAP_RAM);
1448 SekMapMemory(DrvSprRAM, 0x900800, 0x900fff, MAP_RAM); // mirror
1449 SekMapMemory(DrvVidRAM0, 0xa00000, 0xa03fff, MAP_RAM);
1450 SekMapMemory(DrvVidRAM1, 0xa20000, 0xa23fff, MAP_RAM);
1451 SekMapMemory(DrvVidRAM1, 0xa24000, 0xa27fff, MAP_RAM); // mirror
1452 SekSetWriteByteHandler(0, hedpanic_write_byte);
1453 SekSetWriteWordHandler(0, hedpanic_write_word);
1454 SekSetReadByteHandler(0, hedpanic_read_byte);
1455 SekSetReadWordHandler(0, hedpanic_read_word);
1456 SekClose();
1457
1458 return 0;
1459 }
1460
HedpanicInit()1461 static INT32 HedpanicInit()
1462 {
1463 return DrvInit(hedpanicCallback);
1464 }
1465
1466 struct BurnDriver BurnDrvHedpanic = {
1467 "hedpanic", NULL, NULL, NULL, "2000",
1468 "Head Panic (ver. 0117, 17/01/2000)\0", "Story line & game instructions in English", "ESD", "Miscellaneous",
1469 NULL, NULL, NULL, NULL,
1470 BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0,
1471 NULL, hedpanicRomInfo, hedpanicRomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1472 HedpanicInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1473 &DrvRecalc, 0x800, 320, 240, 4, 3
1474 };
1475
1476
1477 // Head Panic (ver. 0702, 02/07/1999)
1478
1479 static struct BurnRomInfo hedpanicaRomDesc[] = {
1480 { "esd12.cu03", 0x040000, 0xdeb7e0a0, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1481 { "esd11.cu02", 0x040000, 0xe1418f23, 1 | BRF_PRG | BRF_ESS }, // 1
1482
1483 { "esd3.su06", 0x040000, 0xa88d4424, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1484
1485 { "ju06", 0x200000, 0x9f6f6193, 3 | BRF_GRA }, // 3 - Sprites
1486 { "ju04", 0x200000, 0x4f3503d7, 3 | BRF_GRA }, // 4
1487 { "esd5.bin", 0x080000, 0x6968265a, 3 | BRF_GRA }, // 5
1488
1489 { "fu35", 0x200000, 0x9b5a45c5, 4 | BRF_GRA }, // 6 - Tiles
1490 { "fu34", 0x200000, 0x8f2099cc, 4 | BRF_GRA }, // 7
1491
1492 { "esd4.bin", 0x080000, 0x5692fe92, 5 | BRF_SND }, // 8 - OKI Samples
1493
1494 { "hedpanic.nv", 0x000080, 0xe91f4038, 0 | BRF_OPT }, // 9 - Default EEPROM
1495 };
1496
1497 STD_ROM_PICK(hedpanica)
1498 STD_ROM_FN(hedpanica)
1499
1500 struct BurnDriver BurnDrvHedpanica = {
1501 "hedpanica", "hedpanic", NULL, NULL, "1999",
1502 "Head Panic (ver. 0702, 02/07/1999)\0", "Story line & game instructions in English", "ESD / Fuuki", "Miscellaneous",
1503 NULL, NULL, NULL, NULL,
1504 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0,
1505 NULL, hedpanicaRomInfo, hedpanicaRomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1506 HedpanicInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1507 &DrvRecalc, 0x800, 320, 240, 4, 3
1508 };
1509
1510
1511 // Head Panic (ver. 0315, 15/03/2000)
1512
1513 static struct BurnRomInfo hedpanifRomDesc[] = {
1514 { "esd2", 0x040000, 0x8cccc691, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1515 { "esd1", 0x040000, 0xd8574925, 1 | BRF_PRG | BRF_ESS }, // 1
1516
1517 { "esd3.su06", 0x040000, 0xa88d4424, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1518
1519 { "esd7.ju02", 0x200000, 0x055d525f, 3 | BRF_GRA }, // 3 - Sprites
1520 { "esd6.ju01", 0x200000, 0x5858372c, 3 | BRF_GRA }, // 4
1521 { "esd5.ju07", 0x080000, 0xbd785921, 3 | BRF_GRA }, // 5
1522
1523 { "esd8.fu35", 0x200000, 0x23aceb4f, 4 | BRF_GRA }, // 6 - Tiles
1524 { "esd9.fu34", 0x200000, 0x76b46cd2, 4 | BRF_GRA }, // 7
1525
1526 { "esd4.su10", 0x020000, 0x3c11c590, 5 | BRF_SND }, // 8 - OKI Samples
1527
1528 { "hedpanic.nv", 0x000080, 0xe91f4038, 0 | BRF_OPT }, // 9 - Default EEPROM
1529 };
1530
1531 STD_ROM_PICK(hedpanif)
1532 STD_ROM_FN(hedpanif)
1533
1534 struct BurnDriver BurnDrvHedpanif = {
1535 "hedpanicf", "hedpanic", NULL, NULL, "2000",
1536 "Head Panic (ver. 0315, 15/03/2000)\0", "Story line in Japanese, game instructions in English", "ESD / Fuuki", "Miscellaneous",
1537 NULL, NULL, NULL, NULL,
1538 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0,
1539 NULL, hedpanifRomInfo, hedpanifRomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1540 HedpanicInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1541 &DrvRecalc, 0x800, 320, 240, 4, 3
1542 };
1543
1544
1545 // Multi Champ Deluxe (ver. 0106, 06/01/2000)
1546
1547 static struct BurnRomInfo mchampdxRomDesc[] = {
1548 { "ver0106_esd2.cu02", 0x040000, 0xea98b3fd, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1549 { "ver0106_esd1.cu03", 0x040000, 0xc6e4546b, 1 | BRF_PRG | BRF_ESS }, // 1
1550
1551 { "esd3.su06", 0x040000, 0x1b22568c, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1552
1553 { "ver0106_ju02.bin", 0x200000, 0xb27a4977, 3 | BRF_GRA }, // 3 - Sprites
1554 { "ver0106_ju01.bin", 0x200000, 0x55841d90, 3 | BRF_GRA }, // 4
1555 { "ver0106_esd5.ju07", 0x040000, 0x7a3ac887, 3 | BRF_GRA }, // 5
1556
1557 { "rom.fu35", 0x200000, 0xba46f3dc, 4 | BRF_GRA }, // 6 - Tiles
1558 { "rom.fu34", 0x200000, 0x2895cf09, 4 | BRF_GRA }, // 7
1559
1560 { "esd4.su10", 0x040000, 0x2fbe94ab, 5 | BRF_SND }, // 8 - OKI Samples
1561
1562 { "eeprom", 0x000080, 0x646b2f53, 0 | BRF_OPT },
1563 };
1564
1565 STD_ROM_PICK(mchampdx)
STD_ROM_FN(mchampdx)1566 STD_ROM_FN(mchampdx)
1567
1568 static INT32 mchampdxCallback()
1569 {
1570 game_select = 3;
1571
1572 {
1573 if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1;
1574 if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1;
1575
1576 if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1;
1577
1578 if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1;
1579 if (BurnLoadRom(DrvGfxROM0 + 0x200000, 4, 1)) return 1;
1580 if (BurnLoadRom(DrvGfxROM0 + 0x400000, 5, 2)) return 1;
1581
1582 if (BurnLoadRom(DrvGfxROM1 + 0x000000, 6, 2)) return 1;
1583 if (BurnLoadRom(DrvGfxROM1 + 0x000001, 7, 2)) return 1;
1584
1585 if (BurnLoadRom(DrvSndROM, 8, 1)) return 1;
1586
1587 HedpanicGfxDecode();
1588 }
1589
1590 SekInit(0, 0x68000);
1591 SekOpen(0);
1592 SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, MAP_ROM);
1593 SekMapMemory(Drv68KRAM, 0x200000, 0x20ffff, MAP_RAM);
1594 SekMapMemory(DrvVidRAM0, 0x300000, 0x303fff, MAP_RAM);
1595 SekMapMemory(DrvVidRAM1, 0x320000, 0x323fff, MAP_RAM);
1596 SekMapMemory(DrvVidRAM1, 0x324000, 0x327fff, MAP_RAM); // mirror
1597 SekMapMemory(DrvPalRAM, 0x400000, 0x400fff, MAP_ROM);
1598 SekMapMemory(DrvSprRAM, 0x600000, 0x6007ff, MAP_RAM);
1599 SekMapMemory(DrvSprRAM, 0x600800, 0x6007ff, MAP_RAM); // mirror
1600 SekSetWriteByteHandler(0, mchampdx_write_byte);
1601 SekSetWriteWordHandler(0, mchampdx_write_word);
1602 SekSetReadByteHandler(0, mchampdx_read_byte);
1603 SekSetReadWordHandler(0, mchampdx_read_word);
1604 SekClose();
1605
1606 return 0;
1607 }
1608
MchampdxInit()1609 static INT32 MchampdxInit()
1610 {
1611 return DrvInit(mchampdxCallback);
1612 }
1613
1614 struct BurnDriver BurnDrvMchampdx = {
1615 "mchampdx", NULL, NULL, NULL, "2000",
1616 "Multi Champ Deluxe (ver. 0106, 06/01/2000)\0", NULL, "ESD", "Miscellaneous",
1617 NULL, NULL, NULL, NULL,
1618 BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0,
1619 NULL, mchampdxRomInfo, mchampdxRomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1620 MchampdxInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1621 &DrvRecalc, 0x800, 320, 240, 4, 3
1622 };
1623
1624
1625 // Multi Champ Deluxe (ver. 1126, 26/11/1999)
1626
1627 static struct BurnRomInfo mchampdaRomDesc[] = {
1628 { "esd2.cu02", 0x040000, 0x4cca802c, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1629 { "esd1.cu03", 0x040000, 0x0af1cd0a, 1 | BRF_PRG | BRF_ESS }, // 1
1630
1631 { "esd3.su06", 0x040000, 0x1b22568c, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1632
1633 { "rom.ju01", 0x200000, 0x1a749fc2, 3 | BRF_GRA }, // 3 - Sprites
1634 { "rom.ju02", 0x200000, 0x7e87e332, 3 | BRF_GRA }, // 4
1635 { "esd5.ju07", 0x080000, 0x6cc871cc, 3 | BRF_GRA }, // 5
1636
1637 { "rom.fu35", 0x200000, 0xba46f3dc, 4 | BRF_GRA }, // 6 - Tiles
1638 { "rom.fu34", 0x200000, 0x2895cf09, 4 | BRF_GRA }, // 7
1639
1640 { "esd4.su10", 0x040000, 0x2fbe94ab, 5 | BRF_SND }, // 8 - OKI Samples
1641
1642 { "eeprom", 0x000080, 0x646b2f53, 0 | BRF_OPT },
1643 };
1644
1645 STD_ROM_PICK(mchampda)
1646 STD_ROM_FN(mchampda)
1647
1648 struct BurnDriver BurnDrvMchampda = {
1649 "mchampdxa", "mchampdx", NULL, NULL, "1999",
1650 "Multi Champ Deluxe (ver. 1126, 26/11/1999)\0", NULL, "ESD", "Miscellaneous",
1651 NULL, NULL, NULL, NULL,
1652 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_MINIGAMES, 0,
1653 NULL, mchampdaRomInfo, mchampdaRomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1654 MchampdxInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1655 &DrvRecalc, 0x800, 320, 240, 4, 3
1656 };
1657
1658
1659 // Tang Tang (ver. 0526, 26/05/2000)
1660
1661 static struct BurnRomInfo tangtangRomDesc[] = {
1662 { "esd2.cu02", 0x040000, 0xb6dd6e3d, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1663 { "esd1.cu03", 0x040000, 0xb6c0f2f4, 1 | BRF_PRG | BRF_ESS }, // 1
1664
1665 { "esd3.su06", 0x040000, 0xd48ecc5c, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1666
1667 { "xju04.bin", 0x040000, 0xf999b9d7, 3 | BRF_GRA }, // 3 - Sprites
1668 { "xju05.bin", 0x040000, 0x679302cf, 3 | BRF_GRA }, // 4
1669 { "xju06.bin", 0x040000, 0x01f59ff7, 3 | BRF_GRA }, // 5
1670 { "xju07.bin", 0x040000, 0x556acac3, 3 | BRF_GRA }, // 6
1671 { "xju08.bin", 0x040000, 0xecc2d8c7, 3 | BRF_GRA }, // 7
1672
1673 { "fu35.bin", 0x200000, 0x84f3f833, 4 | BRF_GRA }, // 8 - Tiles
1674 { "fu34.bin", 0x200000, 0xbf91f543, 4 | BRF_GRA }, // 9
1675
1676 { "esd4.su10", 0x020000, 0xf2dfb02d, 5 | BRF_SND }, // 10 - OKI Samples
1677
1678 { "eeprom", 0x000080, 0x00514989, 0 | BRF_OPT },
1679 };
1680
1681 STD_ROM_PICK(tangtang)
STD_ROM_FN(tangtang)1682 STD_ROM_FN(tangtang)
1683
1684 static INT32 tangtangCallback()
1685 {
1686 game_select = 4;
1687 weird_offsets = 1;
1688
1689 {
1690 if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1;
1691 if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1;
1692
1693 if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1;
1694
1695 for (INT32 i = 0; i < 5; i++) {
1696 if (BurnLoadRom(DrvGfxROM0 + i * 0x80000, 3 + i, 1)) return 1;
1697 }
1698
1699 if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 2)) return 1;
1700 if (BurnLoadRom(DrvGfxROM1 + 0x000001, 9, 2)) return 1;
1701
1702 if (BurnLoadRom(DrvSndROM, 10, 1)) return 1;
1703
1704 TangtangGfxDecode();
1705 }
1706
1707 SekInit(0, 0x68000);
1708 SekOpen(0);
1709 SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, MAP_ROM);
1710 SekMapMemory(DrvPalRAM, 0x100000, 0x100fff, MAP_ROM);
1711 SekMapMemory(DrvSprRAM, 0x200000, 0x2007ff, MAP_RAM);
1712 SekMapMemory(DrvSprRAM, 0x200800, 0x200fff, MAP_RAM); // mirror
1713 SekMapMemory(DrvVidRAM0, 0x300000, 0x303fff, MAP_RAM);
1714 SekMapMemory(DrvVidRAM1, 0x320000, 0x323fff, MAP_RAM);
1715 SekMapMemory(DrvVidRAM1, 0x324000, 0x327fff, MAP_RAM); // mirror
1716 SekMapMemory(Drv68KRAM, 0x700000, 0x70ffff, MAP_RAM);
1717 SekSetWriteByteHandler(0, tangtang_write_byte);
1718 SekSetWriteWordHandler(0, tangtang_write_word);
1719 SekSetReadByteHandler(0, tangtang_read_byte);
1720 SekSetReadWordHandler(0, tangtang_read_word);
1721 SekClose();
1722
1723 return 0;
1724 }
1725
TangtangInit()1726 static INT32 TangtangInit()
1727 {
1728 return DrvInit(tangtangCallback);
1729 }
1730
1731 struct BurnDriver BurnDrvTangtang = {
1732 "tangtang", NULL, NULL, NULL, "2000",
1733 "Tang Tang (ver. 0526, 26/05/2000)\0", NULL, "ESD", "Miscellaneous",
1734 NULL, NULL, NULL, NULL,
1735 BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0,
1736 NULL, tangtangRomInfo, tangtangRomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1737 TangtangInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1738 &DrvRecalc, 0x800, 320, 240, 4, 3
1739 };
1740
1741
1742 // Deluxe 5 (ver. 0107, 07/01/2000, set 1)
1743
1744 static struct BurnRomInfo deluxe5RomDesc[] = {
1745 { "esd2.cu02", 0x040000, 0xd077dc13, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1746 { "esd1.cu03", 0x040000, 0x15d6644f, 1 | BRF_PRG | BRF_ESS }, // 1
1747
1748 { "esd3.su06", 0x040000, 0x31de379a, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1749
1750 { "am27c020.ju03", 0x040000, 0xaa130fd3, 3 | BRF_GRA }, // 3 - Sprites
1751 { "am27c020.ju04", 0x040000, 0x40fa2c2f, 3 | BRF_GRA }, // 4
1752 { "am27c020.ju05", 0x040000, 0xbbe81779, 3 | BRF_GRA }, // 5
1753 { "am27c020.ju06", 0x040000, 0x8b853bce, 3 | BRF_GRA }, // 6
1754 { "am27c020.ju07", 0x040000, 0xd414c3af, 3 | BRF_GRA }, // 7
1755
1756 { "fu35", 0x200000, 0xae10242a, 4 | BRF_GRA }, // 8 - Tiles
1757 { "fu34", 0x200000, 0x248b8c05, 4 | BRF_GRA }, // 9
1758
1759 { "esd4.su10", 0x020000, 0x23f2b7d9, 5 | BRF_SND }, // 10 - OKI Samples
1760
1761 { "eeprom", 0x000080, 0x4539a8a0, 0 | BRF_OPT },
1762 };
1763
1764 STD_ROM_PICK(deluxe5)
1765 STD_ROM_FN(deluxe5)
1766
1767 struct BurnDriver BurnDrvDeluxe5 = {
1768 "deluxe5", NULL, NULL, NULL, "2000",
1769 "Deluxe 5 (ver. 0107, 07/01/2000, set 1)\0", NULL, "ESD", "Miscellaneous",
1770 NULL, NULL, NULL, NULL,
1771 BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0,
1772 NULL, deluxe5RomInfo, deluxe5RomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1773 TangtangInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1774 &DrvRecalc, 0x800, 320, 240, 4, 3
1775 };
1776
1777
1778 // Deluxe 5 (ver. 0107, 07/01/2000, set 2)
1779
1780 static struct BurnRomInfo deluxe5aRomDesc[] = {
1781 { "esd2.cu02", 0x040000, 0xc67bf757, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1782 { "esd1.cu03", 0x040000, 0x24f4d7b9, 1 | BRF_PRG | BRF_ESS }, // 1
1783
1784 { "esd3.su06", 0x040000, 0x31de379a, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1785
1786 { "am27c020.ju03", 0x040000, 0xaa130fd3, 3 | BRF_GRA }, // 3 - Sprites
1787 { "am27c020.ju04", 0x040000, 0x40fa2c2f, 3 | BRF_GRA }, // 4
1788 { "am27c020.ju05", 0x040000, 0xbbe81779, 3 | BRF_GRA }, // 5
1789 { "am27c020.ju06", 0x040000, 0x8b853bce, 3 | BRF_GRA }, // 6
1790 { "am27c020.ju07", 0x040000, 0xd414c3af, 3 | BRF_GRA }, // 7
1791
1792 { "fu35", 0x200000, 0xae10242a, 4 | BRF_GRA }, // 8 - Tiles
1793 { "fu34", 0x200000, 0x248b8c05, 4 | BRF_GRA }, // 9
1794
1795 { "esd4.su10", 0x020000, 0x23f2b7d9, 5 | BRF_SND }, // 10 - OKI Samples
1796
1797 { "eeprom", 0x000080, 0x4539a8a0, 0 | BRF_OPT },
1798 };
1799
1800 STD_ROM_PICK(deluxe5a)
1801 STD_ROM_FN(deluxe5a)
1802
1803 struct BurnDriver BurnDrvDeluxe5a = {
1804 "deluxe5a", "deluxe5", NULL, NULL, "2000",
1805 "Deluxe 5 (ver. 0107, 07/01/2000, set 2)\0", NULL, "ESD", "Miscellaneous",
1806 NULL, NULL, NULL, NULL,
1807 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0,
1808 NULL, deluxe5aRomInfo, deluxe5aRomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1809 TangtangInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1810 &DrvRecalc, 0x800, 320, 240, 4, 3
1811 };
1812
1813
1814 // Deluxe 5 (ver. 0107, 07/01/2000, set 3)
1815
1816 static struct BurnRomInfo deluxe5bRomDesc[] = {
1817 { "esd2.cu02", 0x040000, 0x72a67495, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1818 { "esd1.cu03", 0x040000, 0x7cc119c8, 1 | BRF_PRG | BRF_ESS }, // 1
1819
1820 { "esd3.su06", 0x040000, 0x31de379a, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1821
1822 { "am27c020.ju03", 0x040000, 0xaa130fd3, 3 | BRF_GRA }, // 3 - Sprites
1823 { "am27c020.ju04", 0x040000, 0x40fa2c2f, 3 | BRF_GRA }, // 4
1824 { "am27c020.ju05", 0x040000, 0xbbe81779, 3 | BRF_GRA }, // 5
1825 { "am27c020.ju06", 0x040000, 0x8b853bce, 3 | BRF_GRA }, // 6
1826 { "am27c020.ju07", 0x040000, 0xd414c3af, 3 | BRF_GRA }, // 7
1827
1828 { "fu35", 0x200000, 0xae10242a, 4 | BRF_GRA }, // 8 - Tiles
1829 { "fu34", 0x200000, 0x248b8c05, 4 | BRF_GRA }, // 9
1830
1831 { "esd4.su10", 0x020000, 0x23f2b7d9, 5 | BRF_SND }, // 10 - OKI Samples
1832
1833 { "eeprom", 0x000080, 0x4539a8a0, 0 | BRF_OPT },
1834 };
1835
1836 STD_ROM_PICK(deluxe5b)
1837 STD_ROM_FN(deluxe5b)
1838
1839 struct BurnDriver BurnDrvDeluxe5b = {
1840 "deluxe5b", "deluxe5", NULL, NULL, "2000",
1841 "Deluxe 5 (ver. 0107, 07/01/2000, set 3)\0", NULL, "ESD", "Miscellaneous",
1842 NULL, NULL, NULL, NULL,
1843 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0,
1844 NULL, deluxe5bRomInfo, deluxe5bRomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1845 TangtangInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1846 &DrvRecalc, 0x800, 320, 240, 4, 3
1847 };
1848
1849
1850 // Deluxe 4 U (ver. 0107, 07/01/2000)
1851
1852 static struct BurnRomInfo deluxe4uRomDesc[] = {
1853 { "2.cu02", 0x040000, 0xdb213e1f, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1854 { "1.cu03", 0x040000, 0xfbf14d74, 1 | BRF_PRG | BRF_ESS }, // 1
1855
1856 { "esd3.su06", 0x040000, 0x31de379a, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1857
1858 { "am27c020.ju03", 0x040000, 0xaa130fd3, 3 | BRF_GRA }, // 3 - Sprites
1859 { "am27c020.ju04", 0x040000, 0x40fa2c2f, 3 | BRF_GRA }, // 4
1860 { "am27c020.ju05", 0x040000, 0xbbe81779, 3 | BRF_GRA }, // 5
1861 { "am27c020.ju06", 0x040000, 0x8b853bce, 3 | BRF_GRA }, // 6
1862 { "am27c020.ju07", 0x040000, 0xd414c3af, 3 | BRF_GRA }, // 7
1863
1864 { "fu35", 0x200000, 0x6df14570, 4 | BRF_GRA }, // 8 - Tiles
1865 { "fu34", 0x200000, 0x93175d6d, 4 | BRF_GRA }, // 9
1866
1867 { "esd4.su10", 0x020000, 0x23f2b7d9, 5 | BRF_SND }, // 10 - OKI Samples
1868
1869 { "eeprom", 0x000080, 0x4539a8a0, 0 | BRF_OPT },
1870 };
1871
1872 STD_ROM_PICK(deluxe4u)
1873 STD_ROM_FN(deluxe4u)
1874
1875 struct BurnDriver BurnDrvDeluxe4u = {
1876 "deluxe4u", "deluxe5", NULL, NULL, "2000",
1877 "Deluxe 4 U (ver. 0107, 07/01/2000)\0", NULL, "ESD", "Miscellaneous",
1878 NULL, NULL, NULL, NULL,
1879 BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_POST90S, GBF_PLATFORM, 0,
1880 NULL, deluxe4uRomInfo, deluxe4uRomName, NULL, NULL, NULL, NULL, HedpanicInputInfo, NULL,
1881 TangtangInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1882 &DrvRecalc, 0x800, 320, 240, 4, 3
1883 };
1884
1885
1886 // SWAT Police
1887
1888 static struct BurnRomInfo swatpolcRomDesc[] = {
1889 { "esd.cu02", 0x040000, 0x29e0c126, 1 | BRF_PRG | BRF_ESS }, // 0 - 68k Code
1890 { "esd.cu03", 0x040000, 0x1070208b, 1 | BRF_PRG | BRF_ESS }, // 1
1891
1892 { "esd3.su06", 0x040000, 0x80e97dbe, 2 | BRF_PRG | BRF_ESS }, // 2 - Z80 Code
1893
1894 { "esd1.ju03", 0x080000, 0x17fcc5e7, 3 | BRF_GRA }, // 3 - Sprites
1895 { "esd2.ju04", 0x080000, 0x9c1752f2, 3 | BRF_GRA }, // 4
1896 { "esd3.ju05", 0x080000, 0xe8d9c092, 3 | BRF_GRA }, // 5
1897 { "esd4.ju06", 0x080000, 0xbde1b130, 3 | BRF_GRA }, // 6
1898 { "esd5.ju07", 0x080000, 0xd2c27f03, 3 | BRF_GRA }, // 7
1899
1900 { "fu35", 0x200000, 0xc55897c5, 4 | BRF_GRA }, // 8 - Tiles
1901 { "fu34", 0x200000, 0x7117a6a2, 4 | BRF_GRA }, // 9
1902
1903 { "at27c020.su10", 0x040000, 0xc43efec2, 5 | BRF_SND }, // 10 - OKI Samples
1904 };
1905
1906 STD_ROM_PICK(swatpolc)
STD_ROM_FN(swatpolc)1907 STD_ROM_FN(swatpolc)
1908
1909 static INT32 swatpolcCallback()
1910 {
1911 game_select = 5;
1912
1913 {
1914 if (BurnLoadRom(Drv68KROM + 1, 0, 2)) return 1;
1915 if (BurnLoadRom(Drv68KROM + 0, 1, 2)) return 1;
1916
1917 if (BurnLoadRom(DrvZ80ROM, 2, 1)) return 1;
1918
1919 for (INT32 i = 0; i < 5; i++) {
1920 if (BurnLoadRom(DrvGfxROM0 + i * 0x80000, 3 + i, 1)) return 1;
1921 }
1922
1923 if (BurnLoadRom(DrvGfxROM1 + 0x000000, 8, 2)) return 1;
1924 if (BurnLoadRom(DrvGfxROM1 + 0x000001, 9, 2)) return 1;
1925
1926 if (BurnLoadRom(DrvSndROM, 10, 1)) return 1;
1927
1928 TangtangGfxDecode();
1929 }
1930
1931 SekInit(0, 0x68000);
1932 SekOpen(0);
1933 SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, MAP_ROM);
1934 SekMapMemory(Drv68KRAM, 0x100000, 0x10ffff, MAP_RAM);
1935 SekMapMemory(DrvPalRAM, 0x800000, 0x8007ff, MAP_ROM);
1936 SekMapMemory(DrvSprRAM, 0x900000, 0x9007ff, MAP_RAM);
1937 SekMapMemory(DrvSprRAM, 0x900800, 0x900fff, MAP_RAM); // mirror
1938 SekMapMemory(DrvVidRAM0, 0xa00000, 0xa03fff, MAP_RAM);
1939 SekMapMemory(DrvVidRAM1, 0xa20000, 0xa23fff, MAP_RAM);
1940 SekMapMemory(DrvVidRAM1, 0xa24000, 0xa27fff, MAP_RAM); // mirror
1941 SekSetWriteByteHandler(0, hedpanic_write_byte);
1942 SekSetWriteWordHandler(0, hedpanic_write_word);
1943 SekSetReadByteHandler(0, hedpanic_read_byte);
1944 SekSetReadWordHandler(0, hedpanic_read_word);
1945 SekClose();
1946
1947 return 0;
1948 }
1949
SwatpolcInit()1950 static INT32 SwatpolcInit()
1951 {
1952 return DrvInit(swatpolcCallback);
1953 }
1954
1955 struct BurnDriver BurnDrvSwatpolc = {
1956 "swatpolc", NULL, NULL, NULL, "2001",
1957 "SWAT Police\0", NULL, "ESD", "Miscellaneous",
1958 NULL, NULL, NULL, NULL,
1959 BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_SHOOT, 0,
1960 NULL, swatpolcRomInfo, swatpolcRomName, NULL, NULL, NULL, NULL, SwatpolcInputInfo, NULL,
1961 SwatpolcInit, DrvExit, DrvFrame, DrvDraw, DrvScan,
1962 &DrvRecalc, 0x800, 320, 240, 4, 3
1963 };
1964