1 // FB Alpha Wild West C.O.W.-Boys of Moo Mesa / Bucky O'Hare driver module
2 // Based on MAME driver by R. Belmont, Acho A. Tang
3
4 #include "tiles_generic.h"
5 #include "m68000_intf.h"
6 #include "z80_intf.h"
7 #include "konamiic.h"
8 #include "burn_ym2151.h"
9 #include "k054539.h"
10 #include "msm6295.h"
11 #include "eeprom.h"
12
13 static UINT8 *AllMem;
14 static UINT8 *Drv68KROM;
15 static UINT8 *DrvZ80ROM;
16 static UINT8 *DrvGfxROM0;
17 static UINT8 *DrvGfxROM1;
18 static UINT8 *DrvGfxROMExp0;
19 static UINT8 *DrvGfxROMExp1;
20 static UINT8 *DrvSndROM;
21 static UINT8 *DrvEeprom;
22 static UINT8 *AllRam;
23 static UINT8 *Drv68KRAM;
24 static UINT8 *Drv68KRAM2;
25 static UINT8 *Drv68KRAM3;
26 static UINT8 *DrvZ80RAM;
27 static UINT8 *DrvSprRAM;
28 static UINT8 *DrvPalRAM;
29 static UINT8 *DrvProtRAM;
30 static UINT8 *RamEnd;
31 static UINT8 *MemEnd;
32
33 static UINT8 *soundlatch;
34 static UINT8 *soundlatch2;
35 static UINT8 *soundlatch3;
36
37 static UINT32 *DrvPalette;
38 static UINT8 DrvRecalc;
39
40 static INT32 layerpri[4];
41 static INT32 layer_colorbase[4];
42 static INT32 sprite_colorbase = 0;
43
44 static UINT8 DrvJoy1[16];
45 static UINT8 DrvJoy2[16];
46 static UINT8 DrvJoy3[16];
47 static UINT8 DrvJoy4[16];
48 static UINT8 DrvJoy5[16];
49 static UINT8 DrvReset;
50 static UINT16 DrvInputs[4];
51 static UINT8 DrvDips[1];
52
53 static INT32 sound_nmi_enable = 0;
54 static INT32 irq5_timer = 0;
55 static UINT16 control_data = 0;
56 static INT32 fogcnt = 0;
57 static UINT8 z80_bank;
58
59 static UINT16 zmask; // 0xffff moomesa, 0x00ff bucky
60
61 static INT32 moomesabl = 0;
62
63 static struct BurnInputInfo MooInputList[] = {
64 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" },
65 {"P1 Start", BIT_DIGITAL, DrvJoy3 + 7, "p1 start" },
66 {"P1 Up", BIT_DIGITAL, DrvJoy3 + 2, "p1 up" },
67 {"P1 Down", BIT_DIGITAL, DrvJoy3 + 3, "p1 down" },
68 {"P1 Left", BIT_DIGITAL, DrvJoy3 + 0, "p1 left" },
69 {"P1 Right", BIT_DIGITAL, DrvJoy3 + 1, "p1 right" },
70 {"P1 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p1 fire 1" },
71 {"P1 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p1 fire 2" },
72
73 {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" },
74 {"P2 Start", BIT_DIGITAL, DrvJoy4 + 7, "p2 start" },
75 {"P2 Up", BIT_DIGITAL, DrvJoy4 + 2, "p2 up" },
76 {"P2 Down", BIT_DIGITAL, DrvJoy4 + 3, "p2 down" },
77 {"P2 Left", BIT_DIGITAL, DrvJoy4 + 0, "p2 left" },
78 {"P2 Right", BIT_DIGITAL, DrvJoy4 + 1, "p2 right" },
79 {"P2 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p2 fire 1" },
80 {"P2 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p2 fire 2" },
81
82 {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p3 coin" },
83 {"P3 Start", BIT_DIGITAL, DrvJoy3 + 15, "p3 start" },
84 {"P3 Up", BIT_DIGITAL, DrvJoy3 + 10, "p3 up" },
85 {"P3 Down", BIT_DIGITAL, DrvJoy3 + 11, "p3 down" },
86 {"P3 Left", BIT_DIGITAL, DrvJoy3 + 8, "p3 left" },
87 {"P3 Right", BIT_DIGITAL, DrvJoy3 + 9, "p3 right" },
88 {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 12, "p3 fire 1" },
89 {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 13, "p3 fire 2" },
90
91 {"P4 Coin", BIT_DIGITAL, DrvJoy1 + 3, "p4 coin" },
92 {"P4 Start", BIT_DIGITAL, DrvJoy4 + 15, "p4 start" },
93 {"P4 Up", BIT_DIGITAL, DrvJoy4 + 10, "p4 up" },
94 {"P4 Down", BIT_DIGITAL, DrvJoy4 + 11, "p4 down" },
95 {"P4 Left", BIT_DIGITAL, DrvJoy4 + 8, "p4 left" },
96 {"P4 Right", BIT_DIGITAL, DrvJoy4 + 9, "p4 right" },
97 {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 12, "p4 fire 1" },
98 {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 13, "p4 fire 2" },
99
100 {"Reset", BIT_DIGITAL, &DrvReset, "reset" },
101 {"Service 1", BIT_DIGITAL, DrvJoy1 + 4, "service" },
102 {"Service 2", BIT_DIGITAL, DrvJoy1 + 5, "service" },
103 {"Service 3", BIT_DIGITAL, DrvJoy1 + 6, "service" },
104 {"Service 4", BIT_DIGITAL, DrvJoy1 + 7, "service" },
105 {"Service Mode", BIT_DIGITAL, DrvJoy5 + 3, "diagnostics" },
106 {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" },
107 };
108
109 STDINPUTINFO(Moo)
110
111 static struct BurnInputInfo BuckyInputList[] = {
112 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" },
113 {"P1 Start", BIT_DIGITAL, DrvJoy3 + 7, "p1 start" },
114 {"P1 Up", BIT_DIGITAL, DrvJoy3 + 2, "p1 up" },
115 {"P1 Down", BIT_DIGITAL, DrvJoy3 + 3, "p1 down" },
116 {"P1 Left", BIT_DIGITAL, DrvJoy3 + 0, "p1 left" },
117 {"P1 Right", BIT_DIGITAL, DrvJoy3 + 1, "p1 right" },
118 {"P1 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p1 fire 1" },
119 {"P1 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p1 fire 2" },
120 {"P1 Button 3", BIT_DIGITAL, DrvJoy3 + 6, "p1 fire 3" },
121
122 {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" },
123 {"P2 Start", BIT_DIGITAL, DrvJoy4 + 7, "p2 start" },
124 {"P2 Up", BIT_DIGITAL, DrvJoy4 + 2, "p2 up" },
125 {"P2 Down", BIT_DIGITAL, DrvJoy4 + 3, "p2 down" },
126 {"P2 Left", BIT_DIGITAL, DrvJoy4 + 0, "p2 left" },
127 {"P2 Right", BIT_DIGITAL, DrvJoy4 + 1, "p2 right" },
128 {"P2 Button 1", BIT_DIGITAL, DrvJoy4 + 4, "p2 fire 1" },
129 {"P2 Button 2", BIT_DIGITAL, DrvJoy4 + 5, "p2 fire 2" },
130 {"P2 Button 3", BIT_DIGITAL, DrvJoy4 + 6, "p2 fire 3" },
131
132 {"P3 Coin", BIT_DIGITAL, DrvJoy1 + 2, "p3 coin" },
133 {"P3 Start", BIT_DIGITAL, DrvJoy3 + 15, "p3 start" },
134 {"P3 Up", BIT_DIGITAL, DrvJoy3 + 10, "p3 up" },
135 {"P3 Down", BIT_DIGITAL, DrvJoy3 + 11, "p3 down" },
136 {"P3 Left", BIT_DIGITAL, DrvJoy3 + 8, "p3 left" },
137 {"P3 Right", BIT_DIGITAL, DrvJoy3 + 9, "p3 right" },
138 {"P3 Button 1", BIT_DIGITAL, DrvJoy3 + 12, "p3 fire 1" },
139 {"P3 Button 2", BIT_DIGITAL, DrvJoy3 + 13, "p3 fire 2" },
140 {"P3 Button 3", BIT_DIGITAL, DrvJoy3 + 14, "p3 fire 3" },
141
142 {"P4 Coin", BIT_DIGITAL, DrvJoy1 + 3, "p4 coin" },
143 {"P4 Start", BIT_DIGITAL, DrvJoy4 + 15, "p4 start" },
144 {"P4 Up", BIT_DIGITAL, DrvJoy4 + 10, "p4 up" },
145 {"P4 Down", BIT_DIGITAL, DrvJoy4 + 11, "p4 down" },
146 {"P4 Left", BIT_DIGITAL, DrvJoy4 + 8, "p4 left" },
147 {"P4 Right", BIT_DIGITAL, DrvJoy4 + 9, "p4 right" },
148 {"P4 Button 1", BIT_DIGITAL, DrvJoy4 + 12, "p4 fire 1" },
149 {"P4 Button 2", BIT_DIGITAL, DrvJoy4 + 13, "p4 fire 2" },
150 {"P4 Button 3", BIT_DIGITAL, DrvJoy4 + 14, "p4 fire 3" },
151
152 {"Reset", BIT_DIGITAL, &DrvReset, "reset" },
153 {"Service 1", BIT_DIGITAL, DrvJoy1 + 4, "service" },
154 {"Service 2", BIT_DIGITAL, DrvJoy1 + 5, "service" },
155 {"Service 3", BIT_DIGITAL, DrvJoy1 + 6, "service" },
156 {"Service 4", BIT_DIGITAL, DrvJoy1 + 7, "service" },
157 {"Service Mode", BIT_DIGITAL, DrvJoy5 + 3, "diagnostics" },
158 {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" },
159 };
160
161 STDINPUTINFO(Bucky)
162
163 static struct BurnDIPInfo MooDIPList[]=
164 {
165 {0x26, 0xff, 0xff, 0x60, NULL },
166
167 {0 , 0xfe, 0 , 2, "Sound Output" },
168 {0x26, 0x01, 0x10, 0x10, "Mono" },
169 {0x26, 0x01, 0x10, 0x00, "Stereo" },
170
171 {0 , 0xfe, 0 , 2, "Coin Mechanism" },
172 {0x26, 0x01, 0x20, 0x20, "Common" },
173 {0x26, 0x01, 0x20, 0x00, "Independent" },
174
175 {0 , 0xfe, 0 , 3, "Number of Players" },
176 {0x26, 0x01, 0xc0, 0xc0, "2" },
177 {0x26, 0x01, 0xc0, 0x40, "3" },
178 {0x26, 0x01, 0xc0, 0x80, "4" },
179 };
180
181 STDDIPINFO(Moo)
182
183 static struct BurnDIPInfo BuckyDIPList[]=
184 {
185 {0x2a, 0xff, 0xff, 0x60, NULL },
186
187 {0 , 0xfe, 0 , 2, "Sound Output" },
188 {0x2a, 0x01, 0x10, 0x10, "Mono" },
189 {0x2a, 0x01, 0x10, 0x00, "Stereo" },
190
191 {0 , 0xfe, 0 , 2, "Coin Mechanism" },
192 {0x2a, 0x01, 0x20, 0x20, "Common" },
193 {0x2a, 0x01, 0x20, 0x00, "Independent" },
194
195 {0 , 0xfe, 0 , 3, "Number of Players" },
196 {0x2a, 0x01, 0xc0, 0xc0, "2" },
197 {0x2a, 0x01, 0xc0, 0x40, "3" },
198 {0x2a, 0x01, 0xc0, 0x80, "4" },
199 };
200
STDDIPINFO(Bucky)201 STDDIPINFO(Bucky)
202
203 static void moo_objdma()
204 {
205 INT32 num_inactive;
206 UINT16 *dst = (UINT16*)K053247Ram;
207 UINT16 *src = (UINT16*)DrvSprRAM;
208
209 INT32 dmacntr = 23;
210
211 num_inactive = dmacntr = 256;
212
213 do
214 {
215 if ((*src & 0x8000) && (*src & zmask))
216 {
217 memcpy(dst, src, 0x10);
218 dst += 8;
219 num_inactive--;
220 }
221 src += 0x80;
222 }
223 while (--dmacntr);
224
225 if (num_inactive)
226 {
227 do
228 {
229 *dst = 0;
230 dst += 8;
231 }
232 while (--num_inactive);
233 }
234 }
235
236 #ifdef FBA_DEBUG
237 extern int counter;
238 #endif
239
moo_prot_write(INT32 offset)240 static void moo_prot_write(INT32 offset)
241 {
242 UINT16 *m_protram = (UINT16*)DrvProtRAM;
243
244 if ((offset & 0x1e) == 0x18) // trigger operation
245 {
246 UINT32 src1 = (m_protram[1] & 0xff) << 16 | m_protram[0];
247 UINT32 src2 = (m_protram[3] & 0xff) << 16 | m_protram[2];
248 UINT32 dst = (m_protram[5] & 0xff) << 16 | m_protram[4];
249 UINT32 length = m_protram[0xf];
250
251 while (length)
252 {
253 UINT32 a = SekReadWord(src1);
254 UINT32 b = SekReadWord(src2);
255
256 SekWriteWord(dst, a + 2 * b);
257
258 src1 += 2;
259 src2 += 2;
260 dst += 2;
261 length--;
262 }
263 }
264 }
265
moomesabl_sndbank(INT32 bank)266 static void moomesabl_sndbank(INT32 bank)
267 {
268 if (!moomesabl) return;
269
270 MSM6295SetBank(0, DrvSndROM + ((bank&0xf) * 0x40000), 0, 0x3ffff);
271 }
272
sync_sound()273 static inline void sync_sound()
274 {
275 if (moomesabl) return;
276 INT32 cycles = (SekTotalCycles() / 2) - ZetTotalCycles();
277 if (cycles > 0) {
278 ZetRun(cycles);
279 }
280 }
281
moo_main_write_word(UINT32 address,UINT16 data)282 static void __fastcall moo_main_write_word(UINT32 address, UINT16 data)
283 {
284 if ((address & 0xffc000) == 0x1a0000) {
285 K056832RamWriteWord(address & 0x1fff, data);
286 return;
287 }
288
289 if ((address & 0xfffff8) == 0x0c2000) {
290 K053246Write((address & 0x06) + 0, data >> 8);
291 K053246Write((address & 0x06) + 1, data&0xff);
292 return;
293 }
294
295 if ((address & 0xffffc0) == 0x0c0000) {
296 K056832WordWrite(address & 0x3e, data);
297 return;
298 }
299
300 if ((address & 0xffffe0) == 0x0ca000) {
301 K054338WriteWord(address, data);
302 return;
303 }
304
305 if ((address & 0xffffe0) == 0x0ce000) {
306 *((UINT16*)(DrvProtRAM + (address & 0x1e))) = data;
307 moo_prot_write(address);
308 return;
309 }
310
311 if ((address & 0xfffff8) == 0x0d8000) {
312 return; // regb
313 }
314 switch (address)
315 {
316 case 0x0d6ffc:
317 moomesabl_sndbank(data);
318 return;
319
320 case 0x0d6ffe:
321 if (!moomesabl) return;
322 MSM6295Write(0, data);
323 return;
324
325 case 0x0de000:
326 control_data = data;
327 bprintf(0, _T("control %X.\n"), data);
328 K053246_set_OBJCHA_line((data & 0x100) >> 8);
329 EEPROMWrite((data & 0x04), (data & 0x02), (data & 0x01));
330 return;
331 }
332 }
333
moo_main_write_byte(UINT32 address,UINT8 data)334 static void __fastcall moo_main_write_byte(UINT32 address, UINT8 data)
335 {
336 if ((address & 0xffc000) == 0x1a0000) {
337 K056832RamWriteByte(address & 0x1fff, data);
338 return;
339 }
340
341 if ((address & 0xffffc0) == 0x0c0000) {
342 K056832ByteWrite(address, data);
343 return;
344 }
345
346 if ((address & 0xfffff8) == 0x0c2000) {
347 K053246Write((address & 0x07) ^ 0, data);
348 return;
349 }
350
351 if ((address & 0xffffe0) == 0x0ca000) {
352 K054338WriteByte(address, data);
353 return;
354 }
355
356 if ((address & 0xffffe1) == 0x0cc001) {
357 K053251Write((address / 2) & 0xf, data);
358 return;
359 }
360
361 if ((address & 0xffffe0) == 0x0d0000) {
362 // k053252 unimplemented
363 return;
364 }
365
366 if ((address & 0xfffff8) == 0x0d8000) {
367 return; // regb
368 }
369
370 switch (address)
371 {
372 case 0x0d6ffc:
373 case 0x0d6ffd:
374 moomesabl_sndbank(data);
375 return;
376
377 case 0x0d6ffe:
378 case 0x0d6fff:
379 if (!moomesabl) return;
380 MSM6295Write(0, data);
381 return;
382
383 case 0x0d4000:
384 case 0x0d4001:
385 ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
386 return;
387
388 case 0x0d600c:
389 case 0x0d600d:
390 sync_sound();
391 *soundlatch = data;
392 return;
393
394 case 0x0d600e:
395 case 0x0d600f:
396 sync_sound();
397 *soundlatch2 = data;
398 return;
399
400 case 0x0de000:
401 control_data = (control_data & 0x00ff) + (data << 8);
402 return;
403
404 case 0x0de001:
405 EEPROMWrite((data & 0x04), (data & 0x02), (data & 0x01));
406 control_data = (control_data & 0xff00) + data;
407 return;
408 }
409 }
410
moo_main_read_word(UINT32 address)411 static UINT16 __fastcall moo_main_read_word(UINT32 address)
412 {
413 //bprintf (0, _T("MRW: %5.5x\n"), address);
414
415 if ((address & 0xffc000) == 0x1a0000) {
416 return K056832RamReadWord(address & 0x1fff);
417 }
418
419 if ((address & 0xffe000) == 0x1b0000) {
420 return K056832RomWordRead(address);
421 }
422
423 switch (address)
424 {
425 case 0x0d6ffe:
426 case 0x0d6fff:
427 if (!moomesabl) return 0;
428 return MSM6295Read(0);
429
430 case 0x0c4000:
431 sync_sound();
432 return K053246Read(1) + (K053246Read(0) << 8);
433
434 case 0x0da000:
435 return DrvInputs[2];
436
437 case 0x0da002:
438 return DrvInputs[3];
439
440 case 0x0dc000:
441 return DrvInputs[0] & 0xff;
442
443 case 0x0dc002:
444 return (DrvInputs[1] & 0xf8) | 2 | (EEPROMRead() ? 0x01 : 0);
445
446 case 0x0de000:
447 return control_data;
448 }
449
450 return 0;
451 }
452
moo_main_read_byte(UINT32 address)453 static UINT8 __fastcall moo_main_read_byte(UINT32 address)
454 {
455 //bprintf (0, _T("MRB: %5.5x\n"), address);
456
457 if ((address & 0xffc000) == 0x1a0000) {
458 return K056832RamReadByte(address & 0x1fff);
459 }
460
461 if ((address & 0xffe000) == 0x1b0000) {
462 return K056832RomWordRead(address) >> ((~address & 1) * 8);
463 }
464
465 switch (address)
466 {
467 case 0x0d6ffe:
468 case 0x0d6fff:
469 if (!moomesabl) return 0;
470 return MSM6295Read(0);
471
472 case 0x0c4000:
473 case 0x0c4001:
474 sync_sound();
475 return K053246Read(address & 1);
476
477 case 0x0da000:
478 return DrvInputs[2] >> 8;
479
480 case 0x0da001:
481 return DrvInputs[2];
482
483 case 0x0da002:
484 return DrvInputs[3] >> 8;
485
486 case 0x0da003:
487 return DrvInputs[3];
488
489 case 0x0dc000:
490 return DrvInputs[0] >> 8;
491
492 case 0x0dc001:
493 return DrvInputs[0];
494
495 case 0x0dc002:
496 return 0;
497
498 case 0x0dc003:
499 return ((DrvInputs[1]) & 0xf8) | 2 | (EEPROMRead() ? 0x01 : 0);
500
501 case 0x0d6015:
502 return *soundlatch3;
503
504 case 0x0de000:
505 case 0x0de001:
506 return control_data >> ((~address & 1) * 8);
507 }
508
509 return 0;
510 }
511
bucky_main_write_word(UINT32 address,UINT16 data)512 static void __fastcall bucky_main_write_word(UINT32 address, UINT16 data)
513 {
514 if ((address & 0xffc000) == 0x180000) {
515 K056832RamWriteWord(address & 0x1fff, data);
516 return;
517 }
518
519 if ((address & 0xfffff8) == 0x0c2000) {
520 K053246Write((address & 0x06) + 0, data >> 8);
521 K053246Write((address & 0x06) + 1, data&0xff);
522 return;
523 }
524
525 if ((address & 0xffffc0) == 0x0c0000) {
526 K056832WordWrite(address & 0x3e, data);
527 return;
528 }
529
530 if ((address & 0xffffe0) == 0x0ca000) {
531 K054338WriteWord(address, data);
532 return;
533 }
534
535 if ((address & 0xffffe0) == 0x0ce000) {
536 *((UINT16*)(DrvProtRAM + (address & 0x1e))) = data;
537 moo_prot_write(address);
538 return;
539 }
540
541 if ((address & 0xffff00) == 0x0d2000) {
542 K054000Write((address/2)&0xff, data);
543 return;
544 }
545
546 if ((address & 0xfffff8) == 0x0d8000) {
547 return; // regb
548 }
549
550 switch (address)
551 {
552 case 0x0de000:
553 control_data = data;
554 K053246_set_OBJCHA_line((data & 0x100) >> 8);
555 EEPROMWrite((data & 0x04), (data & 0x02), (data & 0x01));
556 return;
557
558 }
559 }
560
bucky_main_write_byte(UINT32 address,UINT8 data)561 static void __fastcall bucky_main_write_byte(UINT32 address, UINT8 data)
562 {
563 if ((address & 0xffc000) == 0x180000) {
564 K056832RamWriteByte(address & 0x1fff, data);
565 return;
566 }
567
568 if ((address & 0xffffc0) == 0x0c0000) {
569 K056832ByteWrite(address, data);
570 return;
571 }
572
573 if ((address & 0xfffff8) == 0x0c2000) {
574 K053246Write((address & 0x07) ^ 0, data);
575 return;
576 }
577
578 if ((address & 0xffffe0) == 0x0ca000) {
579 K054338WriteByte(address, data);
580 return;
581 }
582
583 if ((address & 0xffffe1) == 0x0cc001) {
584 K053251Write((address / 2) & 0xf, data);
585 return;
586 }
587
588 if ((address & 0xffffe0) == 0x0d0000) {
589 // k053252 unimplemented
590 return;
591 }
592
593 if ((address & 0xffff00) == 0x0d2000) {
594 K054000Write((address/2)&0xff, data);
595 return;
596 }
597
598 if ((address & 0xfffff8) == 0x0d8000) {
599 return; // regb
600 }
601
602 switch (address)
603 {
604 case 0x0d4000:
605 case 0x0d4001:
606 ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
607 return;
608
609 case 0x0d600c:
610 case 0x0d600d:
611 sync_sound();
612 *soundlatch = data;
613 return;
614
615 case 0x0d600e:
616 case 0x0d600f:
617 sync_sound();
618 *soundlatch2 = data;
619 return;
620
621 case 0x0de000:
622 control_data = (control_data & 0x00ff) + (data << 8);
623 return;
624
625 case 0x0de001:
626 EEPROMWrite((data & 0x04), (data & 0x02), (data & 0x01));
627 control_data = (control_data & 0xff00) + data;
628 return;
629 }
630 }
631
bucky_main_read_word(UINT32 address)632 static UINT16 __fastcall bucky_main_read_word(UINT32 address)
633 {
634 //bprintf (0, _T("MRW: %5.5x\n"), address);
635
636 if ((address & 0xffff00) == 0x0d2000) {
637 return K054000Read((address/2)&0xff);
638 }
639
640 if ((address & 0xffc000) == 0x180000) {
641 return K056832RamReadWord(address & 0x1fff);
642 }
643
644 if ((address & 0xffe000) == 0x190000) {
645 return K056832RomWordRead(address);
646 }
647
648 switch (address)
649 {
650 case 0x0c4000:
651 sync_sound();
652 return K053246Read(1) + (K053246Read(0) << 8);
653
654 case 0x0da000:
655 return DrvInputs[2];
656
657 case 0x0da002:
658 return DrvInputs[3];
659
660 case 0x0dc000:
661 return DrvInputs[0] & 0xff;
662
663 case 0x0dc002:
664 return (DrvInputs[1] & 0xf8) | 2 | (EEPROMRead() ? 0x01 : 0);
665
666 case 0x0de000:
667 return control_data;
668 }
669
670 return 0;
671 }
672
bucky_main_read_byte(UINT32 address)673 static UINT8 __fastcall bucky_main_read_byte(UINT32 address)
674 {
675 //bprintf (0, _T("MRB: %5.5x\n"), address);
676
677 if ((address & 0xffff00) == 0x0d2000) {
678 return K054000Read((address/2)&0xff);
679 }
680
681 if ((address & 0xffc000) == 0x180000) {
682 return K056832RamReadByte(address & 0x1fff);
683 }
684
685 if ((address & 0xffe000) == 0x190000) {
686 return K056832RomWordRead(address) >> ((~address & 1) * 8);
687 }
688
689 switch (address)
690 {
691 case 0x0c4000:
692 case 0x0c4001:
693 sync_sound();
694 return K053246Read(address & 1);
695
696 case 0x0da000:
697 return DrvInputs[2] >> 8;
698
699 case 0x0da001:
700 return DrvInputs[2];
701
702 case 0x0da002:
703 return DrvInputs[3] >> 8;
704
705 case 0x0da003:
706 return DrvInputs[3];
707
708 case 0x0dc000:
709 return DrvInputs[0] >> 8;
710
711 case 0x0dc001:
712 return DrvInputs[0];
713
714 case 0x0dc002:
715 return 0;
716
717 case 0x0dc003:
718 return ((DrvInputs[1]) & 0xf8) | 2 | (EEPROMRead() ? 0x01 : 0);
719
720 case 0x0d6015:
721 return *soundlatch3;
722
723 case 0x0de000:
724 case 0x0de001:
725 return control_data >> ((~address & 1) * 8);
726 }
727
728 return 0;
729 }
730
bankswitch(INT32 data)731 static void bankswitch(INT32 data)
732 {
733 z80_bank = data;
734 ZetMapMemory(DrvZ80ROM + ((data & 0x0f) * 0x4000), 0x8000, 0xbfff, MAP_ROM);
735 }
736
moo_sound_write(UINT16 address,UINT8 data)737 static void __fastcall moo_sound_write(UINT16 address, UINT8 data)
738 {
739 switch (address)
740 {
741 case 0xec00:
742 BurnYM2151SelectRegister(data);
743 return;
744
745 case 0xec01:
746 BurnYM2151WriteRegister(data);
747 return;
748
749 case 0xf000:
750 *soundlatch3 = data;
751 return;
752
753 case 0xf800:
754 bankswitch(data);
755 return;
756 }
757
758 if (address >= 0xe000 && address <= 0xe22f) {
759 return K054539Write(0, address & 0x3ff, data);
760 }
761 }
762
moo_sound_read(UINT16 address)763 static UINT8 __fastcall moo_sound_read(UINT16 address)
764 {
765 if (address >= 0xe000 && address <= 0xe22f) {
766 return K054539Read(0, address & 0x3ff);
767 }
768
769 switch (address)
770 {
771 case 0xec00:
772 case 0xec01:
773 return BurnYM2151Read();
774
775 case 0xf002:
776 ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
777 return *soundlatch;
778
779 case 0xf003:
780 return *soundlatch2;
781 }
782
783 return 0;
784 }
785
786 static const eeprom_interface moo_eeprom_interface =
787 {
788 7, /* address bits */
789 8, /* data bits */
790 "011000", /* read command */
791 "011100", /* write command */
792 "0100100000000", /* erase command */
793 "0100000000000", /* lock command */
794 "0100110000000", /* unlock command */
795 0,
796 0
797 };
798
moo_sprite_callback(INT32 *,INT32 * color,INT32 * priority)799 static void moo_sprite_callback(INT32 */*code*/, INT32 *color, INT32 *priority)
800 {
801 INT32 pri = (*color & 0x03e0) >> 4;
802
803 if (pri <= layerpri[2]) *priority = 0x00;
804 else if (pri <= layerpri[1]) *priority = 0xf0;
805 else if (pri <= layerpri[0]) *priority = 0xfc;
806 else *priority = 0xfe;
807
808 *color = sprite_colorbase | (*color & 0x001f);
809 }
810
moo_tile_callback(INT32 layer,INT32 * code,INT32 * color,INT32 *)811 static void moo_tile_callback(INT32 layer, INT32 *code, INT32 *color, INT32 */*flags*/)
812 {
813 *color = layer_colorbase[layer] | (*color >> 2 & 0x0f);
814 if (layer == 1 && *code == 0xda02 && zmask == 0xffff) fogcnt = 10; // moomesa only
815 }
816
DrvDoReset()817 static INT32 DrvDoReset()
818 {
819 memset (AllRam, 0, RamEnd - AllRam);
820
821 SekOpen(0);
822 SekReset();
823 SekClose();
824
825 ZetOpen(0);
826 ZetReset();
827 bankswitch(2);
828 ZetClose();
829
830 KonamiICReset();
831
832 BurnYM2151Reset();
833 K054539Reset(0);
834
835 EEPROMReset();
836
837 if (EEPROMAvailable() == 0) {
838 EEPROMFill(DrvEeprom, 0, 128);
839 }
840
841 control_data = 0;
842 irq5_timer = 0;
843
844 for (INT32 i = 0; i < 4; i++)
845 {
846 layer_colorbase[i] = 0;
847 layerpri[i] = 0;
848 }
849
850 sound_nmi_enable = 0;
851 z80_bank = 0;
852
853 fogcnt = 0;
854
855 return 0;
856 }
857
MemIndex()858 static INT32 MemIndex()
859 {
860 UINT8 *Next; Next = AllMem;
861
862 Drv68KROM = Next; Next += 0x100000;
863 DrvZ80ROM = Next; Next += 0x040000;
864
865 DrvGfxROM0 = Next; Next += 0x200000;
866 DrvGfxROMExp0 = Next; Next += 0x400000;
867 DrvGfxROM1 = Next; Next += 0x800000;
868 DrvGfxROMExp1 = Next; Next += 0x1000000;
869
870 DrvSndROM = Next; Next += 0x400000;
871
872 DrvEeprom = Next; Next += 0x000080;
873
874 konami_palette32 = (UINT32*)Next;
875 DrvPalette = (UINT32*)Next; Next += 0x1000 * sizeof(UINT32);
876
877 AllRam = Next;
878
879 Drv68KRAM = Next; Next += 0x010000;
880 Drv68KRAM2 = Next; Next += 0x010000;
881 Drv68KRAM3 = Next; Next += 0x004000;
882 DrvSprRAM = Next; Next += 0x010000;
883 DrvPalRAM = Next; Next += 0x005000;
884
885 DrvZ80RAM = Next; Next += 0x002000;
886
887 DrvProtRAM = Next; Next += 0x000020;
888
889 soundlatch = Next; Next += 0x000001;
890 soundlatch2 = Next; Next += 0x000001;
891 soundlatch3 = Next; Next += 0x000001;
892
893 RamEnd = Next;
894 MemEnd = Next;
895
896 return 0;
897 }
898
MooInit()899 static INT32 MooInit()
900 {
901 GenericTilesInit();
902
903 AllMem = NULL;
904 MemIndex();
905 INT32 nLen = MemEnd - (UINT8 *)0;
906 if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
907 memset(AllMem, 0, nLen);
908 MemIndex();
909
910 if (moomesabl)
911 { // bootleg
912 if (BurnLoadRom(Drv68KROM + 0x000000, 0, 1)) return 1;
913 if (BurnLoadRom(Drv68KROM + 0x080000, 1, 1)) return 1;
914
915 // ignore 2,3 (repeat of 0,1)
916
917 if (BurnLoadRomExt(DrvGfxROM0 + 0x000000, 4, 4, 2)) return 1;
918 if (BurnLoadRomExt(DrvGfxROM0 + 0x000002, 5, 4, 2)) return 1;
919 if (BurnLoadRomExt(DrvGfxROM0 + 0x100000, 6, 4, 2)) return 1;
920 if (BurnLoadRomExt(DrvGfxROM0 + 0x100002, 7, 4, 2)) return 1;
921
922 if (BurnLoadRomExt(DrvGfxROM1 + 0x000000, 8, 8, 2)) return 1;
923 if (BurnLoadRomExt(DrvGfxROM1 + 0x000002, 9, 8, 2)) return 1;
924 if (BurnLoadRomExt(DrvGfxROM1 + 0x000004, 10, 8, 2)) return 1;
925 if (BurnLoadRomExt(DrvGfxROM1 + 0x000006, 11, 8, 2)) return 1;
926
927 {
928 UINT8 *tmp = (UINT8 *)BurnMalloc(0x100000);
929
930 if (BurnLoadRom(tmp + 0x000000, 12, 1)) return 1;
931 if (BurnLoadRom(tmp + 0x080000, 13, 1)) return 1;
932 memcpy(DrvSndROM + 0x000000, tmp + 0x000000, 0x40000);
933
934 memcpy(DrvSndROM + 0x040000+0x30000, tmp + 0x040000, 0x10000);
935 memcpy(DrvSndROM + 0x080000+0x30000, tmp + 0x050000, 0x10000);
936 memcpy(DrvSndROM + 0x0c0000+0x30000, tmp + 0x060000, 0x10000);
937 memcpy(DrvSndROM + 0x100000+0x30000, tmp + 0x070000, 0x10000);
938
939 memcpy(DrvSndROM + 0x040000, tmp + 0x000000, 0x30000);
940 memcpy(DrvSndROM + 0x080000, tmp + 0x000000, 0x30000);
941 memcpy(DrvSndROM + 0x0c0000, tmp + 0x000000, 0x30000);
942 memcpy(DrvSndROM + 0x100000, tmp + 0x000000, 0x30000);
943 memcpy(DrvSndROM + 0x140000, tmp + 0x000000, 0x30000);
944 memcpy(DrvSndROM + 0x180000, tmp + 0x000000, 0x30000);
945 memcpy(DrvSndROM + 0x1c0000, tmp + 0x000000, 0x30000);
946 memcpy(DrvSndROM + 0x200000, tmp + 0x000000, 0x30000);
947 memcpy(DrvSndROM + 0x240000, tmp + 0x000000, 0x30000);
948 memcpy(DrvSndROM + 0x280000, tmp + 0x000000, 0x30000);
949 memcpy(DrvSndROM + 0x2c0000, tmp + 0x000000, 0x30000);
950 memcpy(DrvSndROM + 0x300000, tmp + 0x000000, 0x30000);
951
952 memcpy(DrvSndROM + 0x140000+0x30000, tmp + 0x080000, 0x10000);
953 memcpy(DrvSndROM + 0x180000+0x30000, tmp + 0x090000, 0x10000);
954 memcpy(DrvSndROM + 0x1c0000+0x30000, tmp + 0x0a0000, 0x10000);
955 memcpy(DrvSndROM + 0x200000+0x30000, tmp + 0x0b0000, 0x10000);
956 memcpy(DrvSndROM + 0x240000+0x30000, tmp + 0x0c0000, 0x10000);
957 memcpy(DrvSndROM + 0x280000+0x30000, tmp + 0x0d0000, 0x10000);
958 memcpy(DrvSndROM + 0x2c0000+0x30000, tmp + 0x0e0000, 0x10000);
959 memcpy(DrvSndROM + 0x300000+0x30000, tmp + 0x0f0000, 0x10000);
960
961 BurnFree(tmp);
962 }
963
964 if (BurnLoadRom(DrvEeprom + 0x000000, 14, 1)) return 1;
965 }
966 else
967 { // regular
968 if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1;
969 if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1;
970 if (BurnLoadRom(Drv68KROM + 0x080001, 2, 2)) return 1;
971 if (BurnLoadRom(Drv68KROM + 0x080000, 3, 2)) return 1;
972
973 if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1;
974
975 if (BurnLoadRomExt(DrvGfxROM0 + 0x000000, 5, 4, 2)) return 1;
976 if (BurnLoadRomExt(DrvGfxROM0 + 0x000002, 6, 4, 2)) return 1;
977
978 if (BurnLoadRomExt(DrvGfxROM1 + 0x000000, 7, 8, 2)) return 1;
979 if (BurnLoadRomExt(DrvGfxROM1 + 0x000002, 8, 8, 2)) return 1;
980 if (BurnLoadRomExt(DrvGfxROM1 + 0x000004, 9, 8, 2)) return 1;
981 if (BurnLoadRomExt(DrvGfxROM1 + 0x000006, 10, 8, 2)) return 1;
982
983 if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1;
984
985 if (BurnLoadRom(DrvEeprom + 0x000000, 12, 1)) return 1;
986 }
987
988 K053247GfxDecode(DrvGfxROM0, DrvGfxROMExp0, 0x200000);
989 K053247GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x800000);
990
991 K054338Init();
992
993 K056832Init(DrvGfxROM0, DrvGfxROMExp0, 0x200000, moo_tile_callback);
994 K056832SetGlobalOffsets(40, 16);
995 K056832SetLayerOffsets(0, -1, 0);
996 K056832SetLayerOffsets(1, 3, 0);
997 K056832SetLayerOffsets(2, 5, 0);
998 K056832SetLayerOffsets(3, 7, 0);
999
1000 K053247Init(DrvGfxROM1, DrvGfxROMExp1, 0x7fffff, moo_sprite_callback, 1);
1001 K053247SetSpriteOffset(-88, -39);
1002
1003 zmask = 0xffff;
1004
1005 SekInit(0, 0x68000);
1006 SekOpen(0);
1007 SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, MAP_ROM);
1008 SekMapMemory(Drv68KROM + 0x080000, 0x100000, 0x17ffff, MAP_ROM);
1009 SekMapMemory(Drv68KRAM, 0x180000, 0x18ffff, MAP_RAM);
1010 SekMapMemory(DrvSprRAM, 0x190000, 0x19ffff, MAP_RAM);
1011 SekMapMemory(DrvPalRAM, 0x1c0000, 0x1c1fff, MAP_RAM);
1012 SekSetWriteWordHandler(0, moo_main_write_word);
1013 SekSetWriteByteHandler(0, moo_main_write_byte);
1014 SekSetReadWordHandler(0, moo_main_read_word);
1015 SekSetReadByteHandler(0, moo_main_read_byte);
1016 SekClose();
1017
1018 ZetInit(0);
1019 ZetOpen(0);
1020 ZetMapMemory(DrvZ80ROM, 0x0000, 0x7fff, MAP_ROM);
1021 ZetMapMemory(DrvZ80RAM, 0xc000, 0xdfff, MAP_RAM);
1022 ZetSetWriteHandler(moo_sound_write);
1023 ZetSetReadHandler(moo_sound_read);
1024 ZetClose();
1025
1026 EEPROMInit(&moo_eeprom_interface);
1027
1028 BurnYM2151Init(4000000);
1029 BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT);
1030 BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT);
1031
1032 K054539Init(0, 48000, DrvSndROM, 0x200000);
1033 K054539SetRoute(0, BURN_SND_K054539_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT);
1034 K054539SetRoute(0, BURN_SND_K054539_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT);
1035
1036 if (moomesabl) {
1037 MSM6295Init(0, 1056000 / MSM6295_PIN7_HIGH, 0);
1038 MSM6295SetRoute(0, 1.00, BURN_SND_ROUTE_BOTH);
1039 }
1040
1041 DrvDoReset();
1042
1043 return 0;
1044 }
1045
BuckyInit()1046 static INT32 BuckyInit()
1047 {
1048 GenericTilesInit();
1049
1050 AllMem = NULL;
1051 MemIndex();
1052 INT32 nLen = MemEnd - (UINT8 *)0;
1053 if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
1054 memset(AllMem, 0, nLen);
1055 MemIndex();
1056
1057 {
1058 if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1;
1059 if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1;
1060 if (BurnLoadRom(Drv68KROM + 0x080001, 2, 2)) return 1;
1061 if (BurnLoadRom(Drv68KROM + 0x080000, 3, 2)) return 1;
1062
1063 if (BurnLoadRom(DrvZ80ROM + 0x000000, 4, 1)) return 1;
1064
1065 if (BurnLoadRomExt(DrvGfxROM0 + 0x000000, 5, 4, 2)) return 1;
1066 if (BurnLoadRomExt(DrvGfxROM0 + 0x000002, 6, 4, 2)) return 1;
1067
1068 if (BurnLoadRomExt(DrvGfxROM1 + 0x000000, 7, 8, 2)) return 1;
1069 if (BurnLoadRomExt(DrvGfxROM1 + 0x000002, 8, 8, 2)) return 1;
1070 if (BurnLoadRomExt(DrvGfxROM1 + 0x000004, 9, 8, 2)) return 1;
1071 if (BurnLoadRomExt(DrvGfxROM1 + 0x000006, 10, 8, 2)) return 1;
1072
1073 if (BurnLoadRom(DrvSndROM + 0x000000, 11, 1)) return 1;
1074 if (BurnLoadRom(DrvSndROM + 0x200000, 12, 1)) return 1;
1075
1076 if (BurnLoadRom(DrvEeprom + 0x000000, 13, 1)) return 1;
1077
1078 K053247GfxDecode(DrvGfxROM0, DrvGfxROMExp0, 0x200000);
1079 K053247GfxDecode(DrvGfxROM1, DrvGfxROMExp1, 0x800000);
1080 }
1081
1082 K054338Init();
1083
1084 K056832Init(DrvGfxROM0, DrvGfxROMExp0, 0x200000, moo_tile_callback);
1085 K056832SetGlobalOffsets(40, 16);
1086 K056832SetLayerOffsets(0, -2, 0);
1087 K056832SetLayerOffsets(1, 2, 0);
1088 K056832SetLayerOffsets(2, 4, 0);
1089 K056832SetLayerOffsets(3, 6, 0);
1090
1091 K053247Init(DrvGfxROM1, DrvGfxROMExp1, 0x7fffff, moo_sprite_callback, 1);
1092 K053247SetSpriteOffset(-88, -39);
1093
1094 zmask = 0x00ff;
1095
1096 SekInit(0, 0x68000);
1097 SekOpen(0);
1098 SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, MAP_ROM);
1099 SekMapMemory(Drv68KROM + 0x080000, 0x200000, 0x23ffff, MAP_ROM);
1100 SekMapMemory(Drv68KRAM, 0x080000, 0x08ffff, MAP_RAM);
1101 SekMapMemory(DrvSprRAM, 0x090000, 0x09ffff, MAP_RAM);
1102 SekMapMemory(Drv68KRAM2, 0x0a0000, 0x0affff, MAP_RAM);
1103 SekMapMemory(Drv68KRAM3, 0x184000, 0x187fff, MAP_RAM);
1104 SekMapMemory(DrvPalRAM, 0x1b0000, 0x1b3fff, MAP_RAM);
1105 SekSetWriteWordHandler(0, bucky_main_write_word);
1106 SekSetWriteByteHandler(0, bucky_main_write_byte);
1107 SekSetReadWordHandler(0, bucky_main_read_word);
1108 SekSetReadByteHandler(0, bucky_main_read_byte);
1109 SekClose();
1110
1111 ZetInit(0);
1112 ZetOpen(0);
1113 ZetMapMemory(DrvZ80ROM, 0x0000, 0x7fff, MAP_ROM);
1114 ZetMapMemory(DrvZ80RAM, 0xc000, 0xdfff, MAP_RAM);
1115 ZetSetWriteHandler(moo_sound_write);
1116 ZetSetReadHandler(moo_sound_read);
1117 ZetClose();
1118
1119 EEPROMInit(&moo_eeprom_interface);
1120
1121 BurnYM2151Init(4000000);
1122 BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.50, BURN_SND_ROUTE_LEFT);
1123 BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.50, BURN_SND_ROUTE_RIGHT);
1124
1125 K054539Init(0, 48000, DrvSndROM, 0x400000);
1126 K054539SetRoute(0, BURN_SND_K054539_ROUTE_1, 0.75, BURN_SND_ROUTE_LEFT);
1127 K054539SetRoute(0, BURN_SND_K054539_ROUTE_2, 0.75, BURN_SND_ROUTE_RIGHT);
1128
1129 DrvDoReset();
1130
1131 return 0;
1132 }
1133
DrvExit()1134 static INT32 DrvExit()
1135 {
1136 GenericTilesExit();
1137
1138 KonamiICExit();
1139
1140 SekExit();
1141 ZetExit();
1142
1143 EEPROMExit();
1144
1145 BurnYM2151Exit();
1146 K054539Exit();
1147
1148 if (moomesabl) {
1149 MSM6295Exit(0);
1150 }
1151
1152 BurnFree (AllMem);
1153
1154 moomesabl = 0;
1155
1156 return 0;
1157 }
1158
DrvPaletteRecalc()1159 static void DrvPaletteRecalc()
1160 {
1161 UINT16 *pal = (UINT16*)DrvPalRAM;
1162
1163 for (INT32 i = 0; i < 0x2000/2; i+=2)
1164 {
1165 INT32 r = pal[i+0] & 0xff;
1166 INT32 g = pal[i+1] >> 8;
1167 INT32 b = pal[i+1] & 0xff;
1168
1169 DrvPalette[i/2] = (r << 16) + (g << 8) + b;
1170 }
1171 }
1172
DrvDraw()1173 static INT32 DrvDraw()
1174 {
1175 DrvPaletteRecalc();
1176
1177 KonamiClearBitmaps(0);
1178
1179 static const INT32 K053251_CI[4] = { 1, 2, 3, 4 };
1180 INT32 layers[3];
1181 INT32 plane, alpha = 0;
1182 INT32 enable_alpha = 0;
1183
1184 sprite_colorbase = K053251GetPaletteIndex(0);
1185 layer_colorbase[0] = 0x70;
1186
1187 for (plane = 1; plane < 4; plane++)
1188 {
1189 layer_colorbase[plane] = K053251GetPaletteIndex(K053251_CI[plane]);
1190 }
1191
1192 layers[0] = 1;
1193 layerpri[0] = K053251GetPriority(2);
1194 layers[1] = 2;
1195 layerpri[1] = K053251GetPriority(3);
1196 layers[2] = 3;
1197 layerpri[2] = K053251GetPriority(4);
1198
1199 konami_sortlayers3(layers, layerpri);
1200
1201 if (layerpri[0] < K053251GetPriority(1))
1202 if (nBurnLayer & (1<<layers[0])) K056832Draw(layers[0], 0, 1);
1203
1204 if (nBurnLayer & (1<<layers[1])) K056832Draw(layers[1], 0, 2);
1205
1206 alpha = (zmask == 0xffff) ? K054338_alpha_level_moo(1) : K054338_set_alpha_level(1);
1207 enable_alpha = K054338_read_register(K338_REG_CONTROL) & K338_CTL_MIXPRI;
1208
1209 if (zmask == 0xffff) { // moo mesa
1210 if (fogcnt) {
1211 enable_alpha = 1;
1212 fogcnt--;
1213 }
1214 }
1215
1216 alpha = (enable_alpha) ? alpha : 0x00;
1217
1218 //bprintf(0, _T("enab %X alpha %X. fogcnt %X\n"), enable_alpha, alpha, fogcnt);
1219
1220 if (255-alpha > 0 && K053251GetPriority(2) != 0x07) { // normal draw
1221 if (nBurnLayer & (1<<layers[2])) K056832Draw(layers[2], K056832_SET_ALPHA(255-alpha), 4);
1222 }
1223
1224 if (nSpriteEnable & 1) K053247SpritesRender();
1225
1226 if (255-alpha > -1 && ((K053251GetPriority(2) == 0x07) || (fogcnt)) ) { // Bucky title, draw layer after sprites for alpha over sprites effect
1227 if (nBurnLayer & (1<<layers[2])) K056832Draw(layers[2], K056832_SET_ALPHA(255-alpha), 4);
1228 }
1229
1230 if (nBurnLayer & 1) K056832Draw(0, 0, 0);
1231
1232 KonamiBlendCopy(DrvPalette);
1233
1234 return 0;
1235 }
1236
DrvFrame()1237 static INT32 DrvFrame()
1238 {
1239 if (DrvReset) {
1240 DrvDoReset();
1241 }
1242
1243 {
1244 memset (DrvInputs, 0xff, 4 * sizeof(INT16));
1245 for (INT32 i = 0; i < 16; i++) {
1246 DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
1247 DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
1248 DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
1249 DrvInputs[3] ^= (DrvJoy4[i] & 1) << i;
1250 }
1251
1252 DrvInputs[1] = (DrvDips[0] & 0xf0) | ((DrvJoy5[3]) ? 0x00 : 0x08);
1253 }
1254
1255 SekNewFrame();
1256 ZetNewFrame();
1257
1258 INT32 nInterleave = 120;
1259 INT32 nSoundBufferPos = 0;
1260 INT32 nCyclesTotal[2] = { 16000000 / 60, 8000000 / 60 };
1261 if (moomesabl) nCyclesTotal[0] = 16100000 / 60; // weird
1262 INT32 nCyclesDone[2] = { 0, 0 };
1263
1264 SekOpen(0);
1265 ZetOpen(0);
1266
1267 for (INT32 i = 0; i < nInterleave; i++) {
1268 INT32 nNext, nCyclesSegment;
1269
1270 nNext = (i + 1) * nCyclesTotal[0] / nInterleave;
1271 nCyclesSegment = nNext - nCyclesDone[0];
1272 nCyclesDone[0] += SekRun(nCyclesSegment);
1273
1274 if (i == (nInterleave - 1)) {
1275 if (moomesabl) {
1276 moo_objdma();
1277 irq5_timer = 5; // guess
1278 SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
1279 } else {
1280 if (K053246_is_IRQ_enabled()) {
1281 moo_objdma();
1282 irq5_timer = 5; // guess
1283 }
1284
1285 if (control_data & 0x20) {
1286 SekSetIRQLine(5, CPU_IRQSTATUS_AUTO);
1287 }
1288 }
1289 }
1290
1291 if (i != (nInterleave - 1)) {
1292 if (irq5_timer > 0) {
1293 irq5_timer--;
1294 if (control_data & 0x800 && (irq5_timer == 0)) {
1295 SekSetIRQLine(4, CPU_IRQSTATUS_AUTO);
1296 }
1297 }
1298 }
1299
1300 if (!moomesabl) {
1301 nCyclesSegment = (SekTotalCycles() / 2) - ZetTotalCycles();
1302 if (nCyclesSegment > 0) nCyclesDone[1] += ZetRun(nCyclesSegment); // sync sound cpu to main cpu
1303
1304 if (pBurnSoundOut) {
1305 INT32 nSegmentLength = nBurnSoundLen / nInterleave;
1306 INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
1307 BurnYM2151Render(pSoundBuf, nSegmentLength);
1308 nSoundBufferPos += nSegmentLength;
1309 }
1310 }
1311 }
1312
1313 if (pBurnSoundOut) {
1314 if (!moomesabl) {
1315 INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos;
1316 INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
1317 if (nSegmentLength) {
1318 BurnYM2151Render(pSoundBuf, nSegmentLength);
1319 }
1320 K054539Update(0, pBurnSoundOut, nBurnSoundLen);
1321 } else {
1322 MSM6295Render(0, pBurnSoundOut, nBurnSoundLen);
1323 }
1324 }
1325
1326 ZetClose();
1327 SekClose();
1328
1329 if (pBurnDraw) {
1330 DrvDraw();
1331 }
1332
1333 return 0;
1334 }
1335
DrvScan(INT32 nAction,INT32 * pnMin)1336 static INT32 DrvScan(INT32 nAction,INT32 *pnMin)
1337 {
1338 struct BurnArea ba;
1339
1340 if (pnMin) {
1341 *pnMin = 0x029732;
1342 }
1343
1344 if (nAction & ACB_VOLATILE) {
1345 memset(&ba, 0, sizeof(ba));
1346
1347 ba.Data = AllRam;
1348 ba.nLen = RamEnd - AllRam;
1349 ba.szName = "All Ram";
1350 BurnAcb(&ba);
1351
1352 SekScan(nAction);
1353 ZetScan(nAction);
1354
1355 BurnYM2151Scan(nAction, pnMin);
1356 K054539Scan(nAction, pnMin);
1357
1358 if (moomesabl) {
1359 MSM6295Scan(nAction, pnMin);
1360 }
1361
1362 KonamiICScan(nAction);
1363
1364 SCAN_VAR(z80_bank);
1365 SCAN_VAR(sound_nmi_enable);
1366
1367 SCAN_VAR(irq5_timer);
1368
1369 SCAN_VAR(control_data);
1370 SCAN_VAR(fogcnt);
1371 }
1372
1373 if (nAction & ACB_WRITE) {
1374 ZetOpen(0);
1375 bankswitch(z80_bank);
1376 ZetClose();
1377 }
1378
1379 EEPROMScan(nAction, pnMin);
1380
1381 return 0;
1382 }
1383
1384
1385
1386 // Wild West C.O.W.-Boys of Moo Mesa (ver EAB)
1387
1388 static struct BurnRomInfo moomesaRomDesc[] = {
1389 { "151b01.q5", 0x040000, 0xfb2fa298, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1390 { "151eab02.q6", 0x040000, 0x37b30c01, 1 | BRF_PRG | BRF_ESS }, // 1
1391 { "151a03.t5", 0x040000, 0xc896d3ea, 1 | BRF_PRG | BRF_ESS }, // 2
1392 { "151a04.t6", 0x040000, 0x3b24706a, 1 | BRF_PRG | BRF_ESS }, // 3
1393
1394 { "151a07.f5", 0x040000, 0xcde247fc, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1395
1396 { "151a05.t8", 0x100000, 0xbc616249, 3 | BRF_GRA }, // 5 K056832 Characters
1397 { "151a06.t10", 0x100000, 0x38dbcac1, 3 | BRF_GRA }, // 6
1398
1399 { "151a10.b8", 0x200000, 0x376c64f1, 4 | BRF_GRA }, // 7 K053247 Sprites
1400 { "151a11.a8", 0x200000, 0xe7f49225, 4 | BRF_GRA }, // 8
1401 { "151a12.b10", 0x200000, 0x4978555f, 4 | BRF_GRA }, // 9
1402 { "151a13.a10", 0x200000, 0x4771f525, 4 | BRF_GRA }, // 10
1403
1404 { "151a08.b6", 0x200000, 0x962251d7, 5 | BRF_SND }, // 11 K054539 Samples
1405
1406 { "moomesa.nv", 0x000080, 0x7bd904a8, 6 | BRF_OPT }, // 12 eeprom data
1407 };
1408
1409 STD_ROM_PICK(moomesa)
1410 STD_ROM_FN(moomesa)
1411
1412 struct BurnDriver BurnDrvMoomesa = {
1413 "moomesa", NULL, NULL, NULL, "1992",
1414 "Wild West C.O.W.-Boys of Moo Mesa (ver EAB)\0", NULL, "Konami", "GX151",
1415 NULL, NULL, NULL, NULL,
1416 BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1417 NULL, moomesaRomInfo, moomesaRomName, NULL, NULL, NULL, NULL, MooInputInfo, MooDIPInfo,
1418 MooInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
1419 384, 224, 4, 3
1420 };
1421
1422
1423 // Wild West C.O.W.-Boys of Moo Mesa (ver UAC)
1424
1425 static struct BurnRomInfo moomesauacRomDesc[] = {
1426 { "151c01.q5", 0x040000, 0x10555732, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1427 { "151uac02.q6", 0x040000, 0x52ae87b0, 1 | BRF_PRG | BRF_ESS }, // 1
1428 { "151a03.t5", 0x040000, 0xc896d3ea, 1 | BRF_PRG | BRF_ESS }, // 2
1429 { "151a04.t6", 0x040000, 0x3b24706a, 1 | BRF_PRG | BRF_ESS }, // 3
1430
1431 { "151a07.f5", 0x040000, 0xcde247fc, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1432
1433 { "151a05.t8", 0x100000, 0xbc616249, 3 | BRF_GRA }, // 5 K056832 Characters
1434 { "151a06.t10", 0x100000, 0x38dbcac1, 3 | BRF_GRA }, // 6
1435
1436 { "151a10.b8", 0x200000, 0x376c64f1, 4 | BRF_GRA }, // 7 K053247 Sprites
1437 { "151a11.a8", 0x200000, 0xe7f49225, 4 | BRF_GRA }, // 8
1438 { "151a12.b10", 0x200000, 0x4978555f, 4 | BRF_GRA }, // 9
1439 { "151a13.a10", 0x200000, 0x4771f525, 4 | BRF_GRA }, // 10
1440
1441 { "151a08.b6", 0x200000, 0x962251d7, 5 | BRF_SND }, // 11 K054539 Samples
1442
1443 { "moomesauac.nv", 0x000080, 0xa5cb137a, 6 | BRF_OPT }, // 12 eeprom data
1444 };
1445
1446 STD_ROM_PICK(moomesauac)
1447 STD_ROM_FN(moomesauac)
1448
1449 struct BurnDriver BurnDrvMoomesauac = {
1450 "moomesauac", "moomesa", NULL, NULL, "1992",
1451 "Wild West C.O.W.-Boys of Moo Mesa (ver UAC)\0", NULL, "Konami", "GX151",
1452 NULL, NULL, NULL, NULL,
1453 BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1454 NULL, moomesauacRomInfo, moomesauacRomName, NULL, NULL, NULL, NULL, MooInputInfo, MooDIPInfo,
1455 MooInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
1456 384, 224, 4, 3
1457 };
1458
1459
1460 // Wild West C.O.W.-Boys of Moo Mesa (ver UAB)
1461
1462 static struct BurnRomInfo moomesauabRomDesc[] = {
1463 { "151b01.q5", 0x040000, 0xfb2fa298, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1464 { "151uab02.q6", 0x040000, 0x3d9f4d59, 1 | BRF_PRG | BRF_ESS }, // 1
1465 { "151a03.t5", 0x040000, 0xc896d3ea, 1 | BRF_PRG | BRF_ESS }, // 2
1466 { "151a04.t6", 0x040000, 0x3b24706a, 1 | BRF_PRG | BRF_ESS }, // 3
1467
1468 { "151a07.f5", 0x040000, 0xcde247fc, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1469
1470 { "151a05.t8", 0x100000, 0xbc616249, 3 | BRF_GRA }, // 5 K056832 Characters
1471 { "151a06.t10", 0x100000, 0x38dbcac1, 3 | BRF_GRA }, // 6
1472
1473 { "151a10.b8", 0x200000, 0x376c64f1, 4 | BRF_GRA }, // 7 K053247 Sprites
1474 { "151a11.a8", 0x200000, 0xe7f49225, 4 | BRF_GRA }, // 8
1475 { "151a12.b10", 0x200000, 0x4978555f, 4 | BRF_GRA }, // 9
1476 { "151a13.a10", 0x200000, 0x4771f525, 4 | BRF_GRA }, // 10
1477
1478 { "151a08.b6", 0x200000, 0x962251d7, 5 | BRF_SND }, // 11 K054539 Samples
1479
1480 { "moomesauab.nv", 0x000080, 0xa5cb137a, 6 | BRF_OPT }, // 12 eeprom data
1481 };
1482
1483 STD_ROM_PICK(moomesauab)
1484 STD_ROM_FN(moomesauab)
1485
1486 struct BurnDriver BurnDrvMoomesauab = {
1487 "moomesauab", "moomesa", NULL, NULL, "1992",
1488 "Wild West C.O.W.-Boys of Moo Mesa (ver UAB)\0", NULL, "Konami", "GX151",
1489 NULL, NULL, NULL, NULL,
1490 BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1491 NULL, moomesauabRomInfo, moomesauabRomName, NULL, NULL, NULL, NULL, MooInputInfo, MooDIPInfo,
1492 MooInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
1493 384, 224, 4, 3
1494 };
1495
1496
1497 // Wild West C.O.W.-Boys of Moo Mesa (ver AAB)
1498
1499 static struct BurnRomInfo moomesaaabRomDesc[] = {
1500 { "151b01.q5", 0x040000, 0xfb2fa298, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1501 { "151aab02.q6", 0x040000, 0x2162d593, 1 | BRF_PRG | BRF_ESS }, // 1
1502 { "151a03.t5", 0x040000, 0xc896d3ea, 1 | BRF_PRG | BRF_ESS }, // 2
1503 { "151a04.t6", 0x040000, 0x3b24706a, 1 | BRF_PRG | BRF_ESS }, // 3
1504
1505 { "151a07.f5", 0x040000, 0xcde247fc, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1506
1507 { "151a05.t8", 0x100000, 0xbc616249, 3 | BRF_GRA }, // 5 K056832 Characters
1508 { "151a06.t10", 0x100000, 0x38dbcac1, 3 | BRF_GRA }, // 6
1509
1510 { "151a10.b8", 0x200000, 0x376c64f1, 4 | BRF_GRA }, // 7 K053247 Sprites
1511 { "151a11.a8", 0x200000, 0xe7f49225, 4 | BRF_GRA }, // 8
1512 { "151a12.b10", 0x200000, 0x4978555f, 4 | BRF_GRA }, // 9
1513 { "151a13.a10", 0x200000, 0x4771f525, 4 | BRF_GRA }, // 10
1514
1515 { "151a08.b6", 0x200000, 0x962251d7, 5 | BRF_SND }, // 11 K054539 Samples
1516
1517 { "moomesaaab.nv", 0x000080, 0x7bd904a8, 6 | BRF_OPT }, // 12 eeprom data
1518 };
1519
1520 STD_ROM_PICK(moomesaaab)
1521 STD_ROM_FN(moomesaaab)
1522
1523 struct BurnDriver BurnDrvMoomesaaab = {
1524 "moomesaaab", "moomesa", NULL, NULL, "1992",
1525 "Wild West C.O.W.-Boys of Moo Mesa (ver AAB)\0", NULL, "Konami", "GX151",
1526 NULL, NULL, NULL, NULL,
1527 BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1528 NULL, moomesaaabRomInfo, moomesaaabRomName, NULL, NULL, NULL, NULL, MooInputInfo, MooDIPInfo,
1529 MooInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
1530 384, 224, 4, 3
1531 };
1532
1533
1534 // Wild West C.O.W.-Boys of Moo Mesa (bootleg)
1535
1536 static struct BurnRomInfo moomesablRomDesc[] = {
1537 { "moo03.rom", 0x080000, 0xfed6a1cb, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1538 { "moo04.rom", 0x080000, 0xec45892a, 1 | BRF_PRG | BRF_ESS }, // 1
1539 { "moo03.rom", 0x080000, 0xfed6a1cb, 1 | BRF_PRG | BRF_ESS }, // 2
1540 { "moo04.rom", 0x080000, 0xec45892a, 1 | BRF_PRG | BRF_ESS }, // 3
1541
1542 { "moo05.rom", 0x080000, 0x8c045f9c, 3 | BRF_GRA }, // 4 K056832 Characters
1543 { "moo07.rom", 0x080000, 0xb9e29f50, 3 | BRF_GRA }, // 5
1544 { "moo06.rom", 0x080000, 0x1261aa89, 3 | BRF_GRA }, // 6
1545 { "moo08.rom", 0x080000, 0xe6937229, 3 | BRF_GRA }, // 7
1546
1547 { "151a10", 0x200000, 0x376c64f1, 4 | BRF_GRA }, // 8 K053247 Sprites
1548 { "151a11", 0x200000, 0xe7f49225, 4 | BRF_GRA }, // 9
1549 { "151a12", 0x200000, 0x4978555f, 4 | BRF_GRA }, // 10
1550 { "151a13", 0x200000, 0x4771f525, 4 | BRF_GRA }, // 11
1551
1552 { "moo01.rom", 0x080000, 0x3311338a, 5 | BRF_SND }, // 12 MSM6295 Samples
1553 { "moo02.rom", 0x080000, 0x2cf3a7c6, 5 | BRF_SND }, // 13
1554
1555 { "moo.nv", 0x000080, 0x7bd904a8, 6 | BRF_OPT }, // 14 eeprom data
1556 };
1557
1558 STD_ROM_PICK(moomesabl)
STD_ROM_FN(moomesabl)1559 STD_ROM_FN(moomesabl)
1560
1561 static INT32 moomesablInit()
1562 {
1563 moomesabl = 1;
1564
1565 return MooInit();
1566 }
1567
1568 struct BurnDriverD BurnDrvMoomesabl = {
1569 "moomesabl", "moomesa", NULL, NULL, "1992",
1570 "Wild West C.O.W.-Boys of Moo Mesa (bootleg)\0", NULL, "bootleg", "GX151",
1571 NULL, NULL, NULL, NULL,
1572 BDF_GAME_NOT_WORKING | BDF_CLONE | BDF_BOOTLEG, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1573 NULL, moomesablRomInfo, moomesablRomName, NULL, NULL, NULL, NULL, MooInputInfo, MooDIPInfo,
1574 moomesablInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
1575 384, 224, 4, 3
1576 };
1577
1578
1579 // Bucky O'Hare (ver EAB)
1580
1581 static struct BurnRomInfo buckyRomDesc[] = {
1582 { "173eab01.q5", 0x040000, 0x7785ac8a, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1583 { "173eab02.q6", 0x040000, 0x9b45f122, 1 | BRF_PRG | BRF_ESS }, // 1
1584 { "173a03.t5", 0x020000, 0xcd724026, 1 | BRF_PRG | BRF_ESS }, // 2
1585 { "173a04.t6", 0x020000, 0x7dd54d6f, 1 | BRF_PRG | BRF_ESS }, // 3
1586
1587 { "173a07.f5", 0x040000, 0x4cdaee71, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1588
1589 { "173a05.t8", 0x100000, 0xd14333b4, 3 | BRF_GRA }, // 5 K056832 Characters
1590 { "173a06.t10", 0x100000, 0x6541a34f, 3 | BRF_GRA }, // 6
1591
1592 { "173a10.b8", 0x200000, 0x42fb0a0c, 4 | BRF_GRA }, // 7 K053247 Sprites
1593 { "173a11.a8", 0x200000, 0xb0d747c4, 4 | BRF_GRA }, // 8
1594 { "173a12.b10", 0x200000, 0x0fc2ad24, 4 | BRF_GRA }, // 9
1595 { "173a13.a10", 0x200000, 0x4cf85439, 4 | BRF_GRA }, // 10
1596
1597 { "173a08.b6", 0x200000, 0xdcdded95, 5 | BRF_SND }, // 11 K054539 Samples
1598 { "173a09.a6", 0x200000, 0xc93697c4, 5 | BRF_SND }, // 12
1599
1600 { "bucky.nv", 0x000080, 0x6a5986f3, 6 | BRF_OPT }, // 13 eeprom data
1601 };
1602
1603 STD_ROM_PICK(bucky)
1604 STD_ROM_FN(bucky)
1605
1606 struct BurnDriver BurnDrvBucky = {
1607 "bucky", NULL, NULL, NULL, "1992",
1608 "Bucky O'Hare (ver EAB)\0", NULL, "Konami", "GX173",
1609 NULL, NULL, NULL, NULL,
1610 BDF_GAME_WORKING, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1611 NULL, buckyRomInfo, buckyRomName, NULL, NULL, NULL, NULL, BuckyInputInfo, BuckyDIPInfo,
1612 BuckyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000,
1613 384, 224, 4, 3
1614 };
1615
1616
1617 // Bucky O'Hare (ver EA)
1618
1619 static struct BurnRomInfo buckyeaRomDesc[] = {
1620 { "2.d5", 0x040000, 0xe18518a6, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1621 { "3.d6", 0x040000, 0x45ef9545, 1 | BRF_PRG | BRF_ESS }, // 1
1622 { "173a03.t5", 0x020000, 0xcd724026, 1 | BRF_PRG | BRF_ESS }, // 2
1623 { "173a04.t6", 0x020000, 0x7dd54d6f, 1 | BRF_PRG | BRF_ESS }, // 3
1624
1625 { "173a07.f5", 0x040000, 0x4cdaee71, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1626
1627 { "173a05.t8", 0x100000, 0xd14333b4, 3 | BRF_GRA }, // 5 K056832 Characters
1628 { "173a06.t10", 0x100000, 0x6541a34f, 3 | BRF_GRA }, // 6
1629
1630 { "173a10.b8", 0x200000, 0x42fb0a0c, 4 | BRF_GRA }, // 7 K053247 Sprites
1631 { "173a11.a8", 0x200000, 0xb0d747c4, 4 | BRF_GRA }, // 8
1632 { "173a12.b10", 0x200000, 0x0fc2ad24, 4 | BRF_GRA }, // 9
1633 { "173a13.a10", 0x200000, 0x4cf85439, 4 | BRF_GRA }, // 10
1634
1635 { "173a08.b6", 0x200000, 0xdcdded95, 5 | BRF_SND }, // 11 K054539 Samples
1636 { "173a09.a6", 0x200000, 0xc93697c4, 5 | BRF_SND }, // 12
1637
1638 { "bucky.nv", 0x000080, 0x6a5986f3, 6 | BRF_OPT }, // 13 eeprom data
1639 };
1640
1641 STD_ROM_PICK(buckyea)
1642 STD_ROM_FN(buckyea)
1643
1644 struct BurnDriver BurnDrvBuckyea = {
1645 "buckyea", "bucky", NULL, NULL, "1992",
1646 "Bucky O'Hare (ver EA)\0", NULL, "Konami", "GX173",
1647 NULL, NULL, NULL, NULL,
1648 BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1649 NULL, buckyeaRomInfo, buckyeaRomName, NULL, NULL, NULL, NULL, BuckyInputInfo, BuckyDIPInfo,
1650 BuckyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000,
1651 384, 224, 4, 3
1652 };
1653
1654
1655 // Bucky O'Hare (ver JAA)
1656
1657 static struct BurnRomInfo buckyjaaRomDesc[] = {
1658 { "173jaa01.05", 0x040000, 0x0a32bde7, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1659 { "173jaa02.06", 0x040000, 0x3e6f3955, 1 | BRF_PRG | BRF_ESS }, // 1
1660 { "173a03.t5", 0x020000, 0xcd724026, 1 | BRF_PRG | BRF_ESS }, // 2
1661 { "173a04.t6", 0x020000, 0x7dd54d6f, 1 | BRF_PRG | BRF_ESS }, // 3
1662
1663 { "173a07.f5", 0x040000, 0x4cdaee71, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1664
1665 { "173a05.t8", 0x100000, 0xd14333b4, 3 | BRF_GRA }, // 5 K056832 Characters
1666 { "173a06.t10", 0x100000, 0x6541a34f, 3 | BRF_GRA }, // 6
1667
1668 { "173a10.b8", 0x200000, 0x42fb0a0c, 4 | BRF_GRA }, // 7 K053247 Sprites
1669 { "173a11.a8", 0x200000, 0xb0d747c4, 4 | BRF_GRA }, // 8
1670 { "173a12.b10", 0x200000, 0x0fc2ad24, 4 | BRF_GRA }, // 9
1671 { "173a13.a10", 0x200000, 0x4cf85439, 4 | BRF_GRA }, // 10
1672
1673 { "173a08.b6", 0x200000, 0xdcdded95, 5 | BRF_SND }, // 11 K054539 Samples
1674 { "173a09.a6", 0x200000, 0xc93697c4, 5 | BRF_SND }, // 12
1675
1676 { "buckyja.nv", 0x000080, 0x2f280a74, 6 | BRF_OPT }, // 13 eeprom data
1677 };
1678
1679 STD_ROM_PICK(buckyjaa)
1680 STD_ROM_FN(buckyjaa)
1681
1682 struct BurnDriver BurnDrvBuckyjaa = {
1683 "buckyjaa", "bucky", NULL, NULL, "1992",
1684 "Bucky O'Hare (ver JAA)\0", NULL, "Konami", "GX173",
1685 NULL, NULL, NULL, NULL,
1686 BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1687 NULL, buckyjaaRomInfo, buckyjaaRomName, NULL, NULL, NULL, NULL, BuckyInputInfo, BuckyDIPInfo,
1688 BuckyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000,
1689 384, 224, 4, 3
1690 };
1691
1692
1693 // Bucky O'Hare (ver AA)
1694
1695 static struct BurnRomInfo buckyaaRomDesc[] = {
1696 { "173aa01.q4", 0x040000, 0xe18518a6, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1697 { "173aa02.q5", 0x040000, 0xc888d0c7, 1 | BRF_PRG | BRF_ESS }, // 1
1698 { "173a03.t5", 0x020000, 0xcd724026, 1 | BRF_PRG | BRF_ESS }, // 2
1699 { "173a04.t6", 0x020000, 0x7dd54d6f, 1 | BRF_PRG | BRF_ESS }, // 3
1700
1701 { "173a07.f5", 0x040000, 0x4cdaee71, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1702
1703 { "173a05.t8", 0x100000, 0xd14333b4, 3 | BRF_GRA }, // 5 K056832 Characters
1704 { "173a06.t10", 0x100000, 0x6541a34f, 3 | BRF_GRA }, // 6
1705
1706 { "173a10.b8", 0x200000, 0x42fb0a0c, 4 | BRF_GRA }, // 7 K053247 Sprites
1707 { "173a11.a8", 0x200000, 0xb0d747c4, 4 | BRF_GRA }, // 8
1708 { "173a12.b10", 0x200000, 0x0fc2ad24, 4 | BRF_GRA }, // 9
1709 { "173a13.a10", 0x200000, 0x4cf85439, 4 | BRF_GRA }, // 10
1710
1711 { "173a08.b6", 0x200000, 0xdcdded95, 5 | BRF_SND }, // 11 K054539 Samples
1712 { "173a09.a6", 0x200000, 0xc93697c4, 5 | BRF_SND }, // 12
1713
1714 // default eeprom to prevent game booting upside down with error
1715 { "bucky.nv", 0x000080, 0x6a5986f3, 6 | BRF_OPT }, // 13 eeprom data
1716 };
1717
1718 STD_ROM_PICK(buckyaa)
1719 STD_ROM_FN(buckyaa)
1720
1721 struct BurnDriver BurnDrvBuckyaa = {
1722 "buckyaa", "bucky", NULL, NULL, "1992",
1723 "Bucky O'Hare (ver AA)\0", NULL, "Konami", "GX173",
1724 NULL, NULL, NULL, NULL,
1725 BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1726 NULL, buckyaaRomInfo, buckyaaRomName, NULL, NULL, NULL, NULL, BuckyInputInfo, BuckyDIPInfo,
1727 BuckyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000,
1728 384, 224, 4, 3
1729 };
1730
1731
1732 // Bucky O'Hare (ver UAB)
1733
1734 static struct BurnRomInfo buckyuabRomDesc[] = {
1735 { "173uab01.q5", 0x040000, 0xdcaecca0, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1736 { "173uab02.q6", 0x040000, 0xe3c856a6, 1 | BRF_PRG | BRF_ESS }, // 1
1737 { "173a03.t5", 0x020000, 0xcd724026, 1 | BRF_PRG | BRF_ESS }, // 2
1738 { "173a04.t6", 0x020000, 0x7dd54d6f, 1 | BRF_PRG | BRF_ESS }, // 3
1739
1740 { "173a07.f5", 0x040000, 0x4cdaee71, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1741
1742 { "173a05.t8", 0x100000, 0xd14333b4, 3 | BRF_GRA }, // 5 K056832 Characters
1743 { "173a06.t10", 0x100000, 0x6541a34f, 3 | BRF_GRA }, // 6
1744
1745 { "173a10.b8", 0x200000, 0x42fb0a0c, 4 | BRF_GRA }, // 7 K053247 Sprites
1746 { "173a11.a8", 0x200000, 0xb0d747c4, 4 | BRF_GRA }, // 8
1747 { "173a12.b10", 0x200000, 0x0fc2ad24, 4 | BRF_GRA }, // 9
1748 { "173a13.a10", 0x200000, 0x4cf85439, 4 | BRF_GRA }, // 10
1749
1750 { "173a08.b6", 0x200000, 0xdcdded95, 5 | BRF_SND }, // 11 K054539 Samples
1751 { "173a09.a6", 0x200000, 0xc93697c4, 5 | BRF_SND }, // 12
1752
1753 { "buckyuab.nv", 0x000080, 0xa5cb137a, 6 | BRF_OPT }, // 13 eeprom data
1754 };
1755
1756 STD_ROM_PICK(buckyuab)
1757 STD_ROM_FN(buckyuab)
1758
1759 struct BurnDriver BurnDrvBuckyuab = {
1760 "buckyuab", "bucky", NULL, NULL, "1992",
1761 "Bucky O'Hare (ver UAB)\0", NULL, "Konami", "GX173",
1762 NULL, NULL, NULL, NULL,
1763 BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1764 NULL, buckyuabRomInfo, buckyuabRomName, NULL, NULL, NULL, NULL, BuckyInputInfo, BuckyDIPInfo,
1765 BuckyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000,
1766 384, 224, 4, 3
1767 };
1768
1769
1770 // Bucky O'Hare (ver AAB)
1771
1772 static struct BurnRomInfo buckyaabRomDesc[] = {
1773 { "173aab01.q5", 0x040000, 0x9193e89f, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code
1774 { "173aab02.q6", 0x040000, 0x2567f3eb, 1 | BRF_PRG | BRF_ESS }, // 1
1775 { "173a03.t5", 0x020000, 0xcd724026, 1 | BRF_PRG | BRF_ESS }, // 2
1776 { "173a04.t6", 0x020000, 0x7dd54d6f, 1 | BRF_PRG | BRF_ESS }, // 3
1777
1778 { "173a07.f5", 0x040000, 0x4cdaee71, 2 | BRF_PRG | BRF_ESS }, // 4 Z80 Code
1779
1780 { "173a05.t8", 0x100000, 0xd14333b4, 3 | BRF_GRA }, // 5 K056832 Characters
1781 { "173a06.t10", 0x100000, 0x6541a34f, 3 | BRF_GRA }, // 6
1782
1783 { "173a10.b8", 0x200000, 0x42fb0a0c, 4 | BRF_GRA }, // 7 K053247 Sprites
1784 { "173a11.a8", 0x200000, 0xb0d747c4, 4 | BRF_GRA }, // 8
1785 { "173a12.b10", 0x200000, 0x0fc2ad24, 4 | BRF_GRA }, // 9
1786 { "173a13.a10", 0x200000, 0x4cf85439, 4 | BRF_GRA }, // 10
1787
1788 { "173a08.b6", 0x200000, 0xdcdded95, 5 | BRF_SND }, // 11 K054539 Samples
1789 { "173a09.a6", 0x200000, 0xc93697c4, 5 | BRF_SND }, // 12
1790
1791 { "buckyaab.nv", 0x000080, 0x6a5986f3, 6 | BRF_OPT }, // 13 eeprom data
1792 };
1793
1794 STD_ROM_PICK(buckyaab)
1795 STD_ROM_FN(buckyaab)
1796
1797 struct BurnDriver BurnDrvBuckyaab = {
1798 "buckyaab", "bucky", NULL, NULL, "1992",
1799 "Bucky O'Hare (ver AAB)\0", NULL, "Konami", "GX173",
1800 NULL, NULL, NULL, NULL,
1801 BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_PREFIX_KONAMI, GBF_RUNGUN, 0,
1802 NULL, buckyaabRomInfo, buckyaabRomName, NULL, NULL, NULL, NULL, BuckyInputInfo, BuckyDIPInfo,
1803 BuckyInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x1000,
1804 384, 224, 4, 3
1805 };
1806