mirror of
https://github.com/holub/mame
synced 2025-05-29 09:03:08 +03:00
Good bye for node->node
This commit is contained in:
parent
ac6238dc59
commit
64c1866c1b
@ -548,7 +548,7 @@ static DISCRETE_RESET(dsd_555_mstbl)
|
||||
context->output_type = info->options & DISC_555_OUT_MASK;
|
||||
if ((context->output_type == DISC_555_OUT_COUNT_F) || (context->output_type == DISC_555_OUT_COUNT_R))
|
||||
{
|
||||
discrete_log(node->info, "Invalid Output type in NODE_%d.\n", node->node - NODE_00);
|
||||
discrete_log(node->info, "Invalid Output type in NODE_%d.\n", NODE_BLOCKINDEX(node));
|
||||
context->output_type = DISC_555_OUT_SQW;
|
||||
}
|
||||
|
||||
@ -1522,7 +1522,7 @@ static DISCRETE_RESET(dsd_566)
|
||||
context->error = 0;
|
||||
if (info->v_neg >= info->v_pos)
|
||||
{
|
||||
logerror("[v_neg >= v_pos] - NODE_%d DISABLED!\n", node->node - NODE_00);
|
||||
logerror("[v_neg >= v_pos] - NODE_%d DISABLED!\n", NODE_BLOCKINDEX(node));
|
||||
context->error = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -786,17 +786,17 @@ static DISCRETE_RESET( dst_rcdisc4)
|
||||
/* some error checking. */
|
||||
if (DST_RCDISC4__R1 <= 0 || DST_RCDISC4__R2 <= 0 || DST_RCDISC4__C1 <= 0 || (DST_RCDISC4__R3 <= 0 && context->type == 1))
|
||||
{
|
||||
discrete_log(node->info, "Invalid component values in NODE_%d.\n", node->node - NODE_00);
|
||||
discrete_log(node->info, "Invalid component values in NODE_%d.\n", NODE_BLOCKINDEX(node));
|
||||
return;
|
||||
}
|
||||
if (DST_RCDISC4__VP < 3)
|
||||
{
|
||||
discrete_log(node->info, "vP must be >= 3V in NODE_%d.\n", node->node - NODE_00);
|
||||
discrete_log(node->info, "vP must be >= 3V in NODE_%d.\n", NODE_BLOCKINDEX(node));
|
||||
return;
|
||||
}
|
||||
if (DST_RCDISC4__TYPE < 1 || DST_RCDISC4__TYPE > 3)
|
||||
{
|
||||
discrete_log(node->info, "Invalid circuit type in NODE_%d.\n", node->node - NODE_00);
|
||||
discrete_log(node->info, "Invalid circuit type in NODE_%d.\n", NODE_BLOCKINDEX(node));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ static DISCRETE_RESET(dss_adjustment)
|
||||
{
|
||||
context->port = input_port_by_tag(node->info->device->machine->portconfig, (const char *)node->custom);
|
||||
if (context->port == NULL)
|
||||
fatalerror("DISCRETE_ADJUSTMENT_TAG - NODE_%d has invalid tag", node->node-NODE_00);
|
||||
fatalerror("DISCRETE_ADJUSTMENT_TAG - NODE_%d has invalid tag", NODE_BLOCKINDEX(node));
|
||||
}
|
||||
else
|
||||
context->port = input_port_by_index(node->info->device->machine->portconfig, DSS_ADJUSTMENT__PORT);
|
||||
|
@ -491,7 +491,7 @@ static DISCRETE_STEP(dst_divide)
|
||||
if(DST_DIVIDE__DIV == 0)
|
||||
{
|
||||
node->output[0 ]= DBL_MAX; /* Max out but don't break */
|
||||
discrete_log(node->info, "dst_divider_step() - Divide by Zero attempted in NODE_%02d.\n",NODE_INDEX(node->node));
|
||||
discrete_log(node->info, "dst_divider_step() - Divide by Zero attempted in NODE_%02d.\n",NODE_BLOCKINDEX(node));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1354,7 +1354,7 @@ static DISCRETE_STEP(dst_multiplex)
|
||||
else
|
||||
{
|
||||
/* Bad address. We will leave the output alone. */
|
||||
discrete_log(node->info, "NODE_%02d - Address = %d. Out of bounds\n", node->node-NODE_00, addr);
|
||||
discrete_log(node->info, "NODE_%02d - Address = %d. Out of bounds\n", NODE_BLOCKINDEX(node), addr);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -66,17 +66,17 @@ static DISCRETE_START( dso_task )
|
||||
int i;
|
||||
found = 0;
|
||||
for (i = 0; i < task->numbuffered; i++)
|
||||
if (task->nodes[i] == inputnode)
|
||||
if (task->nodes[i]->block->node == inputnode)
|
||||
found = 1;
|
||||
if (!found)
|
||||
{
|
||||
if (task->numbuffered >= DISCRETE_MAX_TASK_OUTPUTS)
|
||||
fatalerror("dso_task_start - Number of maximum buffered nodes exceeded");
|
||||
|
||||
discrete_log(node->info, "dso_task_start - buffering %d(%d) in task %p referenced by %d", NODE_INDEX(inputnode), NODE_CHILD_NODE_NUM(inputnode), task, NODE_INDEX(snode->node));
|
||||
discrete_log(node->info, "dso_task_start - buffering %d(%d) in task %p referenced by %d", NODE_INDEX(inputnode), NODE_CHILD_NODE_NUM(inputnode), task, NODE_BLOCKINDEX(snode));
|
||||
task->node_buf[task->numbuffered] = auto_alloc_array(node->info->device->machine, double, 2048);
|
||||
task->dest[task->numbuffered] = (double **) &snode->input[inputnum];
|
||||
task->nodes[task->numbuffered] = inputnode;
|
||||
task->nodes[task->numbuffered] = discrete_find_node(node->info, inputnode);
|
||||
task->numbuffered++;
|
||||
}
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ static DISCRETE_RESET(dss_lfsr)
|
||||
context->out_lfsr_reg = (lfsr_desc->flags & DISC_LFSR_FLAG_OUTPUT_SR_SN1) ? 1 : 0;
|
||||
|
||||
if ((lfsr_desc->clock_type < DISC_CLK_ON_F_EDGE) || (lfsr_desc->clock_type > DISC_CLK_IS_FREQ))
|
||||
discrete_log(node->info, "Invalid clock type passed in NODE_%d\n", NODE_INDEX(node->node));
|
||||
discrete_log(node->info, "Invalid clock type passed in NODE_%d\n", NODE_BLOCKINDEX(node));
|
||||
|
||||
context->last = (DSS_COUNTER__CLOCK != 0);
|
||||
if (lfsr_desc->clock_type == DISC_CLK_IS_FREQ) context->t_clock = 1.0 / DSS_LFSR_NOISE__CLOCK;
|
||||
@ -1569,7 +1569,7 @@ static DISCRETE_STEP(dss_inverter_osc)
|
||||
vG2 = dss_inverter_tf(node,vG3);
|
||||
break;
|
||||
default:
|
||||
fatalerror("DISCRETE_INVERTER_OSC - Wrong type on NODE_%02d", node->node - NODE_00);
|
||||
fatalerror("DISCRETE_INVERTER_OSC - Wrong type on NODE_%02d", NODE_BLOCKINDEX(node));
|
||||
}
|
||||
switch (info->options & DISC_OSC_INVERTER_TYPE_MASK)
|
||||
{
|
||||
@ -1628,7 +1628,7 @@ static DISCRETE_STEP(dss_inverter_osc)
|
||||
diff = diff - diff * exp(-node->info->sample_time/(context->c * rMix));
|
||||
break;
|
||||
default:
|
||||
fatalerror("DISCRETE_INVERTER_OSC - Wrong type on NODE_%02d", node->node - NODE_00);
|
||||
fatalerror("DISCRETE_INVERTER_OSC - Wrong type on NODE_%02d", NODE_BLOCKINDEX(node));
|
||||
}
|
||||
context->v_cap += diff;
|
||||
context->v_g2_old = vG2;
|
||||
|
@ -556,7 +556,7 @@ static void display_profiling(discrete_info *info)
|
||||
node_description *node = (node_description *) entry->ptr;
|
||||
|
||||
if (node->run_time > tresh)
|
||||
printf("%3d: %20s %8.2f %10.2f\n", NODE_INDEX(node->node), node->module->name, (float) node->run_time / (float) total * 100.0, ((float) node->run_time) / (float) info->total_samples);
|
||||
printf("%3d: %20s %8.2f %10.2f\n", NODE_BLOCKINDEX(node), node->module->name, (float) node->run_time / (float) total * 100.0, ((float) node->run_time) / (float) info->total_samples);
|
||||
}
|
||||
|
||||
/* Task information */
|
||||
@ -782,7 +782,7 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
|
||||
/* static inits */
|
||||
node->context = NULL;
|
||||
node->info = info;
|
||||
node->node = block->node;
|
||||
//node->node = block->node;
|
||||
node->module = &module_list[modulenum];
|
||||
node->output[0] = 0.0;
|
||||
node->block = block;
|
||||
@ -900,8 +900,8 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
|
||||
}
|
||||
|
||||
/* and register save state */
|
||||
if (node->node != NODE_SPECIAL)
|
||||
state_save_register_device_item_array(device, node->node, node->output);
|
||||
if (node->block->node != NODE_SPECIAL)
|
||||
state_save_register_device_item_array(device, node->block->node, node->output);
|
||||
}
|
||||
|
||||
/* if no outputs, give an error */
|
||||
@ -937,10 +937,10 @@ static void find_input_nodes(discrete_info *info)
|
||||
{
|
||||
node_description *node_ref = info->indexed_node[NODE_INDEX(inputnode)];
|
||||
if (!node_ref)
|
||||
fatalerror("discrete_start - NODE_%02d referenced a non existent node NODE_%02d", NODE_INDEX(node->node), NODE_INDEX(inputnode));
|
||||
fatalerror("discrete_start - NODE_%02d referenced a non existent node NODE_%02d", NODE_BLOCKINDEX(node), NODE_INDEX(inputnode));
|
||||
|
||||
if (NODE_CHILD_NODE_NUM(inputnode) >= node_ref->module->num_output)
|
||||
fatalerror("discrete_start - 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_%02d referenced non existent output %d on node NODE_%02d", NODE_BLOCKINDEX(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_is_node |= 1 << inputnum; /* Bit flag if input is node */
|
||||
@ -950,9 +950,9 @@ static void find_input_nodes(discrete_info *info)
|
||||
/* warn if trying to use a node for an input that can only be static */
|
||||
if IS_VALUE_A_NODE(block->initial[inputnum])
|
||||
{
|
||||
discrete_log(info, "Warning - discrete_start - NODE_%02d trying to use a node on static input %d", NODE_INDEX(node->node), inputnum);
|
||||
discrete_log(info, "Warning - discrete_start - NODE_%02d trying to use a node on static input %d", NODE_BLOCKINDEX(node), inputnum);
|
||||
/* also report it in the error log so it is not missed */
|
||||
logerror("Warning - discrete_start - NODE_%02d trying to use a node on static input %d", NODE_INDEX(node->node), inputnum);
|
||||
logerror("Warning - discrete_start - NODE_%02d trying to use a node on static input %d", NODE_BLOCKINDEX(node), inputnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3638,7 +3638,6 @@ struct _discrete_module
|
||||
|
||||
struct _node_description
|
||||
{
|
||||
int node; /* The node's index number in the node list */
|
||||
double output[DISCRETE_MAX_OUTPUTS]; /* The node's last output value */
|
||||
|
||||
int active_inputs; /* Number of active inputs on this node type */
|
||||
@ -3678,11 +3677,11 @@ struct _discrete_task_context
|
||||
{
|
||||
linked_list_entry *list;
|
||||
|
||||
int numbuffered;
|
||||
double *ptr[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
double *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
int nodes[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
double **dest[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
int numbuffered;
|
||||
double *ptr[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
double *node_buf[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
node_description *nodes[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
double **dest[DISCRETE_MAX_TASK_OUTPUTS];
|
||||
|
||||
};
|
||||
|
||||
@ -4080,6 +4079,8 @@ enum {
|
||||
#error "DISCRETE_MAX_OUTPUTS != 8"
|
||||
#endif
|
||||
|
||||
#define NODE_BLOCKINDEX(_node) NODE_INDEX((_node)->block->node)
|
||||
|
||||
#define NODE_RELATIVE(_x, _y) (NODE(NODE_INDEX(_x) + (_y)))
|
||||
|
||||
#define NODE_NC NODE_00
|
||||
|
Loading…
Reference in New Issue
Block a user