1 /***************************************************************************
2 
3 	Atari Sky Diver hardware
4 
5 	driver by Mike Balfour
6 
7 	Games supported:
8 		* Sky Diver
9 
10 	Known issues:
11 		* none at this time
12 
13 ****************************************************************************
14 
15 	Memory Map:
16 	0000-00FF    R/W    PAGE ZERO RAM
17 	0010         R/W    H POS PLANE 1
18 	0011         R/W    H POS PLANE 2
19 	0012         R/W    H POS MAN 1
20 	0013         R/W    H POS MAN 2
21 	0014         R/W    RANGE LOAD
22 	0015         R/W    NOTE LOAD
23 	0016         R/W    NAM LD
24 	0017         R/W    UNUSED
25 	0018         R/W    V POS PLANE 1
26 	0019         R/W    PICTURE PLANE 1
27 	001A         R/W    V POS PLANE 2
28 	001B         R/W    PICTURE PLANE 2
29 	001C         R/W    V POS MAN 1
30 	001D         R/W    PICTURE MAN 1
31 	001E         R/W    V POS MAN 2
32 	001F         R/W    PICTURE MAN 2
33 	0400-077F    R/W    PLAYFIELD
34 	0780-07FF    R/W    MAPS TO 0000-D0
35 	0800-0801     W     S LAMP
36 	0802-0803     W     K LAMP
37 	0804-0805     W     START LITE 1
38 	0806-0807     W     START LITE 2
39 	0808-0809     W     Y LAMP
40 	080A-080B     W     D LAMP
41 	080C-080D     W     SOUND ENABLE
42 	1000-1001     W     JUMP LITE 1
43 	1002-1003     W     COIN LOCK OUT
44 	1006-1007     W     JUMP LITE 2
45 	1008-1009     W     WHISTLE 1
46 	100A-100B     W     WHISTLE 2
47 	100C-100D     W     NMION
48 	100E-100F     W     WIDTH
49 	1800          R     D6=LEFT 1, D7=RIGHT 1
50 	1801          R     D6=LEFT 2, D7=RIGHT 2
51 	1802          R     D6=JUMP 1, D7=CHUTE 1
52 	1803          R     D6=JUMP 2, D7=CHUTE 2
53 	1804          R     D6=(D) OPT SW: NEXT TEST, D7=(F) OPT SW
54 	1805          R     D6=(E) OPT SW, D7= (H) OPT SW: DIAGNOSTICS
55 	1806          R     D6=START 1, D7=COIN 1
56 	1807          R     D6=START 2, D7=COIN 2
57 	1808          R     D6=MISSES 2, D7=MISSES 1
58 	1809          R     D6=COIN 2, D7=COIN1
59 	180A          R     D6=HARD/EASY, D7=EXTENDED PLAY
60 	180B          R     D6=LANGUAGE 2, D7=LANGUAGE 1
61 	1810          R     D6=TEST, D7=!VBLANK
62 	1811          R     D6=!SLAM, D7=UNUSED
63 	2000          W     TIMER RESET
64 	2002-2003     W     I LAMP
65 	2004-2005     W     V LAMP
66 	2006-2007     W     E LAMP
67 	2008-2009     W     R LAMP
68 	200A-200B     W     OCT 1
69 	200C-200D     W     OCT 2
70 	200E-200F     W     NOISE RESET
71 	2800-2FFF     R     ROM 0
72 	3000-37FF     R     ROM 1
73 	3800-3FFF     R     ROM 2A
74 	7800-7FFF     R     ROM 2B
75 
76 	If you have any questions about how this driver works, don't hesitate to
77 	ask.  - Mike Balfour (mab22@po.cwru.edu)
78 
79 	Notes:
80 
81 	The NMI interrupts are only used to read the coin switches.
82 
83 ***************************************************************************/
84 
85 #include "driver.h"
86 #include "skydiver.h"
87 
88 static int skydiver_nmion;
89 
90 
91 
92 /*************************************
93  *
94  *	Palette generation
95  *
96  *************************************/
97 
98 static unsigned short colortable_source[] =
99 {
100 	0x02, 0x00,
101 	0x02, 0x01,
102 	0x00, 0x02,
103 	0x01, 0x02
104 };
105 
PALETTE_INIT(skydiver)106 static PALETTE_INIT( skydiver )
107 {
108 	palette_set_color(0,0x00,0x00,0x00); /* black */
109 	palette_set_color(1,0xff,0xff,0xff); /* white */
110 	palette_set_color(2,0xa0,0xa0,0xa0); /* grey */
111 
112 	memcpy(colortable,colortable_source,sizeof(colortable_source));
113 }
114 
115 
116 
117 /*************************************
118  *
119  *	Interrupt generation
120  *
121  *************************************/
122 
WRITE_HANDLER(skydiver_nmion_w)123 static WRITE_HANDLER( skydiver_nmion_w )
124 {
125 	skydiver_nmion = offset;
126 }
127 
128 
INTERRUPT_GEN(skydiver_interrupt)129 static INTERRUPT_GEN( skydiver_interrupt )
130 {
131 /* Convert range data to divide value and write to sound */
132 	discrete_sound_w(0, (0x01 << (~skydiver_videoram[0x394] & 0x07)) & 0xff);	// Range 0-2
133 
134 	discrete_sound_w(1,  skydiver_videoram[0x394] & 0x08);	// Range 3 - note disable
135 	discrete_sound_w(2, ~skydiver_videoram[0x395] & 0xff);	// Note - freq
136 	discrete_sound_w(3,  skydiver_videoram[0x396] & 0x0f);	// NAM - Noise Amplitude
137 
138 
139 	if (skydiver_nmion)
140 		cpu_set_irq_line(0, IRQ_LINE_NMI, PULSE_LINE);
141 }
142 
143 /*************************************
144  *
145  *	Sound handlers
146  *
147  *************************************/
148 
WRITE_HANDLER(skydiver_sound_enable_w)149 static WRITE_HANDLER( skydiver_sound_enable_w )
150 {
151 	discrete_sound_w(9, offset);
152 }
153 
WRITE_HANDLER(skydiver_whistle_w)154 static WRITE_HANDLER( skydiver_whistle_w )
155 {
156 	discrete_sound_w(5 + (offset / 2), offset & 0x01);
157 }
158 
WRITE_HANDLER(skydiver_oct_w)159 static WRITE_HANDLER( skydiver_oct_w )
160 {
161 	discrete_sound_w(7 + (offset / 2), offset & 0x01);
162 }
163 
WRITE_HANDLER(skydiver_noise_reset_w)164 static WRITE_HANDLER( skydiver_noise_reset_w )
165 {
166 	discrete_sound_w(4, !offset);
167 }
168 
169 
170 
171 /*************************************
172  *
173  *	Main CPU memory handlers
174  *
175  *************************************/
176 
MEMORY_READ_START(readmem)177 static MEMORY_READ_START( readmem )
178 	{ 0x0000, 0x007f, skydiver_wram_r },
179 	{ 0x0080, 0x00ff, MRA_RAM },		/* RAM B1 */
180 	{ 0x0400, 0x07ff, MRA_RAM },		/* RAMs K1,M1,P1,J1,N1,K/L1,L1,H/J1 */
181 	{ 0x1800, 0x1800, input_port_0_r },
182 	{ 0x1801, 0x1801, input_port_1_r },
183 	{ 0x1802, 0x1802, input_port_2_r },
184 	{ 0x1803, 0x1803, input_port_3_r },
185 	{ 0x1804, 0x1804, input_port_4_r },
186 	{ 0x1805, 0x1805, input_port_5_r },
187 	{ 0x1806, 0x1806, input_port_6_r },
188 	{ 0x1807, 0x1807, input_port_7_r },
189 	{ 0x1808, 0x1808, input_port_8_r },
190 	{ 0x1809, 0x1809, input_port_9_r },
191 	{ 0x180a, 0x180a, input_port_10_r },
192 	{ 0x180b, 0x180b, input_port_11_r },
193 	{ 0x1810, 0x1810, input_port_12_r },
194 	{ 0x1811, 0x1811, input_port_13_r },
195 	{ 0x2000, 0x2000, watchdog_reset_r },
196 	{ 0x2800, 0x3fff, MRA_ROM },
197 	{ 0x7800, 0x7fff, MRA_ROM },
198 	{ 0xf800, 0xffff, MRA_ROM },
199 MEMORY_END
200 
201 
202 static MEMORY_WRITE_START( writemem )
203 	{ 0x0000, 0x007f, skydiver_wram_w },
204 	{ 0x0080, 0x00ff, MWA_RAM },
205 	{ 0x0400, 0x07ff, skydiver_videoram_w, &skydiver_videoram },
206 	{ 0x0800, 0x0801, skydiver_lamp_s_w },
207 	{ 0x0802, 0x0803, skydiver_lamp_k_w },
208 	{ 0x0804, 0x0805, skydiver_start_lamp_1_w },
209 	{ 0x0806, 0x0807, skydiver_start_lamp_2_w },
210 	{ 0x0808, 0x0809, skydiver_lamp_y_w },
211 	{ 0x080a, 0x080b, skydiver_lamp_d_w },
212 	{ 0x080c, 0x080d, skydiver_sound_enable_w },
213 	/* { 0x1000, 0x1001, skydiver_jump1_lamps_w },*/
214 	{ 0x1002, 0x1003, skydiver_coin_lockout_w },
215 	/* { 0x1006, 0x1007, skydiver_jump2_lamps_w },*/
216 	{ 0x1008, 0x100b, skydiver_whistle_w },
217 	{ 0x100c, 0x100d, skydiver_nmion_w },
218 	{ 0x100e, 0x100f, skydiver_width_w },
219 	{ 0x2000, 0x2000, watchdog_reset_w },
220 	{ 0x2002, 0x2003, skydiver_lamp_i_w },
221 	{ 0x2004, 0x2005, skydiver_lamp_v_w },
222 	{ 0x2006, 0x2007, skydiver_lamp_e_w },
223 	{ 0x2008, 0x2009, skydiver_lamp_r_w },
224 	{ 0x200a, 0x200d, skydiver_oct_w },
225 	{ 0x200e, 0x200f, skydiver_noise_reset_w },
226 	{ 0x2800, 0x3fff, MWA_ROM },
227 	{ 0x7800, 0x7fff, MWA_ROM },
228 	{ 0xf800, 0xffff, MWA_ROM },
229 MEMORY_END
230 
231 
232 
233 /*************************************
234  *
235  *	Port definitions
236  *
237  *************************************/
238 
239 INPUT_PORTS_START( skydiver )
240 	PORT_START /* IN0 */
241 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
242 	PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
243 	PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
244 
245 	PORT_START /* IN1 */
246 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
247 	PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 )
248 	PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
249 
250 	PORT_START /* IN2 */
251 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
252 	PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )	/* Jump 1 */
253 	PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )	/* Chute 1 */
254 
255 	PORT_START /* IN3 */
256 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
257 	PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )	/* Jump 2 */
258 	PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )	/* Chute 2 */
259 
260 	PORT_START /* IN4 */
261 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
262 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_BUTTON3, "(D) OPT SW NEXT TEST", KEYCODE_D, IP_JOY_NONE )
263 	PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_BUTTON4, "(F) OPT SW", KEYCODE_F, IP_JOY_NONE )
264 
265 	PORT_START /* IN5 */
266 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
267 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_BUTTON5, "(E) OPT SW", KEYCODE_E, IP_JOY_NONE )
268 	PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_BUTTON6, "(H) OPT SW DIAGNOSTICS", KEYCODE_H, IP_JOY_NONE )
269 
270 	PORT_START /* IN6 */
271 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
272 	PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_START1 )
273 	PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_LOW, IPT_COIN1, 1 )
274 
275 	PORT_START /* IN7 */
276 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
277 	PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_START2 )
278 	PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_LOW, IPT_COIN2, 1 )
279 
280 	PORT_START /* IN8 */
281 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
282 	PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Lives ) )
283 	PORT_DIPSETTING(    0x00, "3" )
284 	PORT_DIPSETTING(    0x40, "4" )
285 	PORT_DIPSETTING(    0x80, "5" )
286 	PORT_DIPSETTING(    0xc0, "6" )
287 
288 	PORT_START /* IN9 */
289 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
290 	PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Coinage ) )
291 	PORT_DIPSETTING(    0xc0, DEF_STR( 2C_1C ) )
292 	PORT_DIPSETTING(    0x80, DEF_STR( 1C_1C ) )
293 	PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
294 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
295 
296 	PORT_START /* IN10 */
297 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
298 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )
299 	PORT_DIPSETTING(    0x40, "Easy" )
300 	PORT_DIPSETTING(    0x00, "Hard" )
301 	PORT_DIPNAME( 0x80, 0x00, "Extended Play" )
302 	PORT_DIPSETTING(    0x80, DEF_STR( No ) )
303 	PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
304 
305 	PORT_START /* IN11 */
306 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
307 	PORT_DIPNAME( 0xc0, 0x00, "Language" )
308 	PORT_DIPSETTING(    0x00, "English" )
309 	PORT_DIPSETTING(    0x40, "French" )
310 	PORT_DIPSETTING(    0x80, "Spanish" )
311 	PORT_DIPSETTING(    0xc0, "German" )
312 
313 	PORT_START /* IN12 */
314 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
315 	PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
316 	PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_VBLANK )
317 
318 	PORT_START /* IN13 */
319 	PORT_BIT (0x3f, IP_ACTIVE_LOW, IPT_UNUSED )
320 	PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_TILT )
321 	PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_UNUSED )
322 	PORT_START
323 	PORT_ADJUSTER( 67, "Whistle 1 Freq" )
324 
325 	PORT_START
326 	PORT_ADJUSTER( 75, "Whistle 2 Freq" )
327 INPUT_PORTS_END
328 
329 
330 
331 /*************************************
332  *
333  *	Graphics definitions
334  *
335  *************************************/
336 
337 static struct GfxLayout charlayout =
338 {
339 	8,8,
340 	64,
341 	1,
342 	{ 0 },
343 	{ 7, 6, 5, 4, 15, 14, 13, 12 },
344 	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
345 	8*16
346 };
347 
348 
349 static struct GfxLayout motion_layout =
350 {
351 	16,16,
352 	32,
353 	1,
354 	{ 0 },
355 	{ 4, 5, 6, 7, 4 + 0x400*8, 5 + 0x400*8, 6 + 0x400*8, 7 + 0x400*8,
356 	  12, 13, 14, 15, 12 + 0x400*8, 13 + 0x400*8, 14 + 0x400*8, 15 + 0x400*8 },
357 	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
358 	  8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
359 	8*32
360 };
361 
362 
363 static struct GfxDecodeInfo gfxdecodeinfo[] =
364 {
365 	{ REGION_GFX1, 0, &charlayout,    0, 4 },
366 	{ REGION_GFX2, 0, &motion_layout, 0, 4 },
367 	{ -1 }
368 };
369 
370 /************************************************************************/
371 /* skydiver Sound System Analog emulation                               */
372 /* Jan 2004, Derrick Renaud                                             */
373 /************************************************************************/
374 
375 const struct discrete_555_astbl_desc skydiverWhistl555 =
376 {
377 	DISC_555_OUT_SQW | DISC_555_OUT_AC,
378 	5,		// B+ voltage of 555
379 	5.0 - 1.7,	// High output voltage of 555 (Usually v555 - 1.7)
380 	5.0 * 2.0 /3.0,	// normally 2/3 of v555
381 	5.0 / 3.0	// normally 1/3 of v555
382 };
383 
384 const struct discrete_lfsr_desc skydiver_lfsr={
385 	16,				/* Bit Length */
386 	0,				/* Reset Value */
387 	0,				/* Use Bit 0 as XOR input 0 */
388 	14,				/* Use Bit 14 as XOR input 1 */
389 	DISC_LFSR_XNOR,			/* Feedback stage1 is XNOR */
390 	DISC_LFSR_OR,			/* Feedback stage2 is just stage 1 output OR with external feed */
391 	DISC_LFSR_REPLACE,		/* Feedback stage3 replaces the shifted register contents */
392 	0x000001,			/* Everything is shifted into the first bit only */
393 	DISC_LFSR_FLAG_OUT_INVERT,	/* Output is inverted, Active Low Reset */
394 	15				/* Output bit */
395 };
396 
397 /* Nodes - Inputs */
398 #define SKYDIVER_RANGE_DATA	NODE_01
399 #define SKYDIVER_NOTE_DATA	NODE_02
400 #define SKYDIVER_RANGE3_EN	NODE_03
401 #define SKYDIVER_NOISE_DATA	NODE_04
402 #define SKYDIVER_NOISE_RST	NODE_05
403 #define SKYDIVER_WHISTLE1_EN	NODE_06
404 #define SKYDIVER_WHISTLE2_EN	NODE_07
405 #define SKYDIVER_OCT1_EN	NODE_08
406 #define SKYDIVER_OCT2_EN	NODE_09
407 #define SKYDIVER_SOUND_EN	NODE_10
408 /* Nodes - Sounds */
409 #define SKYDIVER_NOTE_SND	NODE_11
410 #define SKYDIVER_NOISE_SND	NODE_12
411 #define SKYDIVER_WHISTLE1_SND	NODE_13
412 #define SKYDIVER_WHISTLE2_SND	NODE_14
413 
414 static DISCRETE_SOUND_START(skydiver_sound_interface)
415 	/************************************************/
416 	/* skydiver  Effects Relataive Gain Table       */
417 	/*                                              */
418 	/* Effect  V-ampIn  Gain ratio        Relative  */
419 	/* Note     3.8     3.8/260.5          1000.0   */
420 	/* Noise    3.8     3.8/680             383.1   */
421 	/* Whistle  5.0     5.0/1500            228.5   */
422 	/************************************************/
423 
424 	/************************************************/
425 	/* Input register mapping for skydiver          */
426 	/************************************************/
427 	/*              NODE                  ADDR  MASK     GAIN        OFFSET  INIT */
428 	DISCRETE_INPUT (SKYDIVER_RANGE_DATA,  0x00, 0x000f,                      0.0)
429 	DISCRETE_INPUT (SKYDIVER_RANGE3_EN,   0x01, 0x000f,                      0.0)
430 	DISCRETE_INPUT (SKYDIVER_NOTE_DATA,   0x02, 0x000f,                      0.0)
431 	DISCRETE_INPUTX(SKYDIVER_NOISE_DATA,  0x03, 0x000f,  383.1/15.0, 0.0,    0.0)
432 	DISCRETE_INPUT (SKYDIVER_NOISE_RST,   0x04, 0x000f,                      1.0)
433 	DISCRETE_INPUT (SKYDIVER_WHISTLE1_EN, 0x05, 0x000f,                      0.0)
434 	DISCRETE_INPUT (SKYDIVER_WHISTLE2_EN, 0x06, 0x000f,                      0.0)
435 	DISCRETE_INPUT (SKYDIVER_OCT1_EN,     0x07, 0x000f,                      0.0)
436 	DISCRETE_INPUT (SKYDIVER_OCT2_EN,     0x08, 0x000f,                      0.0)
437 	DISCRETE_INPUT (SKYDIVER_SOUND_EN,    0x09, 0x000f,                      0.0)
438 	/************************************************/
439 
440 	/************************************************/
441 	/* The note generator has a selectable range    */
442 	/* and selectable frequency.                    */
443 	/* The base frequency is                        */
444 	/* 12.096MHz / 2 / range / note freq / 2        */
445 	/* The final /2 is just to give a 50% duty,     */
446 	/* so we can just start by 12.096MHz/4/range    */
447 	/* The octave is selected by 3 bits selecting   */
448 	/* 000 64H  = 12096MHz / 2 / 128                */
449 	/* 001 32H  = 12096MHz / 2 / 64                 */
450 	/* 010 16H  = 12096MHz / 2 / 32                 */
451 	/* 011  8H  = 12096MHz / 2 / 16                 */
452 	/* 100  4H  = 12096MHz / 2 / 8                  */
453 	/* 101  2H  = 12096MHz / 2 / 4                  */
454 	/* 110  1H  = 12096MHz / 2 / 2                  */
455 	/* 111 6MHz = 12096MHz / 2 / 1                  */
456 	/* We will convert the 3 range bits to a        */
457 	/* divide value in the driver before sending    */
458 	/* to the sound interface.                      */
459 	/*                                              */
460 	/* note data: 0xff = off,                       */
461 	/*            0xfe = /2,                        */
462 	/*            0x00 = /256                       */
463 	/* We will send the note data bit inverted to   */
464 	/* sound interface so it is easier to work with.*/
465 	/*                                              */
466 	/* The note generator is disabled by a low on   */
467 	/* RANGE3.                                      */
468 	/************************************************/
469 	// We will disable the divide if SKYDIVER_RANGE_DATA = 0
470 	DISCRETE_DIVIDE(NODE_20, SKYDIVER_RANGE_DATA, 12096000.0 /2.0 / 2.0, SKYDIVER_RANGE_DATA)
471 	DISCRETE_ADDER2(NODE_21, 1, SKYDIVER_NOTE_DATA, 1)
472 	// We will disable the divide if SKYDIVER_NOTE_DATA = 0
473 	DISCRETE_DIVIDE(NODE_22, SKYDIVER_NOTE_DATA, NODE_20, NODE_21)	// freq
474 	DISCRETE_SQUAREWAVE(SKYDIVER_NOTE_SND, SKYDIVER_RANGE3_EN, NODE_22, 1000.0, 50.0, 0, 0.0)
475 
476 	/************************************************/
477 	/* Noise circuit is built around a noise        */
478 	/* generator built from 2 shift registers that  */
479 	/* are clocked by the 1V signal.                */
480 	/* 1V = HSYNC/2                                 */
481 	/*    = 15750/2                                 */
482 	/* Output is binary weighted with 4 bits of     */
483 	/* volume.                                      */
484 	/************************************************/
485 	DISCRETE_LFSR_NOISE(SKYDIVER_NOISE_SND, SKYDIVER_NOISE_RST, SKYDIVER_NOISE_RST, 15750.0/2.0, SKYDIVER_NOISE_DATA, 0, 0, &skydiver_lfsr)
486 
487 	/************************************************/
488 	/* Whistle circuit is a 555 capacitor charge    */
489 	/* waveform.  The original game pot varies from */
490 	/* 0-250k, but we are going to limit it because */
491 	/* below 50k the frequency is too high.         */
492 	/* When triggered it starts at it's highest     */
493 	/* frequency, then decays at the rate set by    */
494 	/* a 68k resistor and 22uf capacitor.           */
495 	/************************************************/
496 	DISCRETE_ADJUSTMENT(NODE_30, 1, 50000, 250000, DISC_LINADJ, 15)	/* R66 */
497 	DISCRETE_MULTADD(NODE_31, 1, SKYDIVER_WHISTLE1_EN, 3.05-0.33, 0.33)
498 	DISCRETE_RCDISC2(NODE_32, SKYDIVER_WHISTLE1_EN, NODE_31, 1.0, NODE_31, 68000.0, 2.2e-5)	/* CV */
499 	DISCRETE_SWITCH(NODE_33, 1, SKYDIVER_OCT1_EN, 1e-8, 1e-8 + 3.3e-9)	/* Cap C73 & C58 */
500 	DISCRETE_555_ASTABLE(NODE_34, SKYDIVER_WHISTLE1_EN, 100000, NODE_30, NODE_33, NODE_32, &skydiverWhistl555)
501 	DISCRETE_MULTIPLY(SKYDIVER_WHISTLE1_SND, SKYDIVER_WHISTLE1_EN, NODE_34, 228.5/3.3)
502 
503 	DISCRETE_ADJUSTMENT(NODE_35, 1, 50000, 250000, DISC_LINADJ, 14)	/* R65 */
504 	DISCRETE_MULTADD(NODE_36, 1, SKYDIVER_WHISTLE2_EN, 3.05-0.33, 0.33)
505 	DISCRETE_RCDISC2(NODE_37, SKYDIVER_WHISTLE2_EN, NODE_36, 1.0, NODE_36, 68000.0, 2.2e-5)	/* CV */
506 	DISCRETE_SWITCH(NODE_38, 1, SKYDIVER_OCT2_EN, 1e-8, 1e-8 + 3.3e-9)	/* Cap C72 & C59 */
507 	DISCRETE_555_ASTABLE(NODE_39, SKYDIVER_WHISTLE2_EN, 100000, NODE_35, NODE_38, NODE_37, &skydiverWhistl555)
508 	DISCRETE_MULTIPLY(SKYDIVER_WHISTLE2_SND, SKYDIVER_WHISTLE2_EN, NODE_39, 228.5/3.3)
509 
510 	/************************************************/
511 	/* Final gain and ouput.                        */
512 	/************************************************/
513 	DISCRETE_ADDER4(NODE_90, SKYDIVER_SOUND_EN, SKYDIVER_NOTE_SND, SKYDIVER_NOISE_SND, SKYDIVER_WHISTLE1_SND, SKYDIVER_WHISTLE2_SND)
514 	DISCRETE_GAIN(NODE_91, NODE_90, 65534.0/(1000.0 + 383.1 + 228.5 + 228.5))
515 	DISCRETE_OUTPUT(NODE_91, 100)
516 DISCRETE_SOUND_END
517 
518 
519 
520 /*************************************
521  *
522  *	Machine driver
523  *
524  *************************************/
525 
526 static MACHINE_DRIVER_START( skydiver )
527 
528 	/* basic machine hardware */
529 	MDRV_CPU_ADD(M6800,3000000/4)	   /* ???? */
530 	MDRV_CPU_MEMORY(readmem,writemem)
531 	MDRV_CPU_VBLANK_INT(skydiver_interrupt,8)
532 
533 	MDRV_FRAMES_PER_SECOND(60)
534 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
535 	MDRV_MACHINE_INIT(skydiver)
536 
537 	/* video hardware */
538 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
539 	MDRV_SCREEN_SIZE(32*8, 32*8)
540 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
541 	MDRV_GFXDECODE(gfxdecodeinfo)
542 	MDRV_PALETTE_LENGTH(3)
543 	MDRV_COLORTABLE_LENGTH(sizeof(colortable_source) / sizeof(colortable_source[0]))
544 
545 	MDRV_PALETTE_INIT(skydiver)
546 	MDRV_VIDEO_START(skydiver)
547 	MDRV_VIDEO_UPDATE(skydiver)
548 	/* sound hardware */
549 	MDRV_SOUND_ADD_TAG("discrete", DISCRETE, skydiver_sound_interface)
550 MACHINE_DRIVER_END
551 
552 
553 
554 /*************************************
555  *
556  *	ROM definitions
557  *
558  *************************************/
559 
560 ROM_START( skydiver )
561 	ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code */
562 	ROM_LOAD( "33167-02.f1", 0x2800, 0x0800, CRC(25a5c976) SHA1(50fbf5dceab5d78292dc14bf25f2076e8139a594) )
563 	ROM_LOAD( "33164-02.e1", 0x3000, 0x0800, CRC(a348ac39) SHA1(7401cbd2f7236bd1d6ad0e39eb3de2b7d75e8f45) )
564 	ROM_LOAD( "33165-02.d1", 0x3800, 0x0800, CRC(a1fc5504) SHA1(febaa78936de7703b708c0d1f350fe288e0a106b) )
565 	ROM_LOAD( "33166-02.c1", 0x7800, 0x0800, CRC(3d26da2b) SHA1(e515d5c13814b9732a6ca109272500a60edc208a) )
566 	ROM_RELOAD(              0xf800, 0x0800 )
567 
568 	ROM_REGION( 0x0400, REGION_GFX1, ROMREGION_DISPOSE )
569 	ROM_LOAD( "33163-01.h5", 0x0000, 0x0400, CRC(5b9bb7c2) SHA1(319f45b6dff96739f73f2089361239da47042dcd) )
570 
571 	ROM_REGION( 0x0800, REGION_GFX2, ROMREGION_DISPOSE )
572 	ROM_LOAD( "33176-01.l5", 0x0000, 0x0400, CRC(6b082a01) SHA1(8facc94843ea041d205137056bd2035cf968125b) )
573 	ROM_LOAD( "33177-01.k5", 0x0400, 0x0400, CRC(f5541af0) SHA1(0967269518b6eac3c4e9ddaee39303086476c580) )
574 ROM_END
575 
576 
577 
578 /*************************************
579  *
580  *	Game driver
581  *
582  *************************************/
583 
584 GAMEC( 1978, skydiver, 0, skydiver, skydiver, 0, ROT0, "Atari", "Sky Diver", &skydiver_ctrl, NULL )
585