1 // FB Alpha Flack Attack driver module
2 // Based on MAME driver by Manuel Abadia
3
4 #include "tiles_generic.h"
5 #include "hd6309_intf.h"
6 #include "z80_intf.h"
7 #include "k007121.h"
8 #include "burn_ym2151.h"
9 #include "k007232.h"
10 #include "watchdog.h"
11 #include "k007452.h"
12
13 static UINT8 *AllMem;
14 static UINT8 *MemEnd;
15 static UINT8 *AllRam;
16 static UINT8 *RamEnd;
17 static UINT8 *DrvHD6309ROM;
18 static UINT8 *DrvZ80ROM;
19 static UINT8 *DrvGfxROM;
20 static UINT8 *DrvSndROM;
21 static UINT8 *DrvZ80RAM;
22 static UINT8 *DrvHD6309RAM;
23 static UINT8 *DrvPalRAM;
24 static UINT8 *DrvVidRAM0;
25 static UINT8 *DrvVidRAM1;
26 static UINT8 *DrvSprRAM;
27
28 static UINT32 *DrvPalette;
29 static UINT8 DrvRecalc;
30
31 static UINT8 main_bank;
32 static UINT8 soundlatch;
33 static UINT8 flipscreen;
34
35 static INT32 nExtraCycles;
36
37 static UINT8 DrvJoy1[8];
38 static UINT8 DrvJoy2[8];
39 static UINT8 DrvJoy3[8];
40 static UINT8 DrvDips[3];
41 static UINT8 DrvInputs[3];
42 static UINT8 DrvReset;
43
44 static struct BurnInputInfo FlkatckInputList[] = {
45 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" },
46 {"P1 Start", BIT_DIGITAL, DrvJoy1 + 3, "p1 start" },
47 {"P1 Up", BIT_DIGITAL, DrvJoy2 + 2, "p1 up" },
48 {"P1 Down", BIT_DIGITAL, DrvJoy2 + 3, "p1 down" },
49 {"P1 Left", BIT_DIGITAL, DrvJoy2 + 0, "p1 left" },
50 {"P1 Right", BIT_DIGITAL, DrvJoy2 + 1, "p1 right" },
51 {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p1 fire 1" },
52 {"P1 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p1 fire 2" },
53
54 {"P2 Coin", BIT_DIGITAL, DrvJoy1 + 1, "p2 coin" },
55 {"P2 Start", BIT_DIGITAL, DrvJoy1 + 4, "p2 start" },
56 {"P2 Up", BIT_DIGITAL, DrvJoy3 + 2, "p2 up" },
57 {"P2 Down", BIT_DIGITAL, DrvJoy3 + 3, "p2 down" },
58 {"P2 Left", BIT_DIGITAL, DrvJoy3 + 0, "p2 left" },
59 {"P2 Right", BIT_DIGITAL, DrvJoy3 + 1, "p2 right" },
60 {"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" },
61 {"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" },
62
63 {"Reset", BIT_DIGITAL, &DrvReset, "reset" },
64 {"Service", BIT_DIGITAL, DrvJoy1 + 2, "service" },
65 {"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" },
66 {"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" },
67 {"Dip C", BIT_DIPSWITCH, DrvDips + 2, "dip" },
68 };
69
70 STDINPUTINFO(Flkatck)
71
72 static struct BurnDIPInfo FlkatckDIPList[]=
73 {
74 {0x12, 0xff, 0xff, 0xff, NULL },
75 {0x13, 0xff, 0xff, 0x51, NULL },
76 {0x14, 0xff, 0xff, 0xff, NULL },
77
78 {0 , 0xfe, 0 , 16, "Coin A" },
79 {0x12, 0x01, 0x0f, 0x02, "4 Coins 1 Credits" },
80 {0x12, 0x01, 0x0f, 0x05, "3 Coins 1 Credits" },
81 {0x12, 0x01, 0x0f, 0x08, "2 Coins 1 Credits" },
82 {0x12, 0x01, 0x0f, 0x04, "3 Coins 2 Credits" },
83 {0x12, 0x01, 0x0f, 0x01, "4 Coins 3 Credits" },
84 {0x12, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" },
85 {0x12, 0x01, 0x0f, 0x03, "3 Coins 4 Credits" },
86 {0x12, 0x01, 0x0f, 0x07, "2 Coins 3 Credits" },
87 {0x12, 0x01, 0x0f, 0x0e, "1 Coin 2 Credits" },
88 {0x12, 0x01, 0x0f, 0x06, "2 Coins 5 Credits" },
89 {0x12, 0x01, 0x0f, 0x0d, "1 Coin 3 Credits" },
90 {0x12, 0x01, 0x0f, 0x0c, "1 Coin 4 Credits" },
91 {0x12, 0x01, 0x0f, 0x0b, "1 Coin 5 Credits" },
92 {0x12, 0x01, 0x0f, 0x0a, "1 Coin 6 Credits" },
93 {0x12, 0x01, 0x0f, 0x09, "1 Coin 7 Credits" },
94 {0x12, 0x01, 0x0f, 0x00, "Free Play" },
95
96 {0 , 0xfe, 0 , 16, "Coin B" },
97 {0x12, 0x01, 0xf0, 0x20, "4 Coins 1 Credits" },
98 {0x12, 0x01, 0xf0, 0x50, "3 Coins 1 Credits" },
99 {0x12, 0x01, 0xf0, 0x80, "2 Coins 1 Credits" },
100 {0x12, 0x01, 0xf0, 0x40, "3 Coins 2 Credits" },
101 {0x12, 0x01, 0xf0, 0x10, "4 Coins 3 Credits" },
102 {0x12, 0x01, 0xf0, 0xf0, "1 Coin 1 Credits" },
103 {0x12, 0x01, 0xf0, 0x30, "3 Coins 4 Credits" },
104 {0x12, 0x01, 0xf0, 0x70, "2 Coins 3 Credits" },
105 {0x12, 0x01, 0xf0, 0xe0, "1 Coin 2 Credits" },
106 {0x12, 0x01, 0xf0, 0x60, "2 Coins 5 Credits" },
107 {0x12, 0x01, 0xf0, 0xd0, "1 Coin 3 Credits" },
108 {0x12, 0x01, 0xf0, 0xc0, "1 Coin 4 Credits" },
109 {0x12, 0x01, 0xf0, 0xb0, "1 Coin 5 Credits" },
110 {0x12, 0x01, 0xf0, 0xa0, "1 Coin 6 Credits" },
111 {0x12, 0x01, 0xf0, 0x90, "1 Coin 7 Credits" },
112 {0x12, 0x01, 0xf0, 0x00, "Invalid" },
113
114 {0 , 0xfe, 0 , 4, "Lives" },
115 {0x13, 0x01, 0x03, 0x03, "1" },
116 {0x13, 0x01, 0x03, 0x02, "2" },
117 {0x13, 0x01, 0x03, 0x01, "3" },
118 {0x13, 0x01, 0x03, 0x00, "5" },
119
120 {0 , 0xfe, 0 , 2, "Cabinet" },
121 {0x13, 0x01, 0x04, 0x00, "Upright" },
122 {0x13, 0x01, 0x04, 0x04, "Cocktail" },
123
124 {0 , 0xfe, 0 , 4, "Bonus Life" },
125 {0x13, 0x01, 0x18, 0x18, "30K, Every 70K" },
126 {0x13, 0x01, 0x18, 0x10, "40K, Every 80K" },
127 {0x13, 0x01, 0x18, 0x08, "30K Only" },
128 {0x13, 0x01, 0x18, 0x00, "40K Only" },
129
130 {0 , 0xfe, 0 , 4, "Difficulty" },
131 {0x13, 0x01, 0x60, 0x60, "Easy" },
132 {0x13, 0x01, 0x60, 0x40, "Normal" },
133 {0x13, 0x01, 0x60, 0x20, "Difficult" },
134 {0x13, 0x01, 0x60, 0x00, "Very Difficult" },
135
136 {0 , 0xfe, 0 , 2, "Demo Sounds" },
137 {0x13, 0x01, 0x80, 0x80, "Off" },
138 {0x13, 0x01, 0x80, 0x00, "On" },
139
140 {0 , 0xfe, 0 , 2, "Flip Screen" },
141 {0x14, 0x01, 0x01, 0x01, "Off" },
142 {0x14, 0x01, 0x01, 0x00, "On" },
143
144 {0 , 0xfe, 0 , 2, "Upright Controls" },
145 {0x14, 0x01, 0x02, 0x02, "Single" },
146 {0x14, 0x01, 0x02, 0x00, "Dual" },
147
148 {0 , 0xfe, 0 , 2, "Service Mode" },
149 {0x14, 0x01, 0x04, 0x04, "Off" },
150 {0x14, 0x01, 0x04, 0x00, "On" },
151 };
152
STDDIPINFO(Flkatck)153 STDDIPINFO(Flkatck)
154
155
156
157 static void bankswitch(INT32 data)
158 {
159 if ((data & 0x03) < 3) {
160 main_bank = data & 3;
161
162 HD6309MapMemory(DrvHD6309ROM + (main_bank * 0x2000), 0x4000, 0x5fff, MAP_ROM);
163 }
164 }
165
flkatck_main_read(UINT16 address)166 static UINT8 flkatck_main_read(UINT16 address)
167 {
168 switch (address)
169 {
170 case 0x0400:
171 return DrvInputs[1];
172
173 case 0x0401:
174 return DrvInputs[2];
175
176 case 0x0402:
177 return DrvDips[2]; // dsw3
178
179 case 0x0403:
180 return DrvInputs[0];
181
182 case 0x0406:
183 return DrvDips[1];
184
185 case 0x0407:
186 return DrvDips[0];
187 }
188
189 return 0;
190 }
191
flkatck_main_write(UINT16 address,UINT8 data)192 static void flkatck_main_write(UINT16 address, UINT8 data)
193 {
194 if ((address & 0xfff8) == 0x0000) {
195 k007121_ctrl_write(0, address & 7, data);
196 }
197
198 if (address < 0x100) {
199 DrvHD6309RAM[address] = data;
200 return;
201 }
202
203 switch (address & ~3)
204 {
205 case 0x0410:
206 bankswitch(data); // and coin counters - data & 0x18
207 return;
208
209 case 0x0414:
210 soundlatch = data;
211 return;
212
213 case 0x0418:
214 ZetSetIRQLine(0, CPU_IRQSTATUS_HOLD);
215 return;
216
217 case 0x041c:
218 BurnWatchdogWrite();
219 return;
220 }
221 }
222
flkatck_sound_write(UINT16 address,UINT8 data)223 static void __fastcall flkatck_sound_write(UINT16 address, UINT8 data)
224 {
225 switch (address)
226 {
227 case 0x9000:
228 case 0x9001:
229 case 0x9002:
230 case 0x9003:
231 case 0x9004:
232 case 0x9005:
233 case 0x9006:
234 case 0x9007:
235 K007452Write(address & 7, data);
236 return;
237
238 case 0xb000:
239 case 0xb001:
240 case 0xb002:
241 case 0xb003:
242 case 0xb004:
243 case 0xb005:
244 case 0xb006:
245 case 0xb007:
246 case 0xb008:
247 case 0xb009:
248 case 0xb00a:
249 case 0xb00b:
250 case 0xb00c:
251 case 0xb00d:
252 K007232WriteReg(0, address & 0x0f, data);
253 return;
254
255 case 0xc000:
256 case 0xc001:
257 BurnYM2151Write(address & 1, data);
258 return;
259 }
260 }
261
flkatck_sound_read(UINT16 address)262 static UINT8 __fastcall flkatck_sound_read(UINT16 address)
263 {
264 switch (address)
265 {
266 case 0x9000:
267 case 0x9001:
268 case 0x9002:
269 case 0x9003:
270 case 0x9004:
271 case 0x9005:
272 case 0x9006:
273 case 0x9007:
274 return K007452Read(address & 7);
275
276 case 0xa000:
277 return soundlatch;
278
279 case 0xb000:
280 case 0xb001:
281 case 0xb002:
282 case 0xb003:
283 case 0xb004:
284 case 0xb005:
285 case 0xb006:
286 case 0xb007:
287 case 0xb008:
288 case 0xb009:
289 case 0xb00a:
290 case 0xb00b:
291 case 0xb00c:
292 case 0xb00d:
293 return K007232ReadReg(0, address & 0x0f);
294
295 case 0xc000:
296 case 0xc001:
297 return BurnYM2151Read();
298 }
299
300 return 0;
301 }
302
tilemap_callback(bg)303 static tilemap_callback( bg )
304 {
305 UINT8 ctrl_0 = k007121_ctrl_read(0,0);
306 UINT8 ctrl_2 = k007121_ctrl_read(0,2);
307 UINT8 ctrl_3 = k007121_ctrl_read(0,3);
308 UINT8 ctrl_4 = k007121_ctrl_read(0,4);
309 UINT8 ctrl_5 = k007121_ctrl_read(0,5);
310 UINT8 attr = DrvVidRAM0[offs];
311 INT32 bit0 = (ctrl_5 >> 0) & 0x03;
312 INT32 bit1 = (ctrl_5 >> 2) & 0x03;
313 INT32 bit2 = (ctrl_5 >> 4) & 0x03;
314 INT32 bit3 = (ctrl_5 >> 6) & 0x03;
315 INT32 bank = ((attr & 0x80) >> 7) |
316 ((attr >> (bit0 + 2)) & 0x02) |
317 ((attr >> (bit1 + 1)) & 0x04) |
318 ((attr >> (bit2 )) & 0x08) |
319 ((attr >> (bit3 - 1)) & 0x10) |
320 ((ctrl_3 & 0x01) << 5);
321 INT32 mask = (ctrl_4 & 0xf0) >> 4;
322
323 bank = (bank & ~(mask << 1)) | ((ctrl_4 & mask) << 1);
324
325 if ((attr == 0x0d) && (!ctrl_0) && (!ctrl_2))
326 bank = 0;
327
328 TILE_SET_INFO(0, DrvVidRAM0[offs + 0x400] + (bank * 256), (attr & 0x0f) + 16, (attr & 0x20) ? TILE_FLIPY : 0);
329 }
330
tilemap_callback(fg)331 static tilemap_callback( fg )
332 {
333 TILE_SET_INFO(0, DrvVidRAM1[offs + 0x400], DrvVidRAM1[offs], 0);
334 }
335
DrvK007232VolCallback(INT32 v)336 static void DrvK007232VolCallback(INT32 v)
337 {
338 K007232SetVolume(0, 0, (v >> 4) * 0x11, 0);
339 K007232SetVolume(0, 1, 0, (v & 0x0f) * 0x11);
340 }
341
DrvDoReset(INT32 clear_mem)342 static INT32 DrvDoReset(INT32 clear_mem)
343 {
344 if (clear_mem) {
345 memset (AllRam, 0, RamEnd - AllRam);
346 }
347
348 HD6309Open(0);
349 bankswitch(0);
350 HD6309Reset();
351 HD6309Close();
352
353 ZetOpen(0);
354 ZetReset();
355 ZetClose();
356
357 BurnYM2151Reset();
358 K007232Reset(0);
359 k007232_set_bank(0, 0, 1);
360
361 k007121_reset();
362 K007452Reset();
363
364 BurnWatchdogReset();
365
366 flipscreen = 0;
367 soundlatch = 0;
368
369 nExtraCycles = 0;
370
371 return 0;
372 }
373
MemIndex()374 static INT32 MemIndex()
375 {
376 UINT8 *Next; Next = AllMem;
377
378 DrvHD6309ROM = Next; Next += 0x010000;
379 DrvZ80ROM = Next; Next += 0x008000;
380
381 DrvGfxROM = Next; Next += 0x100000;
382
383 DrvSndROM = Next; Next += 0x040000;
384
385 DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32);
386
387 AllRam = Next;
388
389 DrvZ80RAM = Next; Next += 0x000800;
390
391 DrvHD6309RAM = Next; Next += 0x004000;
392 DrvPalRAM = Next; Next += 0x000400;
393 DrvVidRAM0 = Next; Next += 0x000800;
394 DrvVidRAM1 = Next; Next += 0x000800;
395 DrvSprRAM = Next; Next += 0x001000;
396
397 RamEnd = Next;
398 MemEnd = Next;
399
400 return 0;
401 }
402
graphics_expand()403 static void graphics_expand()
404 {
405 for (INT32 i = 0x80000-1; i >= 0; i--)
406 {
407 DrvGfxROM[i*2+1] = DrvGfxROM[i^1] & 0xf;
408 DrvGfxROM[i*2+0] = DrvGfxROM[i^1] >> 4;
409 }
410 }
411
DrvInit(INT32 rom_layout)412 static INT32 DrvInit(INT32 rom_layout)
413 {
414 BurnAllocMemIndex();
415
416 {
417 if (BurnLoadRom(DrvHD6309ROM + 0x00000, 0, 1)) return 1;
418
419 if (BurnLoadRom(DrvZ80ROM + 0x00000, 1, 1)) return 1;
420
421 if (BurnLoadRom(DrvSndROM + 0x00000, 2, 1)) return 1;
422
423 if (rom_layout == 0)
424 {
425 if (BurnLoadRom(DrvGfxROM + 0x00000, 3, 1)) return 1;
426 }
427 else
428 {
429 if (BurnLoadRom(DrvGfxROM + 0x00001, 3, 2)) return 1;
430 if (BurnLoadRom(DrvGfxROM + 0x00000, 4, 2)) return 1;
431 if (BurnLoadRom(DrvGfxROM + 0x20001, 5, 2)) return 1;
432 if (BurnLoadRom(DrvGfxROM + 0x20000, 6, 2)) return 1;
433 if (BurnLoadRom(DrvGfxROM + 0x40001, 7, 2)) return 1;
434 if (BurnLoadRom(DrvGfxROM + 0x40000, 8, 2)) return 1;
435 if (BurnLoadRom(DrvGfxROM + 0x60001, 9, 2)) return 1;
436 if (BurnLoadRom(DrvGfxROM + 0x60000, 10, 2)) return 1;
437 }
438
439 graphics_expand();
440 }
441
442 HD6309Init(0);
443 HD6309Open(0);
444 HD6309MapMemory(DrvHD6309RAM, 0x0000, 0x00ff, MAP_ROM); // write through handler
445 HD6309MapMemory(DrvHD6309RAM + 0x0100, 0x0100, 0x03ff, MAP_RAM);
446 HD6309MapMemory(DrvPalRAM, 0x0800, 0x0bff, MAP_RAM);
447 HD6309MapMemory(DrvSprRAM, 0x1000, 0x1fff, MAP_RAM);
448 HD6309MapMemory(DrvVidRAM0, 0x2000, 0x27ff, MAP_RAM);
449 HD6309MapMemory(DrvVidRAM1, 0x2800, 0x2fff, MAP_RAM);
450 HD6309MapMemory(DrvHD6309RAM + 0x3000, 0x3000, 0x3fff, MAP_RAM);
451 HD6309MapMemory(DrvHD6309ROM + 0x6000, 0x6000, 0xffff, MAP_ROM);
452 HD6309SetWriteHandler(flkatck_main_write);
453 HD6309SetReadHandler(flkatck_main_read);
454 HD6309Close();
455
456 ZetInit(0);
457 ZetOpen(0);
458 ZetMapMemory(DrvZ80ROM, 0x0000, 0x7fff, MAP_RAM);
459 ZetMapMemory(DrvZ80RAM, 0x8000, 0x87ff, MAP_RAM);
460 ZetSetWriteHandler(flkatck_sound_write);
461 ZetSetReadHandler(flkatck_sound_read);
462 ZetClose();
463
464 BurnWatchdogInit(DrvDoReset, 180);
465
466 BurnYM2151InitBuffered(3579545, 1, NULL, 0);
467 BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 1.00, BURN_SND_ROUTE_LEFT);
468 BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
469 BurnTimerAttachZet(3579545);
470
471 K007232Init(0, 3579545, DrvSndROM, 0x40000);
472 K007232SetPortWriteHandler(0, DrvK007232VolCallback);
473 K007232PCMSetAllRoutes(0, 0.35, BURN_SND_ROUTE_BOTH);
474
475 GenericTilesInit();
476 GenericTilemapInit(0, TILEMAP_SCAN_ROWS, bg_map_callback, 8, 8, 32, 32);
477 GenericTilemapInit(1, TILEMAP_SCAN_ROWS, fg_map_callback, 8, 8, 32, 32);
478 GenericTilemapSetGfx(0, DrvGfxROM, 4, 8, 8, 0x100000, 0x100, 0xf);
479 GenericTilemapSetOffsets(TMAP_GLOBAL, 0, -16);
480
481 k007121_init(0, (0x100000 / (8 * 8)) - 1);
482
483 DrvDoReset(1);
484
485 return 0;
486 }
487
DrvExit()488 static INT32 DrvExit()
489 {
490 GenericTilesExit();
491
492 HD6309Exit();
493 ZetExit();
494
495 K007232Exit();
496 BurnYM2151Exit();
497
498 BurnFreeMemIndex();
499
500 return 0;
501 }
502
DrvPaletteUpdate()503 static void DrvPaletteUpdate()
504 {
505 for (INT32 i = 0; i < 0x400; i+=2)
506 {
507 UINT16 p = (DrvPalRAM[i+1] * 256) + DrvPalRAM[i];
508
509 UINT8 r = (p & 0x1f);
510 UINT8 g = (p >> 5) & 0x1f;
511 UINT8 b = (p >> 10) & 0x1f;
512
513 r = (r << 3) | (r >> 2);
514 g = (g << 3) | (g >> 2);
515 b = (b << 3) | (b >> 2);
516
517 DrvPalette[i/2] = BurnHighCol(r,g,b,0);
518 }
519 }
520
DrvDraw()521 static INT32 DrvDraw()
522 {
523 if (DrvRecalc) {
524 DrvPaletteUpdate();
525 DrvRecalc = 1;
526 }
527
528 GenericTilemapSetScrollX(0, k007121_ctrl_read(0, 0) - 40);
529 GenericTilemapSetScrollY(0, k007121_ctrl_read(0, 2));
530
531 BurnTransferClear();
532
533 if (nBurnLayer & 1) GenericTilemapDraw(0, pTransDraw, 0);
534 INT32 spr_offs = (k007121_ctrl_read(0, 3) & 8) ? 0x800 : 0x000;
535 if (nSpriteEnable & 1) k007121_draw(0, pTransDraw, DrvGfxROM, NULL, &DrvSprRAM[spr_offs], 0, 40, 16, 0, -1, 0x0000);
536
537 GenericTilesSetClip(-1, 40, -1, -1);
538 if (nBurnLayer & 2) GenericTilemapDraw(1, pTransDraw, 0);
539 GenericTilesClearClip();
540
541 BurnTransferCopy(DrvPalette);
542
543 return 0;
544 }
545
DrvFrame()546 static INT32 DrvFrame()
547 {
548 BurnWatchdogUpdate();
549
550 if (DrvReset) {
551 DrvDoReset(1);
552 }
553
554 ZetNewFrame();
555
556 {
557 memset (DrvInputs, 0xff, 3 * sizeof(UINT8));
558
559 for (INT32 i = 0; i < 8; i++) {
560 DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
561 DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
562 DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
563 }
564 }
565
566 INT32 nInterleave = 256;
567 INT32 nCyclesTotal[2] = { 3000000 / 60, 3579545 / 60 };
568 INT32 nCyclesDone[2] = { nExtraCycles, 0 };
569
570 HD6309Open(0);
571 ZetOpen(0);
572
573 for (INT32 i = 0; i < nInterleave; i++)
574 {
575 CPU_RUN(0, HD6309);
576
577 if (i == 240) {
578 if (k007121_ctrl_read(0, 7) & 0x02)
579 HD6309SetIRQLine(0, CPU_IRQSTATUS_HOLD);
580
581 if (pBurnDraw) { // missing text in service mode if drawn after vbl
582 DrvDraw();
583 }
584 }
585
586 CPU_RUN_TIMER(1);
587 }
588
589 if (pBurnSoundOut) {
590 BurnYM2151Render(pBurnSoundOut, nBurnSoundLen);
591 K007232Update(0, pBurnSoundOut, nBurnSoundLen);
592 }
593
594 ZetClose();
595 HD6309Close();
596
597 nExtraCycles = nCyclesDone[0] - nCyclesTotal[0];
598
599 return 0;
600 }
601
DrvScan(INT32 nAction,INT32 * pnMin)602 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
603 {
604 struct BurnArea ba;
605
606 if (pnMin) {
607 *pnMin = 0x029702;
608 }
609
610 if (nAction & ACB_VOLATILE) {
611 memset(&ba, 0, sizeof(ba));
612
613 ba.Data = AllRam;
614 ba.nLen = RamEnd - AllRam;
615 ba.szName = "All Ram";
616 BurnAcb(&ba);
617
618 HD6309Scan(nAction);
619 ZetScan(nAction);
620 BurnWatchdogScan(nAction);
621
622 k007121_scan(nAction);
623
624 BurnYM2151Scan(nAction, pnMin);
625 K007232Scan(nAction, pnMin);
626 K007452Scan(nAction);
627
628 SCAN_VAR(soundlatch);
629 SCAN_VAR(flipscreen);
630 SCAN_VAR(main_bank);
631 SCAN_VAR(nExtraCycles);
632 }
633
634 if (nAction & ACB_WRITE)
635 {
636 HD6309Open(0);
637 bankswitch(main_bank);
638 HD6309Close();
639 }
640
641 return 0;
642 }
643
644
645 // MX5000
646
647 static struct BurnRomInfo mx5000RomDesc[] = {
648 { "669_r01.16c", 0x10000, 0x79b226fc, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code
649
650 { "669_m02.16b", 0x08000, 0x7e11e6b9, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code
651
652 { "gx669f04.11a", 0x40000, 0x6d1ea61c, 3 | BRF_SND }, // 2 k007232 Samples
653
654 { "gx669f03.5e", 0x80000, 0xff1d718b, 4 | BRF_GRA }, // 3 Graphics
655 };
656
657 STD_ROM_PICK(mx5000)
STD_ROM_FN(mx5000)658 STD_ROM_FN(mx5000)
659
660 static INT32 Mx5000Init()
661 {
662 return DrvInit(0);
663 }
664
665 struct BurnDriver BurnDrvMx5000 = {
666 "mx5000", NULL, NULL, NULL, "1987",
667 "MX5000\0", NULL, "Konami", "GX669",
668 NULL, NULL, NULL, NULL,
669 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_VERSHOOT, 0,
670 NULL, mx5000RomInfo, mx5000RomName, NULL, NULL, NULL, NULL, FlkatckInputInfo, FlkatckDIPInfo,
671 Mx5000Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
672 224, 280, 3, 4
673 };
674
675
676 // Flak Attack (Japan)
677
678 static struct BurnRomInfo flkatckRomDesc[] = {
679 { "669_p01.16c", 0x10000, 0xc5cd2807, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code
680
681 { "669_m02.16b", 0x08000, 0x7e11e6b9, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code
682
683 { "gx669f04.11a", 0x40000, 0x6d1ea61c, 3 | BRF_SND }, // 2 k007232 Samples
684
685 { "gx669f03.5e", 0x80000, 0xff1d718b, 4 | BRF_GRA }, // 3 Graphics
686 };
687
688 STD_ROM_PICK(flkatck)
689 STD_ROM_FN(flkatck)
690
691 struct BurnDriver BurnDrvFlkatck = {
692 "flkatck", "mx5000", NULL, NULL, "1987",
693 "Flak Attack (Japan)\0", NULL, "Konami", "GX669",
694 NULL, NULL, NULL, NULL,
695 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_VERSHOOT, 0,
696 NULL, flkatckRomInfo, flkatckRomName, NULL, NULL, NULL, NULL, FlkatckInputInfo, FlkatckDIPInfo,
697 Mx5000Init, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
698 224, 280, 3, 4
699 };
700
701
702 // Flak Attack (Japan, PWB 450593 sub-board)
703
704 static struct BurnRomInfo flkatckaRomDesc[] = {
705 { "669_p01.16c", 0x10000, 0xc5cd2807, 1 | BRF_PRG | BRF_ESS }, // 0 HD6309 Code
706
707 { "669_m02.16b", 0x08000, 0x7e11e6b9, 2 | BRF_PRG | BRF_ESS }, // 1 Z80 Code
708
709 { "gx669f04.11a", 0x40000, 0x6d1ea61c, 3 | BRF_GRA }, // 2 k007232 Samples
710
711 { "669_f03a.4b", 0x10000, 0xf0ed4c1e, 4 | BRF_GRA }, // 3 Graphics
712 { "669_f03e.4d", 0x10000, 0x95a57a26, 4 | BRF_GRA }, // 4
713 { "669_f03b.5b", 0x10000, 0xe2593f3c, 4 | BRF_GRA }, // 5
714 { "669_f03f.5d", 0x10000, 0xc6c9903e, 4 | BRF_GRA }, // 6
715 { "669_f03c.6b", 0x10000, 0x47be92dd, 4 | BRF_GRA }, // 7
716 { "669_f03g.6d", 0x10000, 0x70d35fbd, 4 | BRF_GRA }, // 8
717 { "669_f03d.7b", 0x10000, 0x18d48f9e, 4 | BRF_GRA }, // 9
718 { "669_f03h.7d", 0x10000, 0xabfe76e7, 4 | BRF_GRA }, // 10
719 };
720
721 STD_ROM_PICK(flkatcka)
STD_ROM_FN(flkatcka)722 STD_ROM_FN(flkatcka)
723
724 static INT32 FlkatckaInit()
725 {
726 return DrvInit(1);
727 }
728
729 struct BurnDriver BurnDrvFlkatcka = {
730 "flkatcka", "mx5000", NULL, NULL, "1987",
731 "Flak Attack (Japan, PWB 450593 sub-board)\0", NULL, "Konami", "GX669",
732 NULL, NULL, NULL, NULL,
733 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_PREFIX_KONAMI, GBF_VERSHOOT, 0,
734 NULL, flkatckaRomInfo, flkatckaRomName, NULL, NULL, NULL, NULL, FlkatckInputInfo, FlkatckDIPInfo,
735 FlkatckaInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
736 224, 280, 3, 4
737 };
738