mirror of
https://github.com/holub/mame
synced 2025-05-22 13:48:55 +03:00
Discrete tasks now support multiple task output nodes
- See galaxian for example
This commit is contained in:
parent
3de780ea8a
commit
304cd58528
@ -125,17 +125,20 @@ INLINE void step_nodes_in_list(linked_list_entry **list)
|
|||||||
static void *task_callback(void *param, int threadid)
|
static void *task_callback(void *param, int threadid)
|
||||||
{
|
{
|
||||||
task_info *ti = (task_info *) param;
|
task_info *ti = (task_info *) param;
|
||||||
int samples;
|
int samples, i;
|
||||||
|
|
||||||
|
/* set up task buffers */
|
||||||
|
for (i = 0; i < ti->context->numbuffered; i++)
|
||||||
|
ti->context->ptr[i] = &ti->context->node_buf[i][0];
|
||||||
|
|
||||||
/* set up task buffer */
|
|
||||||
ti->context->ptr = &ti->context->node_buf[0];
|
|
||||||
samples = ti->samples;
|
samples = ti->samples;
|
||||||
while (samples-- > 0)
|
while (samples-- > 0)
|
||||||
{
|
{
|
||||||
step_nodes_in_list(&ti->context->list);
|
step_nodes_in_list(&ti->context->list);
|
||||||
}
|
}
|
||||||
/* reset ptr */
|
/* reset ptr */
|
||||||
ti->context->ptr = &ti->context->node_buf[0];
|
for (i = 0; i < ti->context->numbuffered; i++)
|
||||||
|
ti->context->ptr[i] = &ti->context->node_buf[i][0];
|
||||||
|
|
||||||
free(param);
|
free(param);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -144,7 +147,10 @@ static void *task_callback(void *param, int threadid)
|
|||||||
static DISCRETE_STEP( dso_task )
|
static DISCRETE_STEP( dso_task )
|
||||||
{
|
{
|
||||||
discrete_task_context *ctx = (discrete_task_context *) node->context;
|
discrete_task_context *ctx = (discrete_task_context *) node->context;
|
||||||
*(ctx->ptr++) = (double) DISCRETE_INPUT(0);
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ctx->numbuffered; i++)
|
||||||
|
*(ctx->ptr[i]++) = (double) DISCRETE_INPUT(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DISCRETE_RESET( dso_task )
|
static DISCRETE_RESET( dso_task )
|
||||||
@ -759,7 +765,10 @@ INLINE void discrete_stream_update_nodes(discrete_info *info)
|
|||||||
for (entry = info->task_list; entry != 0; entry = entry->next)
|
for (entry = info->task_list; entry != 0; entry = entry->next)
|
||||||
{
|
{
|
||||||
discrete_task_context *task = (discrete_task_context *) entry->ptr;
|
discrete_task_context *task = (discrete_task_context *) entry->ptr;
|
||||||
**task->dest = *task->ptr++;
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < task->numbuffered; i++)
|
||||||
|
**task->dest[i] = *task->ptr[i]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* loop over all nodes */
|
/* loop over all nodes */
|
||||||
@ -865,6 +874,7 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
|
|||||||
node->output[0] = 0.0;
|
node->output[0] = 0.0;
|
||||||
node->block = block;
|
node->block = block;
|
||||||
node->custom = block->custom;
|
node->custom = block->custom;
|
||||||
|
node->active_inputs = block->active_inputs;
|
||||||
|
|
||||||
/* keep track of special nodes */
|
/* keep track of special nodes */
|
||||||
if (block->node == NODE_SPECIAL)
|
if (block->node == NODE_SPECIAL)
|
||||||
@ -902,8 +912,13 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
|
|||||||
case DSO_TASK_END:
|
case DSO_TASK_END:
|
||||||
if (cur_task_node == NULL)
|
if (cur_task_node == NULL)
|
||||||
fatalerror("init_nodes() - NO DISCRETE_START_TASK.");
|
fatalerror("init_nodes() - NO DISCRETE_START_TASK.");
|
||||||
|
task->numbuffered = node->active_inputs;
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < task->numbuffered; i++)
|
||||||
|
task->dest[i] = (double **) &node->input[i];
|
||||||
|
}
|
||||||
node->context = task;
|
node->context = task;
|
||||||
task->dest = (double **) &node->input[0];
|
|
||||||
task = NULL;
|
task = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -920,7 +935,6 @@ static void init_nodes(discrete_info *info, linked_list_entry *block_list, const
|
|||||||
info->indexed_node[NODE_INDEX(block->node)] = node;
|
info->indexed_node[NODE_INDEX(block->node)] = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
node->active_inputs = block->active_inputs;
|
|
||||||
for (inputnum = 0; inputnum < DISCRETE_MAX_INPUTS; inputnum++)
|
for (inputnum = 0; inputnum < DISCRETE_MAX_INPUTS; inputnum++)
|
||||||
{
|
{
|
||||||
node->input[inputnum] = &(block->initial[inputnum]);
|
node->input[inputnum] = &(block->initial[inputnum]);
|
||||||
|
@ -3669,9 +3669,10 @@ struct _discrete_task_context
|
|||||||
{
|
{
|
||||||
linked_list_entry *list;
|
linked_list_entry *list;
|
||||||
|
|
||||||
double *ptr;
|
int numbuffered;
|
||||||
double node_buf[2048];
|
double *ptr[5];
|
||||||
double **dest;
|
double node_buf[5][2048];
|
||||||
|
double **dest[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _discrete_info
|
struct _discrete_info
|
||||||
@ -4411,7 +4412,11 @@ enum
|
|||||||
/* parallel tasks */
|
/* parallel tasks */
|
||||||
|
|
||||||
#define DISCRETE_TASK_START() { NODE_SPECIAL, DSO_TASK_START, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_START" },
|
#define DISCRETE_TASK_START() { NODE_SPECIAL, DSO_TASK_START, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_START" },
|
||||||
#define DISCRETE_TASK_END(BUF_NODE) { NODE_SPECIAL, DSO_TASK_END , 1, { BUF_NODE }, { BUF_NODE }, NULL, "DISCRETE_TASK_END" },
|
#define DISCRETE_TASK_END(BNODE1) { NODE_SPECIAL, DSO_TASK_END , 1, { BNODE1 }, { BNODE1 }, NULL, "DISCRETE_TASK_END" },
|
||||||
|
#define DISCRETE_TASK_END2(BNODE1,BNODE2) { NODE_SPECIAL, DSO_TASK_END , 2, { BNODE1,BNODE2 }, { BNODE1,BNODE2 }, NULL, "DISCRETE_TASK_END2" },
|
||||||
|
#define DISCRETE_TASK_END3(BNODE1,BNODE2,BNODE3) { NODE_SPECIAL, DSO_TASK_END , 3, { BNODE1,BNODE2,BNODE3 }, { BNODE1,BNODE2,BNODE3 }, NULL, "DISCRETE_TASK_END3" },
|
||||||
|
#define DISCRETE_TASK_END4(BNODE1,BNODE2,BNODE3,BNODE4) { NODE_SPECIAL, DSO_TASK_END , 4, { BNODE1,BNODE2,BNODE3,BNODE4 }, { BNODE1,BNODE2,BNODE3,BNODE4 }, NULL, "DISCRETE_TASK_END4" },
|
||||||
|
#define DISCRETE_TASK_END5(BNODE1,BNODE2,BNODE3,BNODE4,BNODE5) { NODE_SPECIAL, DSO_TASK_END , 5, { BNODE1,BNODE2,BNODE3,BNODE4,BNODE5 }, { BNODE1,BNODE2,BNODE3,BNODE4,BNODE5 }, NULL, "DISCRETE_TASK_END5" },
|
||||||
//#define DISCRETE_TASK_SYNC() { NODE_SPECIAL, DSO_TASK_SYNC, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_SYNC" },
|
//#define DISCRETE_TASK_SYNC() { NODE_SPECIAL, DSO_TASK_SYNC, 0, { 0 }, { 0 }, NULL, "DISCRETE_TASK_SYNC" },
|
||||||
|
|
||||||
/* output */
|
/* output */
|
||||||
|
@ -35,8 +35,6 @@ TODO:
|
|||||||
#define SOUND_CLOCK (XTAL/6/2) /* 1.536 MHz */
|
#define SOUND_CLOCK (XTAL/6/2) /* 1.536 MHz */
|
||||||
#define RNG_RATE (XTAL/3*2) /* RNG clock is XTAL/3*2 see Aaron's note in video/galaxian.c */
|
#define RNG_RATE (XTAL/3*2) /* RNG clock is XTAL/3*2 see Aaron's note in video/galaxian.c */
|
||||||
|
|
||||||
//#define DISCRETE_BITSET(_N, _N1, _B, _OV) DISCRETE_TRANSFORM4(_N, _N1, (1 << ((_B)-1)), 0, _OV, "01&2>3*")
|
|
||||||
|
|
||||||
/* 74LS259 */
|
/* 74LS259 */
|
||||||
#define GAL_INP_BG_DAC NODE_10 /* at 9M Q4 to Q7 in schematics */
|
#define GAL_INP_BG_DAC NODE_10 /* at 9M Q4 to Q7 in schematics */
|
||||||
|
|
||||||
@ -270,6 +268,9 @@ static DISCRETE_SOUND_START(galaxian)
|
|||||||
/* Pitch */
|
/* Pitch */
|
||||||
DISCRETE_INPUT_DATA(GAL_INP_PITCH)
|
DISCRETE_INPUT_DATA(GAL_INP_PITCH)
|
||||||
|
|
||||||
|
/* Group Background and pitch */
|
||||||
|
DISCRETE_TASK_START()
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* Background */
|
/* Background */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
@ -306,6 +307,13 @@ static DISCRETE_SOUND_START(galaxian)
|
|||||||
*/
|
*/
|
||||||
DISCRETE_BITS_DECODE(NODE_133, NODE_132, 0, 3, TTL_OUT) /* QA-QD 74393 */
|
DISCRETE_BITS_DECODE(NODE_133, NODE_132, 0, 3, TTL_OUT) /* QA-QD 74393 */
|
||||||
|
|
||||||
|
/* End of this task */
|
||||||
|
DISCRETE_TASK_END5(NODE_120, NODE_SUB(133,0),NODE_SUB(133,1),NODE_SUB(133,2),NODE_SUB(133,3))
|
||||||
|
|
||||||
|
/* Group Hit and Fire */
|
||||||
|
|
||||||
|
DISCRETE_TASK_START()
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* HIT */
|
/* HIT */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
@ -346,6 +354,9 @@ static DISCRETE_SOUND_START(galaxian)
|
|||||||
/* 555 toggles discharge on rc discharge module */
|
/* 555 toggles discharge on rc discharge module */
|
||||||
DISCRETE_RCDISC5(NODE_182, NODE_181, NODE_171, (GAL_R41), GAL_C25)
|
DISCRETE_RCDISC5(NODE_182, NODE_181, NODE_171, (GAL_R41), GAL_C25)
|
||||||
|
|
||||||
|
/* End of task */
|
||||||
|
DISCRETE_TASK_END2(NODE_157, NODE_182)
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* FINAL MIX */
|
/* FINAL MIX */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user