1 /***************************************************************************
2 
3 						-= Sky Fox / Exerizer =-
4 
5 				driver by	Luca Elia (l.elia@tin.it)
6 
7 
8 CPU  :	Z80A x 2
9 Sound:	YM2203C x 2
10 Other:	2 HM6116LP-3 (one on each board)
11 		1 KM6264L-15 (on bottom board)
12 
13 To Do:	The background rendering is entirely guesswork
14 
15 ***************************************************************************/
16 #include "driver.h"
17 #include "vidhrdw/generic.h"
18 
19 /* Variables defined in vidhrdw: */
20 
21 extern int skyfox_bg_pos, skyfox_bg_ctrl;
22 
23 
24 /* Functions defined in vidhrdw: */
25 
26 READ_HANDLER( skyfox_vregs_r );
27 WRITE_HANDLER( skyfox_vregs_w );
28 
29 PALETTE_INIT( skyfox );
30 
31 VIDEO_UPDATE( skyfox );
32 
33 
34 /***************************************************************************
35 
36 
37 								Main CPU
38 
39 
40 ***************************************************************************/
41 
42 
43 /***************************************************************************
44 								Sky Fox
45 ***************************************************************************/
46 
MEMORY_READ_START(skyfox_readmem)47 static MEMORY_READ_START( skyfox_readmem )
48 	{ 0x0000, 0xbfff, MRA_ROM				},	/* ROM*/
49 	{ 0xc000, 0xdfff, MRA_RAM				},	/* RAM*/
50 	{ 0xe000, 0xe000, input_port_0_r		},	/* Input Ports*/
51 	{ 0xe001, 0xe001, input_port_1_r		},	/**/
52 	{ 0xe002, 0xe002, input_port_2_r		},	/**/
53 	{ 0xf001, 0xf001, input_port_3_r		},	/**/
54 /*	{ 0xff00, 0xff07, skyfox_vregs_r		},	*/ /* fake to read the vregs*/
55 MEMORY_END
56 
57 static MEMORY_WRITE_START( skyfox_writemem )
58 	{ 0x0000, 0xbfff, MWA_ROM								},	/* ROM*/
59 	{ 0xc000, 0xcfff, MWA_RAM								},	/* RAM*/
60 	{ 0xd000, 0xd3ff, MWA_RAM, &spriteram, &spriteram_size	},	/* Sprites*/
61 	{ 0xd400, 0xdfff, MWA_RAM								},	/* RAM?*/
62 	{ 0xe008, 0xe00f, skyfox_vregs_w						},	/* Video Regs*/
63 MEMORY_END
64 
65 
66 
67 
68 
69 
70 /***************************************************************************
71 
72 
73 								Sound CPU
74 
75 
76 ***************************************************************************/
77 
78 
79 /***************************************************************************
80 								Sky Fox
81 ***************************************************************************/
82 
83 
84 static MEMORY_READ_START( skyfox_sound_readmem )
85 	{ 0x0000, 0x7fff, MRA_ROM				},	/* ROM*/
86 	{ 0x8000, 0x87ff, MRA_RAM				},	/* RAM*/
87 	{ 0xa001, 0xa001, YM2203_read_port_0_r 	},	/* YM2203 #1*/
88 /*	{ 0xc001, 0xc001, YM2203_read_port_1_r 	},	*/ /* YM2203 #2*/
89 	{ 0xb000, 0xb000, soundlatch_r			},	/* From Main CPU*/
90 MEMORY_END
91 
92 static MEMORY_WRITE_START( skyfox_sound_writemem )
93 	{ 0x0000, 0x7fff, MWA_ROM					},	/* ROM*/
94 	{ 0x8000, 0x87ff, MWA_RAM					},	/* RAM*/
95 /*	{ 0x9000, 0x9001, MWA_NOP					},	*/ /* ??*/
96 	{ 0xa000, 0xa000, YM2203_control_port_0_w 	},	/* YM2203 #1*/
97 	{ 0xa001, 0xa001, YM2203_write_port_0_w 	},	/**/
98 /*	{ 0xb000, 0xb001, MWA_NOP					},	*/ /* ??*/
99 	{ 0xc000, 0xc000, YM2203_control_port_1_w 	},	/* YM2203 #2*/
100 	{ 0xc001, 0xc001, YM2203_write_port_1_w 	},	/**/
101 MEMORY_END
102 
103 
104 
105 
106 /***************************************************************************
107 
108 
109 								Input Ports
110 
111 
112 ***************************************************************************/
113 
114 INPUT_PORTS_START( skyfox )
115 
116 	PORT_START	/* IN0 - Player 1*/
117 	PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    )
118 	PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  )
119 	PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
120 	PORT_BIT(  0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  )
121 	PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_BUTTON2        )
122 	PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_BUTTON1        )
123 	PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_START1         )
124 	PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_START2         )
125 
126 
127 	PORT_START	/* IN1 - DSW*/
128 	PORT_DIPNAME( 0x01, 0x01, "Unknown 1-0" )		/* rest unused?*/
129 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
130 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
131 	PORT_DIPNAME( 0x02, 0x02, "Unknown 1-1" )
132 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
133 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
134 	PORT_DIPNAME( 0x04, 0x04, "Unknown 1-2" )
135 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
136 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
137 	PORT_DIPNAME( 0x18, 0x08, DEF_STR( Bonus_Life ) )
138 	PORT_DIPSETTING(    0x00, "20K" )
139 	PORT_DIPSETTING(    0x08, "30K" )
140 	PORT_DIPSETTING(    0x10, "40K" )
141 	PORT_DIPSETTING(    0x18, "50K" )
142 	PORT_DIPNAME( 0x20, 0x00, DEF_STR( Difficulty ) )
143 	PORT_DIPSETTING(    0x20, "Medium" )
144 	PORT_DIPSETTING(    0x00, "Hard" )
145 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
146 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
147 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
148 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
149 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
150 	PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
151 
152 
153 	PORT_START	/* IN2 - Coins + DSW + Vblank*/
154 	PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_VBLANK  )
155 	PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_COIN1   )
156 	PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) )
157 	PORT_DIPSETTING(    0x00, "1 Coin/1 Credit  2C/1C" )	/* coin A & B*/
158 	PORT_DIPSETTING(    0x04, "1 Coin/2 Credits 3C/1C" )
159 	PORT_DIPSETTING(    0x08, "1 Coin/3 Credits 4C/1C" )
160 	PORT_DIPSETTING(    0x0c, "1 Coin/4 Credits 5C/1C" )
161 	PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
162 	PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
163 	PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
164 	PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
165 
166 
167 	PORT_START	/* IN3 - DSW*/
168 	PORT_DIPNAME( 0x07, 0x02, DEF_STR( Lives ) )
169 	PORT_DIPSETTING(    0x00, "1" )
170 	PORT_DIPSETTING(    0x01, "2" )
171 	PORT_DIPSETTING(    0x02, "3" )
172 	PORT_DIPSETTING(    0x03, "4" )
173 	PORT_DIPSETTING(    0x04, "5" )
174 /*	PORT_DIPSETTING(    0x05, "5" )*/
175 /*	PORT_DIPSETTING(    0x06, "5" )*/
176 	PORT_BITX( 0x07, 0x07, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
177 	PORT_BIT(  0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
178 	PORT_BIT(  0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
179 	PORT_BIT(  0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
180 	PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
181 	PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
182 
183 	PORT_START	/* IN4 - Fake input port, polled every VBLANK to generate an NMI upon coin insertion*/
184 	PORT_BIT_IMPULSE(  0x01, IP_ACTIVE_LOW, IPT_COIN1, 1 )
185 	PORT_BIT_IMPULSE(  0x02, IP_ACTIVE_LOW, IPT_COIN2, 1 )
186 
187 
188 INPUT_PORTS_END
189 
190 
191 
192 
193 /***************************************************************************
194 
195 
196 								Graphics Layouts
197 
198 
199 ***************************************************************************/
200 
201 /* 8x8x8 tiles (note that the tiles in the ROMs are 32x32x8, but
202    we cut them in 8x8x8 ones in the init function, in order to
203    support 8x8, 16x16 and 32x32 sprites. */
204 
205 static struct GfxLayout layout_8x8x8 =
206 {
207 	8,8,
208 	RGN_FRAC(1,1),
209 	8,
210 	{0,1,2,3,4,5,6,7},
211 	{0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8},
212 	{0*64,1*64,2*64,3*64,4*64,5*64,6*64,7*64},
213 	8*8*8
214 };
215 
216 /***************************************************************************
217 								Sky Fox
218 ***************************************************************************/
219 
220 static struct GfxDecodeInfo skyfox_gfxdecodeinfo[] =
221 {
222 	{ REGION_GFX1, 0, &layout_8x8x8,   0, 1 }, /* [0] Sprites*/
223 	{ -1 }
224 };
225 
226 
227 
228 
229 
230 
231 /***************************************************************************
232 
233 
234 								Machine Drivers
235 
236 
237 ***************************************************************************/
238 
239 
240 /***************************************************************************
241 								Sky Fox
242 ***************************************************************************/
243 
244 /* Check for coin insertion once a frame (polling a fake input port).
245    Generate an NMI in case. Scroll the background too. */
246 
INTERRUPT_GEN(skyfox_interrupt)247 static INTERRUPT_GEN( skyfox_interrupt )
248 {
249 	/* Scroll the bg */
250 	skyfox_bg_pos += (skyfox_bg_ctrl >> 1) & 0x7;	/* maybe..*/
251 
252 	/* Check coin 1 & 2 */
253 	if ((readinputport(4) & 3) != 3) cpu_set_irq_line(0, IRQ_LINE_NMI, PULSE_LINE);
254 }
255 
256 static struct YM2203interface skyfox_ym2203_interface =
257 {
258 	2,
259 	1748000,		/* ? same as sound cpu ? */
260 	{ YM2203_VOL(80,80), YM2203_VOL(80,80) },
261 	{ 0, 0 },
262 	{ 0, 0 },
263 	{ 0, 0 },
264 	{ 0, 0 },
265 	{ 0, 0 }
266 };
267 
268 static MACHINE_DRIVER_START( skyfox )
269 
270 	/* basic machine hardware */
271 	MDRV_CPU_ADD(Z80, 4000000)
MDRV_CPU_MEMORY(skyfox_readmem,skyfox_writemem)272 	MDRV_CPU_MEMORY(skyfox_readmem,skyfox_writemem)
273 	MDRV_CPU_VBLANK_INT(skyfox_interrupt,1)		/* NMI caused by coin insertion */
274 
275 	MDRV_CPU_ADD(Z80, 1748000)
276 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)
277 	MDRV_CPU_MEMORY(skyfox_sound_readmem,skyfox_sound_writemem)
278 
279 	MDRV_FRAMES_PER_SECOND(60)
280 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)	/* we're using IPT_VBLANK*/
281 
282 	/* video hardware */
283 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
284 	MDRV_SCREEN_SIZE(512, 256)
285 	MDRV_VISIBLE_AREA(0+0x60, 320-1+0x60, 0+16, 256-1-16)	/* from $30*2 to $CC*2+8*/
286 	MDRV_GFXDECODE(skyfox_gfxdecodeinfo)
287 	MDRV_PALETTE_LENGTH(256+256)	/* 256 static colors (+256 for the background??) */
288 
289 	MDRV_PALETTE_INIT(skyfox)
290 	MDRV_VIDEO_UPDATE(skyfox)
291 
292 	/* sound hardware */
293 	MDRV_SOUND_ADD(YM2203, skyfox_ym2203_interface)
294 MACHINE_DRIVER_END
295 
296 
297 
298 
299 
300 
301 /***************************************************************************
302 
303 
304 								ROMs Loading
305 
306 
307 ***************************************************************************/
308 
309 
310 
311 /***************************************************************************
312 
313 									Sky Fox
314 
315 
316 c042	:	Lives
317 c044-5	:	Score (BCD)
318 c048-9	:	Power (BCD)
319 
320 ***************************************************************************/
321 
322 /***************************************************************************
323 
324 								Exerizer [Bootleg]
325 
326 malcor
327 
328 Location     Type     File ID    Checksum
329 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330 TB 5E       27C256      1-J        F302      [  background  ]
331 TB 5N       27C256      1-I        F5E3      [    sound     ]
332 LB          27C256      1-A        A53E      [  program 1   ]
333 LB          27C256      1-B        382C      [  program 2   ]
334 LB          27C512      1-C        CDAC      [     GFX      ]
335 LB          27C512      1-D        9C7A      [     GFX      ]
336 LB          27C512      1-E        D808      [     GFX      ]
337 LB          27C512      1-F        F87E      [     GFX      ]
338 LB          27C512      1-G        9709      [     GFX      ]
339 LB          27C512      1-H        DFDA      [     GFX      ]
340 TB          82S129      1.BPR      0972      [ video blue   ]
341 TB          82S129      2.BPR      0972      [ video red    ]
342 TB          82S129      3.BPR      0972      [ video green  ]
343 
344 Lower board ROM locations:
345 
346 ---=======------=======----
347 |    CN2          CN1     |
348 |                     1-A |
349 |                         |
350 |                     1-B |
351 |                         |
352 |                         |
353 |              1 1 1 1 1 1|
354 |              H G F E D C|
355 ---------------------------
356 
357 Notes  -  This archive is of a bootleg copy,
358        -  Japanese program revision
359        -  Although the colour PROMs have the same checksums,
360           they are not the same.
361 
362 Main processor  - Z80  4MHz
363 Sound processor - Z80  1.748MHz
364                 - YM2203C x2
365 
366 ***************************************************************************/
367 
368 
369 ROM_START( skyfox )
370 	ROM_REGION( 0x10000, REGION_CPU1, 0 )		/* Main Z80 Code */
371 	ROM_LOAD( "skyfox1.bin", 0x00000, 0x8000, CRC(b4d4bb6f) SHA1(ed1cf6d91ca7170cb7d1c80b586c11164430fd49) )
372 	ROM_LOAD( "skyfox2.bin", 0x08000, 0x8000, CRC(e15e0263) SHA1(005934327834aed46b17161aef82117ee508e9c4) )	/* identical halves*/
373 
374 	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Sound Z80 Code */
375 	ROM_LOAD( "skyfox9.bin", 0x00000, 0x8000, CRC(0b283bf5) SHA1(5b14d0beea689ee7e9174017e5a127435df4fbe3) )
376 
377 	ROM_REGION( 0x60000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites */
378 	ROM_LOAD( "skyfox3.bin", 0x00000, 0x10000, CRC(3a17a929) SHA1(973fb36af416161e04a83d7869819d9b13df18cd) )
379 	ROM_LOAD( "skyfox4.bin", 0x10000, 0x10000, CRC(358053bb) SHA1(589e3270eda0d44e73fbc7ac06e782f332920b39) )
380 	ROM_LOAD( "skyfox5.bin", 0x20000, 0x10000, CRC(c1215a6e) SHA1(5ca30be8a68ac6a00907cc9e47ede0acec980f46) )
381 	ROM_LOAD( "skyfox6.bin", 0x30000, 0x10000, CRC(cc37e15d) SHA1(80806df6185f7b8c2d3ab98420ca514df3e63c8d) )
382 	ROM_LOAD( "skyfox7.bin", 0x40000, 0x10000, CRC(fa2ab5b4) SHA1(c0878b25dae28f7d49e14376ff885d1d4e3d5dfe) )
383 	ROM_LOAD( "skyfox8.bin", 0x50000, 0x10000, CRC(0e3edc49) SHA1(3d1c59ecaabe1c9517203b7e814db41d5cff0cd4) )
384 
385 	ROM_REGION( 0x08000, REGION_GFX2, 0 )	/* Background - do not dispose */
386 	ROM_LOAD( "skyfox10.bin", 0x0000, 0x8000, CRC(19f58f9c) SHA1(6887216243b47152129448cbb4c7d52309feed03) )
387 
388 	ROM_REGION( 0x300, REGION_PROMS, 0 )	/* Color Proms */
389 	ROM_LOAD( "sfoxrprm.bin", 0x000, 0x100, CRC(79913c7f) SHA1(e64e6a3eb55f37984cb2597c8ffba6bc3bad49c7) )	/* R*/
390 	ROM_LOAD( "sfoxgprm.bin", 0x100, 0x100, CRC(fb73d434) SHA1(4a9bd61fbdce9441753c5921f95ead5c4655957e) )	/* G*/
391 	ROM_LOAD( "sfoxbprm.bin", 0x200, 0x100, CRC(60d2ab41) SHA1(e58a54f2aaee5c07136d5437e513d61fb18fbd9f) )	/* B*/
392 ROM_END
393 
394 ROM_START( exerizrb )
395 	ROM_REGION( 0x10000, REGION_CPU1, 0 )		/* Main Z80 Code */
396 	ROM_LOAD( "1-a",         0x00000, 0x8000, CRC(5df72a5d) SHA1(ca35ac06f3702fd650a584da2f442fbc61c00fce) )
397 	ROM_LOAD( "skyfox2.bin", 0x08000, 0x8000, CRC(e15e0263) SHA1(005934327834aed46b17161aef82117ee508e9c4) )	/* 1-b*/
398 
399 	ROM_REGION( 0x10000, REGION_CPU2, 0 )		/* Sound Z80 Code */
400 	ROM_LOAD( "skyfox9.bin", 0x00000, 0x8000, CRC(0b283bf5) SHA1(5b14d0beea689ee7e9174017e5a127435df4fbe3) )	/* 1-i*/
401 
402 	ROM_REGION( 0x60000, REGION_GFX1, ROMREGION_DISPOSE )	/* Sprites */
403 	ROM_LOAD( "1-c",         0x00000, 0x10000, CRC(450e9381) SHA1(f99b2ca73f1e4ba91b8066bb6d28d33b66a3ee81) )
404 	ROM_LOAD( "skyfox4.bin", 0x10000, 0x10000, CRC(358053bb) SHA1(589e3270eda0d44e73fbc7ac06e782f332920b39) )	/* 1-d*/
405 	ROM_LOAD( "1-e",         0x20000, 0x10000, CRC(50a38c60) SHA1(a4b8d530914d6c85b15940a7821b4365068de668) )
406 	ROM_LOAD( "skyfox6.bin", 0x30000, 0x10000, CRC(cc37e15d) SHA1(80806df6185f7b8c2d3ab98420ca514df3e63c8d) )	/* 1-f*/
407 	ROM_LOAD( "1-g",         0x40000, 0x10000, CRC(c9bbfe5c) SHA1(ce3f7d32baa8bb0bfc110877b5b5f4648ee959ac) )
408 	ROM_LOAD( "skyfox8.bin", 0x50000, 0x10000, CRC(0e3edc49) SHA1(3d1c59ecaabe1c9517203b7e814db41d5cff0cd4) )	/* 1-h*/
409 
410 	ROM_REGION( 0x08000, REGION_GFX2, 0 )	/* Background - do not dispose */
411 	ROM_LOAD( "skyfox10.bin", 0x0000, 0x8000, CRC(19f58f9c) SHA1(6887216243b47152129448cbb4c7d52309feed03) )	/* 1-j*/
412 
413 	ROM_REGION( 0x300, REGION_PROMS, 0 )	/* Color Proms */
414 	ROM_LOAD( "sfoxrprm.bin", 0x000, 0x100, CRC(79913c7f) SHA1(e64e6a3eb55f37984cb2597c8ffba6bc3bad49c7) )	/* 2-bpr*/
415 	ROM_LOAD( "sfoxgprm.bin", 0x100, 0x100, CRC(fb73d434) SHA1(4a9bd61fbdce9441753c5921f95ead5c4655957e) )	/* 3-bpr*/
416 	ROM_LOAD( "sfoxbprm.bin", 0x200, 0x100, CRC(60d2ab41) SHA1(e58a54f2aaee5c07136d5437e513d61fb18fbd9f) )	/* 1-bpr*/
417 ROM_END
418 
419 
420 
421 
422 /* Untangle the graphics: cut each 32x32x8 tile in 16 8x8x8 tiles */
423 DRIVER_INIT( skyfox )
424 {
425 	unsigned char *RAM = memory_region(REGION_GFX1);
426 	unsigned char *end = RAM + memory_region_length(REGION_GFX1);
427 	unsigned char buf[32*32];
428 
429 	while (RAM < end)
430 	{
431 		int i;
432 		for (i=0;i<(32*32);i++)
433 			buf[i] = RAM[(i%8) + ((i/8)%8)*32 + ((i/64)%4)*8 + (i/256)*256];
434 
435 		memcpy(RAM,buf,32*32);
436 		RAM += 32*32;
437 	}
438 }
439 
440 
441 
442 GAME( 1987, skyfox,   0,      skyfox, skyfox, skyfox, ROT90, "Jaleco (Nichibutsu USA license)", "Sky Fox"  )
443 GAME( 1987, exerizrb, skyfox, skyfox, skyfox, skyfox, ROT90, "Jaleco", "Exerizer (Japan) (bootleg)" )
444