mirror of
https://github.com/holub/mame
synced 2025-05-17 19:24:59 +03:00
Discrete: Added a class node factory. Currently only creates discrete_legacy_nodes which is just a wrapper around pure "C" discrete implementations. No whatsnew.
This commit is contained in:
parent
dbb0cc1377
commit
97ade28735
@ -396,7 +396,7 @@ DISCRETE_RESET(dsd_555_astbl)
|
||||
DISCRETE_DECLARE_CONTEXT(dsd_555_astbl)
|
||||
DISCRETE_DECLARE_INFO(discrete_555_desc)
|
||||
|
||||
node_description *v_charge_node;
|
||||
discrete_base_node *v_charge_node;
|
||||
|
||||
context->use_ctrlv = (node->input_is_node() >> 4) & 1;
|
||||
context->output_type = info->options & DISC_555_OUT_MASK;
|
||||
|
@ -111,6 +111,7 @@ struct dst_rcfilter_context
|
||||
double rc;
|
||||
double exponent;
|
||||
UINT8 has_rc_nodes;
|
||||
UINT8 is_fast;
|
||||
};
|
||||
|
||||
struct dst_rcfilter_sw_context
|
||||
@ -202,7 +203,7 @@ DISCRETE_RESET(dst_crfilter)
|
||||
#define DST_FILTER1__FREQ DISCRETE_INPUT(2)
|
||||
#define DST_FILTER1__TYPE DISCRETE_INPUT(3)
|
||||
|
||||
static void calculate_filter1_coefficients(node_description *node, double fc, double type,
|
||||
static void calculate_filter1_coefficients(discrete_base_node *node, double fc, double type,
|
||||
double *a1, double *b0, double *b1)
|
||||
{
|
||||
double den, w, two_over_T;
|
||||
@ -272,7 +273,7 @@ DISCRETE_RESET(dst_filter1)
|
||||
#define DST_FILTER2__DAMP DISCRETE_INPUT(3)
|
||||
#define DST_FILTER2__TYPE DISCRETE_INPUT(4)
|
||||
|
||||
static void calculate_filter2_coefficients(node_description *node,
|
||||
static void calculate_filter2_coefficients(discrete_base_node *node,
|
||||
double fc, double d, double type,
|
||||
double *a1, double *a2,
|
||||
double *b0, double *b1, double *b2)
|
||||
@ -1109,6 +1110,10 @@ DISCRETE_STEP(dst_rcfilter)
|
||||
{
|
||||
DISCRETE_DECLARE_CONTEXT(dst_rcfilter)
|
||||
|
||||
if (EXPECTED(context->is_fast))
|
||||
node->output[0] += ((DST_RCFILTER__VIN - node->output[0]) * context->exponent);
|
||||
else
|
||||
{
|
||||
if (UNEXPECTED(context->has_rc_nodes))
|
||||
{
|
||||
double rc = DST_RCFILTER__R * DST_RCFILTER__C;
|
||||
@ -1125,14 +1130,9 @@ DISCRETE_STEP(dst_rcfilter)
|
||||
|
||||
context->vCap += ((DST_RCFILTER__VIN - node->output[0]) * context->exponent);
|
||||
node->output[0] = context->vCap + DST_RCFILTER__VREF;
|
||||
}
|
||||
}
|
||||
|
||||
DISCRETE_STEP(dst_rcfilter_fast)
|
||||
{
|
||||
DISCRETE_DECLARE_CONTEXT(dst_rcfilter)
|
||||
|
||||
node->output[0] += ((DST_RCFILTER__VIN - node->output[0]) * context->exponent);
|
||||
}
|
||||
|
||||
DISCRETE_RESET(dst_rcfilter)
|
||||
{
|
||||
@ -1143,8 +1143,11 @@ DISCRETE_RESET(dst_rcfilter)
|
||||
context->exponent = RC_CHARGE_EXP(context->rc);
|
||||
context->vCap = 0;
|
||||
node->output[0] = 0;
|
||||
/* FIXME --> we really need another class here */
|
||||
if (!context->has_rc_nodes && DST_RCFILTER__VREF == 0)
|
||||
node->step = DISCRETE_STEP_NAME(dst_rcfilter_fast);
|
||||
context->is_fast = 1;
|
||||
else
|
||||
context->is_fast = 0;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -1315,7 +1315,7 @@ DISCRETE_RESET(dst_mixer)
|
||||
DISCRETE_DECLARE_CONTEXT(dst_mixer)
|
||||
DISCRETE_DECLARE_INFO(discrete_mixer_desc)
|
||||
|
||||
node_description *r_node;
|
||||
discrete_base_node *r_node;
|
||||
|
||||
int bit;
|
||||
double rTemp = 0;
|
||||
|
@ -43,13 +43,13 @@ static void task_check(discrete_task *task, discrete_task *dest_task)
|
||||
/* Determine, which nodes in the task are referenced by nodes in dest_task
|
||||
* and add them to the list of nodes to be buffered for further processing
|
||||
*/
|
||||
for_each(node_description *, node_entry, &task->list)
|
||||
for_each(discrete_base_node *, node_entry, &task->list)
|
||||
{
|
||||
node_description *task_node = node_entry.item();
|
||||
discrete_base_node *task_node = node_entry.item();
|
||||
|
||||
for_each(node_description *, step_entry, &dest_task->list)
|
||||
for_each(discrete_base_node *, step_entry, &dest_task->list)
|
||||
{
|
||||
node_description *dest_node = step_entry.item();
|
||||
discrete_base_node *dest_node = step_entry.item();
|
||||
|
||||
/* loop over all active inputs */
|
||||
for (inputnum = 0; inputnum < dest_node->active_inputs(); inputnum++)
|
||||
|
@ -1041,7 +1041,7 @@ DISCRETE_RESET(dss_op_amp_osc)
|
||||
const double *r_info_ptr;
|
||||
const double **r_context_ptr;
|
||||
int loop;
|
||||
node_description *r_node;
|
||||
discrete_base_node *r_node;
|
||||
|
||||
double i1 = 0; /* inverting input current */
|
||||
double i2 = 0; /* non-inverting input current */
|
||||
@ -1698,7 +1698,7 @@ DISCRETE_RESET(dss_squarewave2)
|
||||
#define DSS_INVERTER_OSC__C DISCRETE_INPUT(4)
|
||||
#define DSS_INVERTER_OSC__R2 DISCRETE_INPUT(5)
|
||||
|
||||
INLINE double dss_inverter_tftab(node_description *node, double x)
|
||||
INLINE double dss_inverter_tftab(discrete_base_node *node, double x)
|
||||
{
|
||||
DISCRETE_DECLARE_CONTEXT(dss_inverter_osc)
|
||||
DISCRETE_DECLARE_INFO(discrete_inverter_osc_desc)
|
||||
@ -1710,7 +1710,7 @@ INLINE double dss_inverter_tftab(node_description *node, double x)
|
||||
return info->vB;
|
||||
}
|
||||
|
||||
INLINE double dss_inverter_tf(node_description *node, double x)
|
||||
INLINE double dss_inverter_tf(discrete_base_node *node, double x)
|
||||
{
|
||||
DISCRETE_DECLARE_CONTEXT(dss_inverter_osc)
|
||||
DISCRETE_DECLARE_INFO(discrete_inverter_osc_desc)
|
||||
|
@ -177,125 +177,130 @@ INLINE void linked_list_add(const discrete_device *info, linked_list_entry **lis
|
||||
*
|
||||
*************************************/
|
||||
|
||||
|
||||
|
||||
#define MOD_ENTRY(_type, _name, _num_output, _contextsize, _reset, _step, _start, _stop) \
|
||||
{ new discrete_node_factory<discrete_legacy_node>, _type, _name, _num_output, _contextsize, _reset, _step, _start, _stop }
|
||||
|
||||
static const discrete_module module_list[] =
|
||||
{
|
||||
{ DSO_OUTPUT ,"DSO_OUTPUT" , 0 ,0 ,dso_output_reset ,dso_output_step ,NULL ,NULL },
|
||||
{ DSO_CSVLOG ,"DSO_CSVLOG" , 0 ,sizeof(struct dso_csvlog_context) ,NULL ,dso_csvlog_step ,dso_csvlog_start ,dso_csvlog_stop },
|
||||
{ DSO_WAVELOG ,"DSO_WAVELOG" , 0 ,sizeof(struct dso_wavlog_context) ,NULL ,dso_wavlog_step ,dso_wavlog_start ,dso_wavlog_stop },
|
||||
{ DSO_IMPORT ,"DSO_IMPORT" , 0 ,0 ,NULL ,NULL ,NULL ,NULL },
|
||||
MOD_ENTRY( DSO_OUTPUT ,"DSO_OUTPUT" , 0 ,0 ,dso_output_reset ,dso_output_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSO_CSVLOG ,"DSO_CSVLOG" , 0 ,sizeof(struct dso_csvlog_context) ,NULL ,dso_csvlog_step ,dso_csvlog_start ,dso_csvlog_stop ),
|
||||
MOD_ENTRY( DSO_WAVELOG ,"DSO_WAVELOG" , 0 ,sizeof(struct dso_wavlog_context) ,NULL ,dso_wavlog_step ,dso_wavlog_start ,dso_wavlog_stop ),
|
||||
MOD_ENTRY( DSO_IMPORT ,"DSO_IMPORT" , 0 ,0 ,NULL ,NULL ,NULL ,NULL ),
|
||||
|
||||
/* parallel modules */
|
||||
{ DSO_TASK_START ,"DSO_TASK_START" , 0 ,0 ,dso_task_reset ,dso_task_start_step ,dso_task_start_start ,NULL },
|
||||
{ DSO_TASK_END ,"DSO_TASK_END" , 0 ,0 ,dso_task_reset ,dso_task_end_step ,NULL ,NULL },
|
||||
{ DSO_TASK_SYNC ,"DSO_TASK_SYNC" , 0 ,0 ,NULL ,NULL ,NULL ,NULL },
|
||||
MOD_ENTRY( DSO_TASK_START ,"DSO_TASK_START" , 0 ,0 ,dso_task_reset ,dso_task_start_step ,dso_task_start_start ,NULL ),
|
||||
MOD_ENTRY( DSO_TASK_END ,"DSO_TASK_END" , 0 ,0 ,dso_task_reset ,dso_task_end_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSO_TASK_SYNC ,"DSO_TASK_SYNC" , 0 ,0 ,NULL ,NULL ,NULL ,NULL ),
|
||||
|
||||
/* nop */
|
||||
{ DSS_NOP ,"DSS_NOP" , 0 ,0 ,NULL ,NULL ,NULL ,NULL },
|
||||
MOD_ENTRY( DSS_NOP ,"DSS_NOP" , 0 ,0 ,NULL ,NULL ,NULL ,NULL ),
|
||||
|
||||
/* from disc_inp.c */
|
||||
{ DSS_ADJUSTMENT ,"DSS_ADJUSTMENT" , 1 ,sizeof(struct dss_adjustment_context) ,dss_adjustment_reset ,dss_adjustment_step ,NULL ,NULL },
|
||||
{ DSS_CONSTANT ,"DSS_CONSTANT" , 1 ,0 ,dss_constant_reset ,NULL ,NULL ,NULL },
|
||||
{ DSS_INPUT_DATA ,"DSS_INPUT_DATA" , 1 ,sizeof(struct dss_input_context) ,dss_input_reset ,NULL ,NULL ,NULL },
|
||||
{ DSS_INPUT_LOGIC ,"DSS_INPUT_LOGIC" , 1 ,sizeof(struct dss_input_context) ,dss_input_reset ,NULL ,NULL ,NULL },
|
||||
{ DSS_INPUT_NOT ,"DSS_INPUT_NOT" , 1 ,sizeof(struct dss_input_context) ,dss_input_reset ,NULL ,NULL ,NULL },
|
||||
{ DSS_INPUT_PULSE ,"DSS_INPUT_PULSE" , 1 ,sizeof(struct dss_input_context) ,dss_input_reset ,dss_input_pulse_step ,NULL ,NULL },
|
||||
{ DSS_INPUT_STREAM,"DSS_INPUT_STREAM", 1 ,sizeof(struct dss_input_context) ,dss_input_stream_reset,dss_input_stream_step,dss_input_stream_start,NULL },
|
||||
{ DSS_INPUT_BUFFER,"DSS_INPUT_BUFFER", 1 ,sizeof(struct dss_input_context) ,dss_input_stream_reset,dss_input_stream_step,dss_input_stream_start,NULL },
|
||||
MOD_ENTRY( DSS_ADJUSTMENT ,"DSS_ADJUSTMENT" , 1 ,sizeof(struct dss_adjustment_context) ,dss_adjustment_reset ,dss_adjustment_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_CONSTANT ,"DSS_CONSTANT" , 1 ,0 ,dss_constant_reset ,NULL ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_INPUT_DATA ,"DSS_INPUT_DATA" , 1 ,sizeof(struct dss_input_context) ,dss_input_reset ,NULL ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_INPUT_LOGIC ,"DSS_INPUT_LOGIC" , 1 ,sizeof(struct dss_input_context) ,dss_input_reset ,NULL ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_INPUT_NOT ,"DSS_INPUT_NOT" , 1 ,sizeof(struct dss_input_context) ,dss_input_reset ,NULL ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_INPUT_PULSE ,"DSS_INPUT_PULSE" , 1 ,sizeof(struct dss_input_context) ,dss_input_reset ,dss_input_pulse_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_INPUT_STREAM,"DSS_INPUT_STREAM", 1 ,sizeof(struct dss_input_context) ,dss_input_stream_reset,dss_input_stream_step,dss_input_stream_start,NULL ),
|
||||
MOD_ENTRY( DSS_INPUT_BUFFER,"DSS_INPUT_BUFFER", 1 ,sizeof(struct dss_input_context) ,dss_input_stream_reset,dss_input_stream_step,dss_input_stream_start,NULL ),
|
||||
|
||||
/* from disc_wav.c */
|
||||
/* Generic modules */
|
||||
{ DSS_COUNTER ,"DSS_COUNTER" , 1 ,sizeof(struct dss_counter_context) ,dss_counter_reset ,dss_counter_step ,NULL ,NULL },
|
||||
{ DSS_LFSR_NOISE ,"DSS_LFSR_NOISE" , 2 ,sizeof(struct dss_lfsr_context) ,dss_lfsr_reset ,dss_lfsr_step ,NULL ,NULL },
|
||||
{ DSS_NOISE ,"DSS_NOISE" , 1 ,sizeof(struct dss_noise_context) ,dss_noise_reset ,dss_noise_step ,NULL ,NULL },
|
||||
{ DSS_NOTE ,"DSS_NOTE" , 1 ,sizeof(struct dss_note_context) ,dss_note_reset ,dss_note_step ,NULL ,NULL },
|
||||
{ DSS_SAWTOOTHWAVE,"DSS_SAWTOOTHWAVE", 1 ,sizeof(struct dss_sawtoothwave_context),dss_sawtoothwave_reset,dss_sawtoothwave_step,NULL ,NULL },
|
||||
{ DSS_SINEWAVE ,"DSS_SINEWAVE" , 1 ,sizeof(struct dss_sinewave_context) ,dss_sinewave_reset ,dss_sinewave_step ,NULL ,NULL },
|
||||
{ DSS_SQUAREWAVE ,"DSS_SQUAREWAVE" , 1 ,sizeof(struct dss_squarewave_context) ,dss_squarewave_reset ,dss_squarewave_step ,NULL ,NULL },
|
||||
{ DSS_SQUAREWFIX ,"DSS_SQUAREWFIX" , 1 ,sizeof(struct dss_squarewfix_context) ,dss_squarewfix_reset ,dss_squarewfix_step ,NULL ,NULL },
|
||||
{ DSS_SQUAREWAVE2 ,"DSS_SQUAREWAVE2" , 1 ,sizeof(struct dss_squarewave_context) ,dss_squarewave2_reset ,dss_squarewave2_step ,NULL ,NULL },
|
||||
{ DSS_TRIANGLEWAVE,"DSS_TRIANGLEWAVE", 1 ,sizeof(struct dss_trianglewave_context),dss_trianglewave_reset,dss_trianglewave_step,NULL ,NULL },
|
||||
MOD_ENTRY( DSS_COUNTER ,"DSS_COUNTER" , 1 ,sizeof(struct dss_counter_context) ,dss_counter_reset ,dss_counter_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_LFSR_NOISE ,"DSS_LFSR_NOISE" , 2 ,sizeof(struct dss_lfsr_context) ,dss_lfsr_reset ,dss_lfsr_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_NOISE ,"DSS_NOISE" , 1 ,sizeof(struct dss_noise_context) ,dss_noise_reset ,dss_noise_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_NOTE ,"DSS_NOTE" , 1 ,sizeof(struct dss_note_context) ,dss_note_reset ,dss_note_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_SAWTOOTHWAVE,"DSS_SAWTOOTHWAVE", 1 ,sizeof(struct dss_sawtoothwave_context),dss_sawtoothwave_reset,dss_sawtoothwave_step,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_SINEWAVE ,"DSS_SINEWAVE" , 1 ,sizeof(struct dss_sinewave_context) ,dss_sinewave_reset ,dss_sinewave_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_SQUAREWAVE ,"DSS_SQUAREWAVE" , 1 ,sizeof(struct dss_squarewave_context) ,dss_squarewave_reset ,dss_squarewave_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_SQUAREWFIX ,"DSS_SQUAREWFIX" , 1 ,sizeof(struct dss_squarewfix_context) ,dss_squarewfix_reset ,dss_squarewfix_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_SQUAREWAVE2 ,"DSS_SQUAREWAVE2" , 1 ,sizeof(struct dss_squarewave_context) ,dss_squarewave2_reset ,dss_squarewave2_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_TRIANGLEWAVE,"DSS_TRIANGLEWAVE", 1 ,sizeof(struct dss_trianglewave_context),dss_trianglewave_reset,dss_trianglewave_step,NULL ,NULL ),
|
||||
/* Component specific modules */
|
||||
{ DSS_INVERTER_OSC ,"DSS_INVERTER_OSC" , 1 ,sizeof(struct dss_inverter_osc_context) ,dss_inverter_osc_reset ,dss_inverter_osc_step ,NULL ,NULL },
|
||||
{ DSS_OP_AMP_OSC ,"DSS_OP_AMP_OSC" , 1 ,sizeof(struct dss_op_amp_osc_context) ,dss_op_amp_osc_reset ,dss_op_amp_osc_step ,NULL ,NULL },
|
||||
{ DSS_SCHMITT_OSC ,"DSS_SCHMITT_OSC" , 1 ,sizeof(struct dss_schmitt_osc_context) ,dss_schmitt_osc_reset ,dss_schmitt_osc_step ,NULL ,NULL },
|
||||
MOD_ENTRY( DSS_INVERTER_OSC ,"DSS_INVERTER_OSC" , 1 ,sizeof(struct dss_inverter_osc_context) ,dss_inverter_osc_reset ,dss_inverter_osc_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_OP_AMP_OSC ,"DSS_OP_AMP_OSC" , 1 ,sizeof(struct dss_op_amp_osc_context) ,dss_op_amp_osc_reset ,dss_op_amp_osc_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSS_SCHMITT_OSC ,"DSS_SCHMITT_OSC" , 1 ,sizeof(struct dss_schmitt_osc_context) ,dss_schmitt_osc_reset ,dss_schmitt_osc_step ,NULL ,NULL ),
|
||||
/* Not yet implemented */
|
||||
{ DSS_ADSR ,"DSS_ADSR" , 1 ,sizeof(struct dss_adsr_context) ,dss_adsrenv_reset ,dss_adsrenv_step ,NULL ,NULL },
|
||||
MOD_ENTRY( DSS_ADSR ,"DSS_ADSR" , 1 ,sizeof(struct dss_adsr_context) ,dss_adsrenv_reset ,dss_adsrenv_step ,NULL ,NULL ),
|
||||
|
||||
/* from disc_mth.c */
|
||||
/* Generic modules */
|
||||
{ DST_ADDER ,"DST_ADDER" , 1 ,0 ,NULL ,dst_adder_step ,NULL ,NULL },
|
||||
{ DST_CLAMP ,"DST_CLAMP" , 1 ,0 ,NULL ,dst_clamp_step ,NULL ,NULL },
|
||||
{ DST_DIVIDE ,"DST_DIVIDE" , 1 ,0 ,NULL ,dst_divide_step ,NULL ,NULL },
|
||||
{ DST_GAIN ,"DST_GAIN" , 1 ,0 ,NULL ,dst_gain_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_INV ,"DST_LOGIC_INV" , 1 ,0 ,NULL ,dst_logic_inv_step ,NULL ,NULL },
|
||||
{ DST_BITS_DECODE ,"DST_BITS_DECODE" , 8 ,sizeof(struct dst_bits_decode_context) ,dst_bits_decode_reset ,dst_bits_decode_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_AND ,"DST_LOGIC_AND" , 1 ,0 ,NULL ,dst_logic_and_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_NAND ,"DST_LOGIC_NAND" , 1 ,0 ,NULL ,dst_logic_nand_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_OR ,"DST_LOGIC_OR" , 1 ,0 ,NULL ,dst_logic_or_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_NOR ,"DST_LOGIC_NOR" , 1 ,0 ,NULL ,dst_logic_nor_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_XOR ,"DST_LOGIC_XOR" , 1 ,0 ,NULL ,dst_logic_xor_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_NXOR ,"DST_LOGIC_NXOR" , 1 ,0 ,NULL ,dst_logic_nxor_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_DFF ,"DST_LOGIC_DFF" , 1 ,sizeof(struct dst_flipflop_context) ,dst_logic_ff_reset ,dst_logic_dff_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_JKFF ,"DST_LOGIC_JKFF" , 1 ,sizeof(struct dst_flipflop_context) ,dst_logic_ff_reset ,dst_logic_jkff_step ,NULL ,NULL },
|
||||
{ DST_LOGIC_SHIFT ,"DST_LOGIC_SHIFT" , 1 ,sizeof(struct dst_shift_context) ,dst_logic_shift_reset ,dst_logic_shift_step ,NULL ,NULL },
|
||||
{ DST_LOOKUP_TABLE,"DST_LOOKUP_TABLE", 1 ,0 ,NULL ,dst_lookup_table_step,NULL ,NULL },
|
||||
{ DST_MULTIPLEX ,"DST_MULTIPLEX" , 1 ,sizeof(struct dst_size_context) ,dst_multiplex_reset ,dst_multiplex_step ,NULL ,NULL },
|
||||
{ DST_ONESHOT ,"DST_ONESHOT" , 1 ,sizeof(struct dst_oneshot_context) ,dst_oneshot_reset ,dst_oneshot_step ,NULL ,NULL },
|
||||
{ DST_RAMP ,"DST_RAMP" , 1 ,sizeof(struct dst_ramp_context) ,dst_ramp_reset ,dst_ramp_step ,NULL ,NULL },
|
||||
{ DST_SAMPHOLD ,"DST_SAMPHOLD" , 1 ,sizeof(struct dst_samphold_context) ,dst_samphold_reset ,dst_samphold_step ,NULL ,NULL },
|
||||
{ DST_SWITCH ,"DST_SWITCH" , 1 ,0 ,NULL ,dst_switch_step ,NULL ,NULL },
|
||||
{ DST_ASWITCH ,"DST_ASWITCH" , 1 ,0 ,NULL ,dst_aswitch_step ,NULL ,NULL },
|
||||
{ DST_TRANSFORM ,"DST_TRANSFORM" , 1 ,0 ,NULL ,dst_transform_step ,NULL ,NULL },
|
||||
MOD_ENTRY( DST_ADDER ,"DST_ADDER" , 1 ,0 ,NULL ,dst_adder_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_CLAMP ,"DST_CLAMP" , 1 ,0 ,NULL ,dst_clamp_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_DIVIDE ,"DST_DIVIDE" , 1 ,0 ,NULL ,dst_divide_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_GAIN ,"DST_GAIN" , 1 ,0 ,NULL ,dst_gain_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_INV ,"DST_LOGIC_INV" , 1 ,0 ,NULL ,dst_logic_inv_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_BITS_DECODE ,"DST_BITS_DECODE" , 8 ,sizeof(struct dst_bits_decode_context) ,dst_bits_decode_reset ,dst_bits_decode_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_AND ,"DST_LOGIC_AND" , 1 ,0 ,NULL ,dst_logic_and_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_NAND ,"DST_LOGIC_NAND" , 1 ,0 ,NULL ,dst_logic_nand_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_OR ,"DST_LOGIC_OR" , 1 ,0 ,NULL ,dst_logic_or_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_NOR ,"DST_LOGIC_NOR" , 1 ,0 ,NULL ,dst_logic_nor_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_XOR ,"DST_LOGIC_XOR" , 1 ,0 ,NULL ,dst_logic_xor_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_NXOR ,"DST_LOGIC_NXOR" , 1 ,0 ,NULL ,dst_logic_nxor_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_DFF ,"DST_LOGIC_DFF" , 1 ,sizeof(struct dst_flipflop_context) ,dst_logic_ff_reset ,dst_logic_dff_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_JKFF ,"DST_LOGIC_JKFF" , 1 ,sizeof(struct dst_flipflop_context) ,dst_logic_ff_reset ,dst_logic_jkff_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOGIC_SHIFT ,"DST_LOGIC_SHIFT" , 1 ,sizeof(struct dst_shift_context) ,dst_logic_shift_reset ,dst_logic_shift_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_LOOKUP_TABLE,"DST_LOOKUP_TABLE", 1 ,0 ,NULL ,dst_lookup_table_step,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_MULTIPLEX ,"DST_MULTIPLEX" , 1 ,sizeof(struct dst_size_context) ,dst_multiplex_reset ,dst_multiplex_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_ONESHOT ,"DST_ONESHOT" , 1 ,sizeof(struct dst_oneshot_context) ,dst_oneshot_reset ,dst_oneshot_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RAMP ,"DST_RAMP" , 1 ,sizeof(struct dst_ramp_context) ,dst_ramp_reset ,dst_ramp_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_SAMPHOLD ,"DST_SAMPHOLD" , 1 ,sizeof(struct dst_samphold_context) ,dst_samphold_reset ,dst_samphold_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_SWITCH ,"DST_SWITCH" , 1 ,0 ,NULL ,dst_switch_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_ASWITCH ,"DST_ASWITCH" , 1 ,0 ,NULL ,dst_aswitch_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_TRANSFORM ,"DST_TRANSFORM" , 1 ,0 ,NULL ,dst_transform_step ,NULL ,NULL ),
|
||||
/* Component specific */
|
||||
{ DST_COMP_ADDER ,"DST_COMP_ADDER" , 1 ,sizeof(struct dst_comp_adder_context) ,dst_comp_adder_reset ,dst_comp_adder_step ,NULL ,NULL },
|
||||
{ DST_DAC_R1 ,"DST_DAC_R1" , 1 ,sizeof(struct dst_dac_r1_context) ,dst_dac_r1_reset ,dst_dac_r1_step ,NULL ,NULL },
|
||||
{ DST_DIODE_MIX ,"DST_DIODE_MIX" , 1 ,sizeof(struct dst_diode_mix_context) ,dst_diode_mix_reset ,dst_diode_mix_step ,NULL ,NULL },
|
||||
{ DST_INTEGRATE ,"DST_INTEGRATE" , 1 ,sizeof(struct dst_integrate_context) ,dst_integrate_reset ,dst_integrate_step ,NULL ,NULL },
|
||||
{ DST_MIXER ,"DST_MIXER" , 1 ,sizeof(struct dst_mixer_context) ,dst_mixer_reset ,dst_mixer_step ,NULL ,NULL },
|
||||
{ DST_OP_AMP ,"DST_OP_AMP" , 1 ,sizeof(struct dst_op_amp_context) ,dst_op_amp_reset ,dst_op_amp_step ,NULL ,NULL },
|
||||
{ DST_OP_AMP_1SHT ,"DST_OP_AMP_1SHT" , 1 ,sizeof(struct dst_op_amp_1sht_context) ,dst_op_amp_1sht_reset ,dst_op_amp_1sht_step ,NULL ,NULL },
|
||||
{ DST_TVCA_OP_AMP ,"DST_TVCA_OP_AMP" , 1 ,sizeof(struct dst_tvca_op_amp_context) ,dst_tvca_op_amp_reset ,dst_tvca_op_amp_step ,NULL ,NULL },
|
||||
{ DST_VCA ,"DST_VCA" , 1 ,0 ,NULL ,NULL ,NULL ,NULL },
|
||||
{ DST_XTIME_BUFFER,"DST_XTIME_BUFFER", 1 ,0 ,NULL ,dst_xtime_buffer_step,NULL ,NULL },
|
||||
{ DST_XTIME_AND ,"DST_XTIME_AND" , 1 ,0 ,NULL ,dst_xtime_and_step ,NULL ,NULL },
|
||||
{ DST_XTIME_OR ,"DST_XTIME_OR" , 1 ,0 ,NULL ,dst_xtime_or_step ,NULL ,NULL },
|
||||
{ DST_XTIME_XOR ,"DST_XTIME_XOR" , 1 ,0 ,NULL ,dst_xtime_xor_step ,NULL ,NULL },
|
||||
MOD_ENTRY( DST_COMP_ADDER ,"DST_COMP_ADDER" , 1 ,sizeof(struct dst_comp_adder_context) ,dst_comp_adder_reset ,dst_comp_adder_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_DAC_R1 ,"DST_DAC_R1" , 1 ,sizeof(struct dst_dac_r1_context) ,dst_dac_r1_reset ,dst_dac_r1_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_DIODE_MIX ,"DST_DIODE_MIX" , 1 ,sizeof(struct dst_diode_mix_context) ,dst_diode_mix_reset ,dst_diode_mix_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_INTEGRATE ,"DST_INTEGRATE" , 1 ,sizeof(struct dst_integrate_context) ,dst_integrate_reset ,dst_integrate_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_MIXER ,"DST_MIXER" , 1 ,sizeof(struct dst_mixer_context) ,dst_mixer_reset ,dst_mixer_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_OP_AMP ,"DST_OP_AMP" , 1 ,sizeof(struct dst_op_amp_context) ,dst_op_amp_reset ,dst_op_amp_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_OP_AMP_1SHT ,"DST_OP_AMP_1SHT" , 1 ,sizeof(struct dst_op_amp_1sht_context) ,dst_op_amp_1sht_reset ,dst_op_amp_1sht_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_TVCA_OP_AMP ,"DST_TVCA_OP_AMP" , 1 ,sizeof(struct dst_tvca_op_amp_context) ,dst_tvca_op_amp_reset ,dst_tvca_op_amp_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_VCA ,"DST_VCA" , 1 ,0 ,NULL ,NULL ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_XTIME_BUFFER,"DST_XTIME_BUFFER", 1 ,0 ,NULL ,dst_xtime_buffer_step,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_XTIME_AND ,"DST_XTIME_AND" , 1 ,0 ,NULL ,dst_xtime_and_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_XTIME_OR ,"DST_XTIME_OR" , 1 ,0 ,NULL ,dst_xtime_or_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_XTIME_XOR ,"DST_XTIME_XOR" , 1 ,0 ,NULL ,dst_xtime_xor_step ,NULL ,NULL ),
|
||||
|
||||
/* from disc_flt.c */
|
||||
/* Generic modules */
|
||||
{ DST_FILTER1 ,"DST_FILTER1" , 1 ,sizeof(struct dst_filter1_context) ,dst_filter1_reset ,dst_filter1_step ,NULL ,NULL },
|
||||
{ DST_FILTER2 ,"DST_FILTER2" , 1 ,sizeof(struct dst_filter2_context) ,dst_filter2_reset ,dst_filter2_step ,NULL ,NULL },
|
||||
MOD_ENTRY( DST_FILTER1 ,"DST_FILTER1" , 1 ,sizeof(struct dst_filter1_context) ,dst_filter1_reset ,dst_filter1_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_FILTER2 ,"DST_FILTER2" , 1 ,sizeof(struct dst_filter2_context) ,dst_filter2_reset ,dst_filter2_step ,NULL ,NULL ),
|
||||
/* Component specific modules */
|
||||
{ DST_SALLEN_KEY ,"DST_SALLEN_KEY" , 1 ,sizeof(struct dst_filter2_context) ,dst_sallen_key_reset ,dst_sallen_key_step ,NULL ,NULL },
|
||||
{ DST_CRFILTER ,"DST_CRFILTER" , 1 ,sizeof(struct dst_rcfilter_context) ,dst_crfilter_reset ,dst_crfilter_step ,NULL ,NULL },
|
||||
{ DST_OP_AMP_FILT ,"DST_OP_AMP_FILT" , 1 ,sizeof(struct dst_op_amp_filt_context) ,dst_op_amp_filt_reset ,dst_op_amp_filt_step ,NULL ,NULL },
|
||||
{ DST_RC_CIRCUIT_1,"DST_RC_CIRCUIT_1", 1 ,sizeof(struct dst_rc_circuit_1_context),dst_rc_circuit_1_reset,dst_rc_circuit_1_step,NULL ,NULL },
|
||||
{ DST_RCDISC ,"DST_RCDISC" , 1 ,sizeof(struct dst_rcdisc_context) ,dst_rcdisc_reset ,dst_rcdisc_step ,NULL ,NULL },
|
||||
{ DST_RCDISC2 ,"DST_RCDISC2" , 1 ,sizeof(struct dst_rcdisc_context) ,dst_rcdisc2_reset ,dst_rcdisc2_step ,NULL ,NULL },
|
||||
{ DST_RCDISC3 ,"DST_RCDISC3" , 1 ,sizeof(struct dst_rcdisc_context) ,dst_rcdisc3_reset ,dst_rcdisc3_step ,NULL ,NULL },
|
||||
{ DST_RCDISC4 ,"DST_RCDISC4" , 1 ,sizeof(struct dst_rcdisc4_context) ,dst_rcdisc4_reset ,dst_rcdisc4_step ,NULL ,NULL },
|
||||
{ DST_RCDISC5 ,"DST_RCDISC5" , 1 ,sizeof(struct dst_rcdisc_context) ,dst_rcdisc5_reset ,dst_rcdisc5_step ,NULL ,NULL },
|
||||
{ DST_RCINTEGRATE ,"DST_RCINTEGRATE" , 1 ,sizeof(struct dst_rcintegrate_context) ,dst_rcintegrate_reset ,dst_rcintegrate_step ,NULL ,NULL },
|
||||
{ DST_RCDISC_MOD ,"DST_RCDISC_MOD" , 1 ,sizeof(struct dst_rcdisc_mod_context) ,dst_rcdisc_mod_reset ,dst_rcdisc_mod_step ,NULL ,NULL },
|
||||
{ DST_RCFILTER ,"DST_RCFILTER" , 1 ,sizeof(struct dst_rcfilter_context) ,dst_rcfilter_reset ,dst_rcfilter_step ,NULL ,NULL },
|
||||
{ DST_RCFILTER_SW ,"DST_RCFILTER_SW" , 1 ,sizeof(struct dst_rcfilter_sw_context) ,dst_rcfilter_sw_reset ,dst_rcfilter_sw_step ,NULL ,NULL },
|
||||
MOD_ENTRY( DST_SALLEN_KEY ,"DST_SALLEN_KEY" , 1 ,sizeof(struct dst_filter2_context) ,dst_sallen_key_reset ,dst_sallen_key_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_CRFILTER ,"DST_CRFILTER" , 1 ,sizeof(struct dst_rcfilter_context) ,dst_crfilter_reset ,dst_crfilter_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_OP_AMP_FILT ,"DST_OP_AMP_FILT" , 1 ,sizeof(struct dst_op_amp_filt_context) ,dst_op_amp_filt_reset ,dst_op_amp_filt_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RC_CIRCUIT_1,"DST_RC_CIRCUIT_1", 1 ,sizeof(struct dst_rc_circuit_1_context),dst_rc_circuit_1_reset,dst_rc_circuit_1_step,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCDISC ,"DST_RCDISC" , 1 ,sizeof(struct dst_rcdisc_context) ,dst_rcdisc_reset ,dst_rcdisc_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCDISC2 ,"DST_RCDISC2" , 1 ,sizeof(struct dst_rcdisc_context) ,dst_rcdisc2_reset ,dst_rcdisc2_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCDISC3 ,"DST_RCDISC3" , 1 ,sizeof(struct dst_rcdisc_context) ,dst_rcdisc3_reset ,dst_rcdisc3_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCDISC4 ,"DST_RCDISC4" , 1 ,sizeof(struct dst_rcdisc4_context) ,dst_rcdisc4_reset ,dst_rcdisc4_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCDISC5 ,"DST_RCDISC5" , 1 ,sizeof(struct dst_rcdisc_context) ,dst_rcdisc5_reset ,dst_rcdisc5_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCINTEGRATE ,"DST_RCINTEGRATE" , 1 ,sizeof(struct dst_rcintegrate_context) ,dst_rcintegrate_reset ,dst_rcintegrate_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCDISC_MOD ,"DST_RCDISC_MOD" , 1 ,sizeof(struct dst_rcdisc_mod_context) ,dst_rcdisc_mod_reset ,dst_rcdisc_mod_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCFILTER ,"DST_RCFILTER" , 1 ,sizeof(struct dst_rcfilter_context) ,dst_rcfilter_reset ,dst_rcfilter_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCFILTER_SW ,"DST_RCFILTER_SW" , 1 ,sizeof(struct dst_rcfilter_sw_context) ,dst_rcfilter_sw_reset ,dst_rcfilter_sw_step ,NULL ,NULL ),
|
||||
/* For testing - seem to be buggered. Use versions not ending in N. */
|
||||
{ DST_RCFILTERN ,"DST_RCFILTERN" , 1 ,sizeof(struct dst_filter1_context) ,dst_rcfilterN_reset ,dst_filter1_step ,NULL ,NULL },
|
||||
{ DST_RCDISCN ,"DST_RCDISCN" , 1 ,sizeof(struct dst_filter1_context) ,dst_rcdiscN_reset ,dst_rcdiscN_step ,NULL ,NULL },
|
||||
{ DST_RCDISC2N ,"DST_RCDISC2N" , 1 ,sizeof(struct dst_rcdisc2_context) ,dst_rcdisc2N_reset ,dst_rcdisc2N_step ,NULL ,NULL },
|
||||
MOD_ENTRY( DST_RCFILTERN ,"DST_RCFILTERN" , 1 ,sizeof(struct dst_filter1_context) ,dst_rcfilterN_reset ,dst_filter1_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCDISCN ,"DST_RCDISCN" , 1 ,sizeof(struct dst_filter1_context) ,dst_rcdiscN_reset ,dst_rcdiscN_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DST_RCDISC2N ,"DST_RCDISC2N" , 1 ,sizeof(struct dst_rcdisc2_context) ,dst_rcdisc2N_reset ,dst_rcdisc2N_step ,NULL ,NULL ),
|
||||
|
||||
/* from disc_dev.c */
|
||||
/* generic modules */
|
||||
{ DST_CUSTOM ,"DST_CUSTOM" , 8 ,0 ,NULL ,NULL ,NULL ,NULL },
|
||||
MOD_ENTRY( DST_CUSTOM ,"DST_CUSTOM" , 8 ,0 ,NULL ,NULL ,NULL ,NULL ),
|
||||
/* Component specific modules */
|
||||
{ DSD_555_ASTBL ,"DSD_555_ASTBL" , 1 ,sizeof(struct dsd_555_astbl_context) ,dsd_555_astbl_reset ,dsd_555_astbl_step ,NULL ,NULL },
|
||||
{ DSD_555_MSTBL ,"DSD_555_MSTBL" , 1 ,sizeof(struct dsd_555_mstbl_context) ,dsd_555_mstbl_reset ,dsd_555_mstbl_step ,NULL ,NULL },
|
||||
{ DSD_555_CC ,"DSD_555_CC" , 1 ,sizeof(struct dsd_555_cc_context) ,dsd_555_cc_reset ,dsd_555_cc_step ,NULL ,NULL },
|
||||
{ DSD_555_VCO1 ,"DSD_555_VCO1" , 1 ,sizeof(struct dsd_555_vco1_context) ,dsd_555_vco1_reset ,dsd_555_vco1_step ,NULL ,NULL },
|
||||
{ DSD_566 ,"DSD_566" , 1 ,sizeof(struct dsd_566_context) ,dsd_566_reset ,dsd_566_step ,NULL ,NULL },
|
||||
{ DSD_LS624 ,"DSD_LS624" , 1 ,sizeof(struct dsd_ls624_context) ,dsd_ls624_reset ,dsd_ls624_step ,NULL ,NULL },
|
||||
MOD_ENTRY( DSD_555_ASTBL ,"DSD_555_ASTBL" , 1 ,sizeof(struct dsd_555_astbl_context) ,dsd_555_astbl_reset ,dsd_555_astbl_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSD_555_MSTBL ,"DSD_555_MSTBL" , 1 ,sizeof(struct dsd_555_mstbl_context) ,dsd_555_mstbl_reset ,dsd_555_mstbl_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSD_555_CC ,"DSD_555_CC" , 1 ,sizeof(struct dsd_555_cc_context) ,dsd_555_cc_reset ,dsd_555_cc_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSD_555_VCO1 ,"DSD_555_VCO1" , 1 ,sizeof(struct dsd_555_vco1_context) ,dsd_555_vco1_reset ,dsd_555_vco1_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSD_566 ,"DSD_566" , 1 ,sizeof(struct dsd_566_context) ,dsd_566_reset ,dsd_566_step ,NULL ,NULL ),
|
||||
MOD_ENTRY( DSD_LS624 ,"DSD_LS624" , 1 ,sizeof(struct dsd_ls624_context) ,dsd_ls624_reset ,dsd_ls624_step ,NULL ,NULL ),
|
||||
/* must be the last one */
|
||||
{ DSS_NULL ,"DSS_NULL" , 0 ,0 ,NULL ,NULL ,NULL ,NULL }
|
||||
MOD_ENTRY( DSS_NULL ,"DSS_NULL" , 0 ,0 ,NULL ,NULL ,NULL ,NULL )
|
||||
};
|
||||
|
||||
INLINE void step_nodes_in_list(node_list_t &list)
|
||||
@ -303,22 +308,22 @@ INLINE void step_nodes_in_list(node_list_t &list)
|
||||
|
||||
if (EXPECTED(!profiling))
|
||||
{
|
||||
for_each(node_description *, entry, &list)
|
||||
for_each(discrete_base_node *, entry, &list)
|
||||
{
|
||||
/* Now step the node */
|
||||
(*entry.item()->step)(entry.item());
|
||||
entry.item()->step();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
osd_ticks_t last = get_profile_ticks();
|
||||
|
||||
for_each(node_description *, entry, &list)
|
||||
for_each(discrete_base_node *, entry, &list)
|
||||
{
|
||||
node_description *node = entry.item();
|
||||
discrete_base_node *node = entry.item();
|
||||
|
||||
node->run_time -= last;
|
||||
(*node->step)(node);
|
||||
node->step();
|
||||
last = get_profile_ticks();
|
||||
node->run_time += last;
|
||||
}
|
||||
@ -331,7 +336,7 @@ INLINE void step_nodes_in_list(node_list_t &list)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
node_description *discrete_device::discrete_find_node(int node)
|
||||
discrete_base_node *discrete_device::discrete_find_node(int node)
|
||||
{
|
||||
if (node < NODE_START || node > NODE_END) return NULL;
|
||||
return m_indexed_node[NODE_INDEX(node)];
|
||||
@ -465,7 +470,7 @@ static UINT64 list_run_time(const node_list_t &list)
|
||||
{
|
||||
UINT64 total = 0;
|
||||
|
||||
for_each(node_description *, node, &list)
|
||||
for_each(discrete_base_node *, node, &list)
|
||||
{
|
||||
total += node.item()->run_time;
|
||||
}
|
||||
@ -486,7 +491,7 @@ void discrete_device::display_profiling(void)
|
||||
printf("Total Samples : %16" I64FMT "d\n", m_total_samples);
|
||||
tresh = total / count;
|
||||
printf("Threshold (mean): %16" I64FMT "d\n", tresh / m_total_samples );
|
||||
for_each(node_description *, node, &m_node_list)
|
||||
for_each(discrete_base_node *, node, &m_node_list)
|
||||
{
|
||||
if (node.item()->run_time > tresh)
|
||||
printf("%3d: %20s %8.2f %10.2f\n", node.item()->index(), node.item()->module->name, (float) node.item()->run_time / (float) total * 100.0, ((float) node.item()->run_time) / (float) m_total_samples);
|
||||
@ -566,7 +571,7 @@ static void *task_callback(void *param, int threadid)
|
||||
|
||||
static STREAM_UPDATE( buffer_stream_update )
|
||||
{
|
||||
const node_description *node = (node_description *) param;
|
||||
const discrete_base_node *node = (discrete_base_node *) param;
|
||||
const struct dss_input_context *context = (struct dss_input_context *)node->context;
|
||||
stream_sample_t *ptr = outputs[0];
|
||||
int data = context->data;
|
||||
@ -622,7 +627,8 @@ void discrete_device::init_nodes(const linked_list_entry *block_list)
|
||||
if (module_list[modulenum].type != block->type)
|
||||
fatalerror("init_nodes() - Unable to find discrete module type %d for NODE_%02d", block->type, NODE_INDEX(block->node));
|
||||
|
||||
node_description *node = auto_alloc_clear(machine, node_description(this, &module_list[modulenum], block));
|
||||
//discrete_base_node *node = auto_alloc_clear(machine, discrete_legacy_node(this, &module_list[modulenum], block));
|
||||
discrete_base_node *node = module_list[modulenum].factory->Create(this, &module_list[modulenum], block);
|
||||
|
||||
/* keep track of special nodes */
|
||||
if (block->node == NODE_SPECIAL)
|
||||
@ -689,7 +695,7 @@ void discrete_device::init_nodes(const linked_list_entry *block_list)
|
||||
|
||||
/* our running order just follows the order specified */
|
||||
/* does the node step ? */
|
||||
if (node->step != NULL)
|
||||
if (node->module->step != NULL)
|
||||
{
|
||||
/* do we belong to a task? */
|
||||
if (task == NULL)
|
||||
@ -723,7 +729,7 @@ void discrete_device::init_nodes(const linked_list_entry *block_list)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
node_description::node_description(discrete_device * pdev, const discrete_module *xmodule, const discrete_sound_block *xblock) :
|
||||
discrete_base_node::discrete_base_node(discrete_device * pdev, const discrete_module *xmodule, const discrete_sound_block *xblock) :
|
||||
context(NULL),
|
||||
device(pdev),
|
||||
module(xmodule),
|
||||
@ -743,7 +749,7 @@ node_description::node_description(discrete_device * pdev, const discrete_module
|
||||
}
|
||||
|
||||
/* copy initial / default step function */
|
||||
step = module->step;
|
||||
//step = module->step;
|
||||
|
||||
/* allocate memory if necessary */
|
||||
if (module->contextsize)
|
||||
@ -751,24 +757,24 @@ node_description::node_description(discrete_device * pdev, const discrete_module
|
||||
|
||||
}
|
||||
|
||||
node_description::~node_description(void)
|
||||
discrete_base_node::~discrete_base_node(void)
|
||||
{
|
||||
if (module->contextsize)
|
||||
global_free(context);
|
||||
}
|
||||
|
||||
int node_description::index(void)
|
||||
int discrete_base_node::index(void)
|
||||
{
|
||||
return NODE_INDEX(m_block->node);
|
||||
}
|
||||
|
||||
void node_description::save_state(device_t *device)
|
||||
void discrete_base_node::save_state(device_t *device)
|
||||
{
|
||||
if (m_block->node != NODE_SPECIAL)
|
||||
state_save_register_device_item_array(device, m_block->node, output);
|
||||
}
|
||||
|
||||
void node_description::find_input_nodes(void)
|
||||
void discrete_base_node::find_input_nodes(void)
|
||||
{
|
||||
int inputnum;
|
||||
|
||||
@ -780,7 +786,7 @@ void node_description::find_input_nodes(void)
|
||||
/* if this input is node-based, find the node in the indexed list */
|
||||
if IS_VALUE_A_NODE(inputnode)
|
||||
{
|
||||
const node_description *node_ref = device->m_indexed_node[NODE_INDEX(inputnode)];
|
||||
const discrete_base_node *node_ref = device->m_indexed_node[NODE_INDEX(inputnode)];
|
||||
if (!node_ref)
|
||||
fatalerror("discrete_start - NODE_%02d referenced a non existent node NODE_%02d", index(), NODE_INDEX(inputnode));
|
||||
|
||||
@ -813,11 +819,11 @@ void node_description::find_input_nodes(void)
|
||||
}
|
||||
}
|
||||
|
||||
int discrete_device::same_module_index(node_description &node)
|
||||
int discrete_device::same_module_index(discrete_base_node &node)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
for_each(node_description *, n, &m_node_list)
|
||||
for_each(discrete_base_node *, n, &m_node_list)
|
||||
{
|
||||
if (n.item() == &node)
|
||||
return index;
|
||||
@ -948,7 +954,7 @@ discrete_device::~discrete_device(void)
|
||||
|
||||
/* Process nodes which have a stop func */
|
||||
|
||||
for_each(node_description *, node, &m_node_list)
|
||||
for_each(discrete_base_node *, node, &m_node_list)
|
||||
{
|
||||
if (node.item()->module->stop)
|
||||
(*node.item()->module->stop)(node.item());
|
||||
@ -1010,13 +1016,13 @@ void discrete_device::device_start()
|
||||
m_input_list.reset();
|
||||
|
||||
/* allocate memory to hold pointers to nodes by index */
|
||||
m_indexed_node = auto_alloc_array_clear(this->machine, node_description *, DISCRETE_MAX_NODES);
|
||||
m_indexed_node = auto_alloc_array_clear(this->machine, discrete_base_node *, DISCRETE_MAX_NODES);
|
||||
|
||||
/* initialize the node data */
|
||||
init_nodes(m_block_list);
|
||||
|
||||
/* now go back and find pointers to all input nodes */
|
||||
for_each(node_description *, node, &m_node_list)
|
||||
for_each(discrete_base_node *, node, &m_node_list)
|
||||
{
|
||||
node.item()->find_input_nodes();
|
||||
}
|
||||
@ -1030,7 +1036,7 @@ void discrete_device::device_start()
|
||||
|
||||
/* Process nodes which have a start func */
|
||||
|
||||
for_each(node_description *, node, &m_node_list)
|
||||
for_each(discrete_base_node *, node, &m_node_list)
|
||||
{
|
||||
if (node.item()->module->start)
|
||||
(*node.item()->module->start)(node.item());
|
||||
@ -1048,7 +1054,7 @@ void discrete_device::device_reset()
|
||||
stream_update(discrete_stream);
|
||||
|
||||
/* loop over all nodes */
|
||||
for_each (node_description *, node, &m_node_list)
|
||||
for_each (discrete_base_node *, node, &m_node_list)
|
||||
{
|
||||
node.item()->output[0] = 0;
|
||||
|
||||
@ -1057,8 +1063,8 @@ void discrete_device::device_reset()
|
||||
(*node.item()->module->reset)(node.item());
|
||||
|
||||
/* otherwise, just step it */
|
||||
else if (node.item()->step)
|
||||
(*node.item()->step)(node.item());
|
||||
else
|
||||
node.item()->step();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1081,14 +1087,14 @@ void discrete_device::stream_generate(stream_sample_t **inputs, stream_sample_t
|
||||
return;
|
||||
/* Setup any output streams */
|
||||
outputnum = 0;
|
||||
for_each(node_description *, node, &m_output_list)
|
||||
for_each(discrete_base_node *, node, &m_output_list)
|
||||
{
|
||||
node.item()->context = (void *) outputs[outputnum];
|
||||
outputnum++;
|
||||
}
|
||||
|
||||
/* Setup any input streams */
|
||||
for_each(node_description *, node, &m_input_list)
|
||||
for_each(discrete_base_node *, node, &m_input_list)
|
||||
{
|
||||
struct dss_input_context *context = (struct dss_input_context *) node.item()->context;
|
||||
context->ptr = (stream_sample_t *) inputs[context->stream_in_number];
|
||||
@ -1134,7 +1140,7 @@ void discrete_device::stream_generate(stream_sample_t **inputs, stream_sample_t
|
||||
|
||||
READ8_MEMBER( discrete_device::read )
|
||||
{
|
||||
node_description *node = discrete_find_node(offset);
|
||||
discrete_base_node *node = discrete_find_node(offset);
|
||||
|
||||
UINT8 data = 0;
|
||||
|
||||
@ -1158,7 +1164,7 @@ READ8_MEMBER( discrete_device::read )
|
||||
|
||||
WRITE8_MEMBER( discrete_device::write )
|
||||
{
|
||||
node_description *node = discrete_find_node(offset);
|
||||
discrete_base_node *node = discrete_find_node(offset);
|
||||
|
||||
/* Update the node input value if it's a proper input node */
|
||||
if (node)
|
||||
|
@ -3,7 +3,6 @@
|
||||
#ifndef __DISCRETE_H__
|
||||
#define __DISCRETE_H__
|
||||
|
||||
//#include "devlegcy.h"
|
||||
#include "machine/rescap.h"
|
||||
|
||||
/***********************************************************************
|
||||
@ -3501,7 +3500,7 @@
|
||||
#define DISCRETE_START_NAME( _func ) _func ## _start
|
||||
#define DISCRETE_STOP_NAME( _func ) _func ## _stop
|
||||
|
||||
#define DISCRETE_FUNC(_func) void _func (node_description *node)
|
||||
#define DISCRETE_FUNC(_func) void _func (discrete_base_node *node)
|
||||
|
||||
#define DISCRETE_STEP(_func) static DISCRETE_FUNC(DISCRETE_STEP_NAME(_func))
|
||||
#define DISCRETE_RESET(_func) static DISCRETE_FUNC(DISCRETE_RESET_NAME(_func))
|
||||
@ -3517,7 +3516,7 @@
|
||||
#define DISCRETE_DECLARE_INFO(_name) const _name *info = (const _name *)node->custom_data();
|
||||
|
||||
#define DISCRETE_CUSTOM_MODULE(_basename, _context_type) \
|
||||
{ DST_CUSTOM, "CUSTOM", 1, sizeof(_context_type), DISCRETE_RESET_NAME(_basename), DISCRETE_STEP_NAME(_basename) }
|
||||
{ new discrete_node_factory<discrete_legacy_node>, DST_CUSTOM, "CUSTOM", 1, sizeof(_context_type), DISCRETE_RESET_NAME(_basename), DISCRETE_STEP_NAME(_basename) }
|
||||
|
||||
#define DISCRETE_INPUT(_num) (*(node->input[_num]))
|
||||
|
||||
@ -3871,8 +3870,9 @@ typedef struct _discrete_sound_block discrete_sound_block;
|
||||
typedef struct _discrete_module discrete_module;
|
||||
|
||||
|
||||
class node_description;
|
||||
typedef linked_list_t<node_description *> node_list_t;
|
||||
class discrete_base_node;
|
||||
class discrete_device;
|
||||
typedef linked_list_t<discrete_base_node *> node_list_t;
|
||||
|
||||
|
||||
|
||||
@ -3882,8 +3882,21 @@ typedef linked_list_t<node_description *> node_list_t;
|
||||
*
|
||||
*************************************/
|
||||
|
||||
class discrete_node_base_factory // Each class which can have run time specified object creation
|
||||
{ // has an equivalent factory class that provides a Create virtual
|
||||
// function override
|
||||
|
||||
|
||||
public:
|
||||
virtual discrete_base_node *Create(discrete_device * pdev, const discrete_module *xmodule, const discrete_sound_block *block) = 0;
|
||||
virtual ~discrete_node_base_factory() {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct _discrete_module
|
||||
{
|
||||
discrete_node_base_factory *factory;
|
||||
int type;
|
||||
const char * name;
|
||||
int num_output; /* Total number of output nodes, i.e. Master node + 1 */
|
||||
@ -3913,7 +3926,7 @@ class discrete_task
|
||||
{
|
||||
public:
|
||||
discrete_task(void)
|
||||
: numbuffered(0), task_group(0), m_threadid(-1)
|
||||
: numbuffered(0), task_group(0), m_threadid(-1)
|
||||
{
|
||||
source_list.reset();
|
||||
list.reset();
|
||||
@ -3935,7 +3948,7 @@ public:
|
||||
const double *source[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
|
||||
double *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
node_description *nodes[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
discrete_base_node *nodes[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
|
||||
inline bool lock_threadid(INT32 threadid)
|
||||
{
|
||||
@ -4729,7 +4742,7 @@ protected:
|
||||
class discrete_device : public device_t, public device_sound_interface
|
||||
{
|
||||
friend class discrete_device_config;
|
||||
friend class node_description;
|
||||
friend class discrete_base_node;
|
||||
|
||||
// construction/destruction
|
||||
discrete_device(running_machine &_machine, const discrete_device_config &config);
|
||||
@ -4742,9 +4755,9 @@ public:
|
||||
|
||||
/* --------------------------------- */
|
||||
void CLIB_DECL ATTR_PRINTF(2,3) discrete_log(const char *text, ...) const;
|
||||
node_description *discrete_find_node(int node);
|
||||
discrete_base_node *discrete_find_node(int node);
|
||||
/* FIXME: this is used by csv and wav logs - going forward, identifiers should be explicitly passed */
|
||||
int same_module_index(node_description &node);
|
||||
int same_module_index(discrete_base_node &node);
|
||||
|
||||
|
||||
/* the output stream */
|
||||
@ -4779,7 +4792,7 @@ protected:
|
||||
|
||||
private:
|
||||
/* internal node tracking */
|
||||
node_description **m_indexed_node;
|
||||
discrete_base_node **m_indexed_node;
|
||||
|
||||
/* list of all nodes */
|
||||
node_list_t m_node_list; /* node_description * */
|
||||
@ -4815,12 +4828,19 @@ extern const device_type DISCRETE;
|
||||
*
|
||||
*************************************/
|
||||
|
||||
class node_description
|
||||
class discrete_base_node
|
||||
{
|
||||
public:
|
||||
node_description(discrete_device * pdev, const discrete_module *module, const discrete_sound_block *block);
|
||||
discrete_base_node(discrete_device * pdev, const discrete_module *module, const discrete_sound_block *block);
|
||||
|
||||
~node_description(void);
|
||||
~discrete_base_node(void);
|
||||
|
||||
virtual void step(void) = 0;
|
||||
virtual void reset(void) { }
|
||||
virtual void start(void) { }
|
||||
virtual void stop(void) { }
|
||||
|
||||
virtual bool is_stepping(void) = 0;
|
||||
|
||||
/* Return the node index, i.e. X from NODE(X) */
|
||||
int index(void);
|
||||
@ -4837,9 +4857,6 @@ public:
|
||||
/* The node's last output value */
|
||||
double output[DISCRETE_MAX_OUTPUTS];
|
||||
|
||||
/* Called to execute one time delta of output update */
|
||||
DISCRETE_FUNC((*step));
|
||||
|
||||
/* Contextual information specific to this node type */
|
||||
void * context;
|
||||
|
||||
@ -4866,5 +4883,33 @@ private:
|
||||
|
||||
};
|
||||
|
||||
template <class C>
|
||||
class discrete_node_factory : public discrete_node_base_factory
|
||||
{
|
||||
discrete_base_node *Create(discrete_device * pdev, const discrete_module *xmodule, const discrete_sound_block *block);
|
||||
};
|
||||
|
||||
template <class C>
|
||||
discrete_base_node * discrete_node_factory<C>::Create(discrete_device * pdev, const discrete_module *xmodule, const discrete_sound_block *block)
|
||||
{
|
||||
return auto_alloc_clear(pdev->machine, C(pdev, xmodule, block));
|
||||
}
|
||||
|
||||
class discrete_legacy_node : public discrete_base_node
|
||||
{
|
||||
public:
|
||||
|
||||
discrete_legacy_node(discrete_device * pdev, const discrete_module *xmodule, const discrete_sound_block *block)
|
||||
: discrete_base_node::discrete_base_node(pdev, xmodule, block), m_step(module->step) { }
|
||||
|
||||
void step(void) { /* if (m_step != NULL) */ m_step(this); }
|
||||
virtual void reset(void) { if (module->reset != NULL) module->reset(this); }
|
||||
virtual void start(void) { if (module->start != NULL) module->start(this);}
|
||||
virtual void stop(void) { if (module->stop != NULL) module->stop(this); }
|
||||
|
||||
virtual bool is_stepping(void) { return (m_step != NULL); }
|
||||
protected:
|
||||
DISCRETE_FUNC((*m_step));
|
||||
};
|
||||
|
||||
#endif /* __DISCRETE_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user