Discrete cleanups and fixed discrete logging.

This commit is contained in:
Derrick Renaud 2008-08-20 01:02:57 +00:00
parent 39ea677641
commit 384422ee09
20 changed files with 1634 additions and 1414 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,22 +39,22 @@ struct dss_filter2_context
struct dst_op_amp_filt_context struct dst_op_amp_filt_context
{ {
int type; // What kind of filter int type; /* What kind of filter */
int is_norton; // 1 = Norton op-amps int is_norton; /* 1 = Norton op-amps */
double vRef; double vRef;
double vP; double vP;
double vN; double vN;
double rTotal; // All input resistance in parallel. double rTotal; /* All input resistance in parallel. */
double iFixed; // Current supplied by r3 & r4 if used. double iFixed; /* Current supplied by r3 & r4 if used. */
double exponentC1; double exponentC1;
double exponentC2; double exponentC2;
double exponentC3; double exponentC3;
double rRatio; // divide ratio of resistance network double rRatio; /* divide ratio of resistance network */
double vC1; // Charge on C1 double vC1; /* Charge on C1 */
double vC1b; // Charge on C1, part of C1 charge if needed double vC1b; /* Charge on C1, part of C1 charge if needed */
double vC2; // Charge on C2 double vC2; /* Charge on C2 */
double vC3; // Charge on C2 double vC3; /* Charge on C2 */
double gain; // Gain of the filter double gain; /* Gain of the filter */
double x1, x2; /* x[k-1], x[k-2], previous 2 input values */ double x1, x2; /* x[k-1], x[k-2], previous 2 input values */
double y1, y2; /* y[k-1], y[k-2], previous 2 output values */ double y1, y2; /* y[k-1], y[k-2], previous 2 output values */
double a1,a2; /* digital filter coefficients, denominator */ double a1,a2; /* digital filter coefficients, denominator */
@ -64,18 +64,18 @@ struct dst_op_amp_filt_context
struct dst_rcdisc_context struct dst_rcdisc_context
{ {
int state; int state;
double t; // time double t; /* time */
double f; // RCINTEGRATE double f; /* RCINTEGRATE */
double R1; // RCINTEGRATE double R1; /* RCINTEGRATE */
double R2; // RCINTEGRATE double R2; /* RCINTEGRATE */
double R3; // RCINTEGRATE double R3; /* RCINTEGRATE */
double C; // RCINTEGRATE double C; /* RCINTEGRATE */
double vCap; // RCDISC_MOD double vCap; /* RCDISC_MOD */
double vCE; // RCINTEGRATE double vCE; /* RCINTEGRATE */
double exponent0; double exponent0;
double exponent1; double exponent1;
double exp_exponent0;// RCINTEGRATE double exp_exponent0;/* RCINTEGRATE */
double exp_exponent1;// RCINTEGRATE double exp_exponent1;/* RCINTEGRATE */
}; };
struct dst_rcdisc4_context struct dst_rcdisc4_context
@ -109,7 +109,7 @@ struct dst_rcfilter_sw_context
* input[4] - Voltage reference. Usually 0V. * input[4] - Voltage reference. Usually 0V.
* *
************************************************************************/ ************************************************************************/
#define DST_CRFILTER__ENABLE (*(node->input[0])) #define DST_CRFILTER__ENABLE (*(node->input[0]))
#define DST_CRFILTER__IN (*(node->input[1])) #define DST_CRFILTER__IN (*(node->input[1]))
#define DST_CRFILTER__R (*(node->input[2])) #define DST_CRFILTER__R (*(node->input[2]))
#define DST_CRFILTER__C (*(node->input[3])) #define DST_CRFILTER__C (*(node->input[3]))
@ -135,8 +135,8 @@ static void dst_crfilter_reset(node_description *node)
struct dst_rcfilter_context *context = node->context; struct dst_rcfilter_context *context = node->context;
context->exponent = -1.0 / (DST_CRFILTER__R * DST_CRFILTER__C * discrete_current_context->sample_rate); context->exponent = -1.0 / (DST_CRFILTER__R * DST_CRFILTER__C * discrete_current_context->sample_rate);
context->exponent = 1.0 - exp(context->exponent); context->exponent = 1.0 - exp(context->exponent);
context->vCap = 0; context->vCap = 0;
node->output[0] = DST_CRFILTER__IN; node->output[0] = DST_CRFILTER__IN;
} }
@ -186,6 +186,7 @@ static void calculate_filter1_coefficients(double fc, double type,
static void dst_filter1_step(node_description *node) static void dst_filter1_step(node_description *node)
{ {
struct dss_filter1_context *context = node->context; struct dss_filter1_context *context = node->context;
\
double gain = 1.0; double gain = 1.0;
if (DST_FILTER1__ENABLE == 0.0) if (DST_FILTER1__ENABLE == 0.0)
@ -204,7 +205,7 @@ static void dst_filter1_reset(node_description *node)
struct dss_filter1_context *context = node->context; struct dss_filter1_context *context = node->context;
calculate_filter1_coefficients(DST_FILTER1__FREQ, DST_FILTER1__TYPE, &context->a1, &context->b0, &context->b1); calculate_filter1_coefficients(DST_FILTER1__FREQ, DST_FILTER1__TYPE, &context->a1, &context->b0, &context->b1);
node->output[0]=0; node->output[0] = 0;
} }
@ -237,29 +238,29 @@ static void calculate_filter2_coefficients(double fc, double d, double type,
/* calculate digital filter coefficents */ /* calculate digital filter coefficents */
/*w = 2.0*M_PI*fc; no pre-warping */ /*w = 2.0*M_PI*fc; no pre-warping */
w = discrete_current_context->sample_rate*2.0*tan(M_PI*fc/discrete_current_context->sample_rate); /* pre-warping */ w = discrete_current_context->sample_rate * 2.0 * tan(M_PI * fc / discrete_current_context->sample_rate); /* pre-warping */
w_squared = w*w; w_squared = w * w;
den = two_over_T_squared + d*w*two_over_T + w_squared; den = two_over_T_squared + d*w*two_over_T + w_squared;
*a1 = 2.0*(-two_over_T_squared + w_squared)/den; *a1 = 2.0 * (-two_over_T_squared + w_squared) / den;
*a2 = (two_over_T_squared - d*w*two_over_T + w_squared)/den; *a2 = (two_over_T_squared - d * w * two_over_T + w_squared) / den;
if (type == DISC_FILTER_LOWPASS) if (type == DISC_FILTER_LOWPASS)
{ {
*b0 = *b2 = w_squared/den; *b0 = *b2 = w_squared/den;
*b1 = 2.0*(*b0); *b1 = 2.0 * (*b0);
} }
else if (type == DISC_FILTER_BANDPASS) else if (type == DISC_FILTER_BANDPASS)
{ {
*b0 = d*w*two_over_T/den; *b0 = d * w * two_over_T / den;
*b1 = 0.0; *b1 = 0.0;
*b2 = -(*b0); *b2 = -(*b0);
} }
else if (type == DISC_FILTER_HIGHPASS) else if (type == DISC_FILTER_HIGHPASS)
{ {
*b0 = *b2 = two_over_T_squared/den; *b0 = *b2 = two_over_T_squared / den;
*b1 = -2.0*(*b0); *b1 = -2.0 * (*b0);
} }
else else
{ {
@ -270,6 +271,7 @@ static void calculate_filter2_coefficients(double fc, double d, double type,
static void dst_filter2_step(node_description *node) static void dst_filter2_step(node_description *node)
{ {
struct dss_filter2_context *context = node->context; struct dss_filter2_context *context = node->context;
double gain = 1.0; double gain = 1.0;
if (DST_FILTER2__ENABLE == 0.0) if (DST_FILTER2__ENABLE == 0.0)
@ -277,8 +279,8 @@ static void dst_filter2_step(node_description *node)
gain = 0.0; gain = 0.0;
} }
node->output[0] = -context->a1*context->y1 - context->a2*context->y2 + node->output[0] = -context->a1 * context->y1 - context->a2 * context->y2 +
context->b0*gain*DST_FILTER2__IN + context->b1*context->x1 + context->b2*context->x2; context->b0 * gain * DST_FILTER2__IN + context->b1 * context->x1 + context->b2 * context->x2;
context->x2 = context->x1; context->x2 = context->x1;
context->x1 = gain * DST_FILTER2__IN; context->x1 = gain * DST_FILTER2__IN;
@ -293,7 +295,7 @@ static void dst_filter2_reset(node_description *node)
calculate_filter2_coefficients(DST_FILTER2__FREQ, DST_FILTER2__DAMP, DST_FILTER2__TYPE, calculate_filter2_coefficients(DST_FILTER2__FREQ, DST_FILTER2__DAMP, DST_FILTER2__TYPE,
&context->a1, &context->a2, &context->a1, &context->a2,
&context->b0, &context->b1, &context->b2); &context->b0, &context->b1, &context->b2);
node->output[0]=0; node->output[0] = 0;
} }
/************************************************************************ /************************************************************************
@ -315,6 +317,7 @@ static void dst_filter2_reset(node_description *node)
static void dst_sallen_key_step(node_description *node) static void dst_sallen_key_step(node_description *node)
{ {
struct dss_filter2_context *context = node->context; struct dss_filter2_context *context = node->context;
double gain = 1.0; double gain = 1.0;
if (DST_SALLEN_KEY__ENABLE == 0.0) if (DST_SALLEN_KEY__ENABLE == 0.0)
@ -322,8 +325,8 @@ static void dst_sallen_key_step(node_description *node)
gain = 0.0; gain = 0.0;
} }
node->output[0] = -context->a1*context->y1 - context->a2*context->y2 + node->output[0] = -context->a1 * context->y1 - context->a2 * context->y2 +
context->b0*gain*DST_SALLEN_KEY__INP0 + context->b1*context->x1 + context->b2*context->x2; context->b0 * gain * DST_SALLEN_KEY__INP0 + context->b1 * context->x1 + context->b2 * context->x2;
context->x2 = context->x1; context->x2 = context->x1;
context->x1 = gain * DST_SALLEN_KEY__INP0; context->x1 = gain * DST_SALLEN_KEY__INP0;
@ -333,8 +336,9 @@ static void dst_sallen_key_step(node_description *node)
static void dst_sallen_key_reset(node_description *node) static void dst_sallen_key_reset(node_description *node)
{ {
struct dss_filter2_context *context = node->context; struct dss_filter2_context *context = node->context;
const discrete_op_amp_filt_info *info = node->custom; const discrete_op_amp_filt_info *info = node->custom;
double freq, q; double freq, q;
switch ((int) DST_SALLEN_KEY__TYPE) switch ((int) DST_SALLEN_KEY__TYPE)
@ -350,7 +354,7 @@ static void dst_sallen_key_reset(node_description *node)
calculate_filter2_coefficients(freq, 1.0 / q, DISC_FILTER_LOWPASS, calculate_filter2_coefficients(freq, 1.0 / q, DISC_FILTER_LOWPASS,
&context->a1, &context->a2, &context->a1, &context->a2,
&context->b0, &context->b1, &context->b2); &context->b0, &context->b1, &context->b2);
node->output[0]=0; node->output[0] = 0;
} }
/************************************************************************ /************************************************************************
@ -373,10 +377,10 @@ static void dst_sallen_key_reset(node_description *node)
static void dst_op_amp_filt_step(node_description *node) static void dst_op_amp_filt_step(node_description *node)
{ {
const discrete_op_amp_filt_info *info = node->custom; const discrete_op_amp_filt_info *info = node->custom;
struct dst_op_amp_filt_context *context = node->context; struct dst_op_amp_filt_context *context = node->context;
double i, v=0; double i, v = 0;
if (DST_OP_AMP_FILT__ENABLE) if (DST_OP_AMP_FILT__ENABLE)
{ {
@ -388,7 +392,7 @@ static void dst_op_amp_filt_step(node_description *node)
else else
{ {
/* Millman the input voltages. */ /* Millman the input voltages. */
i = context->iFixed; i = context->iFixed;
i += (DST_OP_AMP_FILT__INP1 - context->vRef) / info->r1; i += (DST_OP_AMP_FILT__INP1 - context->vRef) / info->r1;
if (info->r2 != 0) if (info->r2 != 0)
i += (DST_OP_AMP_FILT__INP2 - context->vRef) / info->r2; i += (DST_OP_AMP_FILT__INP2 - context->vRef) / info->r2;
@ -433,8 +437,8 @@ static void dst_op_amp_filt_step(node_description *node)
case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M: case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M:
case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M | DISC_OP_AMP_IS_NORTON: case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M | DISC_OP_AMP_IS_NORTON:
node->output[0] = -context->a1*context->y1 - context->a2*context->y2 + node->output[0] = -context->a1 * context->y1 - context->a2 * context->y2 +
context->b0*v + context->b1*context->x1 + context->b2*context->x2 + context->b0 * v + context->b1 * context->x1 + context->b2 * context->x2 +
context->vRef; context->vRef;
context->x2 = context->x1; context->x2 = context->x1;
context->x1 = v; context->x1 = v;
@ -456,8 +460,8 @@ static void dst_op_amp_filt_step(node_description *node)
static void dst_op_amp_filt_reset(node_description *node) static void dst_op_amp_filt_reset(node_description *node)
{ {
const discrete_op_amp_filt_info *info = node->custom; const discrete_op_amp_filt_info *info = node->custom;
struct dst_op_amp_filt_context *context = node->context; struct dst_op_amp_filt_context *context = node->context;
/* Convert the passed filter type into an int for easy use. */ /* Convert the passed filter type into an int for easy use. */
context->type = (int)DST_OP_AMP_FILT__TYPE & DISC_OP_AMP_FILTER_TYPE_MASK; context->type = (int)DST_OP_AMP_FILT__TYPE & DISC_OP_AMP_FILTER_TYPE_MASK;
@ -485,7 +489,7 @@ static void dst_op_amp_filt_reset(node_description *node)
context->vN = info->vN; context->vN = info->vN;
/* Work out the input resistance. It is all input and bias resistors in parallel. */ /* Work out the input resistance. It is all input and bias resistors in parallel. */
context->rTotal = 1.0 / info->r1; // There has to be an R1. Otherwise the table is wrong. context->rTotal = 1.0 / info->r1; /* There has to be an R1. Otherwise the table is wrong. */
if (info->r2 != 0) context->rTotal += 1.0 / info->r2; if (info->r2 != 0) context->rTotal += 1.0 / info->r2;
if (info->r3 != 0) context->rTotal += 1.0 / info->r3; if (info->r3 != 0) context->rTotal += 1.0 / info->r3;
context->rTotal = 1.0 / context->rTotal; context->rTotal = 1.0 / context->rTotal;
@ -500,26 +504,26 @@ static void dst_op_amp_filt_reset(node_description *node)
{ {
case DISC_OP_AMP_FILTER_IS_LOW_PASS_1: case DISC_OP_AMP_FILTER_IS_LOW_PASS_1:
context->exponentC1 = -1.0 / (info->rF * info->c1 * discrete_current_context->sample_rate); context->exponentC1 = -1.0 / (info->rF * info->c1 * discrete_current_context->sample_rate);
context->exponentC1 = 1.0 - exp(context->exponentC1); context->exponentC1 = 1.0 - exp(context->exponentC1);
context->exponentC2 = 0; context->exponentC2 = 0;
break; break;
case DISC_OP_AMP_FILTER_IS_HIGH_PASS_1: case DISC_OP_AMP_FILTER_IS_HIGH_PASS_1:
context->exponentC1 = -1.0 / (context->rTotal * info->c1 * discrete_current_context->sample_rate); context->exponentC1 = -1.0 / (context->rTotal * info->c1 * discrete_current_context->sample_rate);
context->exponentC1 = 1.0 - exp(context->exponentC1); context->exponentC1 = 1.0 - exp(context->exponentC1);
context->exponentC2 = 0; context->exponentC2 = 0;
break; break;
case DISC_OP_AMP_FILTER_IS_BAND_PASS_1: case DISC_OP_AMP_FILTER_IS_BAND_PASS_1:
context->exponentC1 = -1.0 / (info->rF * info->c1 * discrete_current_context->sample_rate); context->exponentC1 = -1.0 / (info->rF * info->c1 * discrete_current_context->sample_rate);
context->exponentC1 = 1.0 - exp(context->exponentC1); context->exponentC1 = 1.0 - exp(context->exponentC1);
context->exponentC2 = -1.0 / (context->rTotal * info->c2 * discrete_current_context->sample_rate); context->exponentC2 = -1.0 / (context->rTotal * info->c2 * discrete_current_context->sample_rate);
context->exponentC2 = 1.0 - exp(context->exponentC2); context->exponentC2 = 1.0 - exp(context->exponentC2);
break; break;
case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M | DISC_OP_AMP_IS_NORTON: case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M | DISC_OP_AMP_IS_NORTON:
context->rTotal = 1.0 / (1.0 / info->r1 + 1.0 / info->r2); context->rTotal = 1.0 / (1.0 / info->r1 + 1.0 / info->r2);
case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M: case DISC_OP_AMP_FILTER_IS_BAND_PASS_1M:
{ {
double fc = 1.0 / (2 * M_PI * sqrt(context->rTotal * info->rF * info->c1 * info->c2)); double fc = 1.0 / (2 * M_PI * sqrt(context->rTotal * info->rF * info->c1 * info->c2));
double d = (info->c1 + info->c2) / sqrt(info->rF / context->rTotal * info->c1 * info->c2); double d = (info->c1 + info->c2) / sqrt(info->rF / context->rTotal * info->c1 * info->c2);
double gain = -info->rF / context->rTotal * info->c2 / (info->c1 + info->c2); double gain = -info->rF / context->rTotal * info->c2 / (info->c1 + info->c2);
calculate_filter2_coefficients(fc, d, DISC_FILTER_BANDPASS, calculate_filter2_coefficients(fc, d, DISC_FILTER_BANDPASS,
@ -538,15 +542,15 @@ static void dst_op_amp_filt_reset(node_description *node)
} }
case DISC_OP_AMP_FILTER_IS_BAND_PASS_0 | DISC_OP_AMP_IS_NORTON: case DISC_OP_AMP_FILTER_IS_BAND_PASS_0 | DISC_OP_AMP_IS_NORTON:
context->exponentC1 = -1.0 / ((1.0 / (1.0 / info->r1 + 1.0 / (info->r2 + info->r3 + info->r4))) * info->c1 * discrete_current_context->sample_rate); context->exponentC1 = -1.0 / ((1.0 / (1.0 / info->r1 + 1.0 / (info->r2 + info->r3 + info->r4))) * info->c1 * discrete_current_context->sample_rate);
context->exponentC1 = 1.0 - exp(context->exponentC1); context->exponentC1 = 1.0 - exp(context->exponentC1);
context->exponentC2 = -1.0 / ((1.0 / (1.0 / (info->r1 + info->r2) + 1.0 / (info->r3 + info->r4))) * info->c2 * discrete_current_context->sample_rate); context->exponentC2 = -1.0 / ((1.0 / (1.0 / (info->r1 + info->r2) + 1.0 / (info->r3 + info->r4))) * info->c2 * discrete_current_context->sample_rate);
context->exponentC2 = 1.0 - exp(context->exponentC2); context->exponentC2 = 1.0 - exp(context->exponentC2);
context->exponentC3 = -1.0 / ((info->r1 + info->r2 + info->r3 + info->r4) * info->c3 * discrete_current_context->sample_rate); context->exponentC3 = -1.0 / ((info->r1 + info->r2 + info->r3 + info->r4) * info->c3 * discrete_current_context->sample_rate);
context->exponentC3 = 1.0 - exp(context->exponentC3); context->exponentC3 = 1.0 - exp(context->exponentC3);
break; break;
case DISC_OP_AMP_FILTER_IS_HIGH_PASS_0 | DISC_OP_AMP_IS_NORTON: case DISC_OP_AMP_FILTER_IS_HIGH_PASS_0 | DISC_OP_AMP_IS_NORTON:
context->exponentC1 = -1.0 / (info->r1 * info->c1 * discrete_current_context->sample_rate); context->exponentC1 = -1.0 / (info->r1 * info->c1 * discrete_current_context->sample_rate);
context->exponentC1 = 1.0 - exp(context->exponentC1); context->exponentC1 = 1.0 - exp(context->exponentC1);
break; break;
} }
@ -586,7 +590,7 @@ static void dst_rcdisc_step(node_description *node)
context->state = 1; context->state = 1;
context->t = 0; context->t = 0;
} }
node->output[0]=0; node->output[0] = 0;
break; break;
case 1: case 1:
@ -603,7 +607,7 @@ static void dst_rcdisc_reset(node_description *node)
{ {
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
node->output[0]=0; node->output[0] = 0;
context->state = 0; context->state = 0;
context->t = 0; context->t = 0;
@ -633,9 +637,10 @@ static void dst_rcdisc_reset(node_description *node)
static void dst_rcdisc2_step(node_description *node) static void dst_rcdisc2_step(node_description *node)
{ {
double diff;
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
double diff;
/* Works differently to other as we are always on, no enable */ /* Works differently to other as we are always on, no enable */
/* exponential based in difference between input/output */ /* exponential based in difference between input/output */
@ -678,9 +683,10 @@ static void dst_rcdisc2_reset(node_description *node)
static void dst_rcdisc3_step(node_description *node) static void dst_rcdisc3_step(node_description *node)
{ {
double diff;
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
double diff;
/* Exponential based in difference between input/output */ /* Exponential based in difference between input/output */
if(DST_RCDISC3__ENABLE) if(DST_RCDISC3__ENABLE)
@ -708,12 +714,12 @@ static void dst_rcdisc3_reset(node_description *node)
{ {
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
node->output[0]=0; node->output[0] = 0;
context->state = 0; context->state = 0;
context->t = 0; context->t = 0;
context->exponent0=-1.0 * DST_RCDISC3__R1 * DST_RCDISC3__C; context->exponent0 = -1.0 * DST_RCDISC3__R1 * DST_RCDISC3__C;
context->exponent1=-1.0 *(DST_RCDISC3__R1 * DST_RCDISC3__R2)/( DST_RCDISC3__R1 + DST_RCDISC3__R2)* DST_RCDISC3__C; context->exponent1 = -1.0 *(DST_RCDISC3__R1 * DST_RCDISC3__R2)/( DST_RCDISC3__R1 + DST_RCDISC3__R2)* DST_RCDISC3__C;
} }
@ -742,6 +748,7 @@ static void dst_rcdisc3_reset(node_description *node)
static void dst_rcdisc4_step(node_description *node) static void dst_rcdisc4_step(node_description *node)
{ {
struct dst_rcdisc4_context *context = node->context; struct dst_rcdisc4_context *context = node->context;
int inp1 = (DST_RCDISC4__IN == 0) ? 0 : 1; int inp1 = (DST_RCDISC4__IN == 0) ? 0 : 1;
if (DST_RCDISC4__ENABLE == 0) if (DST_RCDISC4__ENABLE == 0)
@ -767,6 +774,7 @@ static void dst_rcdisc4_step(node_description *node)
static void dst_rcdisc4_reset(node_description *node) static void dst_rcdisc4_reset(node_description *node)
{ {
struct dst_rcdisc4_context *context = node->context; struct dst_rcdisc4_context *context = node->context;
double v, i, r, rT; double v, i, r, rT;
context->type = 0; context->type = 0;
@ -802,21 +810,21 @@ static void dst_rcdisc4_reset(node_description *node)
v = DST_RCDISC4__VP - .5; /* diode drop */ v = DST_RCDISC4__VP - .5; /* diode drop */
/* When the input is 1, both R1 & R3 are basically in parallel. */ /* When the input is 1, both R1 & R3 are basically in parallel. */
r = 1.0 / (1.0 / DST_RCDISC4__R1 + 1.0 / DST_RCDISC4__R3); r = 1.0 / (1.0 / DST_RCDISC4__R1 + 1.0 / DST_RCDISC4__R3);
rT = DST_RCDISC4__R2 + r; rT = DST_RCDISC4__R2 + r;
i = v / rT; i = v / rT;
context->v[1] = i * r + .5; context->v[1] = i * r + .5;
rT = 1.0 / (1.0 / DST_RCDISC4__R2 + 1.0 / r); rT = 1.0 / (1.0 / DST_RCDISC4__R2 + 1.0 / r);
context->exp[1] = -1.0 / (rT * DST_RCDISC4__C1 * discrete_current_context->sample_rate); context->exp[1] = -1.0 / (rT * DST_RCDISC4__C1 * discrete_current_context->sample_rate);
context->exp[1] = 1.0 - exp(context->exp[1]); context->exp[1] = 1.0 - exp(context->exp[1]);
/* When the input is 0, R1 is out of circuit. */ /* When the input is 0, R1 is out of circuit. */
rT = DST_RCDISC4__R2 + DST_RCDISC4__R3; rT = DST_RCDISC4__R2 + DST_RCDISC4__R3;
i = v / rT; i = v / rT;
context->v[0] = i * DST_RCDISC4__R3 + .5; context->v[0] = i * DST_RCDISC4__R3 + .5;
rT = 1.0 / (1.0 / DST_RCDISC4__R2 + 1.0 / DST_RCDISC4__R3); rT = 1.0 / (1.0 / DST_RCDISC4__R2 + 1.0 / DST_RCDISC4__R3);
context->exp[0] = -1.0 / (rT * DST_RCDISC4__C1 * discrete_current_context->sample_rate); context->exp[0] = -1.0 / (rT * DST_RCDISC4__C1 * discrete_current_context->sample_rate);
context->exp[0] = 1.0 - exp(context->exp[0]); context->exp[0] = 1.0 - exp(context->exp[0]);
break; break;
case 3: case 3:
@ -828,12 +836,12 @@ static void dst_rcdisc4_reset(node_description *node)
context->v[1] = DST_RCDISC4__R2 / (r + DST_RCDISC4__R2) * (5.0 - 0.5); context->v[1] = DST_RCDISC4__R2 / (r + DST_RCDISC4__R2) * (5.0 - 0.5);
rT = 1.0 / ( 1.0 / r + 1.0 / DST_RCDISC4__R2); rT = 1.0 / ( 1.0 / r + 1.0 / DST_RCDISC4__R2);
context->exp[1] = -1.0 / (rT * DST_RCDISC4__C1 * discrete_current_context->sample_rate); context->exp[1] = -1.0 / (rT * DST_RCDISC4__C1 * discrete_current_context->sample_rate);
context->exp[1] = 1.0 - exp(context->exp[1]); context->exp[1] = 1.0 - exp(context->exp[1]);
/* When the input is 0, R1 is out of circuit. */ /* When the input is 0, R1 is out of circuit. */
context->v[0] = 0; context->v[0] = 0;
context->exp[0] = -1.0 / (DST_RCDISC4__R2 * DST_RCDISC4__C1 * discrete_current_context->sample_rate); context->exp[0] = -1.0 / (DST_RCDISC4__R2 * DST_RCDISC4__C1 * discrete_current_context->sample_rate);
context->exp[0] = 1.0 - exp(context->exp[0]); context->exp[0] = 1.0 - exp(context->exp[0]);
break; break;
} }
} }
@ -855,9 +863,10 @@ static void dst_rcdisc4_reset(node_description *node)
static void dst_rcdisc5_step(node_description *node) static void dst_rcdisc5_step(node_description *node)
{ {
double diff,u;
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
double diff,u;
/* Exponential based in difference between input/output */ /* Exponential based in difference between input/output */
if(DST_RCDISC5__ENABLE) if(DST_RCDISC5__ENABLE)
@ -875,7 +884,7 @@ static void dst_rcdisc5_step(node_description *node)
} }
else else
{ {
node->output[0]=0; node->output[0] = 0;
} }
} }
@ -883,11 +892,11 @@ static void dst_rcdisc5_reset(node_description *node)
{ {
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
node->output[0]=0; node->output[0] = 0;
context->state = 0; context->state = 0;
context->t = 0; context->t = 0;
context->exponent0=-1.0 * DST_RCDISC5__R * DST_RCDISC5__C; context->exponent0 = -1.0 * DST_RCDISC5__R * DST_RCDISC5__C;
} }
/************************************************************************ /************************************************************************
@ -930,20 +939,21 @@ static void dst_rcdisc5_reset(node_description *node)
static void dst_rcintegrate_step(node_description *node) static void dst_rcintegrate_step(node_description *node)
{ {
double diff,u,iQ,iQc,iC,RG,vE;
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
double dt,vP;
double diff, u, iQ, iQc, iC, RG, vE;
double dt, vP;
if(DST_RCINTEGRATE__ENABLE) if(DST_RCINTEGRATE__ENABLE)
{ {
u = DST_RCINTEGRATE__IN1; u = DST_RCINTEGRATE__IN1;
vP = DST_RCINTEGRATE__VP; vP = DST_RCINTEGRATE__VP;
dt = discrete_current_context->sample_time; dt = discrete_current_context->sample_time;
if ( u-0.7 < context->vCap*context->R2/(context->R1+context->R2)) if ( u-0.7 < context->vCap*context->R2/(context->R1+context->R2))
{ {
/* discharge .... */ /* discharge .... */
diff = 0 - context->vCap; diff = 0.0 - context->vCap;
iC = 0.0 - context->C / context->exponent1 * diff * context->exp_exponent1; // iC iC = 0.0 - context->C / context->exponent1 * diff * context->exp_exponent1; /* iC */
diff = diff - (diff * context->exp_exponent1); diff = diff - (diff * context->exp_exponent1);
context->vCap += diff; context->vCap += diff;
iQ = 0; iQ = 0;
@ -954,7 +964,7 @@ static void dst_rcintegrate_step(node_description *node)
{ {
/* charging */ /* charging */
diff = (vP - context->vCE) * context->f - context->vCap; diff = (vP - context->vCE) * context->f - context->vCap;
iC = 0.0 - context->C / context->exponent0 * diff * context->exp_exponent0; // iC iC = 0.0 - context->C / context->exponent0 * diff * context->exp_exponent0; /* iC */
diff = diff - (diff * context->exp_exponent0); diff = diff - (diff * context->exp_exponent0);
context->vCap += diff; context->vCap += diff;
iQ = iC + (iC * context->R1 + context->vCap) / context->R2; iQ = iC + (iC * context->R1 + context->vCap) / context->R2;
@ -964,10 +974,10 @@ static void dst_rcintegrate_step(node_description *node)
u = DST_RCINTEGRATE__IN1; u = DST_RCINTEGRATE__IN1;
if (u>0.7+vE) if (u > 0.7+vE)
vE=u-0.7; vE = u-0.7;
iQc = EM_IC(u - vE); iQc = EM_IC(u - vE);
context->vCE = MIN(vP-0.1, vP - RG*iQc); context->vCE = MIN(vP - 0.1, vP - RG * iQc);
/* Avoid oscillations /* Avoid oscillations
* The method tends to largely overshoot - no wonder without * The method tends to largely overshoot - no wonder without
@ -975,7 +985,7 @@ static void dst_rcintegrate_step(node_description *node)
*/ */
context->vCE = MAX(context->vCE, 0.1 ); context->vCE = MAX(context->vCE, 0.1 );
context->vCE = 0.1 * context->vCE +0.9 * (vP - vE - iQ * context->R3); context->vCE = 0.1 * context->vCE + 0.9 * (vP - vE - iQ * context->R3);
switch (context->state) switch (context->state)
{ {
@ -986,18 +996,19 @@ static void dst_rcintegrate_step(node_description *node)
node->output[0] = vE; node->output[0] = vE;
break; break;
case DISC_RC_INTEGRATE_TYPE3: case DISC_RC_INTEGRATE_TYPE3:
node->output[0] = MAX(0,vP - iQ * context->R3); node->output[0] = MAX(0, vP - iQ * context->R3);
break; break;
} }
} }
else else
{ {
node->output[0]=0; node->output[0] = 0;
} }
} }
static void dst_rcintegrate_reset(node_description *node) static void dst_rcintegrate_reset(node_description *node)
{ {
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
double r; double r;
double dt = discrete_current_context->sample_time; double dt = discrete_current_context->sample_time;
@ -1007,7 +1018,7 @@ static void dst_rcintegrate_reset(node_description *node)
context->R1 = DST_RCINTEGRATE__R1; context->R1 = DST_RCINTEGRATE__R1;
context->R2 = DST_RCINTEGRATE__R2; context->R2 = DST_RCINTEGRATE__R2;
context->R3 = DST_RCINTEGRATE__R3; context->R3 = DST_RCINTEGRATE__R3;
context->C = DST_RCINTEGRATE__C; context->C = DST_RCINTEGRATE__C;
context->vCap = 0; context->vCap = 0;
context->vCE = 0; context->vCE = 0;
@ -1049,27 +1060,28 @@ static void dst_rcintegrate_reset(node_description *node)
static void dst_rcdisc_mod_step(node_description *node) static void dst_rcdisc_mod_step(node_description *node)
{ {
double diff,Rc,Rc2,vCap,u,vD=0.0;
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
double diff, Rc, Rc2, vCap, u, vD=0.0;
/* Exponential based in difference between input/output */ /* Exponential based in difference between input/output */
vCap = context->vCap; vCap = context->vCap;
if(DST_RCDISC_MOD__ENABLE) if(DST_RCDISC_MOD__ENABLE)
{ {
Rc = (DST_RCDISC_MOD__IN1 > 0.5) ? DST_RCDISC_MOD__R2 : DST_RCDISC_MOD__R1 + DST_RCDISC_MOD__R2; Rc = (DST_RCDISC_MOD__IN1 > 0.5) ? DST_RCDISC_MOD__R2 : DST_RCDISC_MOD__R1 + DST_RCDISC_MOD__R2;
if (Rc<1.0) if (Rc < 1.0)
Rc = 1.0; Rc = 1.0;
u = (DST_RCDISC_MOD__IN1 > 0.5) ? 0 : DST_RCDISC_MOD__VP; u = (DST_RCDISC_MOD__IN1 > 0.5) ? 0 : DST_RCDISC_MOD__VP;
Rc2 = (DST_RCDISC_MOD__IN2 > 0.6) ? (DST_RCDISC_MOD__R3 * DST_RCDISC_MOD__R4 / (DST_RCDISC_MOD__R3 + DST_RCDISC_MOD__R4)) : DST_RCDISC_MOD__R4; Rc2 = (DST_RCDISC_MOD__IN2 > 0.6) ? (DST_RCDISC_MOD__R3 * DST_RCDISC_MOD__R4 / (DST_RCDISC_MOD__R3 + DST_RCDISC_MOD__R4)) : DST_RCDISC_MOD__R4;
/* Clamp */ /* Clamp */
diff = u - vCap; diff = u - vCap;
vD = diff*Rc2/(Rc+Rc2); vD = diff * Rc2 / (Rc + Rc2);
if (vD<-0.6) if (vD < -0.6)
{ {
Rc2=0; Rc2 = 0;
diff = u + 0.6 - vCap; diff = u + 0.6 - vCap;
diff = diff - (diff * exp(0.0-discrete_current_context->sample_time / (DST_RCDISC_MOD__C*Rc))); diff = diff - (diff * exp(0.0 - discrete_current_context->sample_time / (DST_RCDISC_MOD__C * Rc)));
vCap += diff; vCap += diff;
node->output[0] = (DST_RCDISC_MOD__IN2 <= 0.6) ? -0.6 : 0; node->output[0] = (DST_RCDISC_MOD__IN2 <= 0.6) ? -0.6 : 0;
} }
@ -1078,13 +1090,13 @@ static void dst_rcdisc_mod_step(node_description *node)
diff = diff - (diff * exp(0.0-discrete_current_context->sample_time / (DST_RCDISC_MOD__C*(Rc+Rc2)))); diff = diff - (diff * exp(0.0-discrete_current_context->sample_time / (DST_RCDISC_MOD__C*(Rc+Rc2))));
vCap += diff; vCap += diff;
/* neglecting current through R3 drawn by next node */ /* neglecting current through R3 drawn by next node */
node->output[0] = (DST_RCDISC_MOD__IN2 <= 0.6) ? (u-vCap)*DST_RCDISC_MOD__R4/(DST_RCDISC_MOD__R4+Rc) : 0; node->output[0] = (DST_RCDISC_MOD__IN2 <= 0.6) ? (u - vCap) * DST_RCDISC_MOD__R4 / (DST_RCDISC_MOD__R4 + Rc) : 0;
} }
context->vCap = vCap; context->vCap = vCap;
} }
else else
{ {
node->output[0]=0; node->output[0] = 0;
} }
} }
@ -1092,8 +1104,8 @@ static void dst_rcdisc_mod_reset(node_description *node)
{ {
struct dst_rcdisc_context *context = node->context; struct dst_rcdisc_context *context = node->context;
node->output[0]=0; node->output[0] = 0;
context->vCap = 0; context->vCap = 0;
} }
/************************************************************************ /************************************************************************
@ -1128,7 +1140,7 @@ static void dst_rcfilter_step(node_description *node)
} }
else else
{ {
node->output[0]=0; node->output[0] = 0;
} }
} }
@ -1138,7 +1150,7 @@ static void dst_rcfilter_reset(node_description *node)
context->exponent = -1.0 / (DST_RCFILTER__R * DST_RCFILTER__C * discrete_current_context->sample_rate); context->exponent = -1.0 / (DST_RCFILTER__R * DST_RCFILTER__C * discrete_current_context->sample_rate);
context->exponent = 1.0 - exp(context->exponent); context->exponent = 1.0 - exp(context->exponent);
context->vCap = 0; context->vCap = 0;
node->output[0] = 0; node->output[0] = 0;
} }
@ -1164,25 +1176,26 @@ static void dst_rcfilter_reset(node_description *node)
static void dst_rcfilter_sw_step(node_description *node) static void dst_rcfilter_sw_step(node_description *node)
{ {
struct dst_rcfilter_sw_context *context = node->context; struct dst_rcfilter_sw_context *context = node->context;
int i; int i;
double rcexp; double rcexp;
int bits = (int)DST_RCFILTER_SW__SWITCH; int bits = (int)DST_RCFILTER_SW__SWITCH;
double us=0, rs=0; double us = 0, rs = 0;
if (DST_RCFILTER_SW__ENABLE) if (DST_RCFILTER_SW__ENABLE)
{ {
for (i=0;i<4;i++) for (i = 0; i < 4; i++)
{ {
if ( ( bits & (1<<i)) != 0) if (( bits & (1 << i)) != 0)
{ {
us += context->vCap[i]; us += context->vCap[i];
rs += DST_RCFILTER_SW__R; rs += DST_RCFILTER_SW__R;
} }
} }
node->output[0] = CD4066_ON_RES / ( CD4066_ON_RES + rs) * DST_RCFILTER_SW__VIN + DST_RCFILTER_SW__R / (CD4066_ON_RES + rs) * us; node->output[0] = CD4066_ON_RES / ( CD4066_ON_RES + rs) * DST_RCFILTER_SW__VIN + DST_RCFILTER_SW__R / (CD4066_ON_RES + rs) * us;
for (i=0;i<4;i++) for (i = 0; i < 4; i++)
{ {
if ( ( bits & (1<<i)) != 0) if (( bits & (1 << i)) != 0)
{ {
rcexp = 1.0 - exp(-1.0 / ( CD4066_ON_RES * DST_RCFILTER_SW__C(i)) * discrete_current_context->sample_rate); rcexp = 1.0 - exp(-1.0 / ( CD4066_ON_RES * DST_RCFILTER_SW__C(i)) * discrete_current_context->sample_rate);
context->vCap[i] += ((node->output[0] - context->vCap[i]) * rcexp); context->vCap[i] += ((node->output[0] - context->vCap[i]) * rcexp);
@ -1191,16 +1204,17 @@ static void dst_rcfilter_sw_step(node_description *node)
} }
else else
{ {
node->output[0]=0; node->output[0] = 0;
} }
} }
static void dst_rcfilter_sw_reset(node_description *node) static void dst_rcfilter_sw_reset(node_description *node)
{ {
struct dst_rcfilter_sw_context *context = node->context; struct dst_rcfilter_sw_context *context = node->context;
int i; int i;
for (i=0;i<4;i++) for (i = 0; i < 4; i++)
context->vCap[i] = 0; context->vCap[i] = 0;
node->output[0] = 0; node->output[0] = 0;
} }
@ -1225,16 +1239,18 @@ static void dst_rcfilter_sw_reset(node_description *node)
static void dst_rcfilterN_reset(node_description *node) static void dst_rcfilterN_reset(node_description *node)
{ {
// double f=1.0/(2*M_PI* DST_RCFILTERN__R * DST_RCFILTERN__C); #if 0
double f=1.0/(2*M_PI* DST_RCFILTERN__R * DST_RCFILTERN__C);
// !!!!!!!!!!!!!! CAN'T CHEAT LIKE THIS !!!!!!!!!!!!!!!! /* !!!!!!!!!!!!!! CAN'T CHEAT LIKE THIS !!!!!!!!!!!!!!!! */
// Put this stuff in a context /* Put this stuff in a context */
//
// node->input[2] = f; node->input[2] = f;
// node->input[3] = DISC_FILTER_LOWPASS; node->input[3] = DISC_FILTER_LOWPASS;
/* Use first order filter */ /* Use first order filter */
dst_filter1_reset(node); dst_filter1_reset(node);
#endif
} }
@ -1256,21 +1272,24 @@ static void dst_rcfilterN_reset(node_description *node)
static void dst_rcdiscN_reset(node_description *node) static void dst_rcdiscN_reset(node_description *node)
{ {
// double f=1.0/(2*M_PI* DST_RCDISCN__R * DST_RCDISCN__C); #if 0
double f = 1.0 / (2 * M_PI * DST_RCDISCN__R * DST_RCDISCN__C);
// !!!!!!!!!!!!!! CAN'T CHEAT LIKE THIS !!!!!!!!!!!!!!!! /* !!!!!!!!!!!!!! CAN'T CHEAT LIKE THIS !!!!!!!!!!!!!!!! */
// Put this stuff in a context /* Put this stuff in a context */
//
// node->input[2] = f; node->input[2] = f;
// node->input[3] = DISC_FILTER_LOWPASS; node->input[3] = DISC_FILTER_LOWPASS;
/* Use first order filter */ /* Use first order filter */
dst_filter1_reset(node); dst_filter1_reset(node);
#endif
} }
static void dst_rcdiscN_step(node_description *node) static void dst_rcdiscN_step(node_description *node)
{ {
struct dss_filter1_context *context = node->context; struct dss_filter1_context *context = node->context;
double gain = 1.0; double gain = 1.0;
if (DST_RCDISCN__ENABLE == 0.0) if (DST_RCDISCN__ENABLE == 0.0)
@ -1321,6 +1340,7 @@ struct dss_rcdisc2_context
static void dst_rcdisc2N_step(node_description *node) static void dst_rcdisc2N_step(node_description *node)
{ {
struct dss_rcdisc2_context *context = node->context; struct dss_rcdisc2_context *context = node->context;
double input = ((DST_RCDISC2N__ENABLE == 0) ? DST_RCDISC2N__IN0 : DST_RCDISC2N__IN1); double input = ((DST_RCDISC2N__ENABLE == 0) ? DST_RCDISC2N__IN0 : DST_RCDISC2N__IN1);
if (DST_RCDISC2N__ENABLE == 0) if (DST_RCDISC2N__ENABLE == 0)
@ -1337,12 +1357,12 @@ static void dst_rcdisc2N_reset(node_description *node)
struct dss_rcdisc2_context *context = node->context; struct dss_rcdisc2_context *context = node->context;
double f1,f2; double f1,f2;
f1=1.0/(2*M_PI* DST_RCDISC2N__R0 * DST_RCDISC2N__C); f1 = 1.0 / (2 * M_PI * DST_RCDISC2N__R0 * DST_RCDISC2N__C);
f2=1.0/(2*M_PI* DST_RCDISC2N__R1 * DST_RCDISC2N__C); f2 = 1.0 / (2 * M_PI * DST_RCDISC2N__R1 * DST_RCDISC2N__C);
calculate_filter1_coefficients(f1, DISC_FILTER_LOWPASS, &context->a1_0, &context->b0_0, &context->b1_0); calculate_filter1_coefficients(f1, DISC_FILTER_LOWPASS, &context->a1_0, &context->b0_0, &context->b1_0);
calculate_filter1_coefficients(f2, DISC_FILTER_LOWPASS, &context->a1_1, &context->b0_1, &context->b1_1); calculate_filter1_coefficients(f2, DISC_FILTER_LOWPASS, &context->a1_1, &context->b0_1, &context->b1_1);
/* Initialize the object */ /* Initialize the object */
node->output[0]=0; node->output[0] = 0;
} }

View File

@ -33,8 +33,9 @@ struct dss_adjustment_context
READ8_HANDLER(discrete_sound_r) READ8_HANDLER(discrete_sound_r)
{ {
discrete_info *info = sndti_token(SOUND_DISCRETE, 0); discrete_info *info = sndti_token(SOUND_DISCRETE, 0);
node_description *node = discrete_find_node(info, offset); node_description *node = discrete_find_node(info, offset);
UINT8 data = 0; UINT8 data = 0;
/* Read the node input value if allowed */ /* Read the node input value if allowed */
@ -58,15 +59,15 @@ READ8_HANDLER(discrete_sound_r)
WRITE8_HANDLER(discrete_sound_w) WRITE8_HANDLER(discrete_sound_w)
{ {
discrete_info *info = sndti_token(SOUND_DISCRETE, 0); discrete_info *info = sndti_token(SOUND_DISCRETE, 0);
node_description *node = discrete_find_node(info, offset); node_description *node = discrete_find_node(info, offset);
/* Update the node input value if it's a proper input node */ /* Update the node input value if it's a proper input node */
if (node) if (node)
{ {
UINT8 *node_data = node->context; UINT8 *node_data = node->context;
UINT8 last_data = *node_data; UINT8 last_data = *node_data;
UINT8 new_data = 0; UINT8 new_data = 0;
switch (node->module.type) switch (node->module.type)
{ {
@ -122,12 +123,13 @@ WRITE8_HANDLER(discrete_sound_w)
static void dss_adjustment_step(node_description *node) static void dss_adjustment_step(node_description *node)
{ {
struct dss_adjustment_context *context = node->context; struct dss_adjustment_context *context = node->context;
INT32 rawportval = input_port_read_direct(context->port);
INT32 rawportval = input_port_read_direct(context->port);
/* only recompute if the value changed from last time */ /* only recompute if the value changed from last time */
if (rawportval != context->lastpval) if (rawportval != context->lastpval)
{ {
double portval = (double)(rawportval - context->pmin) * context->pscale; double portval = (double)(rawportval - context->pmin) * context->pscale;
double scaledval = portval * context->scale + context->min; double scaledval = portval * context->scale + context->min;
context->lastpval = rawportval; context->lastpval = rawportval;
@ -141,6 +143,7 @@ static void dss_adjustment_step(node_description *node)
static void dss_adjustment_reset(node_description *node) static void dss_adjustment_reset(node_description *node)
{ {
struct dss_adjustment_context *context = node->context; struct dss_adjustment_context *context = node->context;
double min, max; double min, max;
if (node->custom) if (node->custom)
@ -153,13 +156,13 @@ static void dss_adjustment_reset(node_description *node)
context->port = input_port_by_index(Machine->portconfig, DSS_ADJUSTMENT__PORT); context->port = input_port_by_index(Machine->portconfig, DSS_ADJUSTMENT__PORT);
context->lastpval = 0x7fffffff; context->lastpval = 0x7fffffff;
context->pmin = DSS_ADJUSTMENT__PMIN; context->pmin = DSS_ADJUSTMENT__PMIN;
context->pscale = 1.0 / (double)(DSS_ADJUSTMENT__PMAX - DSS_ADJUSTMENT__PMIN); context->pscale = 1.0 / (double)(DSS_ADJUSTMENT__PMAX - DSS_ADJUSTMENT__PMIN);
/* linear scale */ /* linear scale */
if (DSS_ADJUSTMENT__LOG == 0) if (DSS_ADJUSTMENT__LOG == 0)
{ {
context->min = DSS_ADJUSTMENT__MIN; context->min = DSS_ADJUSTMENT__MIN;
context->scale = DSS_ADJUSTMENT__MAX - DSS_ADJUSTMENT__MIN; context->scale = DSS_ADJUSTMENT__MAX - DSS_ADJUSTMENT__MIN;
} }
@ -169,7 +172,7 @@ static void dss_adjustment_reset(node_description *node)
/* force minimum and maximum to be > 0 */ /* force minimum and maximum to be > 0 */
min = (DSS_ADJUSTMENT__MIN > 0) ? DSS_ADJUSTMENT__MIN : 1; min = (DSS_ADJUSTMENT__MIN > 0) ? DSS_ADJUSTMENT__MIN : 1;
max = (DSS_ADJUSTMENT__MAX > 0) ? DSS_ADJUSTMENT__MAX : 1; max = (DSS_ADJUSTMENT__MAX > 0) ? DSS_ADJUSTMENT__MAX : 1;
context->min = log10(min); context->min = log10(min);
context->scale = log10(max) - log10(min); context->scale = log10(max) - log10(min);
} }
@ -249,7 +252,7 @@ static void dss_input_pulse_step(node_description *node)
static void dss_input_stream_step(node_description *node) static void dss_input_stream_step(node_description *node)
{ {
// the context pointer is set to point to the current input stream data in discrete_stream_update /* the context pointer is set to point to the current input stream data in discrete_stream_update */
stream_sample_t **ptr = node->context; stream_sample_t **ptr = node->context;
stream_sample_t *data = *ptr; stream_sample_t *data = *ptr;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -307,8 +307,10 @@ static void *discrete_start(const char *tag, int sndindex, int clock, const void
/* create the logfile */ /* create the logfile */
sprintf(name, "discrete%d.log", info->sndindex); sprintf(name, "discrete%d.log", info->sndindex);
if (DISCRETE_DEBUGLOG && !discrete_current_context->disclogfile) if (DISCRETE_DEBUGLOG && !info->disclogfile)
discrete_current_context->disclogfile = fopen(name, "w"); info->disclogfile = fopen(name, "w");
discrete_current_context = info;
/* first pass through the nodes: sanity check, fill in the indexed_nodes, and make a total count */ /* first pass through the nodes: sanity check, fill in the indexed_nodes, and make a total count */
discrete_log("discrete_start() - Doing node list sanity check"); discrete_log("discrete_start() - Doing node list sanity check");
@ -329,8 +331,6 @@ static void *discrete_start(const char *tag, int sndindex, int clock, const void
/* make sure this is a main node */ /* make sure this is a main node */
if (NODE_CHILD_NODE_NUM(intf[info->node_count].node) > 0) if (NODE_CHILD_NODE_NUM(intf[info->node_count].node) > 0)
fatalerror("discrete_start() - Child node number on NODE_%02d", NODE_INDEX(intf[info->node_count].node) ); fatalerror("discrete_start() - Child node number on NODE_%02d", NODE_INDEX(intf[info->node_count].node) );
} }
info->node_count++; info->node_count++;
discrete_log("discrete_start() - Sanity check counted %d nodes", info->node_count); discrete_log("discrete_start() - Sanity check counted %d nodes", info->node_count);
@ -357,6 +357,8 @@ static void *discrete_start(const char *tag, int sndindex, int clock, const void
setup_output_nodes(info); setup_output_nodes(info);
setup_disc_logs(info); setup_disc_logs(info);
discrete_current_context = NULL;
return info; return info;
} }
@ -414,9 +416,9 @@ static void discrete_stop(void *chip)
if (DISCRETE_DEBUGLOG) if (DISCRETE_DEBUGLOG)
{ {
/* close the debug log */ /* close the debug log */
if (discrete_current_context->disclogfile) if (info->disclogfile)
fclose(discrete_current_context->disclogfile); fclose(info->disclogfile);
discrete_current_context->disclogfile = NULL; info->disclogfile = NULL;
} }
} }
@ -703,8 +705,8 @@ static void find_input_nodes(discrete_info *info, discrete_sound_block *block_li
if (NODE_CHILD_NODE_NUM(inputnode) >= node_ref->module.num_output) if (NODE_CHILD_NODE_NUM(inputnode) >= node_ref->module.num_output)
fatalerror("discrete_start - Node NODE_%02d referenced non existent output %d on node NODE_%02d", NODE_INDEX(node->node), NODE_CHILD_NODE_NUM(inputnode), NODE_INDEX(inputnode)); fatalerror("discrete_start - Node NODE_%02d referenced non existent output %d on node NODE_%02d", NODE_INDEX(node->node), NODE_CHILD_NODE_NUM(inputnode), NODE_INDEX(inputnode));
node->input[inputnum] = &(node_ref->output[NODE_CHILD_NODE_NUM(inputnode)]); // Link referenced node out to input node->input[inputnum] = &(node_ref->output[NODE_CHILD_NODE_NUM(inputnode)]); /* Link referenced node out to input */
node->input_is_node |= 1 << inputnum; // Bit flag if input is node node->input_is_node |= 1 << inputnum; /* Bit flag if input is node */
} }
} }
} }

View File

@ -121,6 +121,59 @@
* *
*********************************************************************** ***********************************************************************
* *
* x_time - ANTI-ALSING features.
*
* Certain modules make use of x_time. This is a feature that passes
* infomation between modules about how long in the current sample, the
* switch in state happened. This is a decimal value of the % of the
* full sample period that it has been in the new state.
* 0 means it has been at the same state the whole sample.
*
* Example: Here is the output of a clock source with x_time on the
* output. The square wave is the real world waveform we
* want. The ^'s are the sample point. The numbers under
* the ^'s are the node output with the logic state left of
* the decimal and the x_time to the right. Under that is
* what the node's anti-aliased output energy would be.
* Note: the example is not 4x sampling so the energy
* does not provide an accurate representation of the
* original waveform. This is intentional so it fits
* in this header file.
* 1 ____ ____ ____ ____ ____ ____ ____ ____
* 0 ___ ____ ____ ____ ____ ____ ____ ____ __
* ^....^....^....^....^....^....^....^....^....^....^....^....^
* x_time 0.2 1.4 0.6 1.8 1.2 0.4 1.6 0.8 0.2 1.4 0.6
* energy 0.8 0.4 0.4 0.8 0.2 0.6 0.6 0.2 0.8 0.4 0.4
*
* Some modules will just pass the x_time onto another module.
*
* Modules that process x_time will keep track of the node's previous
* state so they can calculate the actual energy at the sample time.
*
* Example: Say we have a 555 module that outputs a clock with x_time
* that is connected to a counter. The output of the counter
* is connected to DAC_R1.
* In this case the counter module continues counting dependant
* on the integer portion of the 555 output. But it also
* passes the decimal portion as the x_time.
* The DAC_R1 then uses this info to anti-alias its output.
* Consider the following counter outputs vs DAC_R1
* calculations. The count changes from 9 to 10. It has
* been at the new state for 75% of the sample.
*
* counter binary x_time -- DAC_R1 bit energy --
* out count D3 D2 D1 D0
* 9.0 1001 0.0 1.0 0.0 0.0 1.0
* 10.75 1010 0.75 1.0 0.0 0.75 0.25
* 10.0 1010 0.0 1.0 0.0 1.0 0.0
*
* The DAC_R1 uses these energy calculations to scale the
* voltages created on each of its resistors. This
* anti-aliases the waveform no mater what the resistor
* weighting is.
*
***********************************************************************
*
* LIST OF CURRENTLY IMPLEMENTED DISCRETE BLOCKS * LIST OF CURRENTLY IMPLEMENTED DISCRETE BLOCKS
* --------------------------------------------- * ---------------------------------------------
* *
@ -142,7 +195,7 @@
* DISCRETE_INPUTX_STREAM(NODE,NUM, GAIN,OFFSET) * DISCRETE_INPUTX_STREAM(NODE,NUM, GAIN,OFFSET)
* *
* DISCRETE_COUNTER(NODE,ENAB,RESET,CLK,MAX,DIR,INIT0,CLKTYPE) * DISCRETE_COUNTER(NODE,ENAB,RESET,CLK,MAX,DIR,INIT0,CLKTYPE)
* DISCRETE_COUNTER_7492(NODE,ENAB,RESET,CLK) * DISCRETE_COUNTER_7492(NODE,ENAB,RESET,CLK,CLKTYPE)
* DISCRETE_LFSR_NOISE(NODE,ENAB,RESET,CLK,AMPL,FEED,BIAS,LFSRTB) * DISCRETE_LFSR_NOISE(NODE,ENAB,RESET,CLK,AMPL,FEED,BIAS,LFSRTB)
* DISCRETE_NOISE(NODE,ENAB,FREQ,AMP,BIAS) * DISCRETE_NOISE(NODE,ENAB,FREQ,AMP,BIAS)
* DISCRETE_NOTE(NODE,ENAB,CLK,DATA,MAX1,MAX2,CLKTYPE) * DISCRETE_NOTE(NODE,ENAB,CLK,DATA,MAX1,MAX2,CLKTYPE)
@ -386,7 +439,7 @@
* This counter counts up/down from 0 to MAX. When the enable is low, the output * This counter counts up/down from 0 to MAX. When the enable is low, the output
* is held at it's last value. When reset is high, the reset value is loaded * is held at it's last value. When reset is high, the reset value is loaded
* into the output. The counter can be clocked internally or externally. It also * into the output. The counter can be clocked internally or externally. It also
* supports xTime used by the clock modules to pass on anti-aliasing info. * supports x_time used by the clock modules to pass on anti-aliasing info.
* *
* Declaration syntax * Declaration syntax
* *
@ -399,6 +452,16 @@
* DISC_CLK_IS_FREQ - internally clock at this frequency. * DISC_CLK_IS_FREQ - internally clock at this frequency.
* Clock node must be static if * Clock node must be static if
* DISC_CLK_IS_FREQ is used. * DISC_CLK_IS_FREQ is used.
* x_time options: you can also | these x_time features to the basic
* types above if needed, or use seperately with 7492.
* DISC_OUT_IS_ENERGY - This will uses the x_time to
* anti-alias the count. Might be
* usefull if not connected to other
* modules.
* DISC_OUT_HAS_XTIME - This will generate x_time if
* being used with DISC_CLK_IS_FREQ.
* It will pass x_time for the
* other clock types.
* *
* DISCRETE_COUNTER(name of node, * DISCRETE_COUNTER(name of node,
* enable node or static value, * enable node or static value,
@ -413,10 +476,12 @@
* enable node or static value, * enable node or static value,
* reset node or static value, * reset node or static value,
* clock node or static value, * clock node or static value,
* max count static value) * clock type static value)
* *
* Note: A 7492 counter outputs a special bit pattern on its /6 stage. * Note: A 7492 counter outputs a special bit pattern on its /6 stage.
* A 7492 clocks on falling edge. This emulates the /6 stage only. * A 7492 clocks on the falling edge,
* so it is not recommended to use DISC_CLK_ON_R_EDGE for a 7492.
* This module emulates the /6 stage only.
* Use another DISCRETE_COUNTER for the /2 stage. * Use another DISCRETE_COUNTER for the /2 stage.
* *
* EXAMPLES: see Fire Truck, Monte Carlo, Super Bug, Polaris * EXAMPLES: see Fire Truck, Monte Carlo, Super Bug, Polaris
@ -1659,7 +1724,7 @@
* DISCRETE_DAC_R1(name of node, * DISCRETE_DAC_R1(name of node,
* enable node or static value, * enable node or static value,
* data node (static value is useless), * data node (static value is useless),
* vData node or static value (vON), * vData node or static value (voltage when a bit is on ),
* address of discrete_dac_r1_ladder structure) * address of discrete_dac_r1_ladder structure)
* *
* discrete_dac_r1_ladder = {ladderLength, r{}, vBias, rBias, rGnd, cFilter} * discrete_dac_r1_ladder = {ladderLength, r{}, vBias, rBias, rGnd, cFilter}
@ -1668,6 +1733,9 @@
* are out of circuit. So the bit selecting them will have no effect * are out of circuit. So the bit selecting them will have no effect
* on the DAC output voltage. * on the DAC output voltage.
* *
* x_time - this modules automatically handles any non-integer value
* on the data input as x_time.
*
* EXAMPLES: see Fire Truck, Monte Carlo, Super Bug, Polaris * EXAMPLES: see Fire Truck, Monte Carlo, Super Bug, Polaris
* *
*********************************************************************** ***********************************************************************
@ -1802,7 +1870,7 @@
* input 7 node, (if used) * input 7 node, (if used)
* address of discrete_mixer_info structure) * address of discrete_mixer_info structure)
* *
* discrete_mixer_desc = {type, r{}, rNode{}, c{}, rI, rF, cF, cAmp, vRef, gain} * discrete_mixer_desc = {type, r{}, r_node{}, c{}, rI, rF, cF, cAmp, vRef, gain}
* *
* Note: Set all unused components to 0. * Note: Set all unused components to 0.
* If an rNode is not used it should also be set to 0. * If an rNode is not used it should also be set to 0.
@ -2681,28 +2749,29 @@
* DISCRETE_555_ASTABLE - NE555 Chip simulation (astable mode). * DISCRETE_555_ASTABLE - NE555 Chip simulation (astable mode).
* DISCRETE_555_ASTABLE_CV - NE555 Chip simulation (astable mode) with CV control. * DISCRETE_555_ASTABLE_CV - NE555 Chip simulation (astable mode) with CV control.
* *
* v555 * v_charge v_pos
* | * V V
* .---------+ * | |
* | | * | |
* Z |8 * | |
* R1 Z .---------. * Z |8
* | 7| Vcc | * _FAST_CHARGE_DIODE R1 Z .---------.
* +-----|Discharge| * (optional) | 7| Vcc |
* | | | * +---------> +-----|Discharge|
* Z | 555 |3 * | | | |
* R2 Z | Out|---> Netlist Node * --- Z | 555 |3
* | 6| | * \ / R2 Z | Out|---> Netlist Node
* +-----|Threshold| * V | 6| |
* | | | * --- +-----|Threshold|
* +-----|Trigger | * | | | |
* | 2| |---< Control Voltage * +---------> +-----|Trigger |
* | | Reset |5 * | 2| |---< Control Voltage
* | '---------' * | | Reset |5
* --- 4| * | '---------'
* C --- | * --- 4|
* | ^ * C --- |
* gnd Reset * | ^
* gnd Reset
* *
* Declaration syntax * Declaration syntax
* *
@ -2723,27 +2792,27 @@
* *
* discrete_555_desc = * discrete_555_desc =
* { * {
* options, // bit mapped options * options, - bit mapped options
* v555, // B+ voltage of 555 * v_pos, - B+ voltage of 555
* v555high, // High output voltage of 555 (Usually v555 - 1.2V) * v_charge, - voltage to charge circuit (Defaults to v_pos)
* threshold555, // normally 2/3 of v555 * v_out_high, - High output voltage of 555 (Defaults to v_pos - 1.2V)
* trigger555 // normally 1/3 of v555
* } * }
* *
* The last 3 options of discrete_555_desc can use the following defaults * The last 2 options of discrete_555_desc can use the following defaults:
* unless otherwise needed. * DEFAULT_555_CHARGE - to connect v_charge to v_pos
* DEFAULT_555_HIGH, DEFAULT_555_THRESHOLD, DEFAULT_555_TRIGGER * DEFAULT_555_HIGH - to use the normal output voltage based on v_pos
* or all 3 combined as: * or combine both as:
* DEFAULT_555_VALUES * DEFAULT_555_VALUES
* *
* eg. {DISC_555_OUT_DC | DISC_555_OUT_SQW, 12, DEFAULT_555_VALUES} * eg. {DISC_555_OUT_SQW | DISC_555_OUT_DC, 12, DEFAULT_555_VALUES}
* *
* Output Types: * Output Types: (only needed with DISC_555_OUT_SQW, DISC_555_OUT_CAP
* and DISC_555_OUT_ENERGY)
* DISC_555_OUT_DC - Output is actual DC. (DEFAULT) * DISC_555_OUT_DC - Output is actual DC. (DEFAULT)
* DISC_555_OUT_AC - A cheat to make the waveform AC. * DISC_555_OUT_AC - A cheat to make the waveform AC.
* *
* Waveform Types: (ORed with output types) * Waveform Types: (ORed with output types)
* DISC_555_OUT_SQW - Output is Squarewave. 0 or v555high. (DEFAULT) * DISC_555_OUT_SQW - Output is Squarewave. 0 or v_out_high. (DEFAULT)
* When the state changes from low to high (or high to low) * When the state changes from low to high (or high to low)
* during a sample, the output will high (or low) for that * during a sample, the output will high (or low) for that
* sample. This can cause alaising effects. * sample. This can cause alaising effects.
@ -2763,7 +2832,7 @@
* through the sample, then the output will be 75% of the * through the sample, then the output will be 75% of the
* normal high value. * normal high value.
* DISC_555_OUT_LOGIC_X - This will output the 0/1 level of the flip-flop with * DISC_555_OUT_LOGIC_X - This will output the 0/1 level of the flip-flop with
* some eXtra info. This X info is in decimal remainder. * some eXtra info. This x_time is in decimal remainder.
* It lets you know the percent of sample time where the * It lets you know the percent of sample time where the
* flip-flop changed state. If 0, the change did not happen * flip-flop changed state. If 0, the change did not happen
* during the sample. 1.75 means the flip-flop is 1 and * during the sample. 1.75 means the flip-flop is 1 and
@ -2771,8 +2840,8 @@
* 0.2 means the flip-flop is 0 and switched over 4/5 of * 0.2 means the flip-flop is 0 and switched over 4/5 of
* the way through the sample. * the way through the sample.
* X modules can be used with counters to reduce alaising. * X modules can be used with counters to reduce alaising.
* DISC_555_OUT_COUNT_F_X - Same as DISC_555_OUT_COUNT_F but with X info. * DISC_555_OUT_COUNT_F_X - Same as DISC_555_OUT_COUNT_F but with x_time.
* DISC_555_OUT_COUNT_R_X - Same as DISC_555_OUT_COUNT_R but with X info. * DISC_555_OUT_COUNT_R_X - Same as DISC_555_OUT_COUNT_R but with x_time.
* *
* other options - DISCRETE_555_ASTABLE only: * other options - DISCRETE_555_ASTABLE only:
* DISC_555_ASTABLE_HAS_FAST_CHARGE_DIODE - diode used to bypass rDischarge * DISC_555_ASTABLE_HAS_FAST_CHARGE_DIODE - diode used to bypass rDischarge
@ -2785,9 +2854,10 @@
* DISCRETE_555_MSTABLE - NE555 Chip simulation (monostable mode) * DISCRETE_555_MSTABLE - NE555 Chip simulation (monostable mode)
* - Triggered on falling edge. * - Triggered on falling edge.
* *
* v555 * v_charge v_pos
* | * V V
* .---------+ * | |
* | |
* | | * | |
* Z | * Z |
* R Z .---------. * R Z .---------.
@ -2817,11 +2887,13 @@
* C node (or value) in farads, * C node (or value) in farads,
* address of discrete_555_desc structure) * address of discrete_555_desc structure)
* *
* discrete_555_desc = See DISCRETE_555_ASTABLE for description.
*
* Trigger Types * Trigger Types
* DISC_555_TRIGGER_IS_LOGIC - Input is (0 or !0) logic (DEFAULT) * DISC_555_TRIGGER_IS_LOGIC - Input is (0 or !0) logic (DEFAULT)
* DISC_555_TRIGGER_IS_VOLTAGE - Input is actual voltage. * DISC_555_TRIGGER_IS_VOLTAGE - Input is actual voltage.
* Voltage must drop below * Voltage must drop below
* trigger555 to activate. * trigger to activate.
* DISC_555_TRIGGER_DISCHARGES_CAP - some circuits connect an external * DISC_555_TRIGGER_DISCHARGES_CAP - some circuits connect an external
* device (transistor) to the cap to * device (transistor) to the cap to
* discharge it when the trigger is * discharge it when the trigger is
@ -2833,7 +2905,7 @@
* DISC_555_OUT_AC - A cheat to make the waveform AC. * DISC_555_OUT_AC - A cheat to make the waveform AC.
* *
* Waveform Types: (ORed with trigger types) * Waveform Types: (ORed with trigger types)
* DISC_555_OUT_SQW - Output is Squarewave. 0 or v555high. (DEFAULT) * DISC_555_OUT_SQW - Output is Squarewave. 0 or v_out_high. (DEFAULT)
* DISC_555_OUT_CAP - Output is Timing Capacitor 'C' voltage. * DISC_555_OUT_CAP - Output is Timing Capacitor 'C' voltage.
* *
* EXAMPLES: see Frogs * EXAMPLES: see Frogs
@ -2843,7 +2915,7 @@
* DISCRETE_555_CC - Constant Current Controlled 555 Oscillator * DISCRETE_555_CC - Constant Current Controlled 555 Oscillator
* Which works out to a VCO when R is fixed. * Which works out to a VCO when R is fixed.
* *
* vCCsource v555 * v_cc_source v_pos
* V V * V V
* | .----------------------+ * | .----------------------+
* | | | * | | |
@ -2895,15 +2967,20 @@
* address of discrete_555_cc_desc structure) * address of discrete_555_cc_desc structure)
* *
* discrete_555_cc_desc = * discrete_555_cc_desc =
* { * {
* options, // bit mapped options * options; - bit mapped options
* v555, // B+ voltage of 555 * v_pos; - B+ voltage of 555
* v555high, // High output voltage of 555 (Usually v555 - 1.2V) * v_cc_source; - Voltage of the Constant Current source
* threshold555, // normally 2/3 of v555 * v_out_high; - High output voltage of 555 (Defaults to v_pos - 1.2V)
* trigger555, // normally 1/3 of v555 * v_cc_junction; - The voltage drop of the Constant Current source transitor
* vCCsource, // B+ voltage of the Constant Current source * (0 if Op Amp)
* vCCjunction // The voltage drop of the Constant Current source transitor (0 if Op Amp) * }
* } *
* The last 2 options of discrete_555_desc can use the following defaults:
* DEFAULT_555_CC_SOURCE - to connect v_cc_source to v_pos
* DEFAULT_555_HIGH - to use the normal output voltage based on v_pos
* or combine both as:
* DEFAULT_555_VALUES
* *
* Output Types: * Output Types:
* See DISCRETE_555_ASTABLE for description. * See DISCRETE_555_ASTABLE for description.
@ -2942,7 +3019,7 @@
* | En|<--------. | .---|Discharge | * | En|<--------. | .---|Discharge |
* '----' | gnd | '------------' * '----' | gnd | '------------'
* | | | * | | |
* gnd '-----------------------+---ZZZZ------> 5V * gnd '-----------------------+---ZZZZ------> v_charge (ignored)
* rX * rX
* *
* Declaration syntax * Declaration syntax
@ -2958,12 +3035,16 @@
* Vin2 (CV) node or static value, * Vin2 (CV) node or static value,
* address of discrete_555_vco1_desc structure) * address of discrete_555_vco1_desc structure)
* *
* discrete_555_vco1_desc = {options, // bit mapped options * discrete_555_vco1_desc =
* r1, r2, r3, r4, c, * {
* v555, // B+ voltage of 555 * options, - bit mapped options
* v555high, // High output voltage of 555 (Usually v555 - 1.2V) * r1, r2, r3, r4, c,
* threshold555, // normally 2/3 of v555 * v_pos, - B+ voltage of 555
* trigger555} // normally 1/3 of v555 * v_out_high, - High output voltage of 555 (Defaults to v_pos - 1.2V)
* }
*
* The last option of discrete_555_vco1_desc can use the following default:
* DEFAULT_555_HIGH - to use the normal output voltage based on v_pos
* *
* Notes: The value of resistor rX is not needed. It is just a pull-up * Notes: The value of resistor rX is not needed. It is just a pull-up
* for the discharge output. * for the discharge output.
@ -3543,15 +3624,15 @@ typedef struct _discrete_mixer_desc discrete_mixer_desc;
struct _discrete_mixer_desc struct _discrete_mixer_desc
{ {
int type; int type;
double r[DISC_MAX_MIXER_INPUTS]; // static input resistance values. These are in series with rNode, if used. double r[DISC_MAX_MIXER_INPUTS]; /* static input resistance values. These are in series with rNode, if used. */
int rNode[DISC_MAX_MIXER_INPUTS]; // variable resistance nodes, if needed. 0 if not used. int r_node[DISC_MAX_MIXER_INPUTS]; /* variable resistance nodes, if needed. 0 if not used. */
double c[DISC_MAX_MIXER_INPUTS]; double c[DISC_MAX_MIXER_INPUTS];
double rI; double rI;
double rF; double rF;
double cF; double cF;
double cAmp; double cAmp;
double vRef; double vRef;
double gain; // Scale value to get output close to +/- 32767 double gain; /* Scale value to get output close to +/- 32767 */
}; };
@ -3632,44 +3713,40 @@ struct _discrete_op_amp_filt_info
}; };
#define DEFAULT_555_CHARGE -1
#define DEFAULT_555_HIGH -1 #define DEFAULT_555_HIGH -1
#define DEFAULT_555_THRESHOLD -1 #define DEFAULT_555_VALUES DEFAULT_555_CHARGE, DEFAULT_555_HIGH
#define DEFAULT_555_TRIGGER -1
#define DEFAULT_555_VALUES DEFAULT_555_HIGH, DEFAULT_555_THRESHOLD, DEFAULT_555_TRIGGER
typedef struct _discrete_555_desc discrete_555_desc; typedef struct _discrete_555_desc discrete_555_desc;
struct _discrete_555_desc struct _discrete_555_desc
{ {
int options; // bit mapped options int options; /* bit mapped options */
double v555; // B+ voltage of 555 double v_pos; /* B+ voltage of 555 */
double v555high; // High output voltage of 555 (Usually v555 - 1.2V) double v_charge; /* voltage to charge circuit (Defaults to v_pos) */
double threshold555; // normally 2/3 of v555 double v_out_high; /* High output voltage of 555 (Defaults to v_pos - 1.2V) */
double trigger555; // normally 1/3 of v555
}; };
#define DEFAULT_555_CC_SOURCE DEFAULT_555_CHARGE
typedef struct _discrete_555_cc_desc discrete_555_cc_desc; typedef struct _discrete_555_cc_desc discrete_555_cc_desc;
struct _discrete_555_cc_desc struct _discrete_555_cc_desc
{ {
int options; // bit mapped options int options; /* bit mapped options */
double v555; // B+ voltage of 555 double v_pos; /* B+ voltage of 555 */
double v555high; // High output voltage of 555 (Usually v555 - 1.2V) double v_cc_source; /* Voltage of the Constant Current source */
double threshold555; // normally 2/3 of v555 double v_out_high; /* High output voltage of 555 (Defaults to v_pos - 1.2V) */
double trigger555; // normally 1/3 of v555 double v_cc_junction; /* The voltage drop of the Constant Current source transitor (0 if Op Amp) */
double vCCsource; // B+ voltage of the Constant Current source
double vCCjunction; // The voltage drop of the Constant Current source transitor (0 if Op Amp)
}; };
typedef struct _discrete_555_vco1_desc discrete_555_vco1_desc; typedef struct _discrete_555_vco1_desc discrete_555_vco1_desc;
struct _discrete_555_vco1_desc struct _discrete_555_vco1_desc
{ {
int options; // bit mapped options int options; /* bit mapped options */
double r1, r2, r3, r4, c; double r1, r2, r3, r4, c;
double v555; // B+ voltage of 555 double v_pos; /* B+ voltage of 555 */
double v555high; // High output voltage of 555 (Usually v555 - 1.2V) double v_charge; /* (ignored) */
double threshold555; // normally 2/3 of v555 double v_out_high; /* High output voltage of 555 (Defaults to v_pos - 1.2V) */
double trigger555; // normally 1/3 of v555
}; };
@ -3958,7 +4035,7 @@ enum
/* from disc_wav.c */ /* from disc_wav.c */
/* generic modules */ /* generic modules */
#define DISCRETE_COUNTER(NODE,ENAB,RESET,CLK,MAX,DIR,INIT0,CLKTYPE) { NODE, DSS_COUNTER , 7, { ENAB,RESET,CLK,NODE_NC,DIR,INIT0,NODE_NC }, { ENAB,RESET,CLK,MAX,DIR,INIT0,CLKTYPE }, NULL, "DISCRETE_COUNTER" }, #define DISCRETE_COUNTER(NODE,ENAB,RESET,CLK,MAX,DIR,INIT0,CLKTYPE) { NODE, DSS_COUNTER , 7, { ENAB,RESET,CLK,NODE_NC,DIR,INIT0,NODE_NC }, { ENAB,RESET,CLK,MAX,DIR,INIT0,CLKTYPE }, NULL, "DISCRETE_COUNTER" },
#define DISCRETE_COUNTER_7492(NODE,ENAB,RESET,CLK) { NODE, DSS_COUNTER , 7, { ENAB,RESET,CLK,NODE_NC,NODE_NC,NODE_NC,NODE_NC }, { ENAB,RESET,CLK,5,1,0,DISC_COUNTER_IS_7492 }, NULL, "DISCRETE_COUNTER_7492" }, #define DISCRETE_COUNTER_7492(NODE,ENAB,RESET,CLK,CLKTYPE) { NODE, DSS_COUNTER , 7, { ENAB,RESET,CLK,NODE_NC,NODE_NC,NODE_NC,NODE_NC }, { ENAB,RESET,CLK,CLKTYPE,1,0,DISC_COUNTER_IS_7492 }, NULL, "DISCRETE_COUNTER_7492" },
#define DISCRETE_LFSR_NOISE(NODE,ENAB,RESET,CLK,AMPL,FEED,BIAS,LFSRTB) { NODE, DSS_LFSR_NOISE , 6, { ENAB,RESET,CLK,AMPL,FEED,BIAS }, { ENAB,RESET,CLK,AMPL,FEED,BIAS }, LFSRTB, "LFSR Noise Source" }, #define DISCRETE_LFSR_NOISE(NODE,ENAB,RESET,CLK,AMPL,FEED,BIAS,LFSRTB) { NODE, DSS_LFSR_NOISE , 6, { ENAB,RESET,CLK,AMPL,FEED,BIAS }, { ENAB,RESET,CLK,AMPL,FEED,BIAS }, LFSRTB, "LFSR Noise Source" },
#define DISCRETE_NOISE(NODE,ENAB,FREQ,AMPL,BIAS) { NODE, DSS_NOISE , 4, { ENAB,FREQ,AMPL,BIAS }, { ENAB,FREQ,AMPL,BIAS }, NULL, "Noise Source" }, #define DISCRETE_NOISE(NODE,ENAB,FREQ,AMPL,BIAS) { NODE, DSS_NOISE , 4, { ENAB,FREQ,AMPL,BIAS }, { ENAB,FREQ,AMPL,BIAS }, NULL, "Noise Source" },
#define DISCRETE_NOTE(NODE,ENAB,CLK,DATA,MAX1,MAX2,CLKTYPE) { NODE, DSS_NOTE , 6, { ENAB,CLK,DATA,NODE_NC,NODE_NC,NODE_NC }, { ENAB,CLK,DATA,MAX1,MAX2,CLKTYPE }, NULL, "Note Generator" }, #define DISCRETE_NOTE(NODE,ENAB,CLK,DATA,MAX1,MAX2,CLKTYPE) { NODE, DSS_NOTE , 6, { ENAB,CLK,DATA,NODE_NC,NODE_NC,NODE_NC }, { ENAB,CLK,DATA,MAX1,MAX2,CLKTYPE }, NULL, "Note Generator" },
@ -4079,6 +4156,8 @@ enum
#define DISCRETE_555_VCO1_CV(NODE,RESET,VIN,CTRLV,OPTIONS) { NODE, DSD_555_VCO1 , 3, { RESET,VIN,CTRLV }, { RESET,VIN,CTRLV }, OPTIONS, "555 VCO1 with CV - Op-Amp type" }, #define DISCRETE_555_VCO1_CV(NODE,RESET,VIN,CTRLV,OPTIONS) { NODE, DSD_555_VCO1 , 3, { RESET,VIN,CTRLV }, { RESET,VIN,CTRLV }, OPTIONS, "555 VCO1 with CV - Op-Amp type" },
#define DISCRETE_566(NODE,ENAB,VMOD,R,C,OPTIONS) { NODE, DSD_566 , 4, { ENAB,VMOD,R,C }, { ENAB,VMOD,R,C }, OPTIONS, "566" }, #define DISCRETE_566(NODE,ENAB,VMOD,R,C,OPTIONS) { NODE, DSD_566 , 4, { ENAB,VMOD,R,C }, { ENAB,VMOD,R,C }, OPTIONS, "566" },
#define DISCRETE_74LS624(NODE,ENAB,VMOD,VRNG,C,OUTTYPE) { NODE, DSD_LS624 , 5, { ENAB,VMOD,VRNG,C,NODE_NC }, { ENAB,VMOD,VRNG,C, OUTTYPE }, NULL, "74LS624" }, #define DISCRETE_74LS624(NODE,ENAB,VMOD,VRNG,C,OUTTYPE) { NODE, DSD_LS624 , 5, { ENAB,VMOD,VRNG,C,NODE_NC }, { ENAB,VMOD,VRNG,C, OUTTYPE }, NULL, "74LS624" },
/* logging */
#define DISCRETE_CSVLOG1(NODE1) { NODE_SPECIAL, DSO_CSVLOG , 1, { NODE1 }, { NODE1 }, NULL, "CSV Log 1 Node" }, #define DISCRETE_CSVLOG1(NODE1) { NODE_SPECIAL, DSO_CSVLOG , 1, { NODE1 }, { NODE1 }, NULL, "CSV Log 1 Node" },
#define DISCRETE_CSVLOG2(NODE1,NODE2) { NODE_SPECIAL, DSO_CSVLOG , 2, { NODE1,NODE2 }, { NODE1,NODE2 }, NULL, "CSV Log 2 Nodes" }, #define DISCRETE_CSVLOG2(NODE1,NODE2) { NODE_SPECIAL, DSO_CSVLOG , 2, { NODE1,NODE2 }, { NODE1,NODE2 }, NULL, "CSV Log 2 Nodes" },
#define DISCRETE_CSVLOG3(NODE1,NODE2,NODE3) { NODE_SPECIAL, DSO_CSVLOG , 3, { NODE1,NODE2,NODE3 }, { NODE1,NODE2,NODE3 }, NULL, "CSV Log 3 Nodes" }, #define DISCRETE_CSVLOG3(NODE1,NODE2,NODE3) { NODE_SPECIAL, DSO_CSVLOG , 3, { NODE1,NODE2,NODE3 }, { NODE1,NODE2,NODE3 }, NULL, "CSV Log 3 Nodes" },
@ -4086,6 +4165,7 @@ enum
#define DISCRETE_CSVLOG5(NODE1,NODE2,NODE3,NODE4,NODE5) { NODE_SPECIAL, DSO_CSVLOG , 5, { NODE1,NODE2,NODE3,NODE4,NODE5 }, { NODE1,NODE2,NODE3,NODE4,NODE5 }, NULL, "CSV Log 5 Nodes" }, #define DISCRETE_CSVLOG5(NODE1,NODE2,NODE3,NODE4,NODE5) { NODE_SPECIAL, DSO_CSVLOG , 5, { NODE1,NODE2,NODE3,NODE4,NODE5 }, { NODE1,NODE2,NODE3,NODE4,NODE5 }, NULL, "CSV Log 5 Nodes" },
#define DISCRETE_WAVELOG1(NODE1,GAIN1) { NODE_SPECIAL, DSO_WAVELOG , 2, { NODE1,NODE_NC }, { NODE1,GAIN1 }, NULL, "Wave Log 1 Node" }, #define DISCRETE_WAVELOG1(NODE1,GAIN1) { NODE_SPECIAL, DSO_WAVELOG , 2, { NODE1,NODE_NC }, { NODE1,GAIN1 }, NULL, "Wave Log 1 Node" },
#define DISCRETE_WAVELOG2(NODE1,GAIN1,NODE2,GAIN2) { NODE_SPECIAL, DSO_WAVELOG , 4, { NODE1,NODE_NC,NODE2,NODE_NC }, { NODE1,GAIN1,NODE2,GAIN2 }, NULL, "Wave Log 2 Nodes" }, #define DISCRETE_WAVELOG2(NODE1,GAIN1,NODE2,GAIN2) { NODE_SPECIAL, DSO_WAVELOG , 4, { NODE1,NODE_NC,NODE2,NODE_NC }, { NODE1,GAIN1,NODE2,GAIN2 }, NULL, "Wave Log 2 Nodes" },
/* output */
#define DISCRETE_OUTPUT(OPNODE,GAIN) { NODE_SPECIAL, DSO_OUTPUT , 2, { OPNODE,NODE_NC }, { 0,GAIN }, NULL, "Output Node" }, #define DISCRETE_OUTPUT(OPNODE,GAIN) { NODE_SPECIAL, DSO_OUTPUT , 2, { OPNODE,NODE_NC }, { 0,GAIN }, NULL, "Output Node" },

View File

@ -44,7 +44,6 @@ static const discrete_555_cc_desc asteroid_thump_555cc =
DISC_555_OUT_SQW | DISC_555_OUT_AC | DISCRETE_555_CC_TO_CAP, DISC_555_OUT_SQW | DISC_555_OUT_AC | DISCRETE_555_CC_TO_CAP,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
5, // B+ voltage of the Constant Current source
0.8 // VBE 2N3906 (Si) 0.8 // VBE 2N3906 (Si)
}; };

View File

@ -95,14 +95,14 @@ static const discrete_mixer_desc crash_mixer =
static const discrete_555_desc crash_beeper_555m = static const discrete_555_desc crash_beeper_555m =
{ {
DISC_555_TRIGGER_IS_LOGIC | DISC_555_OUT_DC | DISC_555_OUT_SQW, DISC_555_OUT_SQW | DISC_555_OUT_DC | DISC_555_TRIGGER_IS_LOGIC,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES DEFAULT_555_VALUES
}; };
static const discrete_555_desc crash_beeper_555a = static const discrete_555_desc crash_beeper_555a =
{ {
DISC_555_OUT_DC | DISC_555_OUT_SQW, DISC_555_OUT_SQW | DISC_555_OUT_DC,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES DEFAULT_555_VALUES
}; };

View File

@ -201,62 +201,73 @@ static const discrete_lfsr_desc dkong_lfsr =
}; };
static const discrete_mixer_desc dkong_rc_jump_desc = static const discrete_mixer_desc dkong_rc_jump_desc =
{DISC_MIXER_IS_RESISTOR, {
{1, DK_R49+DK_R51,NE555_INTERNAL_R,2*NE555_INTERNAL_R}, DISC_MIXER_IS_RESISTOR,
{NODE_26,0,0,0}, {1, DK_R49+DK_R51,NE555_INTERNAL_R,2*NE555_INTERNAL_R},
{0,0,0,0}, // no node capacitors {NODE_26,0,0,0},
0, 0, {0,0,0,0}, // no node capacitors
DK_C24, 0, 0,
0, DK_C24,
0, 1}; 0,
0, 1
};
static const discrete_mixer_desc dkong_rc_walk_desc = static const discrete_mixer_desc dkong_rc_walk_desc =
{DISC_MIXER_IS_RESISTOR, {
{1, DK_R45+DK_R44,NE555_INTERNAL_R,2*NE555_INTERNAL_R}, DISC_MIXER_IS_RESISTOR,
{NODE_52,0,0,0}, {1, DK_R45+DK_R44,NE555_INTERNAL_R,2*NE555_INTERNAL_R},
{0,0,0,0}, // no node capacitors {NODE_52,0,0,0},
0, 0, {0,0,0,0}, // no node capacitors
DK_C29, 0, 0,
0, DK_C29,
0, 1}; 0,
0, 1
};
static const discrete_mixer_desc dkong_mixer_desc = static const discrete_mixer_desc dkong_mixer_desc =
{DISC_MIXER_IS_RESISTOR, {
{DK_R2, DK_R24, DK_R1, DK_R14}, DISC_MIXER_IS_RESISTOR,
{0,0,0}, // no variable resistors {DK_R2, DK_R24, DK_R1, DK_R14},
{0,0,0}, // no node capacitors {0,0,0}, // no variable resistors
{0,0,0}, // no node capacitors
#if DK_REVIEW #if DK_REVIEW
0, RES_K(10), 0, RES_K(10),
#else #else
0, 0, 0, 0,
#endif #endif
DK_C159, DK_C159,
DK_C12, DK_C12,
0, 1}; 0, 1
};
/* There is no load on the output for the jump circuit /* There is no load on the output for the jump circuit
* For the walk circuit, the voltage does not matter */ * For the walk circuit, the voltage does not matter */
static const discrete_555_desc dkong_555_vco_desc = static const discrete_555_desc dkong_555_vco_desc =
{DISC_555_OUT_DC | DISC_555_OUT_ENERGY, {
DK_SUP_V, DISC_555_OUT_ENERGY | DISC_555_OUT_DC,
DK_SUP_V-0.5,DK_SUP_V*0.66,DK_SUP_V*0.33 DK_SUP_V,
}; DEFAULT_555_CHARGE,
DK_SUP_V - 0.5
};
static const discrete_inverter_osc_desc dkong_inverter_osc_desc_jump = static const discrete_inverter_osc_desc dkong_inverter_osc_desc_jump =
{DEFAULT_CD40XX_VALUES(DK_SUP_V), {
DEFAULT_CD40XX_VALUES(DK_SUP_V),
DISC_OSC_INVERTER_IS_TYPE1 DISC_OSC_INVERTER_IS_TYPE1
}; };
static const discrete_inverter_osc_desc dkong_inverter_osc_desc_walk = static const discrete_inverter_osc_desc dkong_inverter_osc_desc_walk =
{DEFAULT_CD40XX_VALUES(DK_SUP_V), {
DEFAULT_CD40XX_VALUES(DK_SUP_V),
DISC_OSC_INVERTER_IS_TYPE2 DISC_OSC_INVERTER_IS_TYPE2
}; };
static const discrete_op_amp_filt_info dkong_sallen_key_info = static const discrete_op_amp_filt_info dkong_sallen_key_info =
{ RES_K(5.6), RES_K(5.6), 0, 0, 0, {
CAP_N(22), CAP_N(10), 0 RES_K(5.6), RES_K(5.6), 0, 0, 0,
}; CAP_N(22), CAP_N(10), 0
};
static DISCRETE_SOUND_START(dkong2b) static DISCRETE_SOUND_START(dkong2b)
@ -502,11 +513,7 @@ static const discrete_mixer_desc radarscp_mixer_desc_7 =
/* There is no load on the output for the jump circuit /* There is no load on the output for the jump circuit
* For the walk circuit, the voltage does not matter */ * For the walk circuit, the voltage does not matter */
static const discrete_555_desc radarscp_555_vco_desc = #define radarscp_555_vco_desc dkong_555_vco_desc
{DISC_555_OUT_DC | DISC_555_OUT_ENERGY,
DK_SUP_V,
DK_SUP_V-0.5,DK_SUP_V*0.66,DK_SUP_V*0.33
};
static const discrete_inverter_osc_desc radarscp_inverter_osc_desc_0 = static const discrete_inverter_osc_desc radarscp_inverter_osc_desc_0 =
{DEFAULT_CD40XX_VALUES(DK_SUP_V), {DEFAULT_CD40XX_VALUES(DK_SUP_V),

View File

@ -110,7 +110,6 @@ static const discrete_555_cc_desc firetrk_motor_vco =
DISC_555_OUT_DC | DISC_555_OUT_SQW, DISC_555_OUT_DC | DISC_555_OUT_SQW,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
5, // B+ voltage of the Constant Current source
0.7 // Q2 junction voltage 0.7 // Q2 junction voltage
}; };
@ -222,7 +221,7 @@ DISCRETE_SOUND_START(firetrk)
RES_M(1), 0, 0, // R28, no rGnd, no rDis RES_M(1), 0, 0, // R28, no rGnd, no rDis
&firetrk_motor_vco) &firetrk_motor_vco)
DISCRETE_COUNTER_7492(NODE_23, 1, FIRETRUCK_ATTRACT_EN, // IC A9, QB-QD DISCRETE_COUNTER_7492(NODE_23, 1, FIRETRUCK_ATTRACT_EN, // IC A9, QB-QD
NODE_22) // from IC B9, pin 3 NODE_22, DISC_CLK_ON_F_EDGE) // from IC B9, pin 3
DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 0x04, "01&") // IC A9, pin 8 DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 0x04, "01&") // IC A9, pin 8
DISCRETE_COUNTER(NODE_25, 1, FIRETRUCK_ATTRACT_EN, // IC A9, pin 12 DISCRETE_COUNTER(NODE_25, 1, FIRETRUCK_ATTRACT_EN, // IC A9, pin 12
NODE_24, // from IC A9, pin 8 NODE_24, // from IC A9, pin 8
@ -337,7 +336,6 @@ static const discrete_555_cc_desc superbug_motor_vco =
DISC_555_OUT_DC | DISC_555_OUT_SQW, DISC_555_OUT_DC | DISC_555_OUT_SQW,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
5, // B+ voltage of the Constant Current source
0.7 // Q1 junction voltage 0.7 // Q1 junction voltage
}; };
@ -426,8 +424,8 @@ DISCRETE_SOUND_START(superbug)
RES_M(3.3), 0, 0, // R11, no rGnd, no rDis RES_M(3.3), 0, 0, // R11, no rGnd, no rDis
&superbug_motor_vco) &superbug_motor_vco)
DISCRETE_COUNTER_7492(NODE_23, 1, SUPERBUG_ATTRACT_EN, // IC A7, QB-QD DISCRETE_COUNTER_7492(NODE_23, 1, SUPERBUG_ATTRACT_EN, // IC A7, QB-QD
NODE_22) // from IC A6, pin 3 NODE_22, DISC_CLK_ON_F_EDGE) // from IC A6, pin 3
DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 0x04, "01&") // IC A7, pin 8-QD DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 0x04, "01&") // IC A7, pin 8-QD
DISCRETE_TRANSFORM2(NODE_25, 1, NODE_23, 0x01, "01&") // IC A7, pin 11-QB DISCRETE_TRANSFORM2(NODE_25, 1, NODE_23, 0x01, "01&") // IC A7, pin 11-QB
DISCRETE_LOGIC_XOR(NODE_26, 1, NODE_24, NODE_25) // Gate A9, pin 8 DISCRETE_LOGIC_XOR(NODE_26, 1, NODE_24, NODE_25) // Gate A9, pin 8
DISCRETE_COUNTER(NODE_27, 1, SUPERBUG_ATTRACT_EN, // IC A7, pin 12-QA DISCRETE_COUNTER(NODE_27, 1, SUPERBUG_ATTRACT_EN, // IC A7, pin 12-QA
@ -498,7 +496,6 @@ static const discrete_555_cc_desc montecar_motor_vco =
DISC_555_OUT_DC | DISC_555_OUT_SQW, DISC_555_OUT_DC | DISC_555_OUT_SQW,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
5, // B+ voltage of the Constant Current source
0.7 // Q1 junction voltage 0.7 // Q1 junction voltage
}; };
@ -611,7 +608,7 @@ DISCRETE_SOUND_START(montecar)
RES_M(1), 0, 0, // R86, no rGnd, no rDis RES_M(1), 0, 0, // R86, no rGnd, no rDis
&montecar_motor_vco) &montecar_motor_vco)
DISCRETE_COUNTER_7492(NODE_23, 1, MONTECAR_ATTRACT_EN, // IC B/C9, QB-QD DISCRETE_COUNTER_7492(NODE_23, 1, MONTECAR_ATTRACT_EN, // IC B/C9, QB-QD
NODE_22) // from IC C9, pin 9 NODE_22, DISC_CLK_ON_F_EDGE) // from IC C9, pin 9
DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 0x04, "01&") // IC B/C9, pin 8-QD DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 0x04, "01&") // IC B/C9, pin 8-QD
DISCRETE_TRANSFORM2(NODE_25, 1, NODE_23, 0x01, "01&") // IC B/C9, pin 11-QB DISCRETE_TRANSFORM2(NODE_25, 1, NODE_23, 0x01, "01&") // IC B/C9, pin 11-QB
DISCRETE_LOGIC_XOR(NODE_26, 1, NODE_24, NODE_25) // Gate A9, pin 11 DISCRETE_LOGIC_XOR(NODE_26, 1, NODE_24, NODE_25) // Gate A9, pin 11
@ -646,7 +643,7 @@ DISCRETE_SOUND_START(montecar)
RES_M(1), 0, 0, // R81, no rGnd, no rDis RES_M(1), 0, 0, // R81, no rGnd, no rDis
&montecar_motor_vco) &montecar_motor_vco)
DISCRETE_COUNTER_7492(NODE_43, 1, MONTECAR_ATTRACT_EN, // IC A/B9, QB-QD DISCRETE_COUNTER_7492(NODE_43, 1, MONTECAR_ATTRACT_EN, // IC A/B9, QB-QD
NODE_42) // from IC C9, pin 5 NODE_42, DISC_CLK_ON_F_EDGE) // from IC C9, pin 5
DISCRETE_TRANSFORM2(NODE_44, 1, NODE_43, 0x04, "01&") // IC A/B9, pin 8-QD DISCRETE_TRANSFORM2(NODE_44, 1, NODE_43, 0x04, "01&") // IC A/B9, pin 8-QD
DISCRETE_TRANSFORM2(NODE_45, 1, NODE_43, 0x01, "01&") // IC A/B9, pin 11-QB DISCRETE_TRANSFORM2(NODE_45, 1, NODE_43, 0x01, "01&") // IC A/B9, pin 11-QB
DISCRETE_LOGIC_XOR(NODE_46, 1, NODE_44, NODE_45) // Gate A9, pin 6 DISCRETE_LOGIC_XOR(NODE_46, 1, NODE_44, NODE_45) // Gate A9, pin 6

View File

@ -3151,10 +3151,9 @@ static const discrete_comp_adder_table invaders_thump_resistors =
static const discrete_555_desc invaders_thump_555 = static const discrete_555_desc invaders_thump_555 =
{ {
DISC_555_OUT_ENERGY | DISC_555_OUT_DC, DISC_555_OUT_ENERGY | DISC_555_OUT_DC,
5,
5.0 - 0.6, /* 5V - diode drop */ 5.0 - 0.6, /* 5V - diode drop */
DEFAULT_TTL_V_LOGIC_1, /* Output of F3 7411 buffer */ DEFAULT_TTL_V_LOGIC_1 /* Output of F3 7411 buffer */
DEFAULT_555_THRESHOLD,
DEFAULT_555_TRIGGER
}; };
@ -3708,8 +3707,8 @@ static const discrete_555_desc blueshrk_555_H1B =
{ {
DISC_555_OUT_ENERGY | DISC_555_OUT_DC, DISC_555_OUT_ENERGY | DISC_555_OUT_DC,
5, /* B+ voltage of 555 */ 5, /* B+ voltage of 555 */
12, /* the OC buffer H2 converts the output voltage to 12V. */ DEFAULT_555_CHARGE,
DEFAULT_555_THRESHOLD, DEFAULT_555_TRIGGER 12 /* the OC buffer H2 converts the output voltage to 12V. */
}; };

View File

@ -238,7 +238,8 @@ static const discrete_555_desc phoenix_effect2_555 =
{ {
DISC_555_OUT_ENERGY, DISC_555_OUT_ENERGY,
5, // B+ voltage of 555 5, // B+ voltage of 555
4.0, DEFAULT_555_THRESHOLD, DEFAULT_555_TRIGGER DEFAULT_555_CHARGE,
4.0 // loaded output voltage
}; };
static const discrete_comp_adder_table phoenix_effect2_cap_sel = static const discrete_comp_adder_table phoenix_effect2_cap_sel =
@ -335,52 +336,145 @@ DISCRETE_SOUND_START(phoenix)
/* - level 5 spaceship */ /* - level 5 spaceship */
/************************************************/ /************************************************/
/* R22 has been confirmed on real boards as 470 ohm, not 47k in schematics */ /* R22 has been confirmed on real boards as 470 ohm, not 47k in schematics */
DISCRETE_RCDISC4(NODE_20, 1, PHOENIX_EFFECT_1_FREQ, 470, RES_K(100), RES_K(33), CAP_U(6.8), 12, 1) // R22, R23, R24, C7 DISCRETE_RCDISC4(NODE_20, /* IC52 output pin 7 */
DISCRETE_555_ASTABLE_CV(NODE_21, 1, RES_K(47), RES_K(47), CAP_U(.001), NODE_20, &phoenix_effect1_555) // R25, R26, C8 1, /* ENAB */
PHOENIX_EFFECT_1_FREQ, /* Input to O.C. inverter */
470, /* R22 */
RES_K(100), /* R23 */
RES_K(33), /* R24 */
CAP_U(6.8), /* C7 */
12, /* 12V supply */
1) /* Circuit type 1 */
DISCRETE_555_ASTABLE_CV(NODE_21, /* IC20 pin 6 */
1, /* ENAB */
RES_K(47), /* R25 */
RES_K(47), /* R26 */
CAP_U(.001), /* C8 */
NODE_20, /* IC48 pin 5 input */
&phoenix_effect1_555)
/* LS163 counts rising edge, but the LS14 inverts that */ /* LS163 counts rising edge, but the LS14 inverts that */
DISCRETE_NOTE(NODE_22, 1, NODE_21, PHOENIX_EFFECT_1_DATA, 0x0f, 1, DISC_CLK_BY_COUNT | DISC_OUT_IS_ENERGY) DISCRETE_NOTE(NODE_22, /* IC21 pin 5 output */
1, /* ENAB */
NODE_21, /* IC13 pin 2 clock input */
PHOENIX_EFFECT_1_DATA, /* Pre-load data */
0x0f, /* Maximum count of first counter 0-15 (IC13) */
1, /* Maximum count of second counter 0-1 (IC21) */
DISC_CLK_BY_COUNT | DISC_OUT_IS_ENERGY) /* Module is clocked externally and we anti-alias output */
/* When FILT is enabled, the effect is filtered. /* When FILT is enabled, the effect is filtered.
* While the R20 does decrease the amplitude a little, its main purpose * While the R20 does decrease the amplitude a little, its main purpose
* is to discharge C5 when the filter is disabled. */ * is to discharge C5 when the filter is disabled. */
DISCRETE_SWITCH(NODE_23, 1, PHOENIX_EFFECT_1_FILT, DEFAULT_TTL_V_LOGIC_1, DEFAULT_TTL_V_LOGIC_1 * RES_K(100) / (RES_K(10) + RES_K(100))) // R20, R19 DISCRETE_SWITCH(NODE_23,
DISCRETE_MULTIPLY(NODE_24, 1, NODE_22, NODE_23) 1, /* ENAB */
DISCRETE_RCFILTER(NODE_25, 1, NODE_24, 1.0/(1.0/RES_K(10) + 1.0/RES_K(100)), CAP_U(.047)) // R19, R20, C5 PHOENIX_EFFECT_1_FILT,
DISCRETE_SWITCH(PHOENIX_EFFECT_1_SND, 1, PHOENIX_EFFECT_1_FILT, NODE_24, NODE_25) DEFAULT_TTL_V_LOGIC_1,
DEFAULT_TTL_V_LOGIC_1 * RES_K(100) / (RES_K(10) + RES_K(100))) /* R20, R19 */
DISCRETE_MULTIPLY(NODE_24,
1, /* ENAB */
NODE_22,
NODE_23)
DISCRETE_RCFILTER(NODE_25,
1,
NODE_24,
1.0/(1.0/RES_K(10) + 1.0/RES_K(100)), /* R19, R20 */
CAP_U(.047)) /* C5 */
DISCRETE_SWITCH(PHOENIX_EFFECT_1_SND,
1, /* ENAB */
PHOENIX_EFFECT_1_FILT,
NODE_24, /* non-filtered */
NODE_25) /* filtered */
/************************************************/ /************************************************/
/* Effect 2 */ /* Effect 2 */
/* - bird flying, bird/phoenix/spaceship hit */ /* - bird flying, bird/phoenix/spaceship hit */
/* - phoenix wing hit */ /* - phoenix wing hit */
/************************************************/ /************************************************/
DISCRETE_COMP_ADDER(NODE_30, 1, PHOENIX_EFFECT_2_FREQ, &phoenix_effect2_cap_sel) DISCRETE_COMP_ADDER(NODE_30, /* total capacitance of selected capacitors */
1, /* ENAB */
PHOENIX_EFFECT_2_FREQ, /* passed selection bits */
&phoenix_effect2_cap_sel)
/* Part of the frequency select also effects the gain */ /* Part of the frequency select also effects the gain */
DISCRETE_TRANSFORM2(NODE_31, 1, PHOENIX_EFFECT_2_FREQ, 2, "01&1/") // get bit 0x02 DISCRETE_TRANSFORM2(NODE_31, /* 0/1 state of PHOENIX_EFFECT_2_FREQ high bit */
DISCRETE_SWITCH(NODE_32, 1, NODE_31, DEFAULT_TTL_V_LOGIC_1, DEFAULT_TTL_V_LOGIC_1/2) 1, /* ENAB */
DISCRETE_555_ASTABLE(NODE_33, 1, RES_K(47), RES_K(100), NODE_30, &phoenix_effect2_555) // R40, R41 PHOENIX_EFFECT_2_FREQ, 2, "01&1/") // get bit 0x02
DISCRETE_SWITCH(NODE_32, /* voltage level */
1, /* ENAB */
NODE_31, /* PHOENIX_EFFECT_2_FREQ high bit determines voltage level */
DEFAULT_TTL_V_LOGIC_1,
DEFAULT_TTL_V_LOGIC_1 / 2)
DISCRETE_555_ASTABLE(NODE_33, /* pin 3 output of IC44 */
1, /* ENAB */
RES_K(47), /* R40 */
RES_K(100), /* R41 */
NODE_30, /* C16, C17, C18 combined */
&phoenix_effect2_555)
/* C20 has been confirmed on real boards as 1uF, not 10uF in schematics */ /* C20 has been confirmed on real boards as 1uF, not 10uF in schematics */
DISCRETE_555_ASTABLE(NODE_34, 1, RES_K(510), RES_K(510), CAP_U(1), &phoenix_effect2_555) // R23, R24, C20 DISCRETE_555_ASTABLE(NODE_34, /* pin 3 output of IC51 */
1, /* ENAB */
RES_K(510), /* R23 */
RES_K(510), /* R24 */
CAP_U(1), /* C20 */
&phoenix_effect2_555)
/* R45 & R46 have been confirmed on real boards as 5.1k, not 51k in schematics */ /* R45 & R46 have been confirmed on real boards as 5.1k, not 51k in schematics */
/* We need to work backwards here and calculate the voltage at the junction of R42 & R46 */ /* We need to work backwards here and calculate the voltage at the junction of R42 & R46 */
/* If you remove C22 from the real PCB, you can WAVELOG NODE_35 with a gain of 1000 and compare /* If you remove C22 from the real PCB, you can WAVELOG NODE_35 with a gain of 1000 and compare
* it against the junction of R42 & R46 on a real PCB. */ * it against the junction of R42 & R46 on a real PCB. */
DISCRETE_MIXER3(NODE_35, 1, NODE_33, NODE_34, 5, &phoenix_effect2_mixer1) DISCRETE_MIXER3(NODE_35, /* Voltage at junction of R42 & R46 with C22 removed */
1, /* ENAB */
NODE_33, /* output from IC44 */
NODE_34, /* output from IC51 */
5, /* B+ connected internally to pin 5 of 555 */
&phoenix_effect2_mixer1)
/* Then calculate the voltage going to C22 */ /* Then calculate the voltage going to C22 */
/* If you remove C22 from the real PCB, you can WAVELOG NODE_36 with a gain of 1000 and compare /* If you remove C22 from the real PCB, you can WAVELOG NODE_36 with a gain of 1000 and compare
* it against the junction of R45 & R46 on a real PCB. */ * it against the junction of R45 & R46 on a real PCB. */
DISCRETE_MIXER2(NODE_36, 1, NODE_34, NODE_35, &phoenix_effect2_mixer2) DISCRETE_MIXER2(NODE_36, /* Voltage at junction of R45 & R46 with C22 removed */
1, /* ENAB */
NODE_34, /* pin 3 output of IC51 */
NODE_35, /* Voltage at junction of R42 & R46 with C22 removed */
&phoenix_effect2_mixer2)
/* C22 charging is R45 in parallel with R46, R42 and the 555 CV internal resistance */ /* C22 charging is R45 in parallel with R46, R42 and the 555 CV internal resistance */
DISCRETE_RCFILTER(NODE_37, 1, NODE_36, 1.0/ (1.0/RES_K(5.1) + (1.0/(RES_K(5.1) + 1.0/(1.0/RES_K(10) + 1.0/RES_K(5) + 1.0/RES_K(10)) ))), CAP_U(100)) // R45, R46, R42, internal 555 Rs, C22 DISCRETE_RCFILTER(NODE_37,
1, /* ENAB */
NODE_36,
1.0/ (1.0/RES_K(5.1) + (1.0/(RES_K(5.1) + 1.0/(1.0/RES_K(10) + 1.0/RES_K(5) + 1.0/RES_K(10)) ))),
CAP_U(100)) /* R45, R46, R42, internal 555 Rs, C22 */
/* Now mix from C22 on */ /* Now mix from C22 on */
/* You can WAVELOG NODE_38 with a gain of 1000 and compare it against IC50 pin 5 on a real PCB. */ /* You can WAVELOG NODE_38 with a gain of 1000 and compare it against IC50 pin 5 on a real PCB. */
DISCRETE_MIXER3(NODE_38, 1, NODE_33, NODE_37, 5, &phoenix_effect2_mixer3) DISCRETE_MIXER3(NODE_38, /* control voltage to pin 5 of IC50 */
DISCRETE_555_ASTABLE_CV(NODE_39, 1, RES_K(20), RES_K(20), CAP_U(0.001), NODE_38, &phoenix_effect1_555) // R47, R48, C23 1, /* ENAB */
DISCRETE_NOTE(NODE_40, 1, NODE_39, PHOENIX_EFFECT_2_DATA, 0x0f, 1, DISC_CLK_BY_COUNT | DISC_OUT_IS_ENERGY) NODE_33, /* pin 3 output of IC44 */
DISCRETE_MULTIPLY(PHOENIX_EFFECT_2_SND, 1, NODE_40, NODE_32) NODE_37, /* voltage on C22 */
5, /* IC50 internally connected to B+ */
&phoenix_effect2_mixer3)
DISCRETE_555_ASTABLE_CV(NODE_39, /* IC20 pin 8 output */
1, /* ENAB */
RES_K(20), /* R47 */
RES_K(20), /* R48 */
CAP_U(0.001), /* C23 */
NODE_38, /* IC50 pin 5 input */
&phoenix_effect1_555)
DISCRETE_NOTE(NODE_40, /* IC21 pin 9 output */
1, /* ENAB */
NODE_39, /* IC14 pin 2 clock input */
PHOENIX_EFFECT_2_DATA, /* Pre-load data */
0x0f, /* Maximum count of first counter 0-15 (IC14) */
1, /* Maximum count of second counter 0-1 (IC21) */
DISC_CLK_BY_COUNT | DISC_OUT_IS_ENERGY)
DISCRETE_MULTIPLY(PHOENIX_EFFECT_2_SND,
1, /* ENAB */
NODE_40, /* IC21 pin 9 output */
NODE_32) /* voltage level selected by high bit of PHOENIX_EFFECT_2_FREQ */
/************************************************/ /************************************************/
/* Combine all sound sources. */ /* Combine all sound sources. */
/************************************************/ /************************************************/
DISCRETE_MIXER4(NODE_90, 1, PHOENIX_EFFECT_1_SND, PHOENIX_EFFECT_2_SND, PHOENIX_EFFECT_3_SND, PHOENIX_EFFECT_4_SND,&phoenix_mixer) DISCRETE_MIXER4(NODE_90,
1, /* ENAB */
PHOENIX_EFFECT_1_SND,
PHOENIX_EFFECT_2_SND,
PHOENIX_EFFECT_3_SND,
PHOENIX_EFFECT_4_SND,
&phoenix_mixer)
DISCRETE_OUTPUT(NODE_90, 1) DISCRETE_OUTPUT(NODE_90, 1)
DISCRETE_SOUND_END DISCRETE_SOUND_END
@ -389,9 +483,11 @@ WRITE8_HANDLER( phoenix_sound_control_a_w )
{ {
discrete_sound_w(machine, PHOENIX_EFFECT_2_DATA, data & 0x0f); discrete_sound_w(machine, PHOENIX_EFFECT_2_DATA, data & 0x0f);
discrete_sound_w(machine, PHOENIX_EFFECT_2_FREQ, (data & 0x30) >> 4); discrete_sound_w(machine, PHOENIX_EFFECT_2_FREQ, (data & 0x30) >> 4);
// discrete_sound_w(PHOENIX_EFFECT_3_EN , data & 0x40); #if 0
// discrete_sound_w(PHOENIX_EFFECT_4_EN , data & 0x80); /* future handling of noise sounds */
discrete_sound_w(PHOENIX_EFFECT_3_EN , data & 0x40);
discrete_sound_w(PHOENIX_EFFECT_4_EN , data & 0x80);
#endif
stream_update(channel); stream_update(channel);
sound_latch_a = data; sound_latch_a = data;
} }

View File

@ -26,7 +26,6 @@ static const discrete_555_cc_desc poolshrk_score_vco =
DISC_555_OUT_SQW, DISC_555_OUT_SQW,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
5, // B+ voltage of the Constant Current source
0.7 // Q3 junction voltage 0.7 // Q3 junction voltage
}; };

View File

@ -88,7 +88,7 @@ static const discrete_555_desc spiders_fire_555a =
static const discrete_555_desc spiders_super_web_555a = static const discrete_555_desc spiders_super_web_555a =
{ {
DISC_555_OUT_DC | DISC_555_OUT_CAP, DISC_555_OUT_CAP | DISC_555_OUT_DC,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES DEFAULT_555_VALUES
}; };

View File

@ -42,7 +42,6 @@ static const discrete_555_cc_desc sprint2_motor_vco =
DISC_555_OUT_DC | DISC_555_OUT_SQW, DISC_555_OUT_DC | DISC_555_OUT_SQW,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
5, // B+ voltage of the Constant Current source
0.7 // VBE 2N3644 (Si) 0.7 // VBE 2N3644 (Si)
}; };
@ -140,7 +139,7 @@ DISCRETE_SOUND_START(sprint2)
&sprint2_motor_vco) &sprint2_motor_vco)
/* QB-D of 7492 */ /* QB-D of 7492 */
DISCRETE_COUNTER_7492(NODE_23, 1, SPRINT2_ATTRACT_EN, NODE_22) DISCRETE_COUNTER_7492(NODE_23, 1, SPRINT2_ATTRACT_EN, NODE_22, DISC_CLK_ON_F_EDGE)
/* Mask the bits and XOR for clock input */ /* Mask the bits and XOR for clock input */
DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 1, "01&") DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 1, "01&")
@ -178,7 +177,7 @@ DISCRETE_SOUND_START(sprint2)
&sprint2_motor_vco) &sprint2_motor_vco)
/* QB-D of 7492 */ /* QB-D of 7492 */
DISCRETE_COUNTER_7492(NODE_43, 1, SPRINT2_ATTRACT_EN, NODE_42) DISCRETE_COUNTER_7492(NODE_43, 1, SPRINT2_ATTRACT_EN, NODE_42, DISC_CLK_ON_F_EDGE)
/* Mask the bits and XOR for clock input */ /* Mask the bits and XOR for clock input */
DISCRETE_TRANSFORM2(NODE_44, 1, NODE_43, 1, "01&") DISCRETE_TRANSFORM2(NODE_44, 1, NODE_43, 1, "01&")
@ -263,7 +262,7 @@ DISCRETE_SOUND_START(sprint1)
&sprint2_motor_vco) &sprint2_motor_vco)
/* QB-D of 7492 */ /* QB-D of 7492 */
DISCRETE_COUNTER_7492(NODE_23, 1, SPRINT2_ATTRACT_EN, NODE_22) DISCRETE_COUNTER_7492(NODE_23, 1, SPRINT2_ATTRACT_EN, NODE_22, DISC_CLK_ON_F_EDGE)
/* Mask the bits and XOR for clock input */ /* Mask the bits and XOR for clock input */
DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 1, "01&") DISCRETE_TRANSFORM2(NODE_24, 1, NODE_23, 1, "01&")
@ -329,7 +328,6 @@ static const discrete_555_cc_desc dominos_tone_vco =
DISC_555_OUT_DC | DISC_555_OUT_SQW, DISC_555_OUT_DC | DISC_555_OUT_SQW,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
5, // B+ voltage of the Constant Current source
0.7 // Q1 junction voltage 0.7 // Q1 junction voltage
}; };
@ -381,7 +379,7 @@ DISCRETE_SOUND_START(dominos)
DISCRETE_DAC_R1(NODE_20, 1, DOMINOS_FREQ_DATA, DEFAULT_TTL_V_LOGIC_1, &dominos_tone_vco_dac) DISCRETE_DAC_R1(NODE_20, 1, DOMINOS_FREQ_DATA, DEFAULT_TTL_V_LOGIC_1, &dominos_tone_vco_dac)
DISCRETE_555_CC(NODE_21, 1, NODE_20, DOMINOS_R23, CAP_U(.01), 0, 0, 0, &dominos_tone_vco) DISCRETE_555_CC(NODE_21, 1, NODE_20, DOMINOS_R23, CAP_U(.01), 0, 0, 0, &dominos_tone_vco)
DISCRETE_COUNTER_7492(NODE_22, 1, DOMINOS_ATTRACT_EN, // IC D8, QB-QD DISCRETE_COUNTER_7492(NODE_22, 1, DOMINOS_ATTRACT_EN, // IC D8, QB-QD
NODE_21) // from IC D7/8, pin 3 NODE_21, DISC_CLK_ON_F_EDGE) // from IC D7/8, pin 3
DISCRETE_TRANSFORM2(NODE_23, 1, NODE_22, 0x01, "01&") // IC D8, pin 11-QB DISCRETE_TRANSFORM2(NODE_23, 1, NODE_22, 0x01, "01&") // IC D8, pin 11-QB
DISCRETE_SWITCH(NODE_24, 1, NODE_23, 0, // Enable gate C5 DISCRETE_SWITCH(NODE_24, 1, NODE_23, 0, // Enable gate C5
DOMINOS_AMP_DATA) // IC C4 DOMINOS_AMP_DATA) // IC C4

View File

@ -83,7 +83,6 @@ static const discrete_555_cc_desc sprint4_motor_vco =
DISC_555_OUT_DC | DISC_555_OUT_SQW, DISC_555_OUT_DC | DISC_555_OUT_SQW,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
5, // B+ voltage of the Constant Current source
0.7 // Q1 junction voltage 0.7 // Q1 junction voltage
}; };
@ -191,7 +190,8 @@ static const discrete_mixer_desc sprint4_mixer =
DISCRETE_COUNTER_7492(SPRINT4_PLAYER_MOTOR_NODE(4, _plr), /* IC D9, pins 11,9,8 */ \ DISCRETE_COUNTER_7492(SPRINT4_PLAYER_MOTOR_NODE(4, _plr), /* IC D9, pins 11,9,8 */ \
1, /* ENAB */ \ 1, /* ENAB */ \
SPRINT4_ATTRACT_EN, /* RESET */ \ SPRINT4_ATTRACT_EN, /* RESET */ \
SPRINT4_PLAYER_MOTOR_NODE(3, _plr)) /* CLK */ \ SPRINT4_PLAYER_MOTOR_NODE(3, _plr), /* CLK */ \
DISC_CLK_ON_F_EDGE) \
DISCRETE_TRANSFORM3(SPRINT4_PLAYER_MOTOR_NODE(5, _plr), /* IC B10, pin 3 */ \ DISCRETE_TRANSFORM3(SPRINT4_PLAYER_MOTOR_NODE(5, _plr), /* IC B10, pin 3 */ \
1, /* ENAB */ \ 1, /* ENAB */ \
SPRINT4_PLAYER_MOTOR_NODE(4, _plr), /* INP0 */ \ SPRINT4_PLAYER_MOTOR_NODE(4, _plr), /* INP0 */ \

View File

@ -65,7 +65,7 @@ static const discrete_555_desc tank8_555_a =
static const discrete_555_desc tank8_555_m = static const discrete_555_desc tank8_555_m =
{ {
DISC_555_TRIGGER_IS_VOLTAGE | DISC_555_OUT_SQW | DISC_555_OUT_DC, DISC_555_OUT_SQW | DISC_555_OUT_DC | DISC_555_TRIGGER_IS_VOLTAGE,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES DEFAULT_555_VALUES
}; };

View File

@ -77,7 +77,6 @@ static const discrete_555_cc_desc triplhnt_bear_roar_vco =
DISC_555_OUT_DC | DISC_555_OUT_SQW, DISC_555_OUT_DC | DISC_555_OUT_SQW,
5, // B+ voltage of 555 5, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
5, // B+ voltage of the Constant Current source
0.7 // Q2 junction voltage 0.7 // Q2 junction voltage
}; };

View File

@ -38,7 +38,7 @@ static emu_timer *frogs_croak_timer;
static const discrete_555_desc frogsZip555m = static const discrete_555_desc frogsZip555m =
{ {
DISC_555_TRIGGER_IS_LOGIC | DISC_555_OUT_DC | DISC_555_OUT_CAP, DISC_555_OUT_CAP | DISC_555_OUT_DC | DISC_555_TRIGGER_IS_LOGIC,
12, // B+ voltage of 555 12, // B+ voltage of 555
DEFAULT_555_VALUES DEFAULT_555_VALUES
}; };
@ -48,7 +48,6 @@ static const discrete_555_cc_desc frogsZip555cc =
DISC_555_OUT_CAP | DISC_555_OUT_DC, DISC_555_OUT_CAP | DISC_555_OUT_DC,
12, // B+ voltage of 555 12, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
12, // B+ voltage of the Constant Current source
0.6 // Q13 Vbe 0.6 // Q13 Vbe
}; };
@ -220,53 +219,62 @@ WRITE8_HANDLER( frogs_audio_w )
static const discrete_mixer_desc headon_mixer = static const discrete_mixer_desc headon_mixer =
{DISC_MIXER_IS_RESISTOR, {
{RES_K(130), RES_K(130), RES_K(100), RES_K(100), RES_K(100), RES_K(10)}, // 130 = 390/3, Bonus Res is dummy DISC_MIXER_IS_RESISTOR,
{0,0,0,0,0}, // no variable resistors {RES_K(130), RES_K(130), RES_K(100), RES_K(100), RES_K(100), RES_K(10)}, // 130 = 390/3, Bonus Res is dummy
{0,0,0,0,CAP_N(470),0}, {0,0,0,0,0}, // no variable resistors
0, RES_K(100), {0,0,0,0,CAP_N(470),0},
0, 0, RES_K(100),
CAP_U(1), // not in schematics, used to suppress DC 0,
0, 1}; CAP_U(1), // not in schematics, used to suppress DC
0, 1
};
static const discrete_mixer_desc headon_crash_mixer = static const discrete_mixer_desc headon_crash_mixer =
{DISC_MIXER_IS_OP_AMP, {
{RES_K(50), RES_K(10)}, // Resistors, in fact variable resistors (100k) DISC_MIXER_IS_OP_AMP,
{0,0,0,0,0}, // no variable resistors {RES_K(50), RES_K(10)}, // Resistors, in fact variable resistors (100k)
{CAP_N(100),CAP_U(1)}, {0,0,0,0,0}, // no variable resistors
0, RES_K(100), {CAP_N(100),CAP_U(1)},
0, 0, RES_K(100),
CAP_U(1)*0, // not in schematics, used to suppress DC 0,
0, 1}; CAP_U(1)*0, // not in schematics, used to suppress DC
0, 1
};
static const discrete_inverter_osc_desc headon_inverter_osc_1 = static const discrete_inverter_osc_desc headon_inverter_osc_1 =
{DEFAULT_CD40XX_VALUES(12), {
DEFAULT_CD40XX_VALUES(12),
DISC_OSC_INVERTER_IS_TYPE4 DISC_OSC_INVERTER_IS_TYPE4
}; };
static const discrete_inverter_osc_desc headon_inverter_osc_2 = static const discrete_inverter_osc_desc headon_inverter_osc_2 =
{DEFAULT_CD40XX_VALUES(12), {
DEFAULT_CD40XX_VALUES(12),
DISC_OSC_INVERTER_IS_TYPE5 | DISC_OSC_INVERTER_OUT_IS_LOGIC DISC_OSC_INVERTER_IS_TYPE5 | DISC_OSC_INVERTER_OUT_IS_LOGIC
}; };
static const discrete_555_desc headon_555_bonus = static const discrete_555_desc headon_555_bonus =
{DISC_555_OUT_DC | DISC_555_OUT_ENERGY, {
12, DISC_555_OUT_ENERGY | DISC_555_OUT_DC,
12-0.5,12*0.66,12*0.33 12,
}; DEFAULT_555_CHARGE,
12.0-0.5
};
static const discrete_555_desc headon_555_crash = static const discrete_555_desc headon_555_crash =
{DISC_555_OUT_DC | DISC_555_TRIGGER_IS_LOGIC, {
12, DISC_555_OUT_SQW | DISC_555_OUT_DC | DISC_555_TRIGGER_IS_LOGIC,
12-0.5,12*0.66,12*0.33 12,
}; DEFAULT_555_CHARGE,
12.0-0.5
};
static const discrete_555_cc_desc headon_555cc = static const discrete_555_cc_desc headon_555cc =
{ {
DISC_555_OUT_DC, DISC_555_OUT_SQW | DISC_555_OUT_DC,
12, // B+ voltage of 555 12, // B+ voltage of 555
DEFAULT_555_VALUES, DEFAULT_555_VALUES,
12, // B+ voltage of the Constant Current source
0.6 // Q16, Q10 Vbe 0.6 // Q16, Q10 Vbe
}; };
@ -274,15 +282,15 @@ static const discrete_555_cc_desc headon_555cc =
/* /*
* From : http://www.vego.nl/8/08/03/08_08_03.htm * From : http://www.vego.nl/8/08/03/08_08_03.htm
* *
* - voeding: -7 V, clock-frequentie: 2.267 Hz *- voeding: -7 V, clock-frequency: 2.267 Hz
*- voeding: -8 V, clock-frequentie: 8.731 Hz *- voeding: -8 V, clock-frequency: 8.731 Hz
*- voeding: -9 V, clock-frequentie: 16,38 kHz *- voeding: -9 V, clock-frequency: 16,38 kHz
*- voeding: -10 V, clock-frequentie: 23,53 kHz *- voeding: -10 V, clock-frequency: 23,53 kHz
*- voeding: -11 V, clock-frequentie: 32,56 kHz *- voeding: -11 V, clock-frequency: 32,56 kHz
*- voeding: -12 V, clock-frequentie: 38,34 kHz *- voeding: -12 V, clock-frequency: 38,34 kHz
*- voeding: -13 V, clock-frequentie: 40,00 kHz *- voeding: -13 V, clock-frequency: 40,00 kHz
*- voeding: -14 V, clock-frequentie: 37,80 kHz *- voeding: -14 V, clock-frequency: 37,80 kHz
*- voeding: -15 V, clock-frequentie: 33,17 kHz *- voeding: -15 V, clock-frequency: 33,17 kHz
* *
* However all other mame sources say 100kHz. * However all other mame sources say 100kHz.
*/ */
@ -305,9 +313,10 @@ static const discrete_lfsr_desc mm5837_lfsr =
}; };
static const discrete_op_amp_filt_info headon_sallen_key_info = static const discrete_op_amp_filt_info headon_sallen_key_info =
{ RES_K(15), RES_K(15), 0, 0, 0, {
CAP_N(470), CAP_N(47), 0 RES_K(15), RES_K(15), 0, 0, 0,
}; CAP_N(470), CAP_N(47), 0
};
static DISCRETE_SOUND_START(headon) static DISCRETE_SOUND_START(headon)
/************************************************ /************************************************