Battle Zone discrete sound & discrete sound additions

- added discrete sound to battle zone
- engine frequency (resistor R11) can be changed with slider
- discrete sound may be disabled by setting BZONE_DISCRETE to 0 in bzone.h

DISCRETE_RCDISC3
- added diode junction voltage 
- junction voltage also indicates polarity

DISCRETE_OPAMP_FILTER
- added type DISC_OP_AMP_FILTER_IS_LOW_PASS_1M
- INP2 takes role of v_ref in this type

DISCRETE_OPAMP
- Fixed a bug (possible divide by 0)

DISCRETE_LFSR
- Fixed bug preventing output of shift reg to sub node 1
This commit is contained in:
Couriersud 2009-08-21 20:55:04 +00:00
parent 2ed96fd12f
commit 0978f15208
9 changed files with 421 additions and 35 deletions

View File

@ -73,6 +73,7 @@ struct dst_rcdisc_context
double exponent0;
double exponent1;
double v_cap; /* rcdisc5 */
double v_diode; /* rcdisc3 */
};
struct dst_rcdisc_mod_context
@ -360,9 +361,21 @@ static DISCRETE_STEP(dst_op_amp_filt)
{
/* Millman the input voltages. */
i = context->iFixed;
i += (DST_OP_AMP_FILT__INP1 - context->vRef) / info->r1;
if (info->r2 != 0)
i += (DST_OP_AMP_FILT__INP2 - context->vRef) / info->r2;
switch (context->type)
{
case DISC_OP_AMP_FILTER_IS_LOW_PASS_1M:
i += (DST_OP_AMP_FILT__INP1 - DST_OP_AMP_FILT__INP2) / info->r1;
if (info->r2 != 0)
i += (context->vP - DST_OP_AMP_FILT__INP2) / info->r2;
if (info->r3 != 0)
i += (context->vN - DST_OP_AMP_FILT__INP2) / info->r3;
break;
default:
i += (DST_OP_AMP_FILT__INP1 - context->vRef) / info->r1;
if (info->r2 != 0)
i += (DST_OP_AMP_FILT__INP2 - context->vRef) / info->r2;
break;
}
v = i * context->rTotal;
}
@ -373,6 +386,11 @@ static DISCRETE_STEP(dst_op_amp_filt)
node->output[0] = context->vC1 * context->gain + info->vRef;
break;
case DISC_OP_AMP_FILTER_IS_LOW_PASS_1M:
context->vC1 += (v - context->vC1) * context->exponentC1;
node->output[0] = context->vC1 * context->gain + DST_OP_AMP_FILT__INP2;
break;
case DISC_OP_AMP_FILTER_IS_HIGH_PASS_1:
node->output[0] = (v - context->vC1) * context->gain + info->vRef;
context->vC1 += (v - context->vC1) * context->exponentC1;
@ -470,6 +488,7 @@ static DISCRETE_RESET(dst_op_amp_filt)
switch (context->type)
{
case DISC_OP_AMP_FILTER_IS_LOW_PASS_1:
case DISC_OP_AMP_FILTER_IS_LOW_PASS_1M:
context->exponentC1 = RC_CHARGE_EXP(info->rF * info->c1);
context->exponentC2 = 0;
break;
@ -634,6 +653,7 @@ static DISCRETE_RESET(dst_rcdisc2)
* input[2] - Resistor0 value (initialization only)
* input[4] - Resistor1 value (initialization only)
* input[5] - Capacitor Value (initialization only)
* input[6] - Diode Junction voltage (initialization only)
*
************************************************************************/
#define DST_RCDISC3__ENABLE (*(node->input[0]))
@ -641,6 +661,7 @@ static DISCRETE_RESET(dst_rcdisc2)
#define DST_RCDISC3__R1 (*(node->input[2]))
#define DST_RCDISC3__R2 (*(node->input[3]))
#define DST_RCDISC3__C (*(node->input[4]))
#define DST_RCDISC3__DJV (*(node->input[6]))
static DISCRETE_STEP(dst_rcdisc3)
{
@ -653,15 +674,31 @@ static DISCRETE_STEP(dst_rcdisc3)
if(DST_RCDISC3__ENABLE)
{
diff = DST_RCDISC3__IN - node->output[0];
if( diff > 0 )
if (context->v_diode > 0)
{
diff = diff - (diff * context->exponent0);
} else if( diff < 0)
{
if(diff < -0.5)
diff = diff - (diff * context->exponent1);
else
if( diff > 0 )
{
diff = diff - (diff * context->exponent0);
} else if( diff < 0)
{
if(diff < -context->v_diode)
diff = diff - (diff * context->exponent1);
else
diff = diff - (diff * context->exponent0);
}
}
else
{
if( diff < 0 )
{
diff = diff - (diff * context->exponent0);
} else if( diff > 0)
{
if(diff > -context->v_diode)
diff = diff - (diff * context->exponent1);
else
diff = diff - (diff * context->exponent0);
}
}
node->output[0] += diff;
}
@ -679,6 +716,7 @@ static DISCRETE_RESET(dst_rcdisc3)
context->state = 0;
context->t = 0;
context->v_diode = DST_RCDISC3__DJV;
context->exponent0 = RC_CHARGE_EXP(DST_RCDISC3__R1 * DST_RCDISC3__C);
context->exponent1 = RC_CHARGE_EXP(RES_2_PARALLEL(DST_RCDISC3__R1, DST_RCDISC3__R2) * DST_RCDISC3__C);
}

View File

@ -1872,8 +1872,10 @@ static DISCRETE_RESET(dst_op_amp)
context->exponent = disc_info->sample_rate * info->c;
}
if (info->r3 >= 0)
if (info->r3 > 0)
context->i_fixed = (info->vP - OP_AMP_NORTON_VBE) / info->r3;
else
context->i_fixed = 0;
}

View File

@ -479,7 +479,7 @@ static DISCRETE_STEP(dss_lfsr)
/* output the lfsr reg ?*/
if (context->out_lfsr_reg)
node->output[1] = context->lfsr_reg;
node->output[1] = (double) context->lfsr_reg;
}
if(!DSS_LFSR_NOISE__ENABLE)

View File

@ -141,7 +141,7 @@ static const discrete_module module_list[] =
/* from disc_wav.c */
/* Generic modules */
{ DSS_COUNTER ,"DSS_COUNTER" , 1 ,sizeof(struct dss_counter_context) ,dss_counter_reset ,dss_counter_step },
{ DSS_LFSR_NOISE ,"DSS_LFSR_NOISE" , 1 ,sizeof(struct dss_lfsr_context) ,dss_lfsr_reset ,dss_lfsr_step },
{ DSS_LFSR_NOISE ,"DSS_LFSR_NOISE" , 2 ,sizeof(struct dss_lfsr_context) ,dss_lfsr_reset ,dss_lfsr_step },
{ DSS_NOISE ,"DSS_NOISE" , 1 ,sizeof(struct dss_noise_context) ,dss_noise_reset ,dss_noise_step },
{ DSS_NOTE ,"DSS_NOTE" , 1 ,sizeof(struct dss_note_context) ,dss_note_reset ,dss_note_step },
{ DSS_SAWTOOTHWAVE,"DSS_SAWTOOTHWAVE", 1 ,sizeof(struct dss_sawtoothwave_context),dss_sawtoothwave_reset,dss_sawtoothwave_step},

View File

@ -287,7 +287,7 @@
* DISCRETE_OP_AMP_FILTER(NODE,ENAB,INP0,INP1,TYPE,INFO)
* DISCRETE_RCDISC(NODE,ENAB,IN0,RVAL,CVAL)
* DISCRETE_RCDISC2(NODE,SWITCH,INP0,RVAL0,INP1,RVAL1,CVAL)
* DISCRETE_RCDISC3(NODE,ENAB,INP0,RVAL0,RVAL1,CVAL)
* DISCRETE_RCDISC3(NODE,ENAB,INP0,RVAL0,RVAL1,CVAL, DJV)
* DISCRETE_RCDISC4(NODE,ENAB,INP0,RVAL0,RVAL1,RVAL2,CVAL,VP,TYPE)
* DISCRETE_RCDISC5(NODE,ENAB,IN0,RVAL,CVAL)
* DISCRETE_RCINTEGRATE(NODE,INP0,RVAL0,RVAL1,RVAL2,CVAL,vP,TYPE)
@ -2249,7 +2249,26 @@
* vRef >-----------------------' |/
*
* --------------------------------------------------
*
* DISC_OP_AMP_FILTER_IS_LOW_PASS_1M
* First Order Low Pass Filter
*
* c1
* .-------||---------.
* | |
* r1 | rF |
* IN0 >--ZZZZ--. +------ZZZZ--------+
* | | |
* r2 | | |\ |
* VP >--ZZZZ--+------+--------+ | \ |
* | '--|- \ |
* r3 | | >--+----------> Netlist Node
* VN >--ZZZZ--' .--|+ /
* | | /
* IN1 >------------------------' |/
*
* --------------------------------------------------
*
* DISC_OP_AMP_FILTER_IS_HIGH_PASS_1
* First Order High Pass Filter
*
@ -2482,7 +2501,10 @@
* | |
* ENAB -0------>| |
* | diode R2 |
* INPUT1 -1------>| -+-|<|--ZZZZ-+- |----> Netlist node
* JV -5------>| -+-|>|--ZZZZ-+- |----> Netlist node (JV < 0)
* | |
* | diode R2 |
* INPUT1 -1------>| -+-|<|--ZZZZ-+- |----> Netlist node (JV > 0)
* | | | |
* RVAL1 -2------>| '-ZZZZ-+----' |
* | R1 | |
@ -2499,16 +2521,19 @@
* input node (or value),
* R1 resistor value in OHMS,
* R2 resistor value in OHMS,
* capacitor value in FARADS)
* capacitor value in FARADS,
* diode junction voltage)
*
* The polarity of the diode junction voltage determines the polarity of the diode.
*
* Example config line
*
* DISCRETE_RCDISC3(NODE_11,NODE_10,10,100,220,CAP_U(1))
* DISCRETE_RCDISC3(NODE_11,NODE_10,10,100,220,CAP_U(1), 0.5)
*
* When enabled by NODE_10, C charges from 10v as indicated by RC
* of 100R & 1uF.
*
* EXAMPLES: see Tank8
* EXAMPLES: see Tank8, bzone
*
***********************************************************************
*
@ -3460,6 +3485,7 @@ enum
#define DISC_OP_AMP_FILTER_IS_BAND_PASS_1M 0x30
#define DISC_OP_AMP_FILTER_IS_HIGH_PASS_0 0x40
#define DISC_OP_AMP_FILTER_IS_BAND_PASS_0 0x50
#define DISC_OP_AMP_FILTER_IS_LOW_PASS_1M 0x60
#define DISC_OP_AMP_FILTER_TYPE_MASK (0xf0 | DISC_OP_AMP_IS_NORTON) // Used only internally.
@ -4292,7 +4318,7 @@ enum
#define DISCRETE_OP_AMP_FILTER(NODE,ENAB,INP0,INP1,TYPE,INFO) { NODE, DST_OP_AMP_FILT , 4, { ENAB,INP0,INP1,NODE_NC }, { ENAB,INP0,INP1,TYPE }, INFO, "DISCRETE_OP_AMP_FILTER" },
#define DISCRETE_RCDISC(NODE,ENAB,INP0,RVAL,CVAL) { NODE, DST_RCDISC , 4, { ENAB,INP0,NODE_NC,NODE_NC }, { ENAB,INP0,RVAL,CVAL }, NULL, "DISCRETE_RCDISC" },
#define DISCRETE_RCDISC2(NODE,SWITCH,INP0,RVAL0,INP1,RVAL1,CVAL) { NODE, DST_RCDISC2 , 6, { SWITCH,INP0,NODE_NC,INP1,NODE_NC,NODE_NC }, { SWITCH,INP0,RVAL0,INP1,RVAL1,CVAL }, NULL, "DISCRETE_RCDISC2" },
#define DISCRETE_RCDISC3(NODE,ENAB,INP0,RVAL0,RVAL1,CVAL) { NODE, DST_RCDISC3 , 5, { ENAB,INP0,NODE_NC,NODE_NC,NODE_NC }, { ENAB,INP0,RVAL0,RVAL1,CVAL }, NULL, "DISCRETE_RCDISC3" },
#define DISCRETE_RCDISC3(NODE,ENAB,INP0,RVAL0,RVAL1,CVAL,DJV) { NODE, DST_RCDISC3 , 6, { ENAB,INP0,NODE_NC,NODE_NC,NODE_NC,NODE_NC }, { ENAB,INP0,RVAL0,RVAL1,CVAL,DJV }, NULL, "DISCRETE_RCDISC3" },
#define DISCRETE_RCDISC4(NODE,ENAB,INP0,RVAL0,RVAL1,RVAL2,CVAL,VP,TYPE) { NODE, DST_RCDISC4 , 8, { ENAB,INP0,NODE_NC,NODE_NC,NODE_NC,NODE_NC,NODE_NC,NODE_NC }, { ENAB,INP0,RVAL0,RVAL1,RVAL2,CVAL,VP,TYPE }, NULL, "DISCRETE_RCDISC4" },
#define DISCRETE_RCDISC5(NODE,ENAB,INP0,RVAL,CVAL) { NODE, DST_RCDISC5 , 4, { ENAB,INP0,NODE_NC,NODE_NC }, { ENAB,INP0,RVAL,CVAL }, NULL, "DISCRETE_RCDISC5" },
#define DISCRETE_RCDISC_MODULATED(NODE,INP0,INP1,RVAL0,RVAL1,RVAL2,RVAL3,CVAL,VP) { NODE, DST_RCDISC_MOD, 8, { INP0,INP1,NODE_NC,NODE_NC,NODE_NC,NODE_NC,NODE_NC,NODE_NC }, { INP0,INP1,RVAL0,RVAL1,RVAL2,RVAL3,CVAL,VP }, NULL, "DISCRETE_RCDISC_MODULATED" },

View File

@ -22,6 +22,7 @@ D0 explosion enable gates a noise generator
#include "streams.h"
#include "bzone.h"
#if !BZONE_DISCRETE
#define OUTPUT_RATE (6000*4)
@ -295,4 +296,293 @@ DEVICE_GET_INFO( bzone_sound )
}
}
#else
#include "sound/discrete.h"
#include "sound/pokey.h"
#define BZ_NOISE_CLOCK 12000 /* FIXME */
/*************************************
*
* Discrete Sound Defines
*
*************************************/
#define BZ_INPUT NODE_01 /* at M2 LS273 */
#define BZ_INP_EXPLO NODE_SUB(10, 0)
#define BZ_INP_EXPLOLS NODE_SUB(10, 1)
#define BZ_INP_SHELL NODE_SUB(10, 2)
#define BZ_INP_SHELLLS NODE_SUB(10, 3)
#define BZ_INP_ENGREV NODE_SUB(10, 4)
#define BZ_INP_SOUNDEN NODE_SUB(10, 5)
#define BZ_INP_STARTLED NODE_SUB(10, 6)
#define BZ_INP_MOTEN NODE_SUB(10, 7)
#define TTL_OUT 5
#define BZ_R5 RES_K(1)
#define BZ_R6 RES_K(4.7)
#define BZ_R7 RES_K(1)
#define BZ_R8 RES_K(100)
#define BZ_R9 RES_K(22)
//#define RT (1.0/BZ_R5 + 1.0/BZ_R6 * 1.0/BZ_R7)
#define BZ_R10 RES_K(100)
#define BZ_R11 RES_K(250)
#define BZ_R12 RES_K(33)
#define BZ_R13 RES_K(10)
#define BZ_R14 RES_K(22)
#define BZ_R15 RES_K(1)
#define BZ_R16 RES_K(1)
#define BZ_R17 RES_K(22)
#define BZ_R18 RES_K(10)
#define BZ_R19 RES_K(33)
#define BZ_R20 RES_K(33)
#define BZ_R21 RES_K(33)
#define BZ_R25 RES_K(100)
#define BZ_R26 RES_K(33)
#define BZ_R27 RES_K(330)
#define BZ_R28 RES_K(100)
#define BZ_R29 RES_K(22)
#define BZ_R32 RES_K(330)
#define BZ_R33 RES_K(330)
#define BZ_R34 RES_K(33)
#define BZ_R35 RES_K(33)
#define BZ_C9 CAP_U(4.7)
#define BZ_C11 CAP_U(0.015)
#define BZ_C13 CAP_U(10)
#define BZ_C14 CAP_U(10)
#define BZ_C21 CAP_U(0.0047)
#define BZ_C22 CAP_U(0.0047)
#define BZ_C29 CAP_U(0.47)
/*************************************
*
* Discrete Sound static structs
*
*************************************/
static const discrete_lfsr_desc bzone_lfsr =
{
DISC_CLK_IS_FREQ,
16, /* Bit Length */
0, /* Reset Value */
3, /* Use Bit 10 (QC of second LS164) as F0 input 0 */
14, /* Use Bit 23 (QH of third LS164) as F0 input 1 */
DISC_LFSR_XOR, /* F0 is XOR */
DISC_LFSR_NOT_IN0, /* F1 is inverted F0*/
DISC_LFSR_REPLACE, /* F2 replaces the shifted register contents */
0x000001, /* Everything is shifted into the first bit only */
DISC_LFSR_FLAG_OUTPUT_SR_SN1, /* output the complete shift register to sub node 1*/
15 /* Output bit */
};
static const discrete_op_amp_filt_info bzone_explo_0 =
{
BZ_R18 + BZ_R19, 0, 0, 0, /* r1, r2, r3, r4 */
BZ_R33, /* rF */
BZ_C22, 0, 0, /* c1, c2, c3 */
0, /* vRef - not used */
22, 0 /* vP, vN */
};
static const discrete_op_amp_filt_info bzone_explo_1 =
{
BZ_R18, 0, 0, 0, /* r1, r2, r3, r4 */
BZ_R33, /* rF */
BZ_C22, 0, 0, /* c1, c2, c3 */
0, /* vRef - not used */
22, 0 /* vP, vN */
};
static const discrete_op_amp_filt_info bzone_shell_0 =
{
BZ_R13 + BZ_R12, 0, 0, 0, /* r1, r2, r3, r4 */
BZ_R32, /* rF */
BZ_C21, 0, 0, /* c1, c2, c3 */
0, /* vRef - not used */
22, 0 /* vP, vN */
};
static const discrete_op_amp_filt_info bzone_shell_1 =
{
BZ_R13, 0, 0, 0, /* r1, r2, r3, r4 */
BZ_R32, /* rF */
BZ_C21, 0, 0, /* c1, c2, c3 */
0, /* vRef - not used */
22, 0 /* vP, vN */
};
static const discrete_555_desc bzone_vco_desc =
{
DISC_555_OUT_DC,
5.0,
DEFAULT_555_CHARGE,
1.0 // Logic output
};
static const discrete_mixer_desc bzone_eng_mixer_desc =
{
DISC_MIXER_IS_RESISTOR,
{BZ_R20, BZ_R21, BZ_R34, BZ_R35},
{0, 0, 0, 0},
{0, 0, 0, 0},
0, 0,
BZ_C29,
0, /* no out cap */
0, TTL_OUT /* inputs are logic */
};
static const discrete_mixer_desc bzone_final_mixer_desc =
{
DISC_MIXER_IS_RESISTOR,
{BZ_R28, BZ_R25, BZ_R26, BZ_R27},
{0, 0, 0, 0},
{0, 0, 0, 0},
0, BZ_R29,
0,
0, /* no out cap */
0, 1
};
/*************************************
*
* Discrete Sound Blocks
*
*************************************/
static DISCRETE_SOUND_START(bzone)
/************************************************/
/* Input register mapping for galaxian */
/************************************************/
DISCRETE_INPUT_DATA(BZ_INPUT)
/* decode the bits */
DISCRETE_BITS_DECODE(NODE_10, BZ_INPUT, 0, 7, 5.7)// TTL_OUT) /* QA-QD 74393 */
DISCRETE_ADJUSTMENT_TAG(NODE_11, 0, RES_K(250), DISC_LINADJ, "R11")
/************************************************/
/* NOISE */
/************************************************/
/* 12Khz clock is divided by two by B4 74LS109 */
DISCRETE_LFSR_NOISE(NODE_30, 1, 1, BZ_NOISE_CLOCK / 2, 1.0, 0, 0.5, &bzone_lfsr)
/* divide by 2 */
DISCRETE_COUNTER(NODE_31, 1, 0, NODE_30, 1, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE)
DISCRETE_BITS_DECODE(NODE_32, NODE_SUB(30,1), 11, 14, 1) /* to NAND LS20, J4 */
/* 11-14 */
DISCRETE_LOGIC_NAND4(NODE_33,1,NODE_SUB(32,0),NODE_SUB(32,1),NODE_SUB(32,2),NODE_SUB(32,3))
/* divide by 2 */
DISCRETE_COUNTER(NODE_34, 1, 0, NODE_33, 1, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE)
/************************************************/
/* Explosion */
/************************************************/
/* FIXME: +0.7 for diode */
DISCRETE_RCDISC5(NODE_40, NODE_34, BZ_INP_EXPLO, BZ_R17 + BZ_R16, BZ_C14)
DISCRETE_MULTIPLY(NODE_41, 1, BZ_R16 / (BZ_R17 + BZ_R16), NODE_40)
/* one of two filter configurations active */
DISCRETE_LOGIC_INVERT(NODE_42, 1, BZ_INP_EXPLOLS)
DISCRETE_OP_AMP_FILTER(NODE_43, BZ_INP_EXPLOLS, 0, NODE_41,
DISC_OP_AMP_FILTER_IS_LOW_PASS_1M, &bzone_explo_1)
DISCRETE_OP_AMP_FILTER(NODE_44, NODE_42, 0, NODE_41,
DISC_OP_AMP_FILTER_IS_LOW_PASS_1M, &bzone_explo_0)
DISCRETE_ADDER2(NODE_45, 1, NODE_43, NODE_44)
/************************************************/
/* Shell */
/************************************************/
/* FIXME: +0.7 for diode */
DISCRETE_RCDISC5(NODE_50, NODE_31, BZ_INP_SHELL, BZ_R14 + BZ_R15, BZ_C9)
DISCRETE_MULTIPLY(NODE_51, 1, BZ_R15 / (BZ_R14 + BZ_R15), NODE_50)
/* one of two filter configurations active */
DISCRETE_LOGIC_INVERT(NODE_52, 1, BZ_INP_SHELLLS)
DISCRETE_OP_AMP_FILTER(NODE_53, BZ_INP_SHELLLS, 0, NODE_51,
DISC_OP_AMP_FILTER_IS_LOW_PASS_1M, &bzone_shell_1)
DISCRETE_OP_AMP_FILTER(NODE_54, NODE_52, 0, NODE_51,
DISC_OP_AMP_FILTER_IS_LOW_PASS_1M, &bzone_shell_0)
DISCRETE_ADDER2(NODE_55, 1, NODE_53, NODE_54)
/************************************************/
/* Engine */
/************************************************/
DISCRETE_TRANSFORM2(NODE_60, BZ_INP_ENGREV, 0.0, "01=")
// FIXME: from R5 .. R7
DISCRETE_MULTIPLEX2(NODE_61, 1, NODE_60, 2.5, 4.2)
DISCRETE_RCDISC3(NODE_62, 1, NODE_61, BZ_R8, BZ_R9, BZ_C13, -0.5)
/* R11 taken from adjuster port */
DISCRETE_555_ASTABLE_CV(NODE_63, 1, BZ_R10, NODE_11, BZ_C11, NODE_62, &bzone_vco_desc)
/* two LS161, reset to 4 resp 6 counting up to 15, QD and ripple carry mixed */
DISCRETE_COUNTER(NODE_65, BZ_INP_MOTEN, 0, NODE_63, 11, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE)
DISCRETE_TRANSFORM2(NODE_66, NODE_65, 3, "01>") /* QD */
DISCRETE_TRANSFORM2(NODE_67, NODE_65, 11, "01=") /* Ripple */
DISCRETE_COUNTER(NODE_68, BZ_INP_MOTEN, 0, NODE_63, 9, DISC_COUNT_UP, 0, DISC_CLK_ON_R_EDGE)
DISCRETE_TRANSFORM2(NODE_69, NODE_68, 1, "01>") /* QD */
DISCRETE_TRANSFORM2(NODE_70, NODE_68, 9, "01=") /* Ripple */
DISCRETE_MIXER4(NODE_75, 1, NODE_66, NODE_67, NODE_69, NODE_70, &bzone_eng_mixer_desc)
/************************************************/
/* FINAL MIX */
/************************************************/
/* not sure about pokey output levels - bleow is just a estimate */
DISCRETE_INPUTX_STREAM(NODE_85, 0, 5.0/32767.0 * 4, 0)
DISCRETE_MIXER4(NODE_280, 1, NODE_45, NODE_55, NODE_75, NODE_85, &bzone_final_mixer_desc)
DISCRETE_OUTPUT(NODE_280, 32767.0/5.0 * 2)
//DISCRETE_WAVELOG1(NODE_55, 32767.0/22)
//DISCRETE_WAVELOG2(NODE_30, 32767.0/5.0, NODE_31, 32767.0/5.0)
DISCRETE_SOUND_END
static const pokey_interface bzone_pokey_interface =
{
{ DEVCB_NULL },
DEVCB_INPUT_PORT("IN3")
};
WRITE8_DEVICE_HANDLER( bzone_sounds_w )
{
discrete_sound_w(device, BZ_INPUT, data);
output_set_value("startled", (data >> 6) & 1);
sound_global_enable(data & 0x20);
}
MACHINE_DRIVER_START( bzone_audio )
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD("pokey", POKEY, BZONE_MASTER_CLOCK / 8)
MDRV_SOUND_CONFIG(bzone_pokey_interface)
MDRV_SOUND_ROUTE_EX(0, "discrete", 1.0, 0)
MDRV_SOUND_ADD("discrete", DISCRETE, 0)
MDRV_SOUND_CONFIG_DISCRETE(bzone)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
#endif

View File

@ -212,7 +212,7 @@ DISCRETE_SOUND_START(tank8)
DISCRETE_DIVIDE(NODE_110,1,TANK8_BUGLE_DATA1,7875.0)
DISCRETE_DIVIDE(NODE_111,1,TANK8_BUGLE_DATA2,7875.0)
DISCRETE_SQUAREWAVE2(NODE_112,TANK8_BUGLE_EN,3.4, NODE_110, NODE_111,1.7,0)
DISCRETE_RCDISC3(NODE_113,1, NODE_112, RES_K(10),RES_K(1),CAP_U(0.1))
DISCRETE_RCDISC3(NODE_113,1, NODE_112, RES_K(10),RES_K(1),CAP_U(0.1), 0.5)
DISCRETE_CRFILTER(TANK8_BUGLE, 1, NODE_113, RES_K(47), CAP_U(.01))
/************************************************/

View File

@ -206,14 +206,12 @@
#include "video/avgdvg.h"
#include "machine/mathbox.h"
#include "machine/atari_vg.h"
#include "sound/pokey.h"
#include "rendlay.h"
#include "bzone.h"
#include "bzone.lh"
#include "sound/pokey.h"
#define MASTER_CLOCK (XTAL_12_096MHz)
#define CLOCK_3KHZ (MASTER_CLOCK / 4096)
#include "bzone.lh"
static UINT8 analog_data;
@ -308,7 +306,11 @@ static ADDRESS_MAP_START( bzone_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x1810, 0x1810) AM_DEVREAD("mathbox", mathbox_lo_r)
AM_RANGE(0x1818, 0x1818) AM_DEVREAD("mathbox", mathbox_hi_r)
AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE("pokey", pokey_r, pokey_w)
#if BZONE_DISCRETE
AM_RANGE(0x1840, 0x1840) AM_DEVWRITE("discrete", bzone_sounds_w)
#else
AM_RANGE(0x1840, 0x1840) AM_WRITE(bzone_sounds_w)
#endif
AM_RANGE(0x1860, 0x187f) AM_DEVWRITE("mathbox", mathbox_go_w)
AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION("maincpu", 0x2000)
AM_RANGE(0x3000, 0x7fff) AM_ROM
@ -419,6 +421,11 @@ static INPUT_PORTS_START( bzone )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
#if BZONE_DISCRETE
PORT_START("R11")
PORT_ADJUSTER( 50, "Engine Frequency" )
#endif
INPUT_PORTS_END
@ -543,12 +550,12 @@ static const pokey_interface redbaron_pokey_interface =
*
*************************************/
static MACHINE_DRIVER_START( bzone )
static MACHINE_DRIVER_START( bzone_base )
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6502, MASTER_CLOCK / 8)
MDRV_CPU_ADD("maincpu", M6502, BZONE_MASTER_CLOCK / 8)
MDRV_CPU_PROGRAM_MAP(bzone_map)
MDRV_CPU_PERIODIC_INT(bzone_interrupt, (double)MASTER_CLOCK / 4096 / 12)
MDRV_CPU_PERIODIC_INT(bzone_interrupt, (double)BZONE_MASTER_CLOCK / 4096 / 12)
MDRV_MACHINE_START(bzone)
@ -564,15 +571,25 @@ static MACHINE_DRIVER_START( bzone )
/* Drivers */
MDRV_MATHBOX_ADD("mathbox")
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
MACHINE_DRIVER_END
static MACHINE_DRIVER_START( bzone )
MDRV_IMPORT_FROM(bzone_base)
/* sound hardware */
#if BZONE_DISCRETE
MDRV_IMPORT_FROM(bzone_audio)
#else
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD("pokey", POKEY, MASTER_CLOCK / 8)
MDRV_SOUND_CONFIG(bzone_pokey_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD("custom", BZONE, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
#endif
MACHINE_DRIVER_END
@ -582,7 +599,7 @@ static MACHINE_DRIVER_START( bradley )
MDRV_IMPORT_FROM(bzone)
/* sound hardware */
MDRV_SOUND_REPLACE("pokey", POKEY, MASTER_CLOCK / 8)
MDRV_SOUND_REPLACE("pokey", POKEY, BZONE_MASTER_CLOCK / 8)
MDRV_SOUND_CONFIG(bzone_pokey_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
@ -591,10 +608,10 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( redbaron )
/* basic machine hardware */
MDRV_IMPORT_FROM(bzone)
MDRV_IMPORT_FROM(bzone_base)
MDRV_CPU_MODIFY("maincpu")
MDRV_CPU_PROGRAM_MAP(redbaron_map)
MDRV_CPU_PERIODIC_INT(bzone_interrupt, (double)MASTER_CLOCK / 4096 / 12)
MDRV_CPU_PERIODIC_INT(bzone_interrupt, (double)BZONE_MASTER_CLOCK / 4096 / 12)
MDRV_MACHINE_START(redbaron)
@ -608,11 +625,14 @@ static MACHINE_DRIVER_START( redbaron )
MDRV_VIDEO_START(avg_bzone)
/* sound hardware */
MDRV_SOUND_REPLACE("pokey", POKEY, 1500000)
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD("pokey", POKEY, 1500000)
MDRV_SOUND_CONFIG(redbaron_pokey_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_REPLACE("custom", REDBARON, 0)
MDRV_SOUND_ADD("custom", REDBARON, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_DRIVER_END

View File

@ -4,6 +4,10 @@
*************************************************************************/
#define BZONE_DISCRETE (1)
#define BZONE_MASTER_CLOCK (XTAL_12_096MHz)
#define BZONE_CLOCK_3KHZ (MASTER_CLOCK / 4096)
/*----------- defined in drivers/bzone.c -----------*/
@ -12,11 +16,17 @@ extern UINT8 rb_input_select;
/*----------- defined in audio/bzone.c -----------*/
#if BZONE_DISCRETE
WRITE8_DEVICE_HANDLER( bzone_sounds_w );
MACHINE_DRIVER_EXTERN( bzone_audio );
#else
WRITE8_HANDLER( bzone_sounds_w );
DEVICE_GET_INFO( bzone_sound );
#define SOUND_BZONE DEVICE_GET_INFO_NAME(bzone_sound)
#endif
/*----------- defined in audio/redbaron.c -----------*/