1 // Warp Warp emu-layer for FB Alpha by dink, based on Mirko & Chris Hardy's MAME driver & sound core code by Juergen Buchmueller
2
3 #include "tiles_generic.h"
4 #include "driver.h"
5 #include "z80_intf.h"
6 #include "bitswap.h"
7 #include "resnet.h"
8 #include <math.h>
9
10 static UINT8 *AllMem;
11 static UINT8 *MemEnd;
12 static UINT8 *AllRam;
13 static UINT8 *RamEnd;
14 static UINT8 *DrvZ80ROM;
15 static UINT8 *DrvZ80RAM;
16 static UINT8 *DrvVidRAM;
17 static UINT8 *DrvGFX1ROM;
18 static UINT8 *DrvCharGFX;
19
20 static UINT32 *DrvPalette;
21 static UINT8 DrvRecalc;
22
23 static UINT32 ball_on;
24 static UINT32 ball_h;
25 static UINT32 ball_v;
26
27 static UINT8 DrvJoy1[8];
28 static UINT8 DrvJoy2[8];
29 static UINT8 DrvJoy3[8];
30 static UINT8 DrvJoy4[8];
31 static UINT8 DrvDip[2] = {0, 0};
32 static UINT8 DrvInput[5];
33 static UINT8 use_paddle = 0;
34 static UINT8 Paddle = 0;
35 static UINT8 DrvReset;
36
37 static UINT32 rockola = 0;
38 static UINT32 navaronemode = 0;
39 static UINT32 bombbeemode = 0;
40 static UINT32 kaiteimode = 0;
41
42 static UINT8 ball_size_x;
43 static UINT8 ball_size_y;
44 static UINT32 ball_color;
45 static UINT8 geebee_bgw;
46
47 static struct BurnInputInfo WarpwarpInputList[] = {
48 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin" },
49 {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start" },
50 {"P1 Up", BIT_DIGITAL, DrvJoy3 + 1, "p1 up" },
51 {"P1 Down", BIT_DIGITAL, DrvJoy3 + 0, "p1 down" },
52 {"P1 Left", BIT_DIGITAL, DrvJoy3 + 2, "p1 left" },
53 {"P1 Right", BIT_DIGITAL, DrvJoy3 + 3, "p1 right" },
54 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" },
55
56 {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start" },
57
58 {"Reset", BIT_DIGITAL, &DrvReset, "reset" },
59 {"Service", BIT_DIGITAL, DrvJoy1 + 7, "service" },
60 {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip" },
61 {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip" },
62 };
63
64 STDINPUTINFO(Warpwarp)
65
66
67 static struct BurnDIPInfo WarpwarpDIPList[]=
68 {
69 {0x0a, 0xff, 0xff, 0x85, NULL },
70 {0x0b, 0xff, 0xff, 0x20, NULL },
71
72 {0 , 0xfe, 0 , 4, "Coinage" },
73 {0x0a, 0x01, 0x03, 0x03, "2 Coins 1 Credit" },
74 {0x0a, 0x01, 0x03, 0x01, "1 Coin 1 Credit" },
75 {0x0a, 0x01, 0x03, 0x02, "1 Coin 2 Credits"},
76 {0x0a, 0x01, 0x03, 0x00, "Free Play" },
77
78 {0 , 0xfe, 0 , 4, "Lives" },
79 {0x0a, 0x01, 0x0c, 0x00, "2" },
80 {0x0a, 0x01, 0x0c, 0x04, "3" },
81 {0x0a, 0x01, 0x0c, 0x08, "4" },
82 {0x0a, 0x01, 0x0c, 0x0c, "5" },
83
84 {0 , 0xfe, 0 , 4, "Bonus Life" },
85 {0x0a, 0x01, 0x30, 0x00, "8k 30k 30k+" },
86 {0x0a, 0x01, 0x30, 0x10, "10k 40k 40k+" },
87 {0x0a, 0x01, 0x30, 0x20, "15k 60k 60k+" },
88 {0x0a, 0x01, 0x30, 0x30, "None" },
89
90 {0 , 0xfe, 0 , 2, "Demo Sounds" },
91 {0x0a, 0x01, 0x40, 0x40, "Off" },
92 {0x0a, 0x01, 0x40, 0x00, "On" },
93
94 {0 , 0xfe, 0 , 2, "Level Selection" },
95 {0x0a, 0x01, 0x80, 0x80, "Off" },
96 {0x0a, 0x01, 0x80, 0x00, "On" },
97
98 {0 , 0xfe, 0 , 2, "Service Mode" },
99 {0x0b, 0x01, 0x20, 0x20, "Off" },
100 {0x0b, 0x01, 0x20, 0x00, "On" },
101 };
102
103 STDDIPINFO(Warpwarp)
104
105 static struct BurnDIPInfo WarpwarprDIPList[]=
106 {
107 {0x0a, 0xff, 0xff, 0x05, NULL },
108 {0x0b, 0xff, 0xff, 0xa0, NULL },
109
110 {0 , 0xfe, 0 , 4, "Coinage" },
111 {0x0a, 0x01, 0x03, 0x03, "2 Coins 1 Credit" },
112 {0x0a, 0x01, 0x03, 0x01, "1 Coin 1 Credit" },
113 {0x0a, 0x01, 0x03, 0x02, "1 Coin 2 Credits"},
114 {0x0a, 0x01, 0x03, 0x00, "Free Play" },
115
116 {0 , 0xfe, 0 , 4, "Lives" },
117 {0x0a, 0x01, 0x0c, 0x00, "2" },
118 {0x0a, 0x01, 0x0c, 0x04, "3" },
119 {0x0a, 0x01, 0x0c, 0x08, "4" },
120 {0x0a, 0x01, 0x0c, 0x0c, "5" },
121
122 {0 , 0xfe, 0 , 4, "Bonus Life" },
123 {0x0a, 0x01, 0x30, 0x00, "8k 30k 30k+" },
124 {0x0a, 0x01, 0x30, 0x10, "10k 40k 40k+" },
125 {0x0a, 0x01, 0x30, 0x20, "15k 60k 60k+" },
126 {0x0a, 0x01, 0x30, 0x30, "None" },
127
128 {0 , 0xfe, 0 , 2, "Demo Sounds" },
129 {0x0a, 0x01, 0x40, 0x40, "Off" },
130 {0x0a, 0x01, 0x40, 0x00, "On" },
131
132 {0 , 0xfe, 0 , 2, "High Score Name" },
133 {0x0a, 0x01, 0x80, 0x80, "No" },
134 {0x0a, 0x01, 0x80, 0x00, "Yes" },
135
136 {0 , 0xfe, 0 , 2, "Service Mode" },
137 {0x0b, 0x01, 0x20, 0x20, "Off" },
138 {0x0b, 0x01, 0x20, 0x00, "On" },
139 };
140
141 STDDIPINFO(Warpwarpr)
142
143 static struct BurnInputInfo GeebeeInputList[] = {
144 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"},
145 {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start"},
146 {"P1 Left", BIT_DIGITAL, DrvJoy4 + 0, "p1 left" },
147 {"P1 Right", BIT_DIGITAL, DrvJoy4 + 1, "p1 right" },
148 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"},
149
150 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
151 {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip"},
152 };
153
154 STDINPUTINFO(Geebee)
155
156
157 static struct BurnDIPInfo GeebeeDIPList[]=
158 {
159 {0x06, 0xff, 0xff, 0xd0, NULL },
160
161 {0 , 0xfe, 0 , 2, "Lives" },
162 {0x06, 0x01, 0x02, 0x00, "3" },
163 {0x06, 0x01, 0x02, 0x02, "5" },
164
165 {0 , 0xfe, 0 , 4, "Coinage" },
166 {0x06, 0x01, 0x0c, 0x08, "2 Coins 1 Credits" },
167 {0x06, 0x01, 0x0c, 0x00, "1 Coin 1 Credits" },
168 {0x06, 0x01, 0x0c, 0x04, "1 Coin 2 Credits" },
169 {0x06, 0x01, 0x0c, 0x0c, "Free Play" },
170
171 {0 , 0xfe, 0 , 8, "Replay" },
172 {0x06, 0x01, 0x30, 0x10, "40k 80k" },
173 {0x06, 0x01, 0x30, 0x20, "70k 140k" },
174 {0x06, 0x01, 0x30, 0x30, "100k 200k" },
175 {0x06, 0x01, 0x30, 0x00, "None" },
176 {0x06, 0x01, 0x30, 0x10, "60k 120k" },
177 {0x06, 0x01, 0x30, 0x20, "100k 200k" },
178 {0x06, 0x01, 0x30, 0x30, "150k 300k" },
179 {0x06, 0x01, 0x30, 0x00, "None" },
180 };
181
182 STDDIPINFO(Geebee)
183
184 static struct BurnInputInfo BombbeeInputList[] = {
185 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"},
186 {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start"},
187 {"P1 Left", BIT_DIGITAL, DrvJoy4 + 0, "p1 left" },
188 {"P1 Right", BIT_DIGITAL, DrvJoy4 + 1, "p1 right" },
189 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"},
190
191 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
192 {"Service", BIT_DIGITAL, DrvJoy1 + 7, "service"},
193 {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip"},
194 {"Dip B", BIT_DIPSWITCH, DrvDip + 1, "dip"},
195 };
196
197 STDINPUTINFO(Bombbee)
198
199
200 static struct BurnDIPInfo BombbeeDIPList[]=
201 {
202 {0x07, 0xff, 0xff, 0x03, NULL },
203 {0x08, 0xff, 0xff, 0x20, NULL },
204
205 {0 , 0xfe, 0 , 4, "Coinage" },
206 {0x07, 0x01, 0x03, 0x02, "2 Coins 1 Credit" },
207 {0x07, 0x01, 0x03, 0x03, "1 Coin 1 Credit" },
208 {0x07, 0x01, 0x03, 0x01, "1 Coin 2 Credits" },
209 {0x07, 0x01, 0x03, 0x00, "Free Play" },
210
211 {0 , 0xfe, 0 , 3, "Lives" },
212 {0x07, 0x01, 0x0c, 0x00, "3" },
213 {0x07, 0x01, 0x0c, 0x04, "4" },
214 {0x07, 0x01, 0x0c, 0x0c, "5" },
215
216 {0 , 0xfe, 0 , 2, "Unused" },
217 {0x07, 0x01, 0x10, 0x10, "Off" },
218 {0x07, 0x01, 0x10, 0x00, "On" },
219
220 {0 , 0xfe, 0 , 8, "Replay" },
221 {0x07, 0x01, 0xe0, 0x00, "50000" },
222 {0x07, 0x01, 0xe0, 0x20, "60000" },
223 {0x07, 0x01, 0xe0, 0x40, "70000" },
224 {0x07, 0x01, 0xe0, 0x60, "80000" },
225 {0x07, 0x01, 0xe0, 0x80, "100000" },
226 {0x07, 0x01, 0xe0, 0xa0, "120000" },
227 {0x07, 0x01, 0xe0, 0xc0, "150000" },
228 {0x07, 0x01, 0xe0, 0xe0, "None" },
229
230 {0 , 0xfe, 0 , 2, "Service Mode" },
231 {0x08, 0x01, 0x20, 0x20, "Off" },
232 {0x08, 0x01, 0x20, 0x00, "On" },
233
234 };
235
236 STDDIPINFO(Bombbee)
237
238 static struct BurnInputInfo NavaroneInputList[] = {
239 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"},
240 {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start"},
241 {"P1 Left", BIT_DIGITAL, DrvJoy3 + 1, "p1 left"},
242 {"P1 Right", BIT_DIGITAL, DrvJoy3 + 0, "p1 right"},
243 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"},
244
245 {"P2 Start", BIT_DIGITAL, DrvJoy1 + 3, "p2 start"},
246 {"P2 Left", BIT_DIGITAL, DrvJoy4 + 2, "p2 left"},
247 {"P2 Right", BIT_DIGITAL, DrvJoy4 + 3, "p2 right"},
248 {"P2 Button 1", BIT_DIGITAL, DrvJoy1 + 1, "p2 fire 1"},
249
250 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
251 {"Service", BIT_DIGITAL, DrvJoy1 + 5, "service"},
252 {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip"},
253 };
254
255 STDINPUTINFO(Navarone)
256
257
258 static struct BurnDIPInfo NavaroneDIPList[]=
259 {
260 {0x0b, 0xff, 0xff, 0x16, NULL },
261
262 {0 , 0xfe, 0 , 2, "Lives" },
263 {0x0b, 0x01, 0x02, 0x00, "2" },
264 {0x0b, 0x01, 0x02, 0x02, "3" },
265
266 {0 , 0xfe, 0 , 4, "Bonus Life" },
267 {0x0b, 0x01, 0x0c, 0x04, "5000/2, 6000/3" },
268 {0x0b, 0x01, 0x0c, 0x08, "6000/2, 7000/3" },
269 {0x0b, 0x01, 0x0c, 0x0c, "7000/2, 8000/3" },
270 {0x0b, 0x01, 0x0c, 0x00, "None" },
271
272 {0 , 0xfe, 0 , 4, "Coinage" },
273 {0x0b, 0x01, 0x30, 0x30, "2 Coins 1 Credit" },
274 {0x0b, 0x01, 0x30, 0x10, "1 Coin 1 Credit" },
275 {0x0b, 0x01, 0x30, 0x20, "1 Coin 2 Credits" },
276 {0x0b, 0x01, 0x30, 0x00, "Free Play" },
277 };
278
279 STDDIPINFO(Navarone)
280
281 static struct BurnInputInfo KaiteinInputList[] = {
282 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"},
283 {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start"},
284 {"P1 Left", BIT_DIGITAL, DrvJoy3 + 1, "p1 left"},
285 {"P1 Right", BIT_DIGITAL, DrvJoy3 + 0, "p1 right"},
286 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"},
287
288 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
289 {"Service", BIT_DIGITAL, DrvJoy1 + 5, "service"},
290 {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip"},
291 };
292
293 STDINPUTINFO(Kaitein)
294
295
296 static struct BurnDIPInfo KaiteinDIPList[]=
297 {
298 {0x07, 0xff, 0xff, 0x15, NULL },
299
300 {0 , 0xfe, 0 , 4, "Lives" },
301 {0x07, 0x01, 0x03, 0x00, "2" },
302 {0x07, 0x01, 0x03, 0x01, "3" },
303 {0x07, 0x01, 0x03, 0x02, "4" },
304 {0x07, 0x01, 0x03, 0x03, "5" },
305
306 {0 , 0xfe, 0 , 4, "Bonus Life" },
307 {0x07, 0x01, 0x0c, 0x04, "2000" },
308 {0x07, 0x01, 0x0c, 0x08, "4000" },
309 {0x07, 0x01, 0x0c, 0x0c, "6000" },
310 {0x07, 0x01, 0x0c, 0x00, "None" },
311
312 {0 , 0xfe, 0 , 4, "Coinage" },
313 {0x07, 0x01, 0x30, 0x30, "2 Coins 1 Credit" },
314 {0x07, 0x01, 0x30, 0x10, "1 Coin 1 Credit" },
315 {0x07, 0x01, 0x30, 0x20, "1 Coin 2 Credits" },
316 {0x07, 0x01, 0x30, 0x00, "Free Play" },
317 };
318
319 STDDIPINFO(Kaitein)
320
321 static struct BurnInputInfo KaiteiInputList[] = {
322 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"},
323 {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start"},
324 {"P1 Left", BIT_DIGITAL, DrvJoy2 + 1, "p1 left"},
325 {"P1 Right", BIT_DIGITAL, DrvJoy2 + 0, "p1 right"},
326 {"P1 Button 1", BIT_DIGITAL, DrvJoy2 + 2, "p1 fire 1"},
327
328 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
329 {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip"},
330 };
331
332 STDINPUTINFO(Kaitei)
333
334
335 static struct BurnDIPInfo KaiteiDIPList[]=
336 {
337 {0x06, 0xff, 0xff, 0x1e, NULL },
338
339 {0 , 0xfe, 0 , 4, "Lives" },
340 {0x06, 0x01, 0x06, 0x06, "4" },
341 {0x06, 0x01, 0x06, 0x04, "5" },
342 {0x06, 0x01, 0x06, 0x02, "6" },
343 {0x06, 0x01, 0x06, 0x00, "7" },
344
345 {0 , 0xfe, 0 , 4, "Bonus Life" },
346 {0x06, 0x01, 0x18, 0x18, "4000" },
347 {0x06, 0x01, 0x18, 0x10, "6000" },
348 {0x06, 0x01, 0x18, 0x08, "8000" },
349 {0x06, 0x01, 0x18, 0x00, "10000" },
350
351 {0 , 0xfe, 0 , 2, "Unused" },
352 {0x06, 0x01, 0x20, 0x00, "Off" },
353 {0x06, 0x01, 0x20, 0x20, "On" },
354 };
355
356 STDDIPINFO(Kaitei)
357
358 static struct BurnInputInfo SosInputList[] = {
359 {"P1 Coin", BIT_DIGITAL, DrvJoy1 + 0, "p1 coin"},
360 {"P1 Start", BIT_DIGITAL, DrvJoy1 + 2, "p1 start"},
361 {"P1 Left", BIT_DIGITAL, DrvJoy3 + 1, "p1 left"},
362 {"P1 Right", BIT_DIGITAL, DrvJoy3 + 0, "p1 right"},
363 {"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1"},
364
365 {"Reset", BIT_DIGITAL, &DrvReset, "reset"},
366 {"Service", BIT_DIGITAL, DrvJoy1 + 5, "service"},
367 {"Dip A", BIT_DIPSWITCH, DrvDip + 0, "dip"},
368 };
369
370 STDINPUTINFO(Sos)
371
372
373 static struct BurnDIPInfo SosDIPList[]=
374 {
375 {0x07, 0xff, 0xff, 0x2a, NULL },
376
377 {0 , 0xfe, 0 , 4, "Lives" },
378 {0x07, 0x01, 0x06, 0x00, "2" },
379 {0x07, 0x01, 0x06, 0x02, "3" },
380 {0x07, 0x01, 0x06, 0x04, "4" },
381 {0x07, 0x01, 0x06, 0x06, "5" },
382
383 {0 , 0xfe, 0 , 4, "Coinage" },
384 {0x07, 0x01, 0x18, 0x18, "2 Coins 1 Credit" },
385 {0x07, 0x01, 0x18, 0x08, "1 Coin 1 Credit" },
386 {0x07, 0x01, 0x18, 0x10, "1 Coin 2 Credits" },
387 {0x07, 0x01, 0x18, 0x00, "Free Play" },
388
389 {0 , 0xfe, 0 , 2, "Nudity" },
390 {0x07, 0x01, 0x20, 0x00, "Off" },
391 {0x07, 0x01, 0x20, 0x20, "On" },
392 };
393
394 STDDIPINFO(Sos)
395
396 // Warp Warp soundchip emulation by Juergen Buchmueller <pullmoll@t-online.de>, jan 2000
397 static INT16 *decay = NULL;
398 static INT32 sound_latch = 0;
399 static INT32 music1_latch = 0;
400 static INT32 music2_latch = 0;
401 static INT32 sound_signal = 0;
402 static INT32 sound_volume = 0;
403 static INT32 sound_volume_timer = 0;
404 static INT32 music_signal = 0;
405 static INT32 music_volume = 0;
406 static INT32 music_volume_timer = 0;
407 static INT32 noise = 0;
408
warpwarp_sound_reset()409 static void warpwarp_sound_reset()
410 {
411 sound_latch = 0;
412 music1_latch = 0;
413 music2_latch = 0;
414 sound_signal = 0;
415 sound_volume = 0;
416 sound_volume_timer = 0;
417 music_signal = 0;
418 music_volume = 0;
419 music_volume_timer = 0;
420 noise = 0;
421 }
422
warpwarp_sound_scan()423 static void warpwarp_sound_scan()
424 {
425 SCAN_VAR(sound_latch);
426 SCAN_VAR(music1_latch);
427 SCAN_VAR(music2_latch);
428 SCAN_VAR(sound_signal);
429 SCAN_VAR(sound_volume);
430 SCAN_VAR(sound_volume_timer);
431 SCAN_VAR(music_signal);
432 SCAN_VAR(music_volume);
433 SCAN_VAR(music_volume_timer);
434 SCAN_VAR(noise);
435 }
436
sound_volume_decay()437 static void sound_volume_decay()
438 {
439 if( --sound_volume < 0 )
440 sound_volume = 0;
441 }
442
warpwarp_sound_w(UINT8 data)443 static void warpwarp_sound_w(UINT8 data)
444 {
445 sound_latch = data & 0x0f;
446 sound_volume = 0x7fff; /* set sound_volume */
447 noise = 0x0000; /* reset noise shifter */
448
449 if( sound_latch & 8 ) {
450 sound_volume_timer = 1;
451 } else {
452 sound_volume_timer = 2;
453 }
454 }
455
warpwarp_music1_w(UINT8 data)456 static void warpwarp_music1_w(UINT8 data)
457 {
458 music1_latch = data & 0x3f;
459 }
460
music_volume_decay()461 static void music_volume_decay()
462 {
463 if( --music_volume < 0 )
464 music_volume = 0;
465 }
466
warpwarp_music2_w(UINT8 data)467 static void warpwarp_music2_w(UINT8 data)
468 {
469 music2_latch = data & 0x3f;
470 music_volume = 0x7fff;
471
472 if( music2_latch & 0x10 ) {
473 music_volume_timer = 1;
474 } else {
475 music_volume_timer = 3;
476 }
477 }
478
warpwarp_timer_tiktiktik(INT32)479 static void warpwarp_timer_tiktiktik(INT32 /*ticks*/)
480 {// warpwarp_timer_tiktiktik(); must be called 256 times per frame
481 switch (music_volume_timer) {
482 case 1: music_volume_decay(); // no breaks!
483 case 2: music_volume_decay();
484 case 3: music_volume_decay();
485 }
486 switch (sound_volume_timer) {
487 case 1: sound_volume_decay(); // seriously, no breaks!
488 case 2: sound_volume_decay();
489 case 3: sound_volume_decay();
490 }
491 }
492
warpwarp_sound_update(INT16 * buffer,INT32 length)493 static void warpwarp_sound_update(INT16 *buffer, INT32 length)
494 {
495 static int vcarry = 0;
496 static int vcount = 0;
497 static int mcarry = 0;
498 static int mcount = 0;
499
500 memset(buffer, 0, length * 2 * sizeof(INT16));
501
502 while (length--)
503 {
504 *buffer++ = (sound_signal + music_signal) / 4;
505 *buffer++ = (sound_signal + music_signal) / 4;
506
507 mcarry -= (18432000/3/2/16) / (4 * (64 - music1_latch));
508 while( mcarry < 0 )
509 {
510 mcarry += nBurnSoundRate;
511 mcount++;
512 music_signal = (mcount & ~music2_latch & 15) ? decay[music_volume] : 0;
513 /* override by noise gate? */
514 if( (music2_latch & 32) && (noise & 0x8000) )
515 music_signal = decay[music_volume];
516 }
517
518 /* clock 1V = 8kHz */
519 vcarry -= (18432000/3/2/384);
520 while (vcarry < 0)
521 {
522 vcarry += nBurnSoundRate;
523 vcount++;
524
525 /* noise is clocked with raising edge of 2V */
526 if ((vcount & 3) == 2)
527 {
528 /* bit0 = bit0 ^ !bit10 */
529 if ((noise & 1) == ((noise >> 10) & 1))
530 noise = (noise << 1) | 1;
531 else
532 noise = noise << 1;
533 }
534
535 switch (sound_latch & 7)
536 {
537 case 0: /* 4V */
538 sound_signal = (vcount & 0x04) ? decay[sound_volume] : 0;
539 break;
540 case 1: /* 8V */
541 sound_signal = (vcount & 0x08) ? decay[sound_volume] : 0;
542 break;
543 case 2: /* 16V */
544 sound_signal = (vcount & 0x10) ? decay[sound_volume] : 0;
545 break;
546 case 3: /* 32V */
547 sound_signal = (vcount & 0x20) ? decay[sound_volume] : 0;
548 break;
549 case 4: /* TONE1 */
550 sound_signal = !(vcount & 0x01) && !(vcount & 0x10) ? decay[sound_volume] : 0;
551 break;
552 case 5: /* TONE2 */
553 sound_signal = !(vcount & 0x02) && !(vcount & 0x20) ? decay[sound_volume] : 0;
554 break;
555 case 6: /* TONE3 */
556 sound_signal = !(vcount & 0x04) && !(vcount & 0x40) ? decay[sound_volume] : 0;
557 break;
558 default: /* NOISE */
559 sound_signal = (noise & 0x8000) ? decay[sound_volume] : 0;
560 }
561 }
562 }
563 }
564
warpwarp_sound_init()565 static void warpwarp_sound_init()
566 {
567 decay = (INT16 *) BurnMalloc(32768 * sizeof(INT16));
568
569 for(INT32 i = 0; i < 0x8000; i++ )
570 decay[0x7fff-i] = (INT16) (0x7fff/exp(1.0*i/4096));
571
572 sound_volume_timer = 0;
573 music_volume_timer = 0;
574 }
575
warpwarp_sound_deinit()576 static void warpwarp_sound_deinit()
577 {
578 if (decay)
579 BurnFree(decay);
580 decay = NULL;
581 }
582
warpwarp_palette_init()583 static void warpwarp_palette_init()
584 {
585 static const int resistances_tiles_rg[3] = { 1600, 820, 390 };
586 static const int resistances_tiles_b[2] = { 820, 390 };
587 static const int resistance_ball[1] = { 220 };
588
589 double weights_tiles_rg[3], weights_tiles_b[2], weight_ball[1];
590
591 compute_resistor_weights(0, 0xff, -1.0,
592 3, &resistances_tiles_rg[0], weights_tiles_rg, 150, 0,
593 2, &resistances_tiles_b[0], weights_tiles_b, 150, 0,
594 1, &resistance_ball[0], weight_ball, 150, 0);
595
596 for (INT32 i = 0; i < 0x100; i++)
597 {
598 INT32 bit0, bit1, bit2;
599
600 bit0 = (i >> 0) & 0x01;
601 bit1 = (i >> 1) & 0x01;
602 bit2 = (i >> 2) & 0x01;
603 INT32 r = combine_3_weights(weights_tiles_rg, bit0, bit1, bit2);
604
605 bit0 = (i >> 3) & 0x01;
606 bit1 = (i >> 4) & 0x01;
607 bit2 = (i >> 5) & 0x01;
608 INT32 g = combine_3_weights(weights_tiles_rg, bit0, bit1, bit2);
609
610 bit0 = (i >> 6) & 0x01;
611 bit1 = (i >> 7) & 0x01;
612 INT32 b = combine_2_weights(weights_tiles_b, bit0, bit1);
613
614 DrvPalette[(i * 2) + 0] = BurnHighCol(0, 0, 0, 0);;
615 DrvPalette[(i * 2) + 1] = BurnHighCol(r, g, b, 0);;
616 }
617
618 DrvPalette[0x200] = BurnHighCol((INT32)weight_ball[0], (INT32)weight_ball[0], (INT32)weight_ball[0], 0);
619 }
620
621 static UINT32 geebee_palette[3];
622
geebee_palette_common()623 static void geebee_palette_common()
624 {
625 geebee_palette[0] = BurnHighCol(0x00, 0x00, 0x00, 0); /* black */
626 geebee_palette[1] = BurnHighCol(0xff, 0xff, 0xff, 0); /* white */
627 geebee_palette[2] = BurnHighCol(0x7f, 0x7f, 0x7f, 0); /* grey */
628 }
629
630 #if 0
631 static void geebee_palette_init()
632 {
633 geebee_palette_common();
634 DrvPalette[0] = geebee_palette[0];
635 DrvPalette[1] = geebee_palette[1];
636 DrvPalette[2] = geebee_palette[1];
637 DrvPalette[3] = geebee_palette[0];
638 DrvPalette[4] = geebee_palette[0];
639 DrvPalette[5] = geebee_palette[2];
640 DrvPalette[6] = geebee_palette[2];
641 DrvPalette[7] = geebee_palette[0];
642 }
643 #endif
644
navarone_palette_init()645 static void navarone_palette_init()
646 {
647 geebee_palette_common();
648 DrvPalette[0] = geebee_palette[0];
649 DrvPalette[1] = geebee_palette[1];
650 DrvPalette[2] = geebee_palette[0];
651 DrvPalette[3] = geebee_palette[2];
652 DrvPalette[4] = geebee_palette[0];
653 DrvPalette[5] = geebee_palette[1];
654 DrvPalette[6] = geebee_palette[0];
655 DrvPalette[7] = geebee_palette[2];
656 DrvPalette[8] = geebee_palette[1];
657 }
658
DrvMakeInputs()659 static void DrvMakeInputs()
660 {
661 UINT8 *DrvJoy[4] = { DrvJoy1, DrvJoy2, DrvJoy3, DrvJoy4 };
662 UINT32 DrvJoyInit[4] = { 0xff, 0xff, 0x00, 0x00 };
663
664 CompileInput(DrvJoy, (void*)DrvInput, 4, 8, DrvJoyInit); // first two are active low
665
666 ProcessJoystick(&DrvInput[2], 0, 3,2,1,0, INPUT_4WAY);
667 ProcessJoystick(&DrvInput[3], 1, 3,2,1,0, INPUT_4WAY);
668
669 if (kaiteimode) { // silly protection for Kaitei
670 DrvInput[0] = (DrvInput[0] & 0xd) | 0xa0;
671 DrvInput[1] = (DrvInput[1] & 0x3f) | 0x80;
672 DrvInput[2] = 0x80;
673 DrvInput[3] = 0x80;
674 }
675
676 if (use_paddle) {
677 if (DrvJoy4[0]) Paddle += 0x04;
678 if (DrvJoy4[1]) Paddle -= 0x04;
679 if (Paddle < 0x10) Paddle = 0x10;
680 if (Paddle > 0xa8) Paddle = 0xa8;
681 }
682 }
683
geebee_in_r(UINT8 offset)684 static UINT8 geebee_in_r(UINT8 offset)
685 {
686 INT32 res = 0;
687
688 offset &= 3;
689 switch (offset) {
690 case 0: res = DrvInput[0] | 0x20; break;
691 case 1: res = DrvInput[1]; break;
692 case 2: res = DrvDip[0] | ((kaiteimode) ? 0x80 : 0x00); break;
693 }
694
695 if (offset == 3)
696 {
697 res = (use_paddle) ? Paddle : (DrvInput[2]);
698
699 if (!use_paddle && !kaiteimode) // joystick-mode
700 {
701 if (res & 2) return 0x9f;
702 if (res & 1) return 0x0f;
703 return 0x60;
704 }
705 }
706
707 return res;
708 }
709
geebee_out6_w(UINT16 offset,UINT8 data)710 static void geebee_out6_w(UINT16 offset, UINT8 data)
711 {
712 switch (offset & 3)
713 {
714 case 0:
715 ball_h = data;
716 break;
717 case 1:
718 ball_v = data;
719 break;
720 case 2:
721 break;
722 case 3:
723 warpwarp_sound_w(data);
724 break;
725 }
726 }
727
geebee_out7_w(UINT16 offset,UINT8 data)728 static void geebee_out7_w(UINT16 offset, UINT8 data)
729 {
730 switch (offset & 7)
731 {
732 case 5:
733 geebee_bgw = data & 1;
734 break;
735 case 6:
736 ball_on = data & 1;
737 break;
738 case 7:
739 // flipping for coctail mode.
740 break;
741 }
742 }
743
warpwarp_sw_r(UINT8 offset)744 static UINT8 warpwarp_sw_r(UINT8 offset)
745 {
746 return (DrvInput[0] >> (offset & 7)) & 1;
747 }
748
warpwarp_dsw1_r(UINT8 offset)749 static UINT8 warpwarp_dsw1_r(UINT8 offset)
750 {
751 return (DrvDip[0] >> (offset & 7)) & 1;
752 }
753
warpwarp_vol_r(UINT8)754 static UINT8 warpwarp_vol_r(UINT8 /*offset*/)
755 {
756 INT32 res = (use_paddle) ? Paddle : DrvInput[2];
757
758 if (!use_paddle) {
759 if (res & 1) return 0x0f;
760 if (res & 2) return 0x3f;
761 if (res & 4) return 0x6f;
762 if (res & 8) return 0x9f;
763 return 0xff;
764 }
765
766 return res;
767 }
768
warpwarp_out0_w(UINT16 offset,UINT8 data)769 static void warpwarp_out0_w(UINT16 offset, UINT8 data)
770 {
771 switch (offset & 3)
772 {
773 case 0:
774 ball_h = data;
775 break;
776 case 1:
777 ball_v = data;
778 break;
779 case 2:
780 warpwarp_sound_w(data);
781 break;
782 case 3:
783 // watchdog reset
784 break;
785 }
786 }
787
warpwarp_out3_w(UINT16 offset,UINT8 data)788 static void warpwarp_out3_w(UINT16 offset, UINT8 data)
789 {
790 switch (offset & 7)
791 {
792 case 6:
793 ball_on = data & 1;
794 if (~data & 1) {
795 ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
796 }
797 break;
798 case 7:
799 // flipscreen = data & 1;
800 break;
801 }
802 }
803
main_write(UINT16 address,UINT8 data)804 static void __fastcall main_write(UINT16 address, UINT8 data)
805 {
806 if ((address & 0xf000) == 0x6000) address = (address&0xfff) + 0xc000; // bombee/cutieq map
807
808 if (address >= 0xc000 && address <= 0xc00f) {
809 warpwarp_out0_w(address - 0xc000, data);
810 return;
811 }
812 if (address >= 0xc010 && address <= 0xc01f) {
813 warpwarp_music1_w(data);
814 return;
815 }
816 if (address >= 0xc020 && address <= 0xc02f) {
817 warpwarp_music2_w(data);
818 return;
819 }
820 if (address >= 0xc030 && address <= 0xc03f) {
821 warpwarp_out3_w(address - 0xc030, data);
822 return;
823 }
824 }
825
main_read(UINT16 address)826 static UINT8 __fastcall main_read(UINT16 address)
827 {
828 if ((address&0xf000) == 0x6000) address = (address&0xfff) + 0xc000; // bombee/cutieq map
829
830 if (address >= 0xc000 && address <= 0xc00f) {
831 return warpwarp_sw_r(address - 0xc000);
832 }
833 if (address >= 0xc010 && address <= 0xc01f) {
834 return warpwarp_vol_r(address - 0xc010);
835 }
836 if (address >= 0xc020 && address <= 0xc02f) {
837 return warpwarp_dsw1_r(address - 0xc020);
838 }
839
840 return 0;
841 }
842
geebee_write(UINT16 address,UINT8 data)843 static void __fastcall geebee_write(UINT16 address, UINT8 data)
844 {
845 if (address >= 0x6000 && address <= 0x6fff) {
846 geebee_out6_w(address - 0x6000, data);
847 return;
848 }
849 if (address >= 0x7000 && address <= 0x7fff) {
850 geebee_out7_w(address - 0x7000, data);
851 return;
852 }
853 }
854
geebee_read(UINT16 address)855 static UINT8 __fastcall geebee_read(UINT16 address)
856 {
857 if (address >= 0x5000 && address <= 0x53ff) {
858 return geebee_in_r(address - 0x5000);
859 }
860
861 return 0;
862 }
863
geebee_out(UINT16 address,UINT8 data)864 static void __fastcall geebee_out(UINT16 address, UINT8 data)
865 {
866 address &= 0xff;
867
868 if (address >= 0x60 && address <= 0x6f) {
869 geebee_out6_w(address, data);
870 return;
871 }
872
873 if (address >= 0x70 && address <= 0x7f) {
874 geebee_out7_w(address, data);
875 return;
876 }
877 }
878
geebee_in(UINT16 address)879 static UINT8 __fastcall geebee_in(UINT16 address)
880 {
881 address &= 0xff;
882
883 if (address >= 0x50 && address <= 0x53) {
884 return geebee_in_r(address);
885 }
886
887 return 0;
888 }
889
DrvDoReset()890 static INT32 DrvDoReset()
891 {
892 memset (AllRam, 0, RamEnd - AllRam);
893
894 ZetOpen(0);
895 ZetReset();
896 ZetClose();
897
898 ball_on = 0;
899 ball_h = 0;
900 ball_v = 0;
901 Paddle = 0;
902
903 warpwarp_sound_reset();
904
905 HiscoreReset();
906
907 return 0;
908 }
909
MemIndex()910 static INT32 MemIndex()
911 {
912 UINT8 *Next; Next = AllMem;
913
914 DrvZ80ROM = Next; Next += 0x08000;
915
916 DrvPalette = (UINT32*)Next; Next += 0x0300 * sizeof(UINT32);
917 DrvCharGFX = Next; Next += 0x40000;
918 DrvGFX1ROM = Next; Next += 0x01000;
919
920 AllRam = Next;
921
922 DrvZ80RAM = Next; Next += 0x01000;
923 DrvVidRAM = Next; Next += 0x01000;
924
925 RamEnd = Next;
926 MemEnd = Next;
927
928 return 0;
929 }
930
931 static INT32 CharPlaneOffsets[1] = { 0 };
932 static INT32 CharXOffsets[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
933 static INT32 CharYOffsets[8] = { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 };
934
DrvInit()935 static INT32 DrvInit()
936 {
937 AllMem = NULL;
938 MemIndex();
939 INT32 nLen = MemEnd - (UINT8 *)0;
940 if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
941 memset(AllMem, 0, nLen);
942 MemIndex();
943
944 if (!strncmp(BurnDrvGetTextA(DRV_NAME), "geebee", 6)) {
945 bprintf(0, _T("geebee mode"));
946 if (!strncmp(BurnDrvGetTextA(DRV_NAME), "geebeea", 7) || !strncmp(BurnDrvGetTextA(DRV_NAME), "geebeeb", 7)) { // US version
947 if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1;
948 if (BurnLoadRom(DrvZ80ROM + 0x0400, 1, 1)) return 1;
949 if (BurnLoadRom(DrvZ80ROM + 0x0800, 2, 1)) return 1;
950 if (BurnLoadRom(DrvZ80ROM + 0x0c00, 3, 1)) return 1;
951 if (BurnLoadRom(DrvGFX1ROM , 4, 1)) return 1;
952 if (BurnLoadRom(DrvGFX1ROM + 0x0400, 4, 1)) return 1;
953 } else {
954 if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1;
955 if (BurnLoadRom(DrvGFX1ROM , 1, 1)) return 1;
956 if (BurnLoadRom(DrvGFX1ROM + 0x0400, 1, 1)) return 1;
957 }
958 GfxDecode(0x100, 1, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, DrvGFX1ROM, DrvCharGFX);
959 } else
960 if (bombbeemode) {
961 bprintf(0, _T("bombbee/cutieq mode\n"));
962 if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1;
963 if (BurnLoadRom(DrvGFX1ROM , 1, 1)) return 1;
964 GfxDecode(0x100, 1, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, DrvGFX1ROM, DrvCharGFX);
965
966 } else
967 if (navaronemode) {
968 if (!strcmp(BurnDrvGetTextA(DRV_NAME), "kaitei")) {
969 bprintf(0, _T("original kaitei mode.\n"));
970 if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1;
971 if (BurnLoadRom(DrvZ80ROM + 0x0800, 0, 1)) return 1; // re-load
972 if (BurnLoadRom(DrvZ80ROM + 0x1000, 1, 1)) return 1;
973 if (BurnLoadRom(DrvZ80ROM + 0x1400, 2, 1)) return 1;
974 if (BurnLoadRom(DrvZ80ROM + 0x1800, 3, 1)) return 1;
975 if (BurnLoadRom(DrvZ80ROM + 0x1c00, 4, 1)) return 1;
976 if (BurnLoadRom(DrvGFX1ROM , 5, 1)) return 1;
977 if (BurnLoadRom(DrvGFX1ROM+ 0x0400, 6, 1)) return 1;
978 } else {
979 bprintf(0, _T("original navalone/kaitein mode.\n"));
980 if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1;
981 if (BurnLoadRom(DrvZ80ROM + 0x0800, 1, 1)) return 1;
982 if (BurnLoadRom(DrvGFX1ROM , 2, 1)) return 1;
983 }
984 GfxDecode(0x100, 1, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, DrvGFX1ROM, DrvCharGFX);
985
986 } else { // Load ROMS parse GFX
987 bprintf(0, _T("load roms: warpwarp mode\n"));
988 if (BurnLoadRom(DrvZ80ROM + 0x0000, 0, 1)) return 1;
989 if (BurnLoadRom(DrvZ80ROM + 0x1000, 1, 1)) return 1;
990 if (BurnLoadRom(DrvZ80ROM + 0x2000, 2, 1)) return 1;
991 if (rockola)
992 if (BurnLoadRom(DrvZ80ROM + 0x3000, 3, 1)) return 1;
993
994 if (BurnLoadRom(DrvGFX1ROM , 3 + rockola, 1)) return 1;
995 GfxDecode(0x100, 1, 8, 8, CharPlaneOffsets, CharXOffsets, CharYOffsets, 0x40, DrvGFX1ROM, DrvCharGFX);
996 }
997
998 ZetInit(0);
999 ZetOpen(0);
1000 if (bombbeemode) {
1001 bprintf(0, _T("mapping: bombbee/cutieq mode\n"));
1002 ZetMapMemory(DrvZ80ROM, 0x0000, 0x1fff, MAP_RAM);
1003 ZetMapMemory(DrvZ80RAM, 0x2000, 0x23ff, MAP_RAM);
1004 ZetMapMemory(DrvVidRAM, 0x4000, 0x47ff, MAP_RAM);
1005 ZetMapMemory(DrvGFX1ROM, 0x4800, 0x4fff, MAP_RAM);
1006 ZetSetWriteHandler(main_write);
1007 ZetSetReadHandler(main_read);
1008 ball_color = 0x200;
1009 ball_size_x = 4;
1010 ball_size_y = 4;
1011 } else
1012 if (navaronemode) {
1013 bprintf(0, _T("mapping: navarone mode\n"));
1014 ZetMapMemory(DrvZ80ROM, 0x0000, 0x1fff, MAP_RAM);
1015 ZetMapMemory(DrvZ80RAM, 0x4000, 0x40ff, MAP_RAM);
1016 ZetMapMemory(DrvVidRAM, 0x2000, 0x23ff, MAP_RAM);
1017 ZetMapMemory(DrvVidRAM, 0x2400, 0x27ff, MAP_RAM);
1018 ZetMapMemory(DrvGFX1ROM, 0x3000, 0x37ff, MAP_RAM);
1019 ZetSetInHandler(geebee_in);
1020 ZetSetOutHandler(geebee_out);
1021 ZetSetWriteHandler(geebee_write);
1022 ZetSetReadHandler(geebee_read);
1023 ball_color = 7;
1024 } else { //warpwarp
1025 bprintf(0, _T("mapping: warpwarp mode\n"));
1026 ZetMapMemory(DrvZ80ROM, 0x0000, 0x3fff, MAP_RAM);
1027 ZetMapMemory(DrvZ80RAM, 0x8000, 0x83ff, MAP_RAM);
1028 ZetMapMemory(DrvVidRAM, 0x4000, 0x47ff, MAP_RAM);
1029 ZetMapMemory(DrvGFX1ROM, 0x4800, 0x4fff, MAP_RAM);
1030 ZetSetWriteHandler(main_write);
1031 ZetSetReadHandler(main_read);
1032 ball_color = 0x200;
1033 ball_size_x = 4;
1034 ball_size_y = 4;
1035 }
1036 ZetClose();
1037
1038 GenericTilesInit();
1039
1040 warpwarp_sound_init();
1041
1042 DrvDoReset();
1043
1044 return 0;
1045 }
1046
DrvExit()1047 static INT32 DrvExit()
1048 {
1049 GenericTilesExit();
1050
1051 ZetExit();
1052
1053 BurnFree(AllMem);
1054
1055 warpwarp_sound_deinit();
1056
1057 rockola = 0;
1058 navaronemode = 0;
1059 bombbeemode = 0;
1060 kaiteimode = 0;
1061 use_paddle = 0;
1062
1063 return 0;
1064 }
1065
plot_pixel(INT32 x,INT32 y,INT32 pen)1066 static void plot_pixel(INT32 x, INT32 y, INT32 pen)
1067 {
1068 if (x < 0 || x > nScreenWidth) return;
1069 if (y < 0 || y > nScreenHeight) return;
1070
1071 UINT16 *pPixel = pTransDraw + (y * nScreenWidth) + x;
1072 *pPixel = pen;
1073 }
1074
draw_bullet()1075 static void draw_bullet()
1076 {
1077 if (ball_on) {
1078 INT32 x = 264 - ball_h;
1079 INT32 y = 240 - ball_v;
1080
1081 for (INT32 i = ball_size_y; i > 0; i--)
1082 for (INT32 j = ball_size_x; j > 0; j--) {
1083 plot_pixel(x - j, y - i, ball_color);
1084 }
1085 }
1086 }
1087
draw_chars()1088 static void draw_chars()
1089 {
1090 INT32 mx, my, code, color, x, y, offs, row, col;
1091
1092 for (mx = 0; mx < 28; mx++) {
1093 for (my = 0; my < 34; my++) {
1094 row = mx + 2;
1095 col = my - 1;
1096
1097 if (col & 0x20)
1098 offs = row + ((col & 1) << 5);
1099 else
1100 offs = col + (row << 5);
1101
1102 code = DrvVidRAM[offs];
1103 if (navaronemode) {
1104 color = ((geebee_bgw & 1) << 1) | ((code & 0x80) >> 7);
1105 } else { //warpwarp
1106 color = DrvVidRAM[offs + 0x400];
1107 }
1108
1109 y = 8 * mx;
1110 x = 8 * my;
1111 Render8x8Tile_Clip(pTransDraw, code, x, y, color, 1, 0, DrvCharGFX);
1112 }
1113 }
1114 }
1115
1116
DrvDraw()1117 static INT32 DrvDraw()
1118 {
1119 if (DrvRecalc) {
1120 if (navaronemode) {
1121 navarone_palette_init();
1122 } else {
1123 warpwarp_palette_init();
1124 }
1125 DrvRecalc = 0;
1126 }
1127
1128 BurnTransferClear();
1129
1130 draw_chars();
1131 draw_bullet();
1132
1133 BurnTransferCopy(DrvPalette);
1134
1135 return 0;
1136 }
1137
1138
DrvFrame()1139 static INT32 DrvFrame()
1140 {
1141 if (DrvReset) {
1142 DrvDoReset();
1143 }
1144
1145 DrvMakeInputs();
1146
1147 INT32 nInterleave = 256;
1148 INT32 nCyclesTotal = 2048000 / 60;
1149
1150 ZetOpen(0);
1151 for (INT32 i = 0; i < nInterleave; i++) {
1152 ZetRun(nCyclesTotal / nInterleave);
1153
1154 if (i == nInterleave - 1 && ball_on)
1155 ZetSetIRQLine(0, CPU_IRQSTATUS_ACK);
1156
1157 if (navaronemode && i == 0 && bombbeemode == 0) // weird timing.
1158 ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
1159
1160 warpwarp_timer_tiktiktik(nCyclesTotal / nInterleave);
1161 }
1162 ZetClose();
1163
1164 if (pBurnSoundOut) {
1165 warpwarp_sound_update(pBurnSoundOut, nBurnSoundLen);
1166 }
1167
1168 if (pBurnDraw) {
1169 DrvDraw();
1170 }
1171
1172 return 0;
1173 }
1174
DrvScan(INT32 nAction,INT32 * pnMin)1175 static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
1176 {
1177 struct BurnArea ba;
1178
1179 if (pnMin) {
1180 *pnMin = 0x029735;
1181 }
1182
1183 if (nAction & ACB_VOLATILE) {
1184 memset(&ba, 0, sizeof(ba));
1185 ba.Data = AllRam;
1186 ba.nLen = RamEnd - AllRam;
1187 ba.szName = "All Ram";
1188 BurnAcb(&ba);
1189
1190 ZetScan(nAction);
1191
1192 warpwarp_sound_scan();
1193
1194 SCAN_VAR(ball_on);
1195 SCAN_VAR(ball_h);
1196 SCAN_VAR(ball_v);
1197 SCAN_VAR(geebee_bgw);
1198 SCAN_VAR(Paddle);
1199 }
1200
1201 return 0;
1202 }
1203
1204 // Warp & Warp
1205
1206 static struct BurnRomInfo warpwarpRomDesc[] = {
1207 { "ww1_prg1.s10", 0x1000, 0xf5262f38, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1208 { "ww1_prg2.s8", 0x1000, 0xde8355dd, 1 | BRF_PRG | BRF_ESS }, // 1
1209 { "ww1_prg3.s4", 0x1000, 0xbdd1dec5, 1 | BRF_PRG | BRF_ESS }, // 2
1210
1211 { "ww1_chg1.s12", 0x0800, 0x380994c8, 2 | BRF_GRA }, // 3 gfx1
1212 };
1213
1214 STD_ROM_PICK(warpwarp)
1215 STD_ROM_FN(warpwarp)
1216
1217 struct BurnDriver BurnDrvWarpwarp = {
1218 "warpwarp", NULL, NULL, NULL, "1981",
1219 "Warp & Warp\0", NULL, "Namco", "Miscellaneous",
1220 NULL, NULL, NULL, NULL,
1221 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM | GBF_ACTION, 0,
1222 NULL, warpwarpRomInfo, warpwarpRomName, NULL, NULL, NULL, NULL, WarpwarpInputInfo, WarpwarpDIPInfo,
1223 DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1224 224, 272, 3, 4
1225 };
1226
warpwarprDrvInit()1227 INT32 warpwarprDrvInit()
1228 {
1229 rockola = 1;
1230
1231 return DrvInit();
1232 }
1233
1234 // Warp Warp (Rock-Ola set 1)
1235
1236 static struct BurnRomInfo warpwarprRomDesc[] = {
1237 { "g-09601.2r", 0x1000, 0x916ffa35, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1238 { "g-09602.2m", 0x1000, 0x398bb87b, 1 | BRF_PRG | BRF_ESS }, // 1
1239 { "g-09603.1p", 0x1000, 0x6b962fc4, 1 | BRF_PRG | BRF_ESS }, // 2
1240 { "g-09613.1t", 0x0800, 0x60a67e76, 1 | BRF_PRG | BRF_ESS }, // 3
1241
1242 { "g-9611.4c", 0x0800, 0x00e6a326, 2 | BRF_GRA }, // 4 gfx1
1243 };
1244
1245 STD_ROM_PICK(warpwarpr)
1246 STD_ROM_FN(warpwarpr)
1247
1248 struct BurnDriver BurnDrvWarpwarpr = {
1249 "warpwarpr", "warpwarp", NULL, NULL, "1981",
1250 "Warp Warp (Rock-Ola set 1)\0", NULL, "Namco (Rock-Ola license)", "Miscellaneous",
1251 NULL, NULL, NULL, NULL,
1252 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM | GBF_ACTION, 0,
1253 NULL, warpwarprRomInfo, warpwarprRomName, NULL, NULL, NULL, NULL, WarpwarpInputInfo, WarpwarprDIPInfo,
1254 warpwarprDrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1255 224, 272, 3, 4
1256 };
1257
1258
1259 // Warp Warp (Rock-Ola set 2)
1260
1261 static struct BurnRomInfo warpwarpr2RomDesc[] = {
1262 { "g-09601.2r", 0x1000, 0x916ffa35, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1263 { "g-09602.2m", 0x1000, 0x398bb87b, 1 | BRF_PRG | BRF_ESS }, // 1
1264 { "g-09603.1p", 0x1000, 0x6b962fc4, 1 | BRF_PRG | BRF_ESS }, // 2
1265 { "g-09612.1t", 0x0800, 0xb91e9e79, 1 | BRF_PRG | BRF_ESS }, // 3
1266
1267 { "g-9611.4c", 0x0800, 0x00e6a326, 2 | BRF_GRA }, // 4 gfx1
1268 };
1269
1270 STD_ROM_PICK(warpwarpr2)
1271 STD_ROM_FN(warpwarpr2)
1272
1273 struct BurnDriver BurnDrvWarpwarpr2 = {
1274 "warpwarpr2", "warpwarp", NULL, NULL, "1981",
1275 "Warp Warp (Rock-Ola set 2)\0", NULL, "Namco (Rock-Ola license)", "Miscellaneous",
1276 NULL, NULL, NULL, NULL,
1277 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM | GBF_ACTION, 0,
1278 NULL, warpwarpr2RomInfo, warpwarpr2RomName, NULL, NULL, NULL, NULL, WarpwarpInputInfo, WarpwarprDIPInfo,
1279 warpwarprDrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1280 224, 272, 3, 4
1281 };
1282
GeebeeInit()1283 INT32 GeebeeInit()
1284 {
1285 navaronemode = 1;
1286 ball_size_x = 4;
1287 ball_size_y = 4;
1288 use_paddle = 1;
1289
1290 return DrvInit();
1291 }
1292
1293 // Gee Bee (Japan)
1294
1295 static struct BurnRomInfo geebeeRomDesc[] = {
1296 { "geebee.1k", 0x1000, 0x8a5577e0, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1297
1298 { "geebee.3a", 0x0400, 0xf257b21b, 1 | BRF_GRA }, // 1 gfx1
1299 };
1300
1301 STD_ROM_PICK(geebee)
1302 STD_ROM_FN(geebee)
1303
1304 struct BurnDriver BurnDrvGeebee = {
1305 "geebee", NULL, NULL, NULL, "1978",
1306 "Gee Bee (Japan)\0", NULL, "Namco", "Miscellaneous",
1307 NULL, NULL, NULL, NULL,
1308 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0,
1309 NULL, geebeeRomInfo, geebeeRomName, NULL, NULL, NULL, NULL, GeebeeInputInfo, GeebeeDIPInfo,
1310 GeebeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1311 224, 272, 3, 4
1312 };
1313
1314 // Gee Bee (US)
1315
1316 static struct BurnRomInfo geebeegRomDesc[] = {
1317 { "geebee.1k", 0x1000, 0x8a5577e0, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1318
1319 { "geebeeg.3a", 0x0400, 0xa45932ba, 1 | BRF_GRA }, // 1 gfx1
1320 };
1321
1322 STD_ROM_PICK(geebeeg)
1323 STD_ROM_FN(geebeeg)
1324
1325 struct BurnDriver BurnDrvGeebeeg = {
1326 "geebeeg", "geebee", NULL, NULL, "1978",
1327 "Gee Bee (US)\0", NULL, "Namco (Gremlin license)", "Miscellaneous",
1328 NULL, NULL, NULL, NULL,
1329 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0,
1330 NULL, geebeegRomInfo, geebeegRomName, NULL, NULL, NULL, NULL, GeebeeInputInfo, GeebeeDIPInfo,
1331 GeebeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1332 224, 272, 3, 4
1333 };
1334
1335 // Gee Bee (UK)
1336
1337 static struct BurnRomInfo geebeeaRomDesc[] = {
1338 { "132", 0x0400, 0x23252fc7, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1339 { "133", 0x0400, 0x0bc4d4ca, 1 | BRF_PRG | BRF_ESS }, // 1
1340 { "134", 0x0400, 0x7899b4c1, 1 | BRF_PRG | BRF_ESS }, // 2
1341 { "135", 0x0400, 0x0b6e6fcb, 1 | BRF_PRG | BRF_ESS }, // 3
1342
1343 { "a_136", 0x0400, 0xbd01437d, 2 | BRF_GRA }, // 4 gfx1
1344 };
1345
1346 STD_ROM_PICK(geebeea)
1347 STD_ROM_FN(geebeea)
1348
1349 struct BurnDriver BurnDrvGeebeea = {
1350 "geebeea", "geebee", NULL, NULL, "1978",
1351 "Gee Bee (UK)\0", NULL, "Namco (Alca license)", "Miscellaneous",
1352 NULL, NULL, NULL, NULL,
1353 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0,
1354 NULL, geebeeaRomInfo, geebeeaRomName, NULL, NULL, NULL, NULL, GeebeeInputInfo, GeebeeDIPInfo,
1355 GeebeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1356 224, 272, 3, 4
1357 };
1358
1359 // Gee Bee (Europe)
1360
1361 static struct BurnRomInfo geebeebRomDesc[] = {
1362 { "1.1m", 0x0400, 0x23252fc7, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1363 { "2.1p", 0x0400, 0x0bc4d4ca, 1 | BRF_PRG | BRF_ESS }, // 1
1364 { "3.1s", 0x0400, 0x7899b4c1, 1 | BRF_PRG | BRF_ESS }, // 2
1365 { "4.1t", 0x0400, 0x0b6e6fcb, 1 | BRF_PRG | BRF_ESS }, // 3
1366
1367 { "geebee.3a", 0x0400, 0xf257b21b, 2 | BRF_GRA }, // 4 gfx1
1368 };
1369
1370 STD_ROM_PICK(geebeeb)
1371 STD_ROM_FN(geebeeb)
1372
1373 struct BurnDriver BurnDrvGeebeeb = {
1374 "geebeeb", "geebee", NULL, NULL, "1978",
1375 "Gee Bee (Europe)\0", NULL, "Namco (F.lli Bertolino license)", "Miscellaneous",
1376 NULL, NULL, NULL, NULL,
1377 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0,
1378 NULL, geebeebRomInfo, geebeebRomName, NULL, NULL, NULL, NULL, GeebeeInputInfo, GeebeeDIPInfo,
1379 GeebeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1380 224, 272, 3, 4
1381 };
1382
NavaroneInit()1383 INT32 NavaroneInit()
1384 {
1385 navaronemode = 1;
1386 ball_size_x = 4;
1387 ball_size_y = 4;
1388
1389 return DrvInit();
1390 }
1391
1392 // Navarone
1393
1394 static struct BurnRomInfo navaroneRomDesc[] = {
1395 { "navalone.p1", 0x0800, 0x5a32016b, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1396 { "navalone.p2", 0x0800, 0xb1c86fe3, 1 | BRF_PRG | BRF_ESS }, // 1
1397
1398 { "navalone.chr", 0x0800, 0xb26c6170, 2 | BRF_GRA }, // 2 gfx1
1399 };
1400
1401 STD_ROM_PICK(navarone)
1402 STD_ROM_FN(navarone)
1403
1404 struct BurnDriver BurnDrvNavarone = {
1405 "navarone", NULL, NULL, NULL, "1980",
1406 "Navarone\0", NULL, "Namco", "Miscellaneous",
1407 NULL, NULL, NULL, NULL,
1408 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_SHOOT, 0,
1409 NULL, navaroneRomInfo, navaroneRomName, NULL, NULL, NULL, NULL, NavaroneInputInfo, NavaroneDIPInfo,
1410 NavaroneInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1411 224, 272, 3, 4
1412 };
1413
KaiteinInit()1414 INT32 KaiteinInit()
1415 {
1416 navaronemode = 1;
1417 ball_size_x = 1;
1418 ball_size_y = 16;
1419
1420 return DrvInit();
1421 }
1422
1423 // Kaitei Takara Sagashi (Namco license)
1424
1425 static struct BurnRomInfo kaiteinRomDesc[] = {
1426 { "kaitein.p1", 0x0800, 0xd88e10ae, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1427 { "kaitein.p2", 0x0800, 0xaa9b5763, 1 | BRF_PRG | BRF_ESS }, // 1
1428
1429 { "kaitein.chr", 0x0800, 0x3125af4d, 2 | BRF_GRA }, // 2 gfx1
1430 };
1431
1432 STD_ROM_PICK(kaitein)
1433 STD_ROM_FN(kaitein)
1434
1435 struct BurnDriver BurnDrvKaitein = {
1436 "kaitein", "kaitei", NULL, NULL, "1980",
1437 "Kaitei Takara Sagashi (Namco license)\0", NULL, "K.K. Tokki (Namco license)", "Miscellaneous",
1438 NULL, NULL, NULL, NULL,
1439 BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1440 NULL, kaiteinRomInfo, kaiteinRomName, NULL, NULL, NULL, NULL, KaiteinInputInfo, KaiteinDIPInfo,
1441 KaiteinInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1442 224, 272, 3, 4
1443 };
1444
KaiteiInit()1445 INT32 KaiteiInit()
1446 {
1447 kaiteimode = 1;
1448
1449 return KaiteinInit();
1450 }
1451
1452 // Kaitei Takara Sagashi
1453
1454 static struct BurnRomInfo kaiteiRomDesc[] = {
1455 { "kaitei_7.1k", 0x0800, 0x32f70d48, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1456 { "kaitei_1.1m", 0x0400, 0x9a7ab3b9, 1 | BRF_PRG | BRF_ESS }, // 1
1457 { "kaitei_2.1p", 0x0400, 0x5eeb0fff, 1 | BRF_PRG | BRF_ESS }, // 2
1458 { "kaitei_3.1s", 0x0400, 0x5dff4df7, 1 | BRF_PRG | BRF_ESS }, // 3
1459 { "kaitei_4.1t", 0x0400, 0xe5f303d6, 1 | BRF_PRG | BRF_ESS }, // 4
1460
1461 { "kaitei_5.bin", 0x0400, 0x60fdb795, 2 | BRF_GRA }, // 5 gfx1
1462 { "kaitei_6.bin", 0x0400, 0x21399ace, 2 | BRF_GRA }, // 6
1463 };
1464
1465 STD_ROM_PICK(kaitei)
1466 STD_ROM_FN(kaitei)
1467
1468 struct BurnDriver BurnDrvKaitei = {
1469 "kaitei", NULL, NULL, NULL, "1980",
1470 "Kaitei Takara Sagashi\0", NULL, "K.K. Tokki", "Miscellaneous",
1471 NULL, NULL, NULL, NULL,
1472 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_PLATFORM, 0,
1473 NULL, kaiteiRomInfo, kaiteiRomName, NULL, NULL, NULL, NULL, KaiteiInputInfo, KaiteiDIPInfo,
1474 KaiteiInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1475 224, 272, 3, 4
1476 };
1477
SOSInit()1478 INT32 SOSInit()
1479 {
1480 navaronemode = 1;
1481
1482 ball_size_x = 4;
1483 ball_size_y = 2;
1484
1485 return DrvInit();
1486 }
1487
1488
1489 // SOS
1490
1491 static struct BurnRomInfo sosRomDesc[] = {
1492 { "sos.p1", 0x0800, 0xf70bdafb, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1493 { "sos.p2", 0x0800, 0x58e9c480, 1 | BRF_PRG | BRF_ESS }, // 1
1494
1495 { "sos.chr",0x0800, 0x66f983e4, 2 | BRF_GRA }, // 2 gfx1
1496 };
1497
1498 STD_ROM_PICK(sos)
1499 STD_ROM_FN(sos)
1500
1501 struct BurnDriver BurnDrvSos = {
1502 "sos", NULL, NULL, NULL, "1980",
1503 "SOS\0", NULL, "Namco", "Miscellaneous",
1504 NULL, NULL, NULL, NULL,
1505 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_VERSHOOT, 0,
1506 NULL, sosRomInfo, sosRomName, NULL, NULL, NULL, NULL, SosInputInfo, SosDIPInfo,
1507 SOSInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1508 224, 272, 3, 4
1509 };
1510
BombbeeInit()1511 INT32 BombbeeInit()
1512 {
1513 navaronemode = 0;
1514 bombbeemode = 1;
1515 ball_size_x = 4;
1516 ball_size_y = 4;
1517 use_paddle = 1;
1518
1519 return DrvInit();
1520 }
1521
1522 // Bomb Bee
1523
1524 static struct BurnRomInfo bombbeeRomDesc[] = {
1525 { "bombbee.1k", 0x2000, 0x9f8cd7af, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1526
1527 { "bombbee.4c", 0x0800, 0x5f37d569, 1 | BRF_GRA }, // 1 gfx1
1528 };
1529
1530 STD_ROM_PICK(bombbee)
1531 STD_ROM_FN(bombbee)
1532
1533 struct BurnDriver BurnDrvBombbee = {
1534 "bombbee", NULL, NULL, NULL, "1979",
1535 "Bomb Bee\0", NULL, "Namco", "Miscellaneous",
1536 NULL, NULL, NULL, NULL,
1537 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0,
1538 NULL, bombbeeRomInfo, bombbeeRomName, NULL, NULL, NULL, NULL, BombbeeInputInfo, BombbeeDIPInfo,
1539 BombbeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1540 224, 272, 3, 4
1541 };
1542
1543
1544 // Cutie Q
1545
1546 static struct BurnRomInfo cutieqRomDesc[] = {
1547 { "cutieq.1k", 0x2000, 0x6486cdca, 1 | BRF_PRG | BRF_ESS }, // 0 maincpu
1548
1549 { "cutieq.4c", 0x0800, 0x0e1618c9, 1 | BRF_GRA }, // 1 gfx1
1550 };
1551
1552 STD_ROM_PICK(cutieq)
1553 STD_ROM_FN(cutieq)
1554
1555 struct BurnDriver BurnDrvCutieq = {
1556 "cutieq", NULL, NULL, NULL, "1979",
1557 "Cutie Q\0", NULL, "Namco", "Miscellaneous",
1558 NULL, NULL, NULL, NULL,
1559 BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_BREAKOUT, 0,
1560 NULL, cutieqRomInfo, cutieqRomName, NULL, NULL, NULL, NULL, BombbeeInputInfo, BombbeeDIPInfo,
1561 BombbeeInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x300,
1562 224, 272, 3, 4
1563 };
1564