1 // license:CC0
2 // copyright-holders:Colin Douglas Howell
3 
4 #include "netlist/devices/net_lib.h"
5 
6 
7 // This is a netlist description for the sound circuits of Midway's 280-ZZZAP
8 // and Laguna Racer, based on Midway's schematics "280 ZZZAP Game Logic P.C.
9 // 0610-00907A", "Laguna Racer Game Logic A084-90700-A622", and "Laguna Racer
10 // Game Logic A084-90700-B622". Midway PCB drawings for Laguna Racer and a
11 // photo by Andrew Wellburn of a 280-ZZZAP game logic board were also used to
12 // help determine correct values for certain components. The netlist should
13 // also apply to Taito/Midway's Super Speed Race with only modest changes,
14 // because that game uses very similar sound circuits to 280-ZZZAP and Laguna
15 // Racer.
16 
17 // (Incidentally, the 280-ZZZAP schematic has some notes on changes made to
18 // the circuitry during production, a few of which were to audio circuits.
19 // This netlist uses the final state of the schematic, but it could be
20 // adjusted to the earlier state by modifying a couple of component values.)
21 
22 // Due to its complexity, this netlist is rather CPU intensive. Various
23 // speedups have been employed to allow the game to run at full speed on
24 // modern hardware with some CPU to spare. The main sources of complexity are
25 // the op-amps (15 of them, all of which are National Semiconductor LM3900
26 // current-differencing "Norton-type" op-amps) and the Motorola MC3340
27 // Electronic Attenuator, the latter of which is emulated at its internal
28 // component level, which includes 10 bipolar junction transistors. Several of
29 // the circuits are oscillators which run at frequencies up to hundreds of
30 // hertz and which switch state abruptly, increasing the computing demands of
31 // the emulation.
32 
33 // Midway's 280-ZZZAP and Laguna Racer schematics don't label discrete
34 // components, though they do label ICs with their PCB coordinates, as well as
35 // IC pins. Midway's Super Speed Race schematic, however, does label discrete
36 // components, most of which directly correspond to the 280-ZZZAP and Laguna
37 // Racer ones. I have used the Super Speed Race labels for the 280-ZZZAP
38 // discrete components. IC components I have labeled with their 280-ZZZAP PCB
39 // coordinates, consistent with the 280-ZZZAP schematic. Each LM3900 IC
40 // contains 4 op-amps, so I have labeled these op-amps as _1 to _4, the same
41 // scheme used in the LM3900 datasheet, using the pin numbers on the schematic
42 // to identify the specific op-amp. Likewise, each CD4016 IC contains 4
43 // switches, so I identify a specific switch from its pin numbers on the
44 // schematic; these are labeled _A through _D in the CD4016 datasheet, so I
45 // use that scheme.
46 
47 // The sound circuitry can be divided into three sections: engine sound
48 // generation and control, generation of noise-based sound effects (skidding
49 // and crashes), and the final mix and amplification of all sounds.
50 
51 
52 // When comparing the sound circuitry and components between 280-ZZZAP and
53 // Laguna Racer, here are some things to note. There are two different
54 // versions of the Laguna Racer game logic board (where the sound circuits
55 // reside): A622 and B622. Midway's A622 schematic was clearly copied directly
56 // from 280-ZZZAP's--even the letter indicators for change notes in
57 // 280-ZZZAP's circuitry remain, though the actual notes were blanked out.
58 // B622's schematics show sound circuitry differences from 280-ZZZAP and A622,
59 // and these differences are consistent with Midway's PCB drawings for *both*
60 // the A622 and B622 games boards. Some of them are also consistent with
61 // Wellburn's 280-ZZZAP PCB photo. So it seems that actual 280-ZZZAP boards
62 // lie somewhere between the 280-ZZZAP schematic and the B622 Laguna Racer
63 // schematic.
64 
65 
66 // Include special frontiers within engine sound oscillators whose purpose is
67 // to improve solution convergence by reducing the oscillators' inherent
68 // numeric instability. Also adjusts values of resistors associated with these
69 // oscillators to maintain their frequency and voltage levels.
70 
71 #define CONVERGENCE_FRONTIERS   1
72 
73 // Use the fast high-level emulation of the analog noise generator, based on
74 // passing the noise signal to a simple AFUNC that outputs a high or low level
75 // according to the sign of the noise. This sounds the same as an accurate run
76 // of the component-level noise generator, but it is fast enough to run in
77 // real time.
78 
79 #define FAST_HLE_NOISE_GEN  1
80 
81 // Enable a voltage limiter on the output of the op-amp which generates the
82 // post-crash sound. This removes voltage glitches from the output which would
83 // otherwise be audible when the netlist is run with a fixed 48 kHz timestep,
84 // as it is in MAME.
85 
86 #define REMOVE_POST_CRASH_NOISE_GLITCHES  1
87 
88 
89 // Netlists for two different games are defined in this file. These netlists
90 // are mostly alike but differ in a few key components. I use Aaron Giles'
91 // scheme for combining the two definitions in one file.
92 //
93 // Initial compilation includes this section.
94 //
95 
96 #ifndef SOUND_VARIANT
97 
98 
99 //
100 // Now include ourselves twice, once for 280-ZZZAP and once for Laguna Racer.
101 //
102 
103 #define VARIANT_280ZZZAP  0
104 #define VARIANT_LAGUNAR   1
105 
106 #define SOUND_VARIANT       (VARIANT_280ZZZAP)
107 #include "nl_280zzzap.cpp"
108 
109 #undef SOUND_VARIANT
110 #define SOUND_VARIANT       (VARIANT_LAGUNAR)
111 #include "nl_280zzzap.cpp"
112 
113 
114 #else
115 
116 
117 //
118 // Main netlist
119 //
120 
121 #if (SOUND_VARIANT == VARIANT_280ZZZAP)
122 
123 static NETLIST_START(280zzzap_schematics)
124 
125 #else // (SOUND_VARIANT == VARIANT_LAGUNAR)
126 
127 static NETLIST_START(lagunar_schematics)
128 
129 #endif
130 
131 	// **** Conversion of accelerator level to "engine speed" control
132 	// **** voltage for engine sound, with capacitor-based "engine
133 	// **** inertia" and gear shift changes.
134 
135 	// The accelerator pedal input gives a 4-bit digital value which the
136 	// microprocessor stores in 74174 latch F5. The 4-bit value from the
137 	// latch output is converted by a resistor network to an analog
138 	// current of about 5.5 to 43 microamps, depending on the accelerator
139 	// level, with 5.5 µA being "zero" and each additional accelerator
140 	// increment adding another 2.5 µA. This current is then converted to
141 	// a corresponding analog voltage by the first LM3900 op-amp H5_3 at a
142 	// ratio of about 0.25 volts per accelerator increment. This op-amp's
143 	// output charges or discharges capacitor C18, whose voltage provides
144 	// the reference input for the second op-amp H5_4. The charging and
145 	// discharging of C18 is how the engine sound's pitch and volume are
146 	// changed, so more accelerator will charge it faster, and less
147 	// accelerator will charge it slower or make it discharge faster.
148 	// Also, it can discharge faster than it can charge (RC time constants
149 	// of about 0.5 seconds vs. 2.2 seconds), so the engine will lose
150 	// speed faster than it will gain it. Normally ENGINE_SOUND_OFF is
151 	// low, but if it goes high (if you crash, or when the game is in
152 	// attract mode), it closes CD4016 switch G5_A, which almost instantly
153 	// discharges C18 through 270-ohm resistor R56 and cuts off the engine
154 	// sound completely.
155 	//
156 	// Op-amp H5_4's output, which is driven to match the input current
157 	// from capacitor C18, provides the actual speed voltage signal to the
158 	// engine sound oscillators. This voltage is shifted down in level
159 	// from H5_3, ranging from 0.7 to 4.1 V. It also accounts for gear
160 	// shift, via capacitor C19 and the two adjacent CD4016 switches G5_B
161 	// and G5_C. When in low gear, LO_SHIFT is active, switch G5_C is
162 	// closed, and C19 is discharged via 10K resistor R60. HI_SHIFT is
163 	// inactive, switch G5_B is open, and all the feedback current to H5_4
164 	// runs through its 560K feedback resistor R58. However, when in high
165 	// gear, the state of the two switches is reversed, and C19 is free to
166 	// slowly charge through 560K resistor R59 while supplying additional
167 	// feedback current to the op-amp without a resistor. This has the
168 	// effect of temporarily depressing (or slowing the growth of) H5_4's
169 	// output voltage while C19 is being charged until it eventually
170 	// reaches equilibrium, at which point the output voltage will be the
171 	// same as in the low-gear case. The effect is to slow down the engine
172 	// speed, as you would expect in a higher gear. Likewise, if the
173 	// accelerator is reduced in high gear, lowering the op-amp's input
174 	// current, the fall in the op-amp's output voltage is temporarily
175 	// delayed while C19 is charged until it has sufficiently discharged
176 	// through R59. Thus the rate of engine slowing is also lowered.
177 
178 	// Some component values here were changed in the later version of the
179 	// Laguna Racer game logic board or in Super Speed Race.
180 
181 	CD4016_DIP(G5)
182 
183 	LM3900(H5_3)
184 	LM3900(H5_4)
185 
186 	RES(R42, RES_K(1))
187 	RES(R43, RES_K(1))
188 	RES(R44, RES_K(1))
189 	RES(R45, RES_K(1))
190 	RES(R62, RES_K(1))
191 	RES(R61, RES_K(1))
192 
193 	// For the following resistors R51 and R46-R49, the values given are
194 	// those shown in the Laguna Racer PCB drawings, the Laguna Racer B622
195 	// board schematic, the Super Speed Race schematic, and Andrew
196 	// Wellburn's 280-ZZZAP PCB photo. In the 280-ZZZAP schematic (and the
197 	// Laguna Racer A622 board schematic, a near copy), R51 and R48 are
198 	// 480 Kohms and R46 is 2 Mohms, but these seem to be errors in that
199 	// schematic. 480 Kohm is not even a standard resistor value for any
200 	// tolerance band, so it could not have been used on production
201 	// boards.
202 	RES(R51, RES_K(470))
203 	RES(R46, RES_M(2.2))
204 	RES(R47, RES_M(1))
205 	RES(R48, RES_K(470))
206 	RES(R49, RES_K(240))
207 
208 	RES(R50, RES_K(100))
209 	// Super Speed Race also has a 1 uF capacitor in parallel with R50.
210 	RES(R53, RES_K(47))
211 	RES(R52, RES_K(10))
212 	RES(R56, RES_R(270))
213 
214 	RES(R54, RES_K(560))
215 	RES(R55, RES_M(4.7))
216 
217 	RES(R57, RES_M(2.7))
218 	RES(R58, RES_K(560))
219 
220 	RES(R59, RES_K(560))
221 	RES(R60, RES_K(10))
222 
223 	// The size of capacitor C18 varies with the game: 47 uF in 280-ZZZAP,
224 	// 22 uF in Laguna Racer and Super Speed Race:
225 
226 #if (SOUND_VARIANT == VARIANT_280ZZZAP)
227 
228 	CAP(C18, CAP_U(47))
229 
230 #else // (SOUND_VARIANT == VARIANT_LAGUNAR)
231 
232 	CAP(C18, CAP_U(22))
233 
234 #endif
235 
236 	NET_C(C18.2, GND)
237 
238 	CAP(C19, CAP_U(2.2))
239 
240 	DIODE(D4, 1N914)
241 	DIODE(D5, 1N914)
242 
243 	NET_C(I_V5.Q, R42.1, R43.1, R44.1, R45.1, R62.1, R61.1, R51.1,
244 		R55.1, R57.1)
245 
246 	NET_C(PEDAL_BIT0, R42.2, R46.1)
247 	NET_C(PEDAL_BIT1, R43.2, R47.1)
248 	NET_C(PEDAL_BIT2, R44.2, R48.1)
249 	NET_C(PEDAL_BIT3, R45.2, R49.1)
250 	NET_C(H5_3.PLUS, R46.2, R47.2, R48.2, R49.2, R51.2)
251 	NET_C(H5_3.MINUS, R50.2)
252 	NET_C(H5_3.OUT, R50.1, R53.1, D4.K)
253 	// Super Speed Race also has a 1 uF capacitor in parallel with R50.
254 	NET_C(R53.2, R52.1, C18.1, R56.2, R54.1)
255 	NET_C(R52.2, D4.A)
256 	NET_C(H5_4.PLUS, R54.2, R55.2)
257 	NET_C(H5_4.MINUS, R58.2, R57.2, G5.4)
258 	// The following are only local connections to H5_4.OUT. It also runs
259 	// to all the oscillators; those connections are listed further down.
260 	NET_C(H5_4.OUT, D5.A, R59.1)
261 	NET_C(D5.K, R58.1)
262 	NET_C(C19.1, R59.2, R60.2)
263 
264 	NET_C(G5.1, GND)
265 	NET_C(G5.2, R56.1)
266 	NET_C(G5.13, ENGINE_SOUND_OFF)
267 
268 	NET_C(G5.5, R62.2, HI_SHIFT)
269 
270 	NET_C(G5.3, G5.8, C19.2)
271 	NET_C(G5.9, R60.1)
272 	NET_C(G5.6, R61.2, LO_SHIFT)
273 
274 
275 	// **** Engine sound generation, using three triangle-wave oscillators
276 	// **** running at frequency and amplitude determined by engine speed
277 	// **** control voltage and modulated by MC3340 amplifier/attenuator.
278 
279 	// Engine sound oscillators. There are three of these, at different
280 	// frequencies; all three are triangle-wave oscillators whose
281 	// frequency and amplitude are controlled by the "engine speed"
282 	// voltage signal output from LM3900 op-amp H5_4. Each oscillator is a
283 	// cascaded pair of LM3900s with a CD4016 switch. The switch feeds
284 	// into the reference input of the first op-amp, whose output is also
285 	// the final oscillator output; the second op-amp acts as a Schmitt
286 	// trigger on the first op-amp's output, generating a square wave that
287 	// controls the switch and determines whether the triangle wave is
288 	// rising or falling.
289 
290 	// The two lower-frequency oscillators are summed together. One has
291 	// four times the frequency of the other, producing a "ragged"
292 	// triangle wave. The combined signal is fed into the signal input of
293 	// the MC3340 voltage-controlled amplifier/attenuator. The third,
294 	// highest-frequency oscillator drives the MC3340's control input,
295 	// amplitude-modulating the signal input from the first two
296 	// oscillators. Greater voltages on this control signal produce
297 	// greater attenuation in a logarithmic fashion. The final output
298 	// signal from the MC3340 thus has a waveform of narrow needle-like
299 	// spikes which grow taller and shorter according to the original
300 	// input waveform.
301 
302 	// The Schmitt triggers in these oscillator circuits are numerically
303 	// unstable at the switching points, which makes numeric convergence
304 	// difficult. The standard way to guarantee convergence with such a
305 	// circuit is to use dynamic timestepping with very short minimum
306 	// timesteps. In this case that solution is unacceptably slow, so an
307 	// alternate solution is used instead. To remove the unstable behavior
308 	// of the Schmitt triggers in the solver, a "frontier" is inserted at
309 	// the output of each Schmitt trigger op-amp. With this, a change in
310 	// the op-amp's output level, caused by a change in its inputs, will
311 	// not affect either its feedback input or the CD4016 switch during
312 	// the same timestep. Instead, it will only take effect when computing
313 	// the following timestep. This greatly improves the stability and
314 	// performance of the solver while only slightly altering the
315 	// frequency and voltage levels of the oscillator's triangle-wave
316 	// output. These waveform changes are compensated for by slightly
317 	// adjusting the value of the resistors which determine the Schmitt
318 	// trigger's switch points, bringing the waveform very close to what
319 	// it would be if the standard approach of dynamic timestepping were
320 	// used instead.
321 
322 	// These are the remaining connections from H5_4.OUT:
323 	NET_C(H5_4.OUT, R36.1, R37.1, R31.1, R32.1, R29.1, R30.1)
324 
325 	MC3340_DIP(MC3340_H2)
326 
327 	CD4016_DIP(J4)
328 
329 	// First oscillator (bottommost in schematics).
330 	// Schematic shows frequency of "76 Hz", but when modeled without a
331 	// frontier, the maximum in low gear is 87 Hz.
332 	// With a frontier, uncompensated, this decreases to 86 Hz.
333 
334 	LM3900(J5_2)
335 	LM3900(J5_1)
336 
337 	RES(R36, RES_K(560))
338 	RES(R37, RES_K(270))
339 	RES(R38, RES_K(100))
340 	RES(R41, RES_K(10))
341 	NET_C(R41.2, GND)
342 
343 #if CONVERGENCE_FRONTIERS
344 	// Schmitt trigger resistors changed to compensate for waveform changes
345 	// from use of frontier:
346 	RES(R39, RES_K(465.0))
347 	RES(R40, RES_K(275.0))
348 #else
349 	RES(R39, RES_K(470))
350 	RES(R40, RES_K(270))
351 #endif
352 
353 	CAP(C17, CAP_U(0.022))
354 
355 	DIODE(D3, 1N914)
356 
357 	// Note the connections to this oscillator's CD4016 switch at J4 have
358 	// mislabeled pin numbers on the schematics for 280-ZZZAP and both
359 	// Laguna Racer versions; they are shown as pins 3, 4, 5, which are
360 	// for switch B, the same switch which is used by the middle
361 	// oscillator. The Super Speed Race schematic correctly shows this
362 	// oscillator using pins 10, 11, 12, which are for switch D of the
363 	// CD4016 (located at B1 in that game). It seems very unlikely that
364 	// the earlier games had two oscillators sharing the same switch; that
365 	// shouldn't work at all. I assume that this was a schematic error
366 	// which was not corrected until much later.
367 
368 	NET_C(R37.2, J4.10)
369 	NET_C(J4.11, J5_2.PLUS)
370 	NET_C(R36.2, J5_2.MINUS, C17.1)
371 	NET_C(J5_2.OUT, C17.2, R38.1, D3.A)
372 	NET_C(R38.2, J5_1.MINUS)
373 	NET_C(J5_1.OUT, R40.1, J4.12)
374 	NET_C(I_V5.Q, R39.1)
375 	NET_C(J5_1.PLUS, R39.2, R40.2)
376 	NET_C(R41.1, D3.K, D2.K, C16.1)
377 
378 	// Second oscillator (middle in schematics).
379 	// Schematic shows frequency of "315 Hz", but when modeled without a
380 	// frontier, the maximum in low gear is 343 Hz.
381 	// With a frontier, uncompensated, this decreases to 329 Hz.
382 
383 	LM3900(J3_3)
384 	LM3900(J3_4)
385 
386 	RES(R31, RES_K(300))
387 	RES(R32, RES_K(150))
388 	RES(R33, RES_K(100))
389 
390 #if CONVERGENCE_FRONTIERS
391 	// Schmitt trigger resistors changed to compensate for waveform changes
392 	// from use of frontier:
393 	RES(R34, RES_K(460))
394 	RES(R35, RES_K(281))
395 #else
396 	RES(R34, RES_K(470))
397 	RES(R35, RES_K(270))
398 #endif
399 
400 	CAP(C15, CAP_U(0.01))
401 
402 	CAP(C16, CAP_U(10))
403 
404 	DIODE(D2, 1N914)
405 
406 	NET_C(R32.2, J4.4)
407 	NET_C(J4.3, J3_3.PLUS)
408 	NET_C(R31.2, J3_3.MINUS, C15.1)
409 	NET_C(J3_3.OUT, C15.2, R33.1, D2.A)
410 	NET_C(R33.2, J3_4.MINUS)
411 	NET_C(J3_4.OUT, R35.1, J4.5)
412 	NET_C(I_V5.Q, R34.1)
413 	NET_C(J3_4.PLUS, R34.2, R35.2)
414 	NET_C(C16.2, MC3340_H2.1)  // to MC3340 input pin
415 
416 	// Third oscillator (topmost in schematics).
417 
418 	// This is the amplitude-modulation oscillator, whose frequency
419 	// differs slightly between 280-ZZZAP and the later games, Laguna
420 	// Racer and Super Speed Race. This difference distinctly changes the
421 	// tone of the engine sound.
422 	// The 280-ZZZAP and Laguna Racer schematics all show a frequency of
423 	// "428 Hz", but for 280-ZZZAP, when equipped with a 110 Kohm resistor
424 	// and modeled without a frontier, the maximum in low gear is 465 Hz;
425 	// with a frontier, uncompensated, this decreases to 442 Hz.
426 	// For Laguna Racer, when equipped with a 100 Kohm resistor and
427 	// modeled without a frontier, the maximum low gear frequency is 511
428 	// Hz; with a frontier, uncompensated, it's 482 Hz.
429 
430 	LM3900(J3_2)
431 	LM3900(J3_1)
432 
433 	RES(R29, RES_K(220))
434 
435 	// The value of resistor R30 is what changes the engine sound between
436 	// 280-ZZZAP and the later games. The 280-ZZZAP schematic indicates
437 	// that it is 110 Kohm in that game. This resistor is hidden on Andrew
438 	// Wellburn's 280-ZZZAP PCB photo, but the sound resulting from 110
439 	// Kohm is more consistent with actual 280-ZZZAP machines than that
440 	// from 100 Kohm.
441 	// The resistor is 100 Kohm in the B622 Laguna Racer and Super Speed
442 	// Race schematics and on the PCB drawings for both Laguna Racer board
443 	// versions, so I assume all Laguna Racer versions had this value.
444 #if (SOUND_VARIANT == VARIANT_280ZZZAP)
445 
446 	RES(R30, RES_K(110))
447 
448 #else // (SOUND_VARIANT == VARIANT_LAGUNAR)
449 
450 	RES(R30, RES_K(100))
451 
452 #endif
453 
454 	RES(R28, RES_K(100))
455 
456 #if CONVERGENCE_FRONTIERS
457 	// Schmitt trigger resistors changed to compensate for waveform changes
458 	// from use of frontier.
459 	// Since the different games have different oscillator frequencies,
460 	// the compensated values of these resistors differ slightly as well.
461 #if (SOUND_VARIANT == VARIANT_280ZZZAP)
462 	RES(R26, RES_K(455))
463 	RES(R27, RES_K(284))
464 #else // (SOUND_VARIANT == VARIANT_LAGUNAR)
465 	RES(R26, RES_K(453))
466 	RES(R27, RES_K(286))
467 #endif
468 #else
469 	RES(R26, RES_K(470))
470 	RES(R27, RES_K(270))
471 #endif
472 
473 	CAP(C14, CAP_U(0.01))
474 
475 	RES(R23, RES_K(10))
476 	NET_C(R23.1, I_V12.Q)
477 
478 	RES(R25, RES_K(3.3))
479 	NET_C(R25.2, GND)
480 
481 	CAP(C13, CAP_U(10))
482 
483 	RES(R22, RES_R(470))
484 
485 	DIODE(D1, 1N914)
486 
487 	NET_C(I_V5.Q, R22.1)
488 	NET_C(ENGINE_SOUND_OFF, R22.2, D1.A)
489 
490 	NET_C(R30.2, J4.1)
491 	NET_C(J4.2, J3_2.PLUS)
492 	NET_C(R29.2, J3_2.MINUS, C14.1)
493 	NET_C(J3_2.OUT, C14.2, R28.1, C13.1)
494 	NET_C(R28.2, J3_1.MINUS)
495 	NET_C(J3_1.OUT, R27.1, J4.13)
496 	NET_C(I_V5.Q, R26.1)
497 	NET_C(J3_1.PLUS, R26.2, R27.2)
498 	NET_C(D1.K, R23.2, C13.2, R25.1, MC3340_H2.2)  // to MC3340 ctrl pin
499 
500 	// The MC3340's output is the complete engine sound, which is sent to
501 	// the final mix.
502 
503 
504 	// **** Noise generation and noise-based sound effects: tire skid
505 	// **** (NOISE_CR_1), boom from crash (BOOM), post-crash noise
506 	// **** (NOISE_CR_2).
507 
508 	// The noise generator circuit for 280-ZZZAP and Laguna Racer is based
509 	// on a reverse-biased 9.1-volt 1N5239 zener diode which generates a
510 	// noisy current for an LM3900 Norton op-amp input. This op-amp then
511 	// amplifies the noise so strongly that its output saturates, randomly
512 	// oscillating between the maximum and mininum values, producing a
513 	// quasi-digital random waveform which is then smoothed and filtered
514 	// by another op-amp to form a continuous analog noise signal.
515 	// Following circuits re-filter and reshape this noise for the
516 	// noise-based sound effects.
517 	//
518 	// The noise of zener diodes is not well controlled during their
519 	// manufacture, and it can vary widely in strength from one part to
520 	// another even within a single production lot. However, this
521 	// op-amp-based noise generator takes zener noise of unpredictable
522 	// strength and converts it into an analog noise stream whose strength
523 	// is predictable, determined by the response of the op-amp circuits.
524 	//
525 	// Super Speed Race generates its noise in a different fashion, using
526 	// a linear-feedback shift register on the main motherboard to
527 	// generate a true digital random noise signal. However, once this
528 	// digital noise has been generated, it gets smoothed and filtered
529 	// into continuous analog form in the same way and is further
530 	// processed through similar sound effect circuits.
531 	//
532 	// Since the noise generator discrete components are unlabeled on the
533 	// 280-ZZZAP and Laguna Racer schematics and are not present in Super
534 	// Speed Race, I've chosen my own labels for them.
535 	//
536 	// The netlist library supports zener diodes, but not zener noise. The
537 	// noise is simulated using an additional source of noise voltage.
538 	// This noise is handled in one of two ways, depending on how the
539 	// netlist is configured.
540 	//
541 	// If the netlist is configured for detailed circuit simulation, the
542 	// noise source is inserted in series between the zener diode's output
543 	// and the op-amp's non-inverting input. This netlist configuration
544 	// tries to accurately reproduce the amplified noise signal which the
545 	// op-amp would generate. Because of the rapidly changing noise signal
546 	// and the op-amp's high gain, however, producing an accurate,
547 	// glitch-free signal requires using dynamic time-stepping with a very
548 	// short minimum time step on the order of 10 nanoseconds. This has an
549 	// unacceptable impact on performance and is unsuitable for real-time
550 	// operation, like in a normal MAME session.
551 	//
552 	// For such operation, a simpler high-level emulation configuration is
553 	// used. Because of the very high gain of the op-amp, the real output
554 	// signal will always lie at either the op-amp's maximum or minimum
555 	// output value, almost never being in between. So we take the same
556 	// input noise signal and replace the op-amp with a simple AFUNC()
557 	// module which only checks the input signal's sign and outputs the
558 	// corresponding maximum or minimum value. This version runs much
559 	// faster, not requiring dynamic time-stepping at all for a
560 	// glitch-free result, and its output is very similar to running the
561 	// detailed emulation with a short minimum timestep. Once the output
562 	// has been smoothed and filtered, the two configurations will be
563 	// effectively identical, and there will be no difference in the
564 	// resulting sound effects except for how fast they are computed.
565 
566 	// 24 kHz noise clock for the noise source, chosen to retain noise
567 	// frequencies as high as possible for 48 kHz sample rate.
568 	CLOCK(NCLK, 24000)
569 	NET_C(I_V5.Q, NCLK.VCC)
570 	NET_C(GND, NCLK.GND)
571 
572 	// Normally-distributed noise of 10 millivolts RMS voltage. With the
573 	// zener passing about 25 microamps of current, the real noise may be
574 	// even stronger than this, but this is strong enough to cause the
575 	// op-amp to saturate its output, which this noise generator is
576 	// designed to do.
577 	// (If the simplified noise generator netlist is being used, the noise
578 	// signal is re-centered on zero volts, and its amplitude no longer
579 	// matters, only its sign.)
580 	SYS_NOISE_MT_N(NOISE, 0.01)
581 
582 	NET_C(NCLK.Q, NOISE.I)
583 
584 	// Both the quasi-digital noise signal produced by the 280-ZZZAP and
585 	// Laguna Racer noise generators and the digital noise signal produced
586 	// by the Super Speed Race noise generator enter at the upstream end
587 	// of capacitor C1.
588 
589 	CAP(C1, CAP_U(10))
590 
591 #if FAST_HLE_NOISE_GEN
592 
593 	// Simplified high-level emulation of the noise generator: oscillate
594 	// between full on and full off according to the sign of the noise
595 	// input.
596 
597 	NET_C(NOISE.1, A_NOISE.A0)
598 	NET_C(NOISE.2, GND)
599 	AFUNC(A_NOISE, 1, "if(A0 > 0, 4.5, 0.03)")
600 
601 	NET_C(A_NOISE.Q, C1.1)
602 
603 #else
604 
605 	// Simple model of a 1N5239 9.1-volt Zener diode. The 1N5239 is
606 	// specified to conduct 20 mA of current at its nominal breakdown
607 	// voltage of 9.1 V. The model produces an exponential I-V curve,
608 	// passing through this point, which has the same general shape as
609 	// that of a normal forward-biased diode. NBV is an exponent scale
610 	// factor; its value here of 1 gives the curve a steep rise and a
611 	// relatively sharp knee. Actual breakdown I-V curves have an even
612 	// steeper rise and sharper knee, too steep and sharp to be
613 	// represented by an exponential, but this model is good enough for
614 	// this emulation, since the diode operates very close to a single
615 	// point on the curve.
616 	ZDIODE(ZD_1N5239, "D(BV=9.1 IBV=0.020 NBV=1)")
617 
618 	RES(RNOISE0, RES_K(100))
619 	CAP(CNOISE0, CAP_U(10))
620 	NET_C(CNOISE0.2, GND)
621 
622 	NET_C(I_V12.Q, RNOISE0.1)
623 	NET_C(RNOISE0.2, CNOISE0.1, ZD_1N5239.K)
624 
625 	LM3900(H4_2)
626 
627 	NET_C(I_V5.Q, H4_2.VCC)
628 	NET_C(GND, H4_2.GND)
629 
630 	RES(RNOISE1, RES_K(56))
631 	RES(RNOISE2, RES_K(47))
632 	RES(RNOISE3, RES_K(1))
633 
634 	CAP(CNOISE, CAP_U(10))
635 
636 	NET_C(CNOISE.1, RNOISE1.1, RNOISE2.1)
637 	NET_C(CNOISE.2, GND)
638 	NET_C(H4_2.MINUS, RNOISE1.2)
639 	NET_C(ZD_1N5239.A, NOISE.1)
640 	NET_C(H4_2.PLUS, NOISE.2)
641 	NET_C(H4_2.OUT, RNOISE2.2, RNOISE3.1, C1.1)
642 	NET_C(RNOISE3.2, GND)
643 
644 #endif
645 
646 	NET_C(C1.2, R1.1)
647 
648 	// The noise generator is followed by a single-amplifier active
649 	// low-pass filter with a corner frequency of about 6.3 kHz, a very
650 	// broad Q of 0.014, and a gain of about 0.8. This filter attenuates
651 	// the very highest noise frequencies, converting the initial
652 	// quasi-digital noise waveform into a smoother analog noise waveform
653 	// that is still of pretty high frequency.
654 
655 	RES(R1, RES_K(330))  // 680 Kohm in Super Speed Race
656 
657 	LM3900(H4_1)
658 
659 	CAP(C2, CAP_P(6800))
660 	RES(R2, RES_K(10))
661 	RES(R3, RES_K(820))
662 	RES(R4, RES_K(270))
663 	CAP(C3, CAP_P(220))
664 
665 	NET_C(R1.2, C2.1, R2.1, R4.1)
666 	NET_C(C2.2, GND)
667 	NET_C(H4_1.MINUS, R2.2, C3.1)
668 	NET_C(I_V5.Q, R3.1)
669 	NET_C(H4_1.PLUS, R3.2)
670 	NET_C(H4_1.OUT, C3.2, R4.2, R5.1, R17.1, C5.1, C4.1)
671 
672 	// The smoothed analog noise is passed to three different sound-effect
673 	// circuits, each of which is also an active-filter type.
674 
675 	// First noise circuit: tire skid (NOISE_CR_1)
676 
677 	// This is a two-amplifier active bandpass filter with a center
678 	// frequency of about 1 kHz and a high Q value of 25, giving a
679 	// narrow bandwidth of 40 Hz. The gain is about 15.
680 
681 	// The result is a high-pitched "tire skid" screeching sound.
682 
683 	// The circuit appears to be taken practically verbatim from page 19 of
684 	// National Semiconductor's Application Note 72 about the LM3900.
685 
686 	CD4016_DIP(G4)
687 
688 	LM3900(H4_3)
689 
690 	RES(R5, RES_K(39))
691 	RES(R6, RES_R(62))
692 	RES(R7, RES_K(82))
693 	RES(R8, RES_K(39))
694 
695 	CAP(C7, CAP_U(0.1))
696 	CAP(C8, CAP_U(0.1))
697 
698 	NET_C(R5.2, R6.1, C7.1, C8.1, R12.1)
699 	NET_C(R6.2, GND)
700 	NET_C(H4_3.MINUS, C7.2, R8.1)
701 	NET_C(I_V5.Q, R7.1)
702 	NET_C(H4_3.PLUS, R7.2)
703 	NET_C(H4_3.OUT, R8.2, C8.2, R9.1)
704 
705 	// Super Speed Race has an extra CD4016 switch (controlled by the same
706 	// NOISE_CR_1 control line as the one at the end of this circuit) and
707 	// a 0.1 uF capacitor between H4_3.OUT and R9.1 here.
708 
709 	LM3900(H4_4)
710 
711 	// For resistor R11, the value given is that shown in the Laguna Racer
712 	// PCB drawings, the Laguna Racer B622 board schematic, the Super
713 	// Speed Race schematic, and Andrew Wellburn's 280-ZZZAP PCB photo. In
714 	// the 280-ZZZAP schematic and the near-copy Laguna Racer A622 board
715 	// schematic, R11 is 100 Kohms, but this seems to be a schematic
716 	// error. (The original National Semiconductor Application Note 72
717 	// from which this circuit was apparently taken also uses 120 Kohm for
718 	// R11.)
719 	RES(R9, RES_K(39))
720 	RES(R10, RES_K(62))   // 240 Kohm in Super Speed Race
721 	RES(R11, RES_K(120))
722 	RES(R12, RES_K(62))
723 
724 	NET_C(H4_4.MINUS, R9.2, R11.1)
725 	NET_C(I_V5.Q, R10.1)
726 	NET_C(H4_4.PLUS, R10.2)
727 	NET_C(H4_4.OUT, R11.2, R12.2, G4.4)
728 	NET_C(G4.3, R63.1)
729 	NET_C(G4.5, NOISE_CR_1)
730 
731 	// Second noise circuit: post-crash noise (NOISE_CR_2)
732 
733 	// This circuit is peculiar. It's structured like a single-amplifier
734 	// active low-pass filter, with a corner frequency of about 1 kHz and
735 	// a gain of 100--but its Q factor turns out to be a small *negative*
736 	// number. (I'm not sure what effect this has on a filter, but it
737 	// might indicate instability.)
738 
739 	// The result is saturated, heavily clipped noise with frequencies
740 	// mainly below 1 kHz.
741 
742 	// I don't know why the circuit was designed this way, or whether it
743 	// was deliberate or a design or production error which the makers
744 	// decided they liked or at least could accept. It doesn't look like
745 	// they fixed it later; this same circuit is unchanged in the
746 	// schematics for all three games.
747 
748 	RES(R17, RES_K(10))
749 
750 	CAP(C5, CAP_U(10))
751 	CAP(C4, CAP_U(0.022))
752 
753 	LM3900(H5_2)
754 
755 	RES(R16, RES_K(1.5))
756 	RES(R15, RES_K(15))
757 	RES(R14, RES_M(2.7))
758 	RES(R13, RES_K(150))
759 
760 	CAP(C6, CAP_U(0.01))
761 	CAP(C9, CAP_U(0.001))
762 
763 	NET_C(C4.2, R16.1)
764 	NET_C(R16.2, C6.1, R15.1, R13.1)
765 	NET_C(C6.2, GND)
766 	NET_C(H5_2.MINUS, R15.2, C9.1)
767 	NET_C(I_V5.Q, R14.1)
768 	NET_C(H5_2.PLUS, R14.2)
769 #if REMOVE_POST_CRASH_NOISE_GLITCHES
770 	// With the static time-stepping used to ensure acceptable performance
771 	// with MAME, this part of the netlist will generate extra spikes on
772 	// the op-amp output with voltages outside of the real op-amp's output
773 	// range. These spikes give the sound an unwanted "grittiness" not in
774 	// the original, so I've added a voltage-limiting AFUNC to the op-amp
775 	// output beyond its feedback connection. This gives a smoother sound,
776 	// closer to the original.
777 
778 	NET_C(H5_2.OUT, C9.2, R13.2, H5_2_LIM.A0)
779 	AFUNC(H5_2_LIM, 1, "max(min(A0, 4.5), 0)")
780 	NET_C(H5_2_LIM.Q, G4.8)
781 #else
782 	NET_C(H5_2.OUT, C9.2, R13.2, G4.8)
783 #endif
784 	NET_C(G4.9, R64.1)
785 	NET_C(G4.6, NOISE_CR_2)
786 
787 	// Third noise circuit: boom from crash (BOOM)
788 
789 	// This is a single-amplifier active bandpass filter with a center
790 	// frequency of about 60 Hz and a high Q value of about 19, giving a
791 	// narrow 3 Hz bandwidth. The gain is also very high, a little over
792 	// 200.
793 
794 	// The filter is normally cut off from the noise signal, and thus it
795 	// remains quiet. When the BOOM signal is activated, CD4016 switch
796 	// G4_A opens, letting in the noise to be filtered and amplified until
797 	// the switch is cut off again, generating a loud, fairly deep "boom".
798 	// (The "boom" doesn't have much decay, though; it gets cut abruptly.)
799 
800 	LM3900(H5_1)
801 
802 	// Resistor R18, part of the BOOM filter, is 2.2 Kohms on the
803 	// 280-ZZZAP schematic as well as in Laguna Racer, but the 280-ZZZAP
804 	// schematic has a note "E" saying that the first 325 machines had a
805 	// 6.8 Kohm resistor here instead. Andrew Wellburn's 280-ZZZAP board
806 	// photo may show such a resistor. With this larger resistor, the
807 	// filter's values are: center frequency 54 Hz, Q 16.9, gain 73.5; so
808 	// the filter is slightly broader, pitched a bit lower, and has only a
809 	// third as much gain. Still, the basic effect is the same.
810 	RES(R18, RES_K(2.2))  // 20 Kohm in Super Speed Race
811 
812 	RES(R19, RES_K(1))
813 	RES(R20, RES_M(3.3))
814 	RES(R21, RES_M(1))    // 1.5 Mohm in Super Speed Race
815 
816 	CAP(C10, CAP_U(0.1))
817 	CAP(C11, CAP_U(0.1))
818 
819 	NET_C(R17.2, C5.2, G4.1)
820 	NET_C(G4.2, R18.1)
821 	NET_C(G4.13, BOOM)
822 	NET_C(R18.2, R19.1, C10.1, C11.1)
823 	NET_C(R19.2, GND)
824 	NET_C(H5_1.MINUS, C10.2, R21.1)
825 	NET_C(I_V5.Q, R20.1)
826 	NET_C(H5_1.PLUS, R20.2)
827 	NET_C(H5_1.OUT, R21.2, C11.2, R65.1)
828 
829 
830 	// **** Final mix of sound effects and sound preamplification.
831 
832 	// The preamplification stage after the final mix has two LM3900
833 	// op-amps. The audio power amplifier beyond it is a National
834 	// Semiconductor LM377 integrated dual power amp, with two 2-watt
835 	// power amps on the same chip. Both of these power amps drive the
836 	// single speaker from opposite ends in a push-pull fashion, a
837 	// so-called "bridge configuration" which effectively converts the
838 	// dual 2-watt power amp into a single 4-watt amp.
839 
840 	// The two power amps get their inputs from the outputs of the two
841 	// LM3900 op-amps. The first LM3900, J5_3, pre-amplifies the signal
842 	// from the final mix and has a master volume potentiometer to control
843 	// its gain. Its output gets sent directly to one power amp and is
844 	// also passed to the second LM3900, J5_4, which inverts the signal
845 	// without changing the gain. The inverted signal is sent to the
846 	// second power amp that drives the speaker's other end. The first
847 	// LM3900 is AC-coupled to the second, and both are AC-coupled to the
848 	// power amps. As a result, the output signal of the second LM3900
849 	// more closely resembles the final output in waveform and tone
850 	// quality than the first LM3900's output does, so I have chosen the
851 	// second LM3900 as the final output for the emulation. The power amps
852 	// themselves are not emulated.
853 
854 	// The master volume potentiometer is user-adjustable and is set to
855 	// its midpoint by default. Higher settings may produce clipped,
856 	// distorted output, but since the power amps are configured for a
857 	// voltage gain of 20 and use a 20 V power supply, this is likely true
858 	// for the original hardware as well.
859 
860 	RES(R63, RES_K(12))  // 3 Kohm in Super Speed Race
861 	RES(R64, RES_K(150))
862 
863 	// Resistor R65, the mixing resistor for the BOOM effect, is 12 Kohms
864 	// on the 280-ZZZAP schematic and in Laguna Racer and Super Speed
865 	// Race, but the 280-ZZZAP schematic has a note "F" saying that the
866 	// first 325 machines had a 4.3 Kohm resistor here instead. Andrew
867 	// Wellburn's 280-ZZZAP board photo shows such a resistor. The lower
868 	// resistor makes the BOOM effect much louder, countering the reduced
869 	// gain on its generating filter described above. In fact, it makes it
870 	// loud enough to be clipped by the post-mixer op-amps; turning down
871 	// the volume to prevent this clipping makes all other sounds quieter
872 	// by comparison. This may explain why both the mixing resistor and
873 	// the filter resistor were changed in later machines.
874 	RES(R65, RES_K(12))
875 
876 	RES(R66, RES_K(33))
877 
878 	CAP(C20, CAP_U(10))
879 	CAP(C21, CAP_U(10))
880 
881 	NET_C(R63.2, R64.2, R65.2, C20.1)
882 	NET_C(MC3340_H2.7, R66.1)  // MC3340 output pin
883 	NET_C(R66.2, C21.1)
884 
885 	LM3900(J5_3)
886 	LM3900(J5_4)
887 
888 	RES(R67, RES_K(2))
889 	CAP(C22, CAP_U(10))
890 	RES(R68, RES_K(220))
891 	RES(R74, RES_K(220))
892 
893 	NET_C(I_V5.Q, R67.1)
894 	NET_C(R67.2, C22.1, R68.1, R74.1)
895 	NET_C(C22.2, GND)
896 	NET_C(J5_3.PLUS, R68.2)
897 	NET_C(J5_4.PLUS, R74.2)
898 
899 	RES(R69, RES_K(100))
900 	POT2(R70, RES_K(10))  // Master volume potentiometer (2 terminals)
901 	CAP(C23, CAP_U(10))
902 	CAP(C24, CAP_U(0.1))
903 	RES(R73, RES_K(100))
904 	RES(R75, RES_K(100))
905 
906 	NET_C(R70.2, C23.2)
907 	NET_C(J5_3.MINUS, C20.2, C21.2, R69.1, R70.1)
908 	NET_C(J5_3.OUT, C23.1, R69.2, C24.1)
909 	NET_C(C24.2, R73.1)
910 	NET_C(J5_4.MINUS, R73.2, R75.1)
911 	NET_C(J5_4.OUT, R75.2)
912 
913 	ALIAS(OUTPUT, J5_4.OUT)
914 
915 NETLIST_END()
916 
917 
918 #if (SOUND_VARIANT == VARIANT_280ZZZAP)
919 
920 NETLIST_START(280zzzap)
921 
922 #else // (SOUND_VARIANT == VARIANT_LAGUNAR)
923 
924 NETLIST_START(lagunar)
925 
926 #endif
927 
928 	SOLVER(Solver, 48000)
929 
930 #if !(FAST_HLE_NOISE_GEN)
931 	PARAM(Solver.DYNAMIC_TS, 1)
932 	// 10 ns is the minimum timestep to avoid significant spikes outside
933 	// the allowed LM3900 output region of 0-4.5 V; even 20 ns gives
934 	// frequent spikes into the 4.5-5 volt region.
935 	PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 1e-8)
936 #endif
937 
938 	// All together, loosening both tolerances and reducing accuracy
939 	// increases speed by ~10%, but it also causes audible "crackling".
940 //  PARAM(Solver.RELTOL, 1e-2) // default 1e-3 (several % faster, but < quality)
941 //  PARAM(Solver.VNTOL, 5e-3)  // default 1e-7 (several % faster, but < quality)
942 //  PARAM(Solver.ACCURACY, 1e-3)  // default 1e-7  (few % faster)
943 
944 //  PARAM(Solver.DYNAMIC_TS, 1)
945 //  PARAM(Solver.DYNAMIC_LTE, 1e-4)  // default 1e-5
946 //  PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 1e-8)  // default 1e-6
947 
948 	ANALOG_INPUT(I_V12, 12)
949 	ANALOG_INPUT(I_V5, 5)
950 
951 #if (SOUND_VARIANT == VARIANT_280ZZZAP)
952 
953 	LOCAL_SOURCE(280zzzap_schematics)
954 	INCLUDE(280zzzap_schematics)
955 
956 #else // (SOUND_VARIANT == VARIANT_LAGUNAR)
957 
958 	LOCAL_SOURCE(lagunar_schematics)
959 	INCLUDE(lagunar_schematics)
960 
961 #endif
962 
963 	// The MC3340 gets 12-volt power in 280-ZZZAP and Laguna Racer.
964 	// In Super Speed Race it gets 5-volt power.
965 	NET_C(I_V12.Q, MC3340_H2.8)
966 	NET_C(GND, MC3340_H2.3)
967 
968 	// Logic inputs which represent output pins from 74174 latches at F4
969 	// and F5
970 	LOGIC_INPUT(I_F4_2, 0, "74XX")  // BOOM
971 	LOGIC_INPUT(I_F4_5, 0, "74XX")  // labeled "ENGINE SOUND", but really
972 					// an "engine sound off" flag
973 	LOGIC_INPUT(I_F4_7, 0, "74XX")  // NOISE CR 1
974 	LOGIC_INPUT(I_F4_10, 0, "74XX")  // NOISE CR 2
975 	LOGIC_INPUT(I_F5_2, 0, "74XX")  // PEDAL_BIT0
976 	LOGIC_INPUT(I_F5_5, 0, "74XX")  // PEDAL_BIT1
977 	LOGIC_INPUT(I_F5_7, 0, "74XX")  // PEDAL_BIT2
978 	LOGIC_INPUT(I_F5_10, 0, "74XX")  // PEDAL_BIT3
979 	LOGIC_INPUT(I_F5_12, 0, "74XX")  // HI SHIFT
980 	LOGIC_INPUT(I_F5_15, 0, "74XX")  // LO SHIFT
981 
982 	ALIAS(I_BOOM, I_F4_2.IN)
983 	ALIAS(I_ENGINE_SOUND_OFF, I_F4_5.IN)
984 	ALIAS(I_NOISE_CR_1, I_F4_7.IN)
985 	ALIAS(I_NOISE_CR_2, I_F4_10.IN)
986 	ALIAS(I_PEDAL_BIT0, I_F5_2.IN)
987 	ALIAS(I_PEDAL_BIT1, I_F5_5.IN)
988 	ALIAS(I_PEDAL_BIT2, I_F5_7.IN)
989 	ALIAS(I_PEDAL_BIT3, I_F5_10.IN)
990 	ALIAS(I_HI_SHIFT, I_F5_12.IN)
991 	ALIAS(I_LO_SHIFT, I_F5_15.IN)
992 
993 	ALIAS(BOOM, I_F4_2.Q)
994 	ALIAS(ENGINE_SOUND_OFF, I_F4_5.Q)
995 	ALIAS(NOISE_CR_1, I_F4_7.Q)
996 	ALIAS(NOISE_CR_2, I_F4_10.Q)
997 	ALIAS(PEDAL_BIT0, I_F5_2.Q)
998 	ALIAS(PEDAL_BIT1, I_F5_5.Q)
999 	ALIAS(PEDAL_BIT2, I_F5_7.Q)
1000 	ALIAS(PEDAL_BIT3, I_F5_10.Q)
1001 	ALIAS(HI_SHIFT, I_F5_12.Q)
1002 	ALIAS(LO_SHIFT, I_F5_15.Q)
1003 
1004 	// Power pins for logic inputs:
1005 	NET_C(I_V5.Q,
1006 		  I_F4_2.VCC, I_F4_5.VCC, I_F4_7.VCC, I_F4_10.VCC,
1007 		  I_F5_2.VCC, I_F5_5.VCC, I_F5_7.VCC, I_F5_10.VCC,
1008 		  I_F5_12.VCC, I_F5_15.VCC)
1009 	NET_C(GND,
1010 		  I_F4_2.GND, I_F4_5.GND, I_F4_7.GND, I_F4_10.GND,
1011 		  I_F5_2.GND, I_F5_5.GND, I_F5_7.GND, I_F5_10.GND,
1012 		  I_F5_12.GND, I_F5_15.GND)
1013 
1014 	// Power inputs for the LM3900 op-amps. These aren't shown on the
1015 	// schematics, but it looks like 5-volt power is needed to get proper
1016 	// results.
1017 	// (H4_2, the noise generator op-amp, is not listed here because it's
1018 	// inside the #else clause of the #if FAST_HLE_NOISE_GEN conditional.)
1019 	NET_C(I_V5.Q,
1020 		H4_1.VCC, H4_3.VCC, H4_4.VCC,
1021 		H5_1.VCC, H5_2.VCC, H5_3.VCC, H5_4.VCC,
1022 		J3_1.VCC, J3_2.VCC, J3_3.VCC, J3_4.VCC,
1023 		J5_1.VCC, J5_2.VCC, J5_3.VCC, J5_4.VCC)
1024 	NET_C(GND,
1025 		H4_1.GND, H4_3.GND, H4_4.GND,
1026 		H5_1.GND, H5_2.GND, H5_3.GND, H5_4.GND,
1027 		J3_1.GND, J3_2.GND, J3_3.GND, J3_4.GND,
1028 		J5_1.GND, J5_2.GND, J5_3.GND, J5_4.GND)
1029 
1030 	// Power inputs for the CD4016 switches. Again, these aren't shown on
1031 	// the schematics, but 5-volt power must be used for the switches to
1032 	// handle the voltage levels they are switching.
1033 	NET_C(I_V5.Q, G5.14, J4.14, G4.14)
1034 	NET_C(GND, G5.7, J4.7, G4.7)
1035 	// Switches G5_D, J4_C, and G4_D are unused.
1036 	NET_C(GND, G5.10, G5.11, G5.12, J4.6, J4.8, J4.9, G4.10, G4.11, G4.12)
1037 
1038 	// Frontier after output of noise generator.
1039 	// FIXME: Anomaly - with FAST_HLE_NOISE_GEN set, this frontier cannot
1040 	// be removed, because doing so kills the noise entirely, even though
1041 	// the AFUNC is still generating the same output. Perhaps an AFUNC
1042 	// output by itself won't change the capacitor state?
1043 	OPTIMIZE_FRONTIER(C1.1, RES_M(1), 50)
1044 
1045 	// Frontier before skid screech generator.
1046 	OPTIMIZE_FRONTIER(R5.1, RES_K(39), 50)
1047 	// (Adding a frontier *after* the skid screech generator makes the
1048 	// sudden jumps in signal level on skids much larger, so the resulting
1049 	// clicks are louder and more objectionable. Also it does little or
1050 	// nothing for speed. That's why I don't have such a frontier.)
1051 
1052 	// Frontiers after NOISE CR 2 and BOOM generators.
1053 	OPTIMIZE_FRONTIER(R64.1, RES_K(150), 50)
1054 	OPTIMIZE_FRONTIER(R65.1, RES_K(12), 50)
1055 
1056 	// Frontier after engine sound generation.
1057 	OPTIMIZE_FRONTIER(R66.1, RES_K(33), 50)
1058 
1059 	// Frontiers before MC3340 inputs.
1060 	OPTIMIZE_FRONTIER(C16.1, RES_M(1), 50)
1061 	OPTIMIZE_FRONTIER(C13.1, RES_M(1), 50)
1062 
1063 	// Frontiers before engine sound op-amp oscillators.
1064 	OPTIMIZE_FRONTIER(R36.1, RES_K(560), 50)
1065 	OPTIMIZE_FRONTIER(R37.1, RES_K(270), 50)
1066 	OPTIMIZE_FRONTIER(R31.1, RES_K(300), 50)
1067 	OPTIMIZE_FRONTIER(R32.1, RES_K(150), 50)
1068 	OPTIMIZE_FRONTIER(R29.1, RES_K(220), 50)
1069 #if (SOUND_VARIANT == VARIANT_280ZZZAP)
1070 	OPTIMIZE_FRONTIER(R30.1, RES_K(110), 50)
1071 #else // (SOUND_VARIANT == VARIANT_LAGUNAR)
1072 	OPTIMIZE_FRONTIER(R30.1, RES_K(100), 50)
1073 #endif
1074 
1075 #if CONVERGENCE_FRONTIERS
1076 	// Frontiers at Schmitt trigger op-amp outputs of engine sound
1077 	// oscillators, to eliminate numeric instability and speed convergence
1078 	// rather than to partition matrices. The resistor values given are
1079 	// the modified ones which compensate for how the frontiers would
1080 	// otherwise change the oscillator waveforms.
1081 	OPTIMIZE_FRONTIER(R40.1, RES_K(275), 50)
1082 	OPTIMIZE_FRONTIER(R35.1, RES_K(281), 50)
1083 #if (SOUND_VARIANT == VARIANT_280ZZZAP)
1084 	OPTIMIZE_FRONTIER(R27.1, RES_K(284), 50)
1085 #else // (SOUND_VARIANT == VARIANT_LAGUNAR)
1086 	OPTIMIZE_FRONTIER(R27.1, RES_K(286), 50)
1087 #endif
1088 #endif
1089 
1090 NETLIST_END()
1091 
1092 
1093 #endif
1094