hexsha
stringlengths 40
40
| repo
stringlengths 5
105
| path
stringlengths 3
173
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
438
| return_type
stringlengths 1
106
⌀ | original_string
stringlengths 21
40.7k
| original_docstring
stringlengths 18
13.4k
| docstring
stringlengths 11
3.24k
| docstring_tokens
sequence | code
stringlengths 14
20.4k
| code_tokens
sequence | short_docstring
stringlengths 0
4.36k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | drcmap_get_value | UINT32 | UINT32 drcmap_get_value(drcmap_state *drcmap, drccodeptr codebase, UINT32 mapvar)
{
UINT64 *endscan = (UINT64 *)drccache_top(drcmap->cache);
UINT32 varmask = 0x10 << mapvar;
drccodeptr curcode;
UINT32 result = 0;
UINT64 *curscan;
UINT32 *data;
assert(mapvar >= DRCUML_MAPVAR_M0 && mapvar < DRCUML_MAPVAR_END);
mapvar -= DRCUML_MAPVAR_M0;
/* get an aligned pointer to start scanning */
curscan = (UINT64 *)(((FPTR)codebase | 7) + 1);
/* look for the signature */
while (curscan < endscan && *curscan++ != drcmap->uniquevalue) ;
if (curscan >= endscan)
return 0;
/* switch to 32-bit pointers for processing the rest */
data = (UINT32 *)curscan;
/* first get the 32-bit starting offset to the code */
curcode = (drccodeptr)data - *data;
data++;
/* now loop until we advance past our target */
while (TRUE)
{
UINT32 controlword = *data++;
/* a 0 is a terminator */
if (controlword == 0)
break;
/* update the codeptr; if this puts us past the end, we're done */
curcode += (controlword >> 16) & 0xffff;
if (curcode > codebase)
break;
/* if our mapvar has changed, process this word */
if ((controlword & varmask) != 0)
{
int dataoffs = 0;
UINT32 skipmask;
/* count how many words precede the one we care about */
for (skipmask = (controlword & (varmask - 1)) >> 4; skipmask != 0; skipmask = skipmask & (skipmask - 1))
dataoffs++;
/* fetch the one we want */
result = data[dataoffs];
}
/* low 4 bits contain the total number of words of data */
data += controlword & 0x0f;
}
if (LOG_RECOVER)
printf("recover %d @ %p = %08X\n", mapvar, codebase, result);
return result;
} | /*-------------------------------------------------
drcmap_get_value - return a map value for the
given code pointer
-------------------------------------------------*/ | return a map value for the
given code pointer | [
"return",
"a",
"map",
"value",
"for",
"the",
"given",
"code",
"pointer"
] | UINT32 drcmap_get_value(drcmap_state *drcmap, drccodeptr codebase, UINT32 mapvar)
{
UINT64 *endscan = (UINT64 *)drccache_top(drcmap->cache);
UINT32 varmask = 0x10 << mapvar;
drccodeptr curcode;
UINT32 result = 0;
UINT64 *curscan;
UINT32 *data;
assert(mapvar >= DRCUML_MAPVAR_M0 && mapvar < DRCUML_MAPVAR_END);
mapvar -= DRCUML_MAPVAR_M0;
curscan = (UINT64 *)(((FPTR)codebase | 7) + 1);
while (curscan < endscan && *curscan++ != drcmap->uniquevalue) ;
if (curscan >= endscan)
return 0;
data = (UINT32 *)curscan;
curcode = (drccodeptr)data - *data;
data++;
while (TRUE)
{
UINT32 controlword = *data++;
if (controlword == 0)
break;
curcode += (controlword >> 16) & 0xffff;
if (curcode > codebase)
break;
if ((controlword & varmask) != 0)
{
int dataoffs = 0;
UINT32 skipmask;
for (skipmask = (controlword & (varmask - 1)) >> 4; skipmask != 0; skipmask = skipmask & (skipmask - 1))
dataoffs++;
result = data[dataoffs];
}
data += controlword & 0x0f;
}
if (LOG_RECOVER)
printf("recover %d @ %p = %08X\n", mapvar, codebase, result);
return result;
} | [
"UINT32",
"drcmap_get_value",
"(",
"drcmap_state",
"*",
"drcmap",
",",
"drccodeptr",
"codebase",
",",
"UINT32",
"mapvar",
")",
"{",
"UINT64",
"*",
"endscan",
"=",
"(",
"UINT64",
"*",
")",
"drccache_top",
"(",
"drcmap",
"->",
"cache",
")",
";",
"UINT32",
"varmask",
"=",
"0x10",
"<<",
"mapvar",
";",
"drccodeptr",
"curcode",
";",
"UINT32",
"result",
"=",
"0",
";",
"UINT64",
"*",
"curscan",
";",
"UINT32",
"*",
"data",
";",
"assert",
"(",
"mapvar",
">=",
"DRCUML_MAPVAR_M0",
"&&",
"mapvar",
"<",
"DRCUML_MAPVAR_END",
")",
";",
"mapvar",
"-=",
"DRCUML_MAPVAR_M0",
";",
"curscan",
"=",
"(",
"UINT64",
"*",
")",
"(",
"(",
"(",
"FPTR",
")",
"codebase",
"|",
"7",
")",
"+",
"1",
")",
";",
"while",
"(",
"curscan",
"<",
"endscan",
"&&",
"*",
"curscan",
"++",
"!=",
"drcmap",
"->",
"uniquevalue",
")",
";",
"if",
"(",
"curscan",
">=",
"endscan",
")",
"return",
"0",
";",
"data",
"=",
"(",
"UINT32",
"*",
")",
"curscan",
";",
"curcode",
"=",
"(",
"drccodeptr",
")",
"data",
"-",
"*",
"data",
";",
"data",
"++",
";",
"while",
"(",
"TRUE",
")",
"{",
"UINT32",
"controlword",
"=",
"*",
"data",
"++",
";",
"if",
"(",
"controlword",
"==",
"0",
")",
"break",
";",
"curcode",
"+=",
"(",
"controlword",
">>",
"16",
")",
"&",
"0xffff",
";",
"if",
"(",
"curcode",
">",
"codebase",
")",
"break",
";",
"if",
"(",
"(",
"controlword",
"&",
"varmask",
")",
"!=",
"0",
")",
"{",
"int",
"dataoffs",
"=",
"0",
";",
"UINT32",
"skipmask",
";",
"for",
"(",
"skipmask",
"=",
"(",
"controlword",
"&",
"(",
"varmask",
"-",
"1",
")",
")",
">>",
"4",
";",
"skipmask",
"!=",
"0",
";",
"skipmask",
"=",
"skipmask",
"&",
"(",
"skipmask",
"-",
"1",
")",
")",
"dataoffs",
"++",
";",
"result",
"=",
"data",
"[",
"dataoffs",
"]",
";",
"}",
"data",
"+=",
"controlword",
"&",
"0x0f",
";",
"}",
"if",
"(",
"LOG_RECOVER",
")",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"mapvar",
",",
"codebase",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | drcmap_get_value - return a map value for the
given code pointer | [
"drcmap_get_value",
"-",
"return",
"a",
"map",
"value",
"for",
"the",
"given",
"code",
"pointer"
] | [
"/* get an aligned pointer to start scanning */",
"/* look for the signature */",
"/* switch to 32-bit pointers for processing the rest */",
"/* first get the 32-bit starting offset to the code */",
"/* now loop until we advance past our target */",
"/* a 0 is a terminator */",
"/* update the codeptr; if this puts us past the end, we're done */",
"/* if our mapvar has changed, process this word */",
"/* count how many words precede the one we care about */",
"/* fetch the one we want */",
"/* low 4 bits contain the total number of words of data */"
] | [
{
"param": "drcmap",
"type": "drcmap_state"
},
{
"param": "codebase",
"type": "drccodeptr"
},
{
"param": "mapvar",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcmap",
"type": "drcmap_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "codebase",
"type": "drccodeptr",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mapvar",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | drcmap_get_last_value | UINT32 | UINT32 drcmap_get_last_value(drcmap_state *drcmap, UINT32 mapvar)
{
assert(mapvar >= DRCUML_MAPVAR_M0 && mapvar < DRCUML_MAPVAR_END);
return drcmap->mapvalue[mapvar - DRCUML_MAPVAR_M0];
} | /*-------------------------------------------------
drcmap_get_last_value - return the most
recently set map value
-------------------------------------------------*/ | return the most
recently set map value | [
"return",
"the",
"most",
"recently",
"set",
"map",
"value"
] | UINT32 drcmap_get_last_value(drcmap_state *drcmap, UINT32 mapvar)
{
assert(mapvar >= DRCUML_MAPVAR_M0 && mapvar < DRCUML_MAPVAR_END);
return drcmap->mapvalue[mapvar - DRCUML_MAPVAR_M0];
} | [
"UINT32",
"drcmap_get_last_value",
"(",
"drcmap_state",
"*",
"drcmap",
",",
"UINT32",
"mapvar",
")",
"{",
"assert",
"(",
"mapvar",
">=",
"DRCUML_MAPVAR_M0",
"&&",
"mapvar",
"<",
"DRCUML_MAPVAR_END",
")",
";",
"return",
"drcmap",
"->",
"mapvalue",
"[",
"mapvar",
"-",
"DRCUML_MAPVAR_M0",
"]",
";",
"}"
] | drcmap_get_last_value - return the most
recently set map value | [
"drcmap_get_last_value",
"-",
"return",
"the",
"most",
"recently",
"set",
"map",
"value"
] | [] | [
{
"param": "drcmap",
"type": "drcmap_state"
},
{
"param": "mapvar",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcmap",
"type": "drcmap_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mapvar",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | drclabel_list_alloc | drclabel_list | drclabel_list *drclabel_list_alloc(drccache *cache)
{
drclabel_list *list;
/* allocate permanent state from the cache */
list = (drclabel_list *)drccache_memory_alloc(cache, sizeof(*list));
if (list == NULL)
return NULL;
memset(list, 0, sizeof(*list));
/* remember the cache */
list->cache = cache;
return list;
} | /*-------------------------------------------------
drclabel_list_alloc - allocate a label
list within the cache (it auto-frees with the
cache)
-------------------------------------------------*/ | allocate a label
list within the cache (it auto-frees with the
cache) | [
"allocate",
"a",
"label",
"list",
"within",
"the",
"cache",
"(",
"it",
"auto",
"-",
"frees",
"with",
"the",
"cache",
")"
] | drclabel_list *drclabel_list_alloc(drccache *cache)
{
drclabel_list *list;
list = (drclabel_list *)drccache_memory_alloc(cache, sizeof(*list));
if (list == NULL)
return NULL;
memset(list, 0, sizeof(*list));
list->cache = cache;
return list;
} | [
"drclabel_list",
"*",
"drclabel_list_alloc",
"(",
"drccache",
"*",
"cache",
")",
"{",
"drclabel_list",
"*",
"list",
";",
"list",
"=",
"(",
"drclabel_list",
"*",
")",
"drccache_memory_alloc",
"(",
"cache",
",",
"sizeof",
"(",
"*",
"list",
")",
")",
";",
"if",
"(",
"list",
"==",
"NULL",
")",
"return",
"NULL",
";",
"memset",
"(",
"list",
",",
"0",
",",
"sizeof",
"(",
"*",
"list",
")",
")",
";",
"list",
"->",
"cache",
"=",
"cache",
";",
"return",
"list",
";",
"}"
] | drclabel_list_alloc - allocate a label
list within the cache (it auto-frees with the
cache) | [
"drclabel_list_alloc",
"-",
"allocate",
"a",
"label",
"list",
"within",
"the",
"cache",
"(",
"it",
"auto",
"-",
"frees",
"with",
"the",
"cache",
")"
] | [
"/* allocate permanent state from the cache */",
"/* remember the cache */"
] | [
{
"param": "cache",
"type": "drccache"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "drccache",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | drclabel_block_begin | void | void drclabel_block_begin(drclabel_list *list, drcuml_block *block)
{
/* make sure the label list is clear, but don't fatalerror */
label_list_reset(list, FALSE);
} | /*-------------------------------------------------
drclabel_block_begin - note the beginning of
a block
-------------------------------------------------*/ | note the beginning of
a block | [
"note",
"the",
"beginning",
"of",
"a",
"block"
] | void drclabel_block_begin(drclabel_list *list, drcuml_block *block)
{
label_list_reset(list, FALSE);
} | [
"void",
"drclabel_block_begin",
"(",
"drclabel_list",
"*",
"list",
",",
"drcuml_block",
"*",
"block",
")",
"{",
"label_list_reset",
"(",
"list",
",",
"FALSE",
")",
";",
"}"
] | drclabel_block_begin - note the beginning of
a block | [
"drclabel_block_begin",
"-",
"note",
"the",
"beginning",
"of",
"a",
"block"
] | [
"/* make sure the label list is clear, but don't fatalerror */"
] | [
{
"param": "list",
"type": "drclabel_list"
},
{
"param": "block",
"type": "drcuml_block"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "list",
"type": "drclabel_list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | drclabel_block_end | void | void drclabel_block_end(drclabel_list *list, drcuml_block *block)
{
/* make sure the label list is clear, and fatalerror if we missed anything */
label_list_reset(list, TRUE);
} | /*-------------------------------------------------
drclabel_block_end - note the end of a block
-------------------------------------------------*/ | note the end of a block | [
"note",
"the",
"end",
"of",
"a",
"block"
] | void drclabel_block_end(drclabel_list *list, drcuml_block *block)
{
label_list_reset(list, TRUE);
} | [
"void",
"drclabel_block_end",
"(",
"drclabel_list",
"*",
"list",
",",
"drcuml_block",
"*",
"block",
")",
"{",
"label_list_reset",
"(",
"list",
",",
"TRUE",
")",
";",
"}"
] | drclabel_block_end - note the end of a block | [
"drclabel_block_end",
"-",
"note",
"the",
"end",
"of",
"a",
"block"
] | [
"/* make sure the label list is clear, and fatalerror if we missed anything */"
] | [
{
"param": "list",
"type": "drclabel_list"
},
{
"param": "block",
"type": "drcuml_block"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "list",
"type": "drclabel_list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | drclabel_get_codeptr | drccodeptr | drccodeptr drclabel_get_codeptr(drclabel_list *list, drcuml_codelabel label, drclabel_fixup_func fixup, void *param)
{
drclabel *curlabel = label_find_or_allocate(list, label);
/* if no code pointer, request an OOB callback */
if (curlabel->codeptr == NULL && fixup != NULL)
drccache_request_oob_codegen(list->cache, label_oob_callback, curlabel, (void *)fixup, param);
return curlabel->codeptr;
} | /*-------------------------------------------------
drclabel_get_codeptr - find or allocate a new
label; returns NULL and requests an OOB
callback if undefined
-------------------------------------------------*/ | find or allocate a new
label; returns NULL and requests an OOB
callback if undefined | [
"find",
"or",
"allocate",
"a",
"new",
"label",
";",
"returns",
"NULL",
"and",
"requests",
"an",
"OOB",
"callback",
"if",
"undefined"
] | drccodeptr drclabel_get_codeptr(drclabel_list *list, drcuml_codelabel label, drclabel_fixup_func fixup, void *param)
{
drclabel *curlabel = label_find_or_allocate(list, label);
if (curlabel->codeptr == NULL && fixup != NULL)
drccache_request_oob_codegen(list->cache, label_oob_callback, curlabel, (void *)fixup, param);
return curlabel->codeptr;
} | [
"drccodeptr",
"drclabel_get_codeptr",
"(",
"drclabel_list",
"*",
"list",
",",
"drcuml_codelabel",
"label",
",",
"drclabel_fixup_func",
"fixup",
",",
"void",
"*",
"param",
")",
"{",
"drclabel",
"*",
"curlabel",
"=",
"label_find_or_allocate",
"(",
"list",
",",
"label",
")",
";",
"if",
"(",
"curlabel",
"->",
"codeptr",
"==",
"NULL",
"&&",
"fixup",
"!=",
"NULL",
")",
"drccache_request_oob_codegen",
"(",
"list",
"->",
"cache",
",",
"label_oob_callback",
",",
"curlabel",
",",
"(",
"void",
"*",
")",
"fixup",
",",
"param",
")",
";",
"return",
"curlabel",
"->",
"codeptr",
";",
"}"
] | drclabel_get_codeptr - find or allocate a new
label; returns NULL and requests an OOB
callback if undefined | [
"drclabel_get_codeptr",
"-",
"find",
"or",
"allocate",
"a",
"new",
"label",
";",
"returns",
"NULL",
"and",
"requests",
"an",
"OOB",
"callback",
"if",
"undefined"
] | [
"/* if no code pointer, request an OOB callback */"
] | [
{
"param": "list",
"type": "drclabel_list"
},
{
"param": "label",
"type": "drcuml_codelabel"
},
{
"param": "fixup",
"type": "drclabel_fixup_func"
},
{
"param": "param",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "list",
"type": "drclabel_list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "label",
"type": "drcuml_codelabel",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fixup",
"type": "drclabel_fixup_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | drclabel_set_codeptr | void | void drclabel_set_codeptr(drclabel_list *list, drcuml_codelabel label, drccodeptr codeptr)
{
/* set the code pointer */
drclabel *curlabel = label_find_or_allocate(list, label);
assert(curlabel->codeptr == NULL);
curlabel->codeptr = codeptr;
} | /*-------------------------------------------------
drclabel_set_codeptr - set the pointer to a new
label
-------------------------------------------------*/ | set the pointer to a new
label | [
"set",
"the",
"pointer",
"to",
"a",
"new",
"label"
] | void drclabel_set_codeptr(drclabel_list *list, drcuml_codelabel label, drccodeptr codeptr)
{
drclabel *curlabel = label_find_or_allocate(list, label);
assert(curlabel->codeptr == NULL);
curlabel->codeptr = codeptr;
} | [
"void",
"drclabel_set_codeptr",
"(",
"drclabel_list",
"*",
"list",
",",
"drcuml_codelabel",
"label",
",",
"drccodeptr",
"codeptr",
")",
"{",
"drclabel",
"*",
"curlabel",
"=",
"label_find_or_allocate",
"(",
"list",
",",
"label",
")",
";",
"assert",
"(",
"curlabel",
"->",
"codeptr",
"==",
"NULL",
")",
";",
"curlabel",
"->",
"codeptr",
"=",
"codeptr",
";",
"}"
] | drclabel_set_codeptr - set the pointer to a new
label | [
"drclabel_set_codeptr",
"-",
"set",
"the",
"pointer",
"to",
"a",
"new",
"label"
] | [
"/* set the code pointer */"
] | [
{
"param": "list",
"type": "drclabel_list"
},
{
"param": "label",
"type": "drcuml_codelabel"
},
{
"param": "codeptr",
"type": "drccodeptr"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "list",
"type": "drclabel_list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "label",
"type": "drcuml_codelabel",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "codeptr",
"type": "drccodeptr",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | label_list_reset | void | static void label_list_reset(drclabel_list *list, int fatal_on_leftovers)
{
/* loop until out of labels */
while (list->head != NULL)
{
/* remove from the list */
drclabel *label = list->head;
list->head = label->next;
/* fatal if we were a leftover */
if (fatal_on_leftovers && label->codeptr == NULL)
fatalerror("Label %08X never defined!", label->label);
/* free the label */
drccache_memory_free(list->cache, label, sizeof(*label));
}
} | /*-------------------------------------------------
label_list_reset - reset a label
list (add all entries to the free list)
-------------------------------------------------*/ | reset a label
list (add all entries to the free list) | [
"reset",
"a",
"label",
"list",
"(",
"add",
"all",
"entries",
"to",
"the",
"free",
"list",
")"
] | static void label_list_reset(drclabel_list *list, int fatal_on_leftovers)
{
while (list->head != NULL)
{
drclabel *label = list->head;
list->head = label->next;
if (fatal_on_leftovers && label->codeptr == NULL)
fatalerror("Label %08X never defined!", label->label);
drccache_memory_free(list->cache, label, sizeof(*label));
}
} | [
"static",
"void",
"label_list_reset",
"(",
"drclabel_list",
"*",
"list",
",",
"int",
"fatal_on_leftovers",
")",
"{",
"while",
"(",
"list",
"->",
"head",
"!=",
"NULL",
")",
"{",
"drclabel",
"*",
"label",
"=",
"list",
"->",
"head",
";",
"list",
"->",
"head",
"=",
"label",
"->",
"next",
";",
"if",
"(",
"fatal_on_leftovers",
"&&",
"label",
"->",
"codeptr",
"==",
"NULL",
")",
"fatalerror",
"(",
"\"",
"\"",
",",
"label",
"->",
"label",
")",
";",
"drccache_memory_free",
"(",
"list",
"->",
"cache",
",",
"label",
",",
"sizeof",
"(",
"*",
"label",
")",
")",
";",
"}",
"}"
] | label_list_reset - reset a label
list (add all entries to the free list) | [
"label_list_reset",
"-",
"reset",
"a",
"label",
"list",
"(",
"add",
"all",
"entries",
"to",
"the",
"free",
"list",
")"
] | [
"/* loop until out of labels */",
"/* remove from the list */",
"/* fatal if we were a leftover */",
"/* free the label */"
] | [
{
"param": "list",
"type": "drclabel_list"
},
{
"param": "fatal_on_leftovers",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "list",
"type": "drclabel_list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fatal_on_leftovers",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | label_find_or_allocate | drclabel | static drclabel *label_find_or_allocate(drclabel_list *list, drcuml_codelabel label)
{
drclabel *curlabel;
/* find the label, or else allocate a new one */
for (curlabel = list->head; curlabel != NULL; curlabel = curlabel->next)
if (curlabel->label == label)
break;
/* if none found, allocate */
if (curlabel == NULL)
{
curlabel = (drclabel *)drccache_memory_alloc(list->cache, sizeof(*curlabel));
curlabel->next = list->head;
curlabel->label = label;
curlabel->codeptr = NULL;
list->head = curlabel;
}
return curlabel;
} | /*-------------------------------------------------
label_find_or_allocate - look up a label and
allocate a new one if not found
-------------------------------------------------*/ | look up a label and
allocate a new one if not found | [
"look",
"up",
"a",
"label",
"and",
"allocate",
"a",
"new",
"one",
"if",
"not",
"found"
] | static drclabel *label_find_or_allocate(drclabel_list *list, drcuml_codelabel label)
{
drclabel *curlabel;
for (curlabel = list->head; curlabel != NULL; curlabel = curlabel->next)
if (curlabel->label == label)
break;
if (curlabel == NULL)
{
curlabel = (drclabel *)drccache_memory_alloc(list->cache, sizeof(*curlabel));
curlabel->next = list->head;
curlabel->label = label;
curlabel->codeptr = NULL;
list->head = curlabel;
}
return curlabel;
} | [
"static",
"drclabel",
"*",
"label_find_or_allocate",
"(",
"drclabel_list",
"*",
"list",
",",
"drcuml_codelabel",
"label",
")",
"{",
"drclabel",
"*",
"curlabel",
";",
"for",
"(",
"curlabel",
"=",
"list",
"->",
"head",
";",
"curlabel",
"!=",
"NULL",
";",
"curlabel",
"=",
"curlabel",
"->",
"next",
")",
"if",
"(",
"curlabel",
"->",
"label",
"==",
"label",
")",
"break",
";",
"if",
"(",
"curlabel",
"==",
"NULL",
")",
"{",
"curlabel",
"=",
"(",
"drclabel",
"*",
")",
"drccache_memory_alloc",
"(",
"list",
"->",
"cache",
",",
"sizeof",
"(",
"*",
"curlabel",
")",
")",
";",
"curlabel",
"->",
"next",
"=",
"list",
"->",
"head",
";",
"curlabel",
"->",
"label",
"=",
"label",
";",
"curlabel",
"->",
"codeptr",
"=",
"NULL",
";",
"list",
"->",
"head",
"=",
"curlabel",
";",
"}",
"return",
"curlabel",
";",
"}"
] | label_find_or_allocate - look up a label and
allocate a new one if not found | [
"label_find_or_allocate",
"-",
"look",
"up",
"a",
"label",
"and",
"allocate",
"a",
"new",
"one",
"if",
"not",
"found"
] | [
"/* find the label, or else allocate a new one */",
"/* if none found, allocate */"
] | [
{
"param": "list",
"type": "drclabel_list"
},
{
"param": "label",
"type": "drcuml_codelabel"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "list",
"type": "drclabel_list",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "label",
"type": "drcuml_codelabel",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555774830412f4457247ab31f4e20b521972476f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/drcbeut.c | [
"Unlicense"
] | C | label_oob_callback | void | static void label_oob_callback(drccodeptr *codeptr, void *param1, void *param2, void *param3)
{
drclabel *label = (drclabel *)param1;
drclabel_fixup_func callback = (drclabel_fixup_func)param2;
(*callback)(param3, label->codeptr);
} | /*-------------------------------------------------
label_oob_callback - out-of-band codegen
callback for labels
-------------------------------------------------*/ | out-of-band codegen
callback for labels | [
"out",
"-",
"of",
"-",
"band",
"codegen",
"callback",
"for",
"labels"
] | static void label_oob_callback(drccodeptr *codeptr, void *param1, void *param2, void *param3)
{
drclabel *label = (drclabel *)param1;
drclabel_fixup_func callback = (drclabel_fixup_func)param2;
(*callback)(param3, label->codeptr);
} | [
"static",
"void",
"label_oob_callback",
"(",
"drccodeptr",
"*",
"codeptr",
",",
"void",
"*",
"param1",
",",
"void",
"*",
"param2",
",",
"void",
"*",
"param3",
")",
"{",
"drclabel",
"*",
"label",
"=",
"(",
"drclabel",
"*",
")",
"param1",
";",
"drclabel_fixup_func",
"callback",
"=",
"(",
"drclabel_fixup_func",
")",
"param2",
";",
"(",
"*",
"callback",
")",
"(",
"param3",
",",
"label",
"->",
"codeptr",
")",
";",
"}"
] | label_oob_callback - out-of-band codegen
callback for labels | [
"label_oob_callback",
"-",
"out",
"-",
"of",
"-",
"band",
"codegen",
"callback",
"for",
"labels"
] | [] | [
{
"param": "codeptr",
"type": "drccodeptr"
},
{
"param": "param1",
"type": "void"
},
{
"param": "param2",
"type": "void"
},
{
"param": "param3",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "codeptr",
"type": "drccodeptr",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param1",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param2",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param3",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
76a02dc4e8119adf65f0c389d144ff3f7b15116b | lofunz/mieme | Reloaded/trunk/src/mame/video/carpolo.c | [
"Unlicense"
] | C | check_sprite_left_goal_collision | int | static int check_sprite_left_goal_collision(running_machine *machine, int x1, int y1, int code1, int flipy1, int goalpost_only)
{
int collided = 0;
x1 = 240 - x1;
y1 = 240 - y1;
/* check if the sprite is even within the range of the goal */
if (((y1 + 16) > GOAL_Y) && (y1 < (GOAL_Y + GOAL_HEIGHT)) &&
((x1 + 16) > LEFT_GOAL_X) && (x1 < (LEFT_GOAL_X + GOAL_WIDTH)))
{
int x,y;
int x2,y2;
x2 = LEFT_GOAL_X;
y2 = GOAL_Y;
normalize_coordinates(&x1, &y1, &x2, &y2);
bitmap_fill(sprite_goal_collision_bitmap1, 0, 0);
bitmap_fill(sprite_goal_collision_bitmap2, 0, 0);
drawgfx_opaque(sprite_goal_collision_bitmap1,0,machine->gfx[0],
code1,0,
0,flipy1,
x1,y1);
drawgfxzoom_transpen(sprite_goal_collision_bitmap2,0,machine->gfx[1],
0,0,
0,0,
x2,y2,
0x20000,0x20000,0);
for (x = x1; x < x1 + SPRITE_WIDTH; x++)
for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
if ((*BITMAP_ADDR16(sprite_goal_collision_bitmap1, y, x) == 1))
{
pen_t pix = *BITMAP_ADDR16(sprite_goal_collision_bitmap2, y, x);
if (pix == LEFT_GOAL_PEN)
{
collided = 1;
break;
}
if (!goalpost_only && (pix == LEFT_SCORE_PEN))
{
collided = 2;
break;
}
}
}
return collided;
} | /* returns 1 for collision with goal post,
2 for collision with scoring area */ | returns 1 for collision with goal post,
2 for collision with scoring area | [
"returns",
"1",
"for",
"collision",
"with",
"goal",
"post",
"2",
"for",
"collision",
"with",
"scoring",
"area"
] | static int check_sprite_left_goal_collision(running_machine *machine, int x1, int y1, int code1, int flipy1, int goalpost_only)
{
int collided = 0;
x1 = 240 - x1;
y1 = 240 - y1;
if (((y1 + 16) > GOAL_Y) && (y1 < (GOAL_Y + GOAL_HEIGHT)) &&
((x1 + 16) > LEFT_GOAL_X) && (x1 < (LEFT_GOAL_X + GOAL_WIDTH)))
{
int x,y;
int x2,y2;
x2 = LEFT_GOAL_X;
y2 = GOAL_Y;
normalize_coordinates(&x1, &y1, &x2, &y2);
bitmap_fill(sprite_goal_collision_bitmap1, 0, 0);
bitmap_fill(sprite_goal_collision_bitmap2, 0, 0);
drawgfx_opaque(sprite_goal_collision_bitmap1,0,machine->gfx[0],
code1,0,
0,flipy1,
x1,y1);
drawgfxzoom_transpen(sprite_goal_collision_bitmap2,0,machine->gfx[1],
0,0,
0,0,
x2,y2,
0x20000,0x20000,0);
for (x = x1; x < x1 + SPRITE_WIDTH; x++)
for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
if ((*BITMAP_ADDR16(sprite_goal_collision_bitmap1, y, x) == 1))
{
pen_t pix = *BITMAP_ADDR16(sprite_goal_collision_bitmap2, y, x);
if (pix == LEFT_GOAL_PEN)
{
collided = 1;
break;
}
if (!goalpost_only && (pix == LEFT_SCORE_PEN))
{
collided = 2;
break;
}
}
}
return collided;
} | [
"static",
"int",
"check_sprite_left_goal_collision",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"x1",
",",
"int",
"y1",
",",
"int",
"code1",
",",
"int",
"flipy1",
",",
"int",
"goalpost_only",
")",
"{",
"int",
"collided",
"=",
"0",
";",
"x1",
"=",
"240",
"-",
"x1",
";",
"y1",
"=",
"240",
"-",
"y1",
";",
"if",
"(",
"(",
"(",
"y1",
"+",
"16",
")",
">",
"GOAL_Y",
")",
"&&",
"(",
"y1",
"<",
"(",
"GOAL_Y",
"+",
"GOAL_HEIGHT",
")",
")",
"&&",
"(",
"(",
"x1",
"+",
"16",
")",
">",
"LEFT_GOAL_X",
")",
"&&",
"(",
"x1",
"<",
"(",
"LEFT_GOAL_X",
"+",
"GOAL_WIDTH",
")",
")",
")",
"{",
"int",
"x",
",",
"y",
";",
"int",
"x2",
",",
"y2",
";",
"x2",
"=",
"LEFT_GOAL_X",
";",
"y2",
"=",
"GOAL_Y",
";",
"normalize_coordinates",
"(",
"&",
"x1",
",",
"&",
"y1",
",",
"&",
"x2",
",",
"&",
"y2",
")",
";",
"bitmap_fill",
"(",
"sprite_goal_collision_bitmap1",
",",
"0",
",",
"0",
")",
";",
"bitmap_fill",
"(",
"sprite_goal_collision_bitmap2",
",",
"0",
",",
"0",
")",
";",
"drawgfx_opaque",
"(",
"sprite_goal_collision_bitmap1",
",",
"0",
",",
"machine",
"->",
"gfx",
"[",
"0",
"]",
",",
"code1",
",",
"0",
",",
"0",
",",
"flipy1",
",",
"x1",
",",
"y1",
")",
";",
"drawgfxzoom_transpen",
"(",
"sprite_goal_collision_bitmap2",
",",
"0",
",",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"x2",
",",
"y2",
",",
"0x20000",
",",
"0x20000",
",",
"0",
")",
";",
"for",
"(",
"x",
"=",
"x1",
";",
"x",
"<",
"x1",
"+",
"SPRITE_WIDTH",
";",
"x",
"++",
")",
"for",
"(",
"y",
"=",
"y1",
";",
"y",
"<",
"y1",
"+",
"SPRITE_HEIGHT",
";",
"y",
"++",
")",
"if",
"(",
"(",
"*",
"BITMAP_ADDR16",
"(",
"sprite_goal_collision_bitmap1",
",",
"y",
",",
"x",
")",
"==",
"1",
")",
")",
"{",
"pen_t",
"pix",
"=",
"*",
"BITMAP_ADDR16",
"(",
"sprite_goal_collision_bitmap2",
",",
"y",
",",
"x",
")",
";",
"if",
"(",
"pix",
"==",
"LEFT_GOAL_PEN",
")",
"{",
"collided",
"=",
"1",
";",
"break",
";",
"}",
"if",
"(",
"!",
"goalpost_only",
"&&",
"(",
"pix",
"==",
"LEFT_SCORE_PEN",
")",
")",
"{",
"collided",
"=",
"2",
";",
"break",
";",
"}",
"}",
"}",
"return",
"collided",
";",
"}"
] | returns 1 for collision with goal post,
2 for collision with scoring area | [
"returns",
"1",
"for",
"collision",
"with",
"goal",
"post",
"2",
"for",
"collision",
"with",
"scoring",
"area"
] | [
"/* check if the sprite is even within the range of the goal */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "x1",
"type": "int"
},
{
"param": "y1",
"type": "int"
},
{
"param": "code1",
"type": "int"
},
{
"param": "flipy1",
"type": "int"
},
{
"param": "goalpost_only",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "goalpost_only",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
76a02dc4e8119adf65f0c389d144ff3f7b15116b | lofunz/mieme | Reloaded/trunk/src/mame/video/carpolo.c | [
"Unlicense"
] | C | check_sprite_border_collision | int | static int check_sprite_border_collision(running_machine *machine, UINT8 x1, UINT8 y1, int code1, int flipy1)
{
UINT8 x,y;
int collided = 0;
x1 = 240 - x1;
y1 = 240 - y1;
drawgfx_opaque(sprite_border_collision_bitmap,0,machine->gfx[0],
code1,0,
0,flipy1,
0,0);
for (x = 0; x < SPRITE_WIDTH; x++)
for (y = 0; y < SPRITE_HEIGHT; y++)
if ((*BITMAP_ADDR16(sprite_border_collision_bitmap, y, x) == 1))
{
if (((UINT8)(x1 + x) == LEFT_BORDER) ||
((UINT8)(x1 + x) == RIGHT_BORDER))
{
collided = 1;
break;
}
if (((UINT8)(y1 + y) == TOP_BORDER) ||
((UINT8)(y1 + y) == BOTTOM_BORDER))
{
collided = 2;
break;
}
}
return collided;
} | /* returns 1 for collision with vertical border,
2 for collision with horizontal border */ | returns 1 for collision with vertical border,
2 for collision with horizontal border | [
"returns",
"1",
"for",
"collision",
"with",
"vertical",
"border",
"2",
"for",
"collision",
"with",
"horizontal",
"border"
] | static int check_sprite_border_collision(running_machine *machine, UINT8 x1, UINT8 y1, int code1, int flipy1)
{
UINT8 x,y;
int collided = 0;
x1 = 240 - x1;
y1 = 240 - y1;
drawgfx_opaque(sprite_border_collision_bitmap,0,machine->gfx[0],
code1,0,
0,flipy1,
0,0);
for (x = 0; x < SPRITE_WIDTH; x++)
for (y = 0; y < SPRITE_HEIGHT; y++)
if ((*BITMAP_ADDR16(sprite_border_collision_bitmap, y, x) == 1))
{
if (((UINT8)(x1 + x) == LEFT_BORDER) ||
((UINT8)(x1 + x) == RIGHT_BORDER))
{
collided = 1;
break;
}
if (((UINT8)(y1 + y) == TOP_BORDER) ||
((UINT8)(y1 + y) == BOTTOM_BORDER))
{
collided = 2;
break;
}
}
return collided;
} | [
"static",
"int",
"check_sprite_border_collision",
"(",
"running_machine",
"*",
"machine",
",",
"UINT8",
"x1",
",",
"UINT8",
"y1",
",",
"int",
"code1",
",",
"int",
"flipy1",
")",
"{",
"UINT8",
"x",
",",
"y",
";",
"int",
"collided",
"=",
"0",
";",
"x1",
"=",
"240",
"-",
"x1",
";",
"y1",
"=",
"240",
"-",
"y1",
";",
"drawgfx_opaque",
"(",
"sprite_border_collision_bitmap",
",",
"0",
",",
"machine",
"->",
"gfx",
"[",
"0",
"]",
",",
"code1",
",",
"0",
",",
"0",
",",
"flipy1",
",",
"0",
",",
"0",
")",
";",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"SPRITE_WIDTH",
";",
"x",
"++",
")",
"for",
"(",
"y",
"=",
"0",
";",
"y",
"<",
"SPRITE_HEIGHT",
";",
"y",
"++",
")",
"if",
"(",
"(",
"*",
"BITMAP_ADDR16",
"(",
"sprite_border_collision_bitmap",
",",
"y",
",",
"x",
")",
"==",
"1",
")",
")",
"{",
"if",
"(",
"(",
"(",
"UINT8",
")",
"(",
"x1",
"+",
"x",
")",
"==",
"LEFT_BORDER",
")",
"||",
"(",
"(",
"UINT8",
")",
"(",
"x1",
"+",
"x",
")",
"==",
"RIGHT_BORDER",
")",
")",
"{",
"collided",
"=",
"1",
";",
"break",
";",
"}",
"if",
"(",
"(",
"(",
"UINT8",
")",
"(",
"y1",
"+",
"y",
")",
"==",
"TOP_BORDER",
")",
"||",
"(",
"(",
"UINT8",
")",
"(",
"y1",
"+",
"y",
")",
"==",
"BOTTOM_BORDER",
")",
")",
"{",
"collided",
"=",
"2",
";",
"break",
";",
"}",
"}",
"return",
"collided",
";",
"}"
] | returns 1 for collision with vertical border,
2 for collision with horizontal border | [
"returns",
"1",
"for",
"collision",
"with",
"vertical",
"border",
"2",
"for",
"collision",
"with",
"horizontal",
"border"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "x1",
"type": "UINT8"
},
{
"param": "y1",
"type": "UINT8"
},
{
"param": "code1",
"type": "int"
},
{
"param": "flipy1",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x1",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "y1",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy1",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
557eb861a1c936c2a6e4968906f6d8e88eb2a8f1 | lofunz/mieme | Reloaded/trunk/src/emu/inputseq.c | [
"Unlicense"
] | C | input_seq_pressed | int | int input_seq_pressed(running_machine *machine, const input_seq *seq)
{
int result = FALSE;
int invert = FALSE;
int first = TRUE;
int codenum;
/* iterate over all of the codes */
for (codenum = 0; codenum < ARRAY_LENGTH(seq->code); codenum++)
{
input_code code = seq->code[codenum];
/* handle NOT */
if (code == SEQCODE_NOT)
invert = TRUE;
/* handle OR and END */
else if (code == SEQCODE_OR || code == SEQCODE_END)
{
/* if we have a positive result from the previous set, we're done */
if (result || code == SEQCODE_END)
break;
/* otherwise, reset our state */
result = FALSE;
invert = FALSE;
first = TRUE;
}
/* handle everything else as a series of ANDs */
else
{
/* if this is the first in the sequence, result is set equal */
if (first)
result = input_code_pressed(machine, code) ^ invert;
/* further values are ANDed */
else if (result)
result &= input_code_pressed(machine, code) ^ invert;
/* no longer first, and clear the invert flag */
first = invert = FALSE;
}
}
/* return the result if we queried at least one switch */
return result;
} | /*-------------------------------------------------
input_seq_pressed - return true if the given
sequence of switch inputs is "pressed"
-------------------------------------------------*/ | return true if the given
sequence of switch inputs is "pressed" | [
"return",
"true",
"if",
"the",
"given",
"sequence",
"of",
"switch",
"inputs",
"is",
"\"",
"pressed",
"\""
] | int input_seq_pressed(running_machine *machine, const input_seq *seq)
{
int result = FALSE;
int invert = FALSE;
int first = TRUE;
int codenum;
for (codenum = 0; codenum < ARRAY_LENGTH(seq->code); codenum++)
{
input_code code = seq->code[codenum];
if (code == SEQCODE_NOT)
invert = TRUE;
else if (code == SEQCODE_OR || code == SEQCODE_END)
{
if (result || code == SEQCODE_END)
break;
result = FALSE;
invert = FALSE;
first = TRUE;
}
else
{
if (first)
result = input_code_pressed(machine, code) ^ invert;
else if (result)
result &= input_code_pressed(machine, code) ^ invert;
first = invert = FALSE;
}
}
return result;
} | [
"int",
"input_seq_pressed",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"input_seq",
"*",
"seq",
")",
"{",
"int",
"result",
"=",
"FALSE",
";",
"int",
"invert",
"=",
"FALSE",
";",
"int",
"first",
"=",
"TRUE",
";",
"int",
"codenum",
";",
"for",
"(",
"codenum",
"=",
"0",
";",
"codenum",
"<",
"ARRAY_LENGTH",
"(",
"seq",
"->",
"code",
")",
";",
"codenum",
"++",
")",
"{",
"input_code",
"code",
"=",
"seq",
"->",
"code",
"[",
"codenum",
"]",
";",
"if",
"(",
"code",
"==",
"SEQCODE_NOT",
")",
"invert",
"=",
"TRUE",
";",
"else",
"if",
"(",
"code",
"==",
"SEQCODE_OR",
"||",
"code",
"==",
"SEQCODE_END",
")",
"{",
"if",
"(",
"result",
"||",
"code",
"==",
"SEQCODE_END",
")",
"break",
";",
"result",
"=",
"FALSE",
";",
"invert",
"=",
"FALSE",
";",
"first",
"=",
"TRUE",
";",
"}",
"else",
"{",
"if",
"(",
"first",
")",
"result",
"=",
"input_code_pressed",
"(",
"machine",
",",
"code",
")",
"^",
"invert",
";",
"else",
"if",
"(",
"result",
")",
"result",
"&=",
"input_code_pressed",
"(",
"machine",
",",
"code",
")",
"^",
"invert",
";",
"first",
"=",
"invert",
"=",
"FALSE",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | input_seq_pressed - return true if the given
sequence of switch inputs is "pressed" | [
"input_seq_pressed",
"-",
"return",
"true",
"if",
"the",
"given",
"sequence",
"of",
"switch",
"inputs",
"is",
"\"",
"pressed",
"\""
] | [
"/* iterate over all of the codes */",
"/* handle NOT */",
"/* handle OR and END */",
"/* if we have a positive result from the previous set, we're done */",
"/* otherwise, reset our state */",
"/* handle everything else as a series of ANDs */",
"/* if this is the first in the sequence, result is set equal */",
"/* further values are ANDed */",
"/* no longer first, and clear the invert flag */",
"/* return the result if we queried at least one switch */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "seq",
"type": "input_seq"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seq",
"type": "input_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
557eb861a1c936c2a6e4968906f6d8e88eb2a8f1 | lofunz/mieme | Reloaded/trunk/src/emu/inputseq.c | [
"Unlicense"
] | C | input_seq_axis_value | INT32 | INT32 input_seq_axis_value(running_machine *machine, const input_seq *seq, input_item_class *itemclass_ptr)
{
input_item_class itemclasszero = ITEM_CLASS_ABSOLUTE;
input_item_class itemclass = ITEM_CLASS_INVALID;
int result = 0;
int invert = FALSE;
int enable = TRUE;
int codenum;
/* iterate over all of the codes */
for (codenum = 0; codenum < ARRAY_LENGTH(seq->code); codenum++)
{
input_code code = seq->code[codenum];
/* handle NOT */
if (code == SEQCODE_NOT)
invert = TRUE;
/* handle OR and END */
else if (code == SEQCODE_OR || code == SEQCODE_END)
{
/* if we have a positive result from the previous set, we're done */
if (itemclass != ITEM_CLASS_INVALID || code == SEQCODE_END)
break;
/* otherwise, reset our state */
result = 0;
invert = FALSE;
enable = TRUE;
}
/* handle everything else only if we're still enabled */
else if (enable)
{
/* switch codes serve as enables */
if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
{
/* AND against previous digital codes */
if (enable)
enable &= input_code_pressed(machine, code) ^ invert;
}
/* non-switch codes are analog values */
else
{
INT32 value = input_code_value(machine, code);
/* if we got a 0 value, don't do anything except remember the first type */
if (value == 0)
{
if (itemclasszero == ITEM_CLASS_INVALID)
itemclasszero = INPUT_CODE_ITEMCLASS(code);
}
/* non-zero absolute values stick */
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_ABSOLUTE)
{
itemclass = ITEM_CLASS_ABSOLUTE;
result = value;
}
/* non-zero relative values accumulate */
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_RELATIVE)
{
itemclass = ITEM_CLASS_RELATIVE;
result += value;
}
}
/* clear the invert flag */
invert = FALSE;
}
}
/* if the caller wants to know the type, provide it */
if (itemclass_ptr != NULL)
*itemclass_ptr = (result == 0) ? itemclasszero : itemclass;
return result;
} | /*-------------------------------------------------
input_seq_axis_value - return the value of an
axis defined in an input sequence
-------------------------------------------------*/ | return the value of an
axis defined in an input sequence | [
"return",
"the",
"value",
"of",
"an",
"axis",
"defined",
"in",
"an",
"input",
"sequence"
] | INT32 input_seq_axis_value(running_machine *machine, const input_seq *seq, input_item_class *itemclass_ptr)
{
input_item_class itemclasszero = ITEM_CLASS_ABSOLUTE;
input_item_class itemclass = ITEM_CLASS_INVALID;
int result = 0;
int invert = FALSE;
int enable = TRUE;
int codenum;
for (codenum = 0; codenum < ARRAY_LENGTH(seq->code); codenum++)
{
input_code code = seq->code[codenum];
if (code == SEQCODE_NOT)
invert = TRUE;
else if (code == SEQCODE_OR || code == SEQCODE_END)
{
if (itemclass != ITEM_CLASS_INVALID || code == SEQCODE_END)
break;
result = 0;
invert = FALSE;
enable = TRUE;
}
else if (enable)
{
if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_SWITCH)
{
if (enable)
enable &= input_code_pressed(machine, code) ^ invert;
}
else
{
INT32 value = input_code_value(machine, code);
if (value == 0)
{
if (itemclasszero == ITEM_CLASS_INVALID)
itemclasszero = INPUT_CODE_ITEMCLASS(code);
}
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_ABSOLUTE)
{
itemclass = ITEM_CLASS_ABSOLUTE;
result = value;
}
else if (INPUT_CODE_ITEMCLASS(code) == ITEM_CLASS_RELATIVE)
{
itemclass = ITEM_CLASS_RELATIVE;
result += value;
}
}
invert = FALSE;
}
}
if (itemclass_ptr != NULL)
*itemclass_ptr = (result == 0) ? itemclasszero : itemclass;
return result;
} | [
"INT32",
"input_seq_axis_value",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"input_seq",
"*",
"seq",
",",
"input_item_class",
"*",
"itemclass_ptr",
")",
"{",
"input_item_class",
"itemclasszero",
"=",
"ITEM_CLASS_ABSOLUTE",
";",
"input_item_class",
"itemclass",
"=",
"ITEM_CLASS_INVALID",
";",
"int",
"result",
"=",
"0",
";",
"int",
"invert",
"=",
"FALSE",
";",
"int",
"enable",
"=",
"TRUE",
";",
"int",
"codenum",
";",
"for",
"(",
"codenum",
"=",
"0",
";",
"codenum",
"<",
"ARRAY_LENGTH",
"(",
"seq",
"->",
"code",
")",
";",
"codenum",
"++",
")",
"{",
"input_code",
"code",
"=",
"seq",
"->",
"code",
"[",
"codenum",
"]",
";",
"if",
"(",
"code",
"==",
"SEQCODE_NOT",
")",
"invert",
"=",
"TRUE",
";",
"else",
"if",
"(",
"code",
"==",
"SEQCODE_OR",
"||",
"code",
"==",
"SEQCODE_END",
")",
"{",
"if",
"(",
"itemclass",
"!=",
"ITEM_CLASS_INVALID",
"||",
"code",
"==",
"SEQCODE_END",
")",
"break",
";",
"result",
"=",
"0",
";",
"invert",
"=",
"FALSE",
";",
"enable",
"=",
"TRUE",
";",
"}",
"else",
"if",
"(",
"enable",
")",
"{",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_SWITCH",
")",
"{",
"if",
"(",
"enable",
")",
"enable",
"&=",
"input_code_pressed",
"(",
"machine",
",",
"code",
")",
"^",
"invert",
";",
"}",
"else",
"{",
"INT32",
"value",
"=",
"input_code_value",
"(",
"machine",
",",
"code",
")",
";",
"if",
"(",
"value",
"==",
"0",
")",
"{",
"if",
"(",
"itemclasszero",
"==",
"ITEM_CLASS_INVALID",
")",
"itemclasszero",
"=",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
";",
"}",
"else",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_ABSOLUTE",
")",
"{",
"itemclass",
"=",
"ITEM_CLASS_ABSOLUTE",
";",
"result",
"=",
"value",
";",
"}",
"else",
"if",
"(",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
"==",
"ITEM_CLASS_RELATIVE",
")",
"{",
"itemclass",
"=",
"ITEM_CLASS_RELATIVE",
";",
"result",
"+=",
"value",
";",
"}",
"}",
"invert",
"=",
"FALSE",
";",
"}",
"}",
"if",
"(",
"itemclass_ptr",
"!=",
"NULL",
")",
"*",
"itemclass_ptr",
"=",
"(",
"result",
"==",
"0",
")",
"?",
"itemclasszero",
":",
"itemclass",
";",
"return",
"result",
";",
"}"
] | input_seq_axis_value - return the value of an
axis defined in an input sequence | [
"input_seq_axis_value",
"-",
"return",
"the",
"value",
"of",
"an",
"axis",
"defined",
"in",
"an",
"input",
"sequence"
] | [
"/* iterate over all of the codes */",
"/* handle NOT */",
"/* handle OR and END */",
"/* if we have a positive result from the previous set, we're done */",
"/* otherwise, reset our state */",
"/* handle everything else only if we're still enabled */",
"/* switch codes serve as enables */",
"/* AND against previous digital codes */",
"/* non-switch codes are analog values */",
"/* if we got a 0 value, don't do anything except remember the first type */",
"/* non-zero absolute values stick */",
"/* non-zero relative values accumulate */",
"/* clear the invert flag */",
"/* if the caller wants to know the type, provide it */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "seq",
"type": "input_seq"
},
{
"param": "itemclass_ptr",
"type": "input_item_class"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seq",
"type": "input_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "itemclass_ptr",
"type": "input_item_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
557eb861a1c936c2a6e4968906f6d8e88eb2a8f1 | lofunz/mieme | Reloaded/trunk/src/emu/inputseq.c | [
"Unlicense"
] | C | input_seq_poll_start | void | void input_seq_poll_start(running_machine *machine, input_item_class itemclass, const input_seq *startseq)
{
input_code dummycode;
assert(itemclass == ITEM_CLASS_SWITCH || itemclass == ITEM_CLASS_ABSOLUTE || itemclass == ITEM_CLASS_RELATIVE);
/* reset the recording count and the clock */
record_last = 0;
record_class = itemclass;
/* grab the starting sequence to append to */
if (startseq != NULL)
record_seq = *startseq;
else
input_seq_set_0(&record_seq);
/* append an OR if this is not a NULL sequence */
if (input_seq_length(&record_seq) > 0)
input_seq_append(&record_seq, SEQCODE_OR);
/* flush out any goobers */
dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(machine, TRUE) : input_code_poll_axes(machine, TRUE);
while (dummycode != INPUT_CODE_INVALID)
dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(machine, FALSE) : input_code_poll_axes(machine, FALSE);
} | /*-------------------------------------------------
input_seq_poll_start - begin polling for a
new sequence of the given itemclass
-------------------------------------------------*/ | begin polling for a
new sequence of the given itemclass | [
"begin",
"polling",
"for",
"a",
"new",
"sequence",
"of",
"the",
"given",
"itemclass"
] | void input_seq_poll_start(running_machine *machine, input_item_class itemclass, const input_seq *startseq)
{
input_code dummycode;
assert(itemclass == ITEM_CLASS_SWITCH || itemclass == ITEM_CLASS_ABSOLUTE || itemclass == ITEM_CLASS_RELATIVE);
record_last = 0;
record_class = itemclass;
if (startseq != NULL)
record_seq = *startseq;
else
input_seq_set_0(&record_seq);
if (input_seq_length(&record_seq) > 0)
input_seq_append(&record_seq, SEQCODE_OR);
dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(machine, TRUE) : input_code_poll_axes(machine, TRUE);
while (dummycode != INPUT_CODE_INVALID)
dummycode = (record_class == ITEM_CLASS_SWITCH) ? input_code_poll_switches(machine, FALSE) : input_code_poll_axes(machine, FALSE);
} | [
"void",
"input_seq_poll_start",
"(",
"running_machine",
"*",
"machine",
",",
"input_item_class",
"itemclass",
",",
"const",
"input_seq",
"*",
"startseq",
")",
"{",
"input_code",
"dummycode",
";",
"assert",
"(",
"itemclass",
"==",
"ITEM_CLASS_SWITCH",
"||",
"itemclass",
"==",
"ITEM_CLASS_ABSOLUTE",
"||",
"itemclass",
"==",
"ITEM_CLASS_RELATIVE",
")",
";",
"record_last",
"=",
"0",
";",
"record_class",
"=",
"itemclass",
";",
"if",
"(",
"startseq",
"!=",
"NULL",
")",
"record_seq",
"=",
"*",
"startseq",
";",
"else",
"input_seq_set_0",
"(",
"&",
"record_seq",
")",
";",
"if",
"(",
"input_seq_length",
"(",
"&",
"record_seq",
")",
">",
"0",
")",
"input_seq_append",
"(",
"&",
"record_seq",
",",
"SEQCODE_OR",
")",
";",
"dummycode",
"=",
"(",
"record_class",
"==",
"ITEM_CLASS_SWITCH",
")",
"?",
"input_code_poll_switches",
"(",
"machine",
",",
"TRUE",
")",
":",
"input_code_poll_axes",
"(",
"machine",
",",
"TRUE",
")",
";",
"while",
"(",
"dummycode",
"!=",
"INPUT_CODE_INVALID",
")",
"dummycode",
"=",
"(",
"record_class",
"==",
"ITEM_CLASS_SWITCH",
")",
"?",
"input_code_poll_switches",
"(",
"machine",
",",
"FALSE",
")",
":",
"input_code_poll_axes",
"(",
"machine",
",",
"FALSE",
")",
";",
"}"
] | input_seq_poll_start - begin polling for a
new sequence of the given itemclass | [
"input_seq_poll_start",
"-",
"begin",
"polling",
"for",
"a",
"new",
"sequence",
"of",
"the",
"given",
"itemclass"
] | [
"/* reset the recording count and the clock */",
"/* grab the starting sequence to append to */",
"/* append an OR if this is not a NULL sequence */",
"/* flush out any goobers */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "itemclass",
"type": "input_item_class"
},
{
"param": "startseq",
"type": "input_seq"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "itemclass",
"type": "input_item_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "startseq",
"type": "input_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
557eb861a1c936c2a6e4968906f6d8e88eb2a8f1 | lofunz/mieme | Reloaded/trunk/src/emu/inputseq.c | [
"Unlicense"
] | C | input_seq_from_tokens | int | int input_seq_from_tokens(running_machine *machine, const char *string, input_seq *seq)
{
char *strcopy = auto_alloc_array(machine, char, strlen(string) + 1);
char *str = strcopy;
int result = FALSE;
/* start with a blank sequence */
input_seq_set_0(seq);
/* loop until we're done */
strcpy(strcopy, string);
while (1)
{
input_code code;
char origspace;
char *strtemp;
/* trim any leading spaces */
while (*str != 0 && isspace((UINT8)*str))
str++;
/* bail if we're done */
if (*str == 0)
{
result = TRUE;
break;
}
/* find the end of the token and make it upper-case along the way */
for (strtemp = str; *strtemp != 0 && !isspace((UINT8)*strtemp); strtemp++)
*strtemp = toupper((UINT8)*strtemp);
origspace = *strtemp;
*strtemp = 0;
/* look for common stuff */
if (strcmp(str, "OR") == 0)
code = SEQCODE_OR;
else if (strcmp(str, "NOT") == 0)
code = SEQCODE_NOT;
else if (strcmp(str, "DEFAULT") == 0)
code = SEQCODE_DEFAULT;
else
code = input_code_from_token(machine, str);
/* translate and add to the sequence */
input_seq_append(seq, code);
/* advance */
if (origspace == 0)
{
result = TRUE;
break;
}
str = strtemp + 1;
}
auto_free(machine, strcopy);
return result;
} | /*-------------------------------------------------
input_seq_from_tokens - generate the tokenized
form of a sequence
-------------------------------------------------*/ | generate the tokenized
form of a sequence | [
"generate",
"the",
"tokenized",
"form",
"of",
"a",
"sequence"
] | int input_seq_from_tokens(running_machine *machine, const char *string, input_seq *seq)
{
char *strcopy = auto_alloc_array(machine, char, strlen(string) + 1);
char *str = strcopy;
int result = FALSE;
input_seq_set_0(seq);
strcpy(strcopy, string);
while (1)
{
input_code code;
char origspace;
char *strtemp;
while (*str != 0 && isspace((UINT8)*str))
str++;
if (*str == 0)
{
result = TRUE;
break;
}
for (strtemp = str; *strtemp != 0 && !isspace((UINT8)*strtemp); strtemp++)
*strtemp = toupper((UINT8)*strtemp);
origspace = *strtemp;
*strtemp = 0;
if (strcmp(str, "OR") == 0)
code = SEQCODE_OR;
else if (strcmp(str, "NOT") == 0)
code = SEQCODE_NOT;
else if (strcmp(str, "DEFAULT") == 0)
code = SEQCODE_DEFAULT;
else
code = input_code_from_token(machine, str);
input_seq_append(seq, code);
if (origspace == 0)
{
result = TRUE;
break;
}
str = strtemp + 1;
}
auto_free(machine, strcopy);
return result;
} | [
"int",
"input_seq_from_tokens",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"string",
",",
"input_seq",
"*",
"seq",
")",
"{",
"char",
"*",
"strcopy",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"char",
",",
"strlen",
"(",
"string",
")",
"+",
"1",
")",
";",
"char",
"*",
"str",
"=",
"strcopy",
";",
"int",
"result",
"=",
"FALSE",
";",
"input_seq_set_0",
"(",
"seq",
")",
";",
"strcpy",
"(",
"strcopy",
",",
"string",
")",
";",
"while",
"(",
"1",
")",
"{",
"input_code",
"code",
";",
"char",
"origspace",
";",
"char",
"*",
"strtemp",
";",
"while",
"(",
"*",
"str",
"!=",
"0",
"&&",
"isspace",
"(",
"(",
"UINT8",
")",
"*",
"str",
")",
")",
"str",
"++",
";",
"if",
"(",
"*",
"str",
"==",
"0",
")",
"{",
"result",
"=",
"TRUE",
";",
"break",
";",
"}",
"for",
"(",
"strtemp",
"=",
"str",
";",
"*",
"strtemp",
"!=",
"0",
"&&",
"!",
"isspace",
"(",
"(",
"UINT8",
")",
"*",
"strtemp",
")",
";",
"strtemp",
"++",
")",
"*",
"strtemp",
"=",
"toupper",
"(",
"(",
"UINT8",
")",
"*",
"strtemp",
")",
";",
"origspace",
"=",
"*",
"strtemp",
";",
"*",
"strtemp",
"=",
"0",
";",
"if",
"(",
"strcmp",
"(",
"str",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"code",
"=",
"SEQCODE_OR",
";",
"else",
"if",
"(",
"strcmp",
"(",
"str",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"code",
"=",
"SEQCODE_NOT",
";",
"else",
"if",
"(",
"strcmp",
"(",
"str",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"code",
"=",
"SEQCODE_DEFAULT",
";",
"else",
"code",
"=",
"input_code_from_token",
"(",
"machine",
",",
"str",
")",
";",
"input_seq_append",
"(",
"seq",
",",
"code",
")",
";",
"if",
"(",
"origspace",
"==",
"0",
")",
"{",
"result",
"=",
"TRUE",
";",
"break",
";",
"}",
"str",
"=",
"strtemp",
"+",
"1",
";",
"}",
"auto_free",
"(",
"machine",
",",
"strcopy",
")",
";",
"return",
"result",
";",
"}"
] | input_seq_from_tokens - generate the tokenized
form of a sequence | [
"input_seq_from_tokens",
"-",
"generate",
"the",
"tokenized",
"form",
"of",
"a",
"sequence"
] | [
"/* start with a blank sequence */",
"/* loop until we're done */",
"/* trim any leading spaces */",
"/* bail if we're done */",
"/* find the end of the token and make it upper-case along the way */",
"/* look for common stuff */",
"/* translate and add to the sequence */",
"/* advance */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "string",
"type": "char"
},
{
"param": "seq",
"type": "input_seq"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seq",
"type": "input_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
557eb861a1c936c2a6e4968906f6d8e88eb2a8f1 | lofunz/mieme | Reloaded/trunk/src/emu/inputseq.c | [
"Unlicense"
] | C | input_seq_is_valid | int | static int input_seq_is_valid(const input_seq *seq)
{
input_item_class lastclass = ITEM_CLASS_INVALID;
input_code lastcode = INPUT_CODE_INVALID;
int positive_code_count = 0;
int seqnum;
/* scan the sequence for valid codes */
for (seqnum = 0; seqnum < ARRAY_LENGTH(seq->code); seqnum++)
{
input_code code = seq->code[seqnum];
/* invalid codes are invalid */
if (code == INPUT_CODE_INVALID)
return FALSE;
/* if we hit an OR or the end, validate the previous chunk */
if (code == SEQCODE_OR || code == SEQCODE_END)
{
/* must be at least one positive code */
if (positive_code_count == 0)
return FALSE;
/* last code must not have been an internal code */
if (INPUT_CODE_IS_INTERNAL(lastcode))
return FALSE;
/* if this is the end, we're ok */
if (code == SEQCODE_END)
return TRUE;
/* reset the state for the next chunk */
positive_code_count = 0;
lastclass = ITEM_CLASS_INVALID;
}
/* if we hit a NOT, make sure we don't have a double */
else if (code == SEQCODE_NOT)
{
if (lastcode == SEQCODE_NOT)
return FALSE;
}
/* anything else */
else
{
input_item_class itemclass = INPUT_CODE_ITEMCLASS(code);
/* count positive codes */
if (lastcode != SEQCODE_NOT)
positive_code_count++;
/* non-switch items can't have a NOT */
if (itemclass != ITEM_CLASS_SWITCH && lastcode == SEQCODE_NOT)
return FALSE;
/* absolute/relative items must all be the same class */
if ((lastclass == ITEM_CLASS_ABSOLUTE && itemclass != ITEM_CLASS_ABSOLUTE) ||
(lastclass == ITEM_CLASS_RELATIVE && itemclass != ITEM_CLASS_RELATIVE))
return FALSE;
}
/* remember the last code */
lastcode = code;
}
/* if we got here, we were missing an END token; fail */
return FALSE;
} | /*-------------------------------------------------
input_seq_is_valid - return TRUE if a given
sequence is valid
-------------------------------------------------*/ | return TRUE if a given
sequence is valid | [
"return",
"TRUE",
"if",
"a",
"given",
"sequence",
"is",
"valid"
] | static int input_seq_is_valid(const input_seq *seq)
{
input_item_class lastclass = ITEM_CLASS_INVALID;
input_code lastcode = INPUT_CODE_INVALID;
int positive_code_count = 0;
int seqnum;
for (seqnum = 0; seqnum < ARRAY_LENGTH(seq->code); seqnum++)
{
input_code code = seq->code[seqnum];
if (code == INPUT_CODE_INVALID)
return FALSE;
if (code == SEQCODE_OR || code == SEQCODE_END)
{
if (positive_code_count == 0)
return FALSE;
if (INPUT_CODE_IS_INTERNAL(lastcode))
return FALSE;
if (code == SEQCODE_END)
return TRUE;
positive_code_count = 0;
lastclass = ITEM_CLASS_INVALID;
}
else if (code == SEQCODE_NOT)
{
if (lastcode == SEQCODE_NOT)
return FALSE;
}
else
{
input_item_class itemclass = INPUT_CODE_ITEMCLASS(code);
if (lastcode != SEQCODE_NOT)
positive_code_count++;
if (itemclass != ITEM_CLASS_SWITCH && lastcode == SEQCODE_NOT)
return FALSE;
if ((lastclass == ITEM_CLASS_ABSOLUTE && itemclass != ITEM_CLASS_ABSOLUTE) ||
(lastclass == ITEM_CLASS_RELATIVE && itemclass != ITEM_CLASS_RELATIVE))
return FALSE;
}
lastcode = code;
}
return FALSE;
} | [
"static",
"int",
"input_seq_is_valid",
"(",
"const",
"input_seq",
"*",
"seq",
")",
"{",
"input_item_class",
"lastclass",
"=",
"ITEM_CLASS_INVALID",
";",
"input_code",
"lastcode",
"=",
"INPUT_CODE_INVALID",
";",
"int",
"positive_code_count",
"=",
"0",
";",
"int",
"seqnum",
";",
"for",
"(",
"seqnum",
"=",
"0",
";",
"seqnum",
"<",
"ARRAY_LENGTH",
"(",
"seq",
"->",
"code",
")",
";",
"seqnum",
"++",
")",
"{",
"input_code",
"code",
"=",
"seq",
"->",
"code",
"[",
"seqnum",
"]",
";",
"if",
"(",
"code",
"==",
"INPUT_CODE_INVALID",
")",
"return",
"FALSE",
";",
"if",
"(",
"code",
"==",
"SEQCODE_OR",
"||",
"code",
"==",
"SEQCODE_END",
")",
"{",
"if",
"(",
"positive_code_count",
"==",
"0",
")",
"return",
"FALSE",
";",
"if",
"(",
"INPUT_CODE_IS_INTERNAL",
"(",
"lastcode",
")",
")",
"return",
"FALSE",
";",
"if",
"(",
"code",
"==",
"SEQCODE_END",
")",
"return",
"TRUE",
";",
"positive_code_count",
"=",
"0",
";",
"lastclass",
"=",
"ITEM_CLASS_INVALID",
";",
"}",
"else",
"if",
"(",
"code",
"==",
"SEQCODE_NOT",
")",
"{",
"if",
"(",
"lastcode",
"==",
"SEQCODE_NOT",
")",
"return",
"FALSE",
";",
"}",
"else",
"{",
"input_item_class",
"itemclass",
"=",
"INPUT_CODE_ITEMCLASS",
"(",
"code",
")",
";",
"if",
"(",
"lastcode",
"!=",
"SEQCODE_NOT",
")",
"positive_code_count",
"++",
";",
"if",
"(",
"itemclass",
"!=",
"ITEM_CLASS_SWITCH",
"&&",
"lastcode",
"==",
"SEQCODE_NOT",
")",
"return",
"FALSE",
";",
"if",
"(",
"(",
"lastclass",
"==",
"ITEM_CLASS_ABSOLUTE",
"&&",
"itemclass",
"!=",
"ITEM_CLASS_ABSOLUTE",
")",
"||",
"(",
"lastclass",
"==",
"ITEM_CLASS_RELATIVE",
"&&",
"itemclass",
"!=",
"ITEM_CLASS_RELATIVE",
")",
")",
"return",
"FALSE",
";",
"}",
"lastcode",
"=",
"code",
";",
"}",
"return",
"FALSE",
";",
"}"
] | input_seq_is_valid - return TRUE if a given
sequence is valid | [
"input_seq_is_valid",
"-",
"return",
"TRUE",
"if",
"a",
"given",
"sequence",
"is",
"valid"
] | [
"/* scan the sequence for valid codes */",
"/* invalid codes are invalid */",
"/* if we hit an OR or the end, validate the previous chunk */",
"/* must be at least one positive code */",
"/* last code must not have been an internal code */",
"/* if this is the end, we're ok */",
"/* reset the state for the next chunk */",
"/* if we hit a NOT, make sure we don't have a double */",
"/* anything else */",
"/* count positive codes */",
"/* non-switch items can't have a NOT */",
"/* absolute/relative items must all be the same class */",
"/* remember the last code */",
"/* if we got here, we were missing an END token; fail */"
] | [
{
"param": "seq",
"type": "input_seq"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "seq",
"type": "input_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79e068a660eb40837a4f04129a9d0f92556e9db8 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/nmk16.c | [
"Unlicense"
] | C | nmk16_video_init | void | static void nmk16_video_init(running_machine *machine)
{
spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2);
spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2);
videoshift = 0; /* 256x224 screen, no shift */
background_bitmap = NULL;
nmk16_simple_scroll = 1;
} | /***************************************************************************
Start the video hardware emulation.
***************************************************************************/ | Start the video hardware emulation. | [
"Start",
"the",
"video",
"hardware",
"emulation",
"."
] | static void nmk16_video_init(running_machine *machine)
{
spriteram_old = auto_alloc_array_clear(machine, UINT16, 0x1000/2);
spriteram_old2 = auto_alloc_array_clear(machine, UINT16, 0x1000/2);
videoshift = 0;
background_bitmap = NULL;
nmk16_simple_scroll = 1;
} | [
"static",
"void",
"nmk16_video_init",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"spriteram_old",
"=",
"auto_alloc_array_clear",
"(",
"machine",
",",
"UINT16",
",",
"0x1000",
"/",
"2",
")",
";",
"spriteram_old2",
"=",
"auto_alloc_array_clear",
"(",
"machine",
",",
"UINT16",
",",
"0x1000",
"/",
"2",
")",
";",
"videoshift",
"=",
"0",
";",
"background_bitmap",
"=",
"NULL",
";",
"nmk16_simple_scroll",
"=",
"1",
";",
"}"
] | Start the video hardware emulation. | [
"Start",
"the",
"video",
"hardware",
"emulation",
"."
] | [
"/* 256x224 screen, no shift */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79e068a660eb40837a4f04129a9d0f92556e9db8 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/nmk16.c | [
"Unlicense"
] | C | nmk16_draw_sprites | void | static void nmk16_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
{
int offs;
for (offs = 0;offs < 0x1000/2;offs += 8)
{
if ((spriteram_old2[offs] & 0x0001))
{
int sx = (spriteram_old2[offs+4] & 0x1ff) + videoshift;
int sy = (spriteram_old2[offs+6] & 0x1ff);
int code = spriteram_old2[offs+3];
int color = spriteram_old2[offs+7];
int w = (spriteram_old2[offs+1] & 0x0f);
int h = ((spriteram_old2[offs+1] & 0xf0) >> 4);
int pri = (spriteram_old2[offs] & 0xc0) >> 6;
int xx,yy,x;
int delta = 16;
if(pri != priority)
continue;
if (flip_screen_get(machine))
{
sx = 368 - sx;
sy = 240 - sy;
delta = -16;
}
yy = h;
do
{
x = sx;
xx = w;
do
{
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code,
color,
flip_screen_get(machine), flip_screen_get(machine),
((x + 16) & 0x1ff) - 16,sy & 0x1ff,15);
code++;
x += delta;
} while (--xx >= 0);
sy += delta;
} while (--yy >= 0);
}
}
} | // manybloc uses extra flip bits on the sprites, but these break other games | manybloc uses extra flip bits on the sprites, but these break other games | [
"manybloc",
"uses",
"extra",
"flip",
"bits",
"on",
"the",
"sprites",
"but",
"these",
"break",
"other",
"games"
] | static void nmk16_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority)
{
int offs;
for (offs = 0;offs < 0x1000/2;offs += 8)
{
if ((spriteram_old2[offs] & 0x0001))
{
int sx = (spriteram_old2[offs+4] & 0x1ff) + videoshift;
int sy = (spriteram_old2[offs+6] & 0x1ff);
int code = spriteram_old2[offs+3];
int color = spriteram_old2[offs+7];
int w = (spriteram_old2[offs+1] & 0x0f);
int h = ((spriteram_old2[offs+1] & 0xf0) >> 4);
int pri = (spriteram_old2[offs] & 0xc0) >> 6;
int xx,yy,x;
int delta = 16;
if(pri != priority)
continue;
if (flip_screen_get(machine))
{
sx = 368 - sx;
sy = 240 - sy;
delta = -16;
}
yy = h;
do
{
x = sx;
xx = w;
do
{
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
code,
color,
flip_screen_get(machine), flip_screen_get(machine),
((x + 16) & 0x1ff) - 16,sy & 0x1ff,15);
code++;
x += delta;
} while (--xx >= 0);
sy += delta;
} while (--yy >= 0);
}
}
} | [
"static",
"void",
"nmk16_draw_sprites",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"int",
"priority",
")",
"{",
"int",
"offs",
";",
"for",
"(",
"offs",
"=",
"0",
";",
"offs",
"<",
"0x1000",
"/",
"2",
";",
"offs",
"+=",
"8",
")",
"{",
"if",
"(",
"(",
"spriteram_old2",
"[",
"offs",
"]",
"&",
"0x0001",
")",
")",
"{",
"int",
"sx",
"=",
"(",
"spriteram_old2",
"[",
"offs",
"+",
"4",
"]",
"&",
"0x1ff",
")",
"+",
"videoshift",
";",
"int",
"sy",
"=",
"(",
"spriteram_old2",
"[",
"offs",
"+",
"6",
"]",
"&",
"0x1ff",
")",
";",
"int",
"code",
"=",
"spriteram_old2",
"[",
"offs",
"+",
"3",
"]",
";",
"int",
"color",
"=",
"spriteram_old2",
"[",
"offs",
"+",
"7",
"]",
";",
"int",
"w",
"=",
"(",
"spriteram_old2",
"[",
"offs",
"+",
"1",
"]",
"&",
"0x0f",
")",
";",
"int",
"h",
"=",
"(",
"(",
"spriteram_old2",
"[",
"offs",
"+",
"1",
"]",
"&",
"0xf0",
")",
">>",
"4",
")",
";",
"int",
"pri",
"=",
"(",
"spriteram_old2",
"[",
"offs",
"]",
"&",
"0xc0",
")",
">>",
"6",
";",
"int",
"xx",
",",
"yy",
",",
"x",
";",
"int",
"delta",
"=",
"16",
";",
"if",
"(",
"pri",
"!=",
"priority",
")",
"continue",
";",
"if",
"(",
"flip_screen_get",
"(",
"machine",
")",
")",
"{",
"sx",
"=",
"368",
"-",
"sx",
";",
"sy",
"=",
"240",
"-",
"sy",
";",
"delta",
"=",
"-16",
";",
"}",
"yy",
"=",
"h",
";",
"do",
"{",
"x",
"=",
"sx",
";",
"xx",
"=",
"w",
";",
"do",
"{",
"drawgfx_transpen",
"(",
"bitmap",
",",
"cliprect",
",",
"machine",
"->",
"gfx",
"[",
"2",
"]",
",",
"code",
",",
"color",
",",
"flip_screen_get",
"(",
"machine",
")",
",",
"flip_screen_get",
"(",
"machine",
")",
",",
"(",
"(",
"x",
"+",
"16",
")",
"&",
"0x1ff",
")",
"-",
"16",
",",
"sy",
"&",
"0x1ff",
",",
"15",
")",
";",
"code",
"++",
";",
"x",
"+=",
"delta",
";",
"}",
"while",
"(",
"--",
"xx",
">=",
"0",
")",
";",
"sy",
"+=",
"delta",
";",
"}",
"while",
"(",
"--",
"yy",
">=",
"0",
")",
";",
"}",
"}",
"}"
] | manybloc uses extra flip bits on the sprites, but these break other games | [
"manybloc",
"uses",
"extra",
"flip",
"bits",
"on",
"the",
"sprites",
"but",
"these",
"break",
"other",
"games"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "priority",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "priority",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55266fd0f0de8a59db9fcf8dc2fb728b13fd2898 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/tools/src2html.c | [
"Unlicense"
] | C | create_file_and_output_header | core_file | static core_file *create_file_and_output_header(const astring *filename, const astring *templatefile, const astring *path)
{
astring *modified;
core_file *file;
/* create the indexfile */
if (core_fopen(astring_c(filename), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE)
return NULL;
/* print a header */
modified = astring_dup(templatefile);
astring_replacec(modified, 0, "<!--PATH-->", astring_c(path));
core_fwrite(file, astring_c(modified), astring_len(modified));
/* return the file */
astring_free(modified);
return file;
} | /*-------------------------------------------------
create_file_and_output_header - create a new
HTML file with a standard header
-------------------------------------------------*/ | create a new
HTML file with a standard header | [
"create",
"a",
"new",
"HTML",
"file",
"with",
"a",
"standard",
"header"
] | static core_file *create_file_and_output_header(const astring *filename, const astring *templatefile, const astring *path)
{
astring *modified;
core_file *file;
if (core_fopen(astring_c(filename), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS | OPEN_FLAG_NO_BOM, &file) != FILERR_NONE)
return NULL;
modified = astring_dup(templatefile);
astring_replacec(modified, 0, "<!--PATH-->", astring_c(path));
core_fwrite(file, astring_c(modified), astring_len(modified));
astring_free(modified);
return file;
} | [
"static",
"core_file",
"*",
"create_file_and_output_header",
"(",
"const",
"astring",
"*",
"filename",
",",
"const",
"astring",
"*",
"templatefile",
",",
"const",
"astring",
"*",
"path",
")",
"{",
"astring",
"*",
"modified",
";",
"core_file",
"*",
"file",
";",
"if",
"(",
"core_fopen",
"(",
"astring_c",
"(",
"filename",
")",
",",
"OPEN_FLAG_WRITE",
"|",
"OPEN_FLAG_CREATE",
"|",
"OPEN_FLAG_CREATE_PATHS",
"|",
"OPEN_FLAG_NO_BOM",
",",
"&",
"file",
")",
"!=",
"FILERR_NONE",
")",
"return",
"NULL",
";",
"modified",
"=",
"astring_dup",
"(",
"templatefile",
")",
";",
"astring_replacec",
"(",
"modified",
",",
"0",
",",
"\"",
"\"",
",",
"astring_c",
"(",
"path",
")",
")",
";",
"core_fwrite",
"(",
"file",
",",
"astring_c",
"(",
"modified",
")",
",",
"astring_len",
"(",
"modified",
")",
")",
";",
"astring_free",
"(",
"modified",
")",
";",
"return",
"file",
";",
"}"
] | create_file_and_output_header - create a new
HTML file with a standard header | [
"create_file_and_output_header",
"-",
"create",
"a",
"new",
"HTML",
"file",
"with",
"a",
"standard",
"header"
] | [
"/* create the indexfile */",
"/* print a header */",
"/* return the file */"
] | [
{
"param": "filename",
"type": "astring"
},
{
"param": "templatefile",
"type": "astring"
},
{
"param": "path",
"type": "astring"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "templatefile",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55266fd0f0de8a59db9fcf8dc2fb728b13fd2898 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/tools/src2html.c | [
"Unlicense"
] | C | output_footer_and_close_file | void | static void output_footer_and_close_file(core_file *file, const astring *templatefile, const astring *path)
{
astring *modified;
modified = astring_dup(templatefile);
astring_replacec(modified, 0, "<!--PATH-->", astring_c(path));
core_fwrite(file, astring_c(modified), astring_len(modified));
astring_free(modified);
core_fclose(file);
} | /*-------------------------------------------------
output_footer_and_close_file - write a
standard footer to an HTML file and close it
-------------------------------------------------*/ | write a
standard footer to an HTML file and close it | [
"write",
"a",
"standard",
"footer",
"to",
"an",
"HTML",
"file",
"and",
"close",
"it"
] | static void output_footer_and_close_file(core_file *file, const astring *templatefile, const astring *path)
{
astring *modified;
modified = astring_dup(templatefile);
astring_replacec(modified, 0, "<!--PATH-->", astring_c(path));
core_fwrite(file, astring_c(modified), astring_len(modified));
astring_free(modified);
core_fclose(file);
} | [
"static",
"void",
"output_footer_and_close_file",
"(",
"core_file",
"*",
"file",
",",
"const",
"astring",
"*",
"templatefile",
",",
"const",
"astring",
"*",
"path",
")",
"{",
"astring",
"*",
"modified",
";",
"modified",
"=",
"astring_dup",
"(",
"templatefile",
")",
";",
"astring_replacec",
"(",
"modified",
",",
"0",
",",
"\"",
"\"",
",",
"astring_c",
"(",
"path",
")",
")",
";",
"core_fwrite",
"(",
"file",
",",
"astring_c",
"(",
"modified",
")",
",",
"astring_len",
"(",
"modified",
")",
")",
";",
"astring_free",
"(",
"modified",
")",
";",
"core_fclose",
"(",
"file",
")",
";",
"}"
] | output_footer_and_close_file - write a
standard footer to an HTML file and close it | [
"output_footer_and_close_file",
"-",
"write",
"a",
"standard",
"footer",
"to",
"an",
"HTML",
"file",
"and",
"close",
"it"
] | [] | [
{
"param": "file",
"type": "core_file"
},
{
"param": "templatefile",
"type": "astring"
},
{
"param": "path",
"type": "astring"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "core_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "templatefile",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55266fd0f0de8a59db9fcf8dc2fb728b13fd2898 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/tools/src2html.c | [
"Unlicense"
] | C | normalized_subpath | astring | static const astring *normalized_subpath(const astring *path, int start)
{
astring *result = astring_dupsubstr(path, start, -1);
if (result != NULL)
astring_replacechr(result, PATH_SEPARATOR[0], '/');
return result;
} | /*-------------------------------------------------
normalized_subpath - normalize a path to
forward slashes and extract a subpath
-------------------------------------------------*/ | normalize a path to
forward slashes and extract a subpath | [
"normalize",
"a",
"path",
"to",
"forward",
"slashes",
"and",
"extract",
"a",
"subpath"
] | static const astring *normalized_subpath(const astring *path, int start)
{
astring *result = astring_dupsubstr(path, start, -1);
if (result != NULL)
astring_replacechr(result, PATH_SEPARATOR[0], '/');
return result;
} | [
"static",
"const",
"astring",
"*",
"normalized_subpath",
"(",
"const",
"astring",
"*",
"path",
",",
"int",
"start",
")",
"{",
"astring",
"*",
"result",
"=",
"astring_dupsubstr",
"(",
"path",
",",
"start",
",",
"-1",
")",
";",
"if",
"(",
"result",
"!=",
"NULL",
")",
"astring_replacechr",
"(",
"result",
",",
"PATH_SEPARATOR",
"[",
"0",
"]",
",",
"'",
"'",
")",
";",
"return",
"result",
";",
"}"
] | normalized_subpath - normalize a path to
forward slashes and extract a subpath | [
"normalized_subpath",
"-",
"normalize",
"a",
"path",
"to",
"forward",
"slashes",
"and",
"extract",
"a",
"subpath"
] | [] | [
{
"param": "path",
"type": "astring"
},
{
"param": "start",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "start",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55266fd0f0de8a59db9fcf8dc2fb728b13fd2898 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/tools/src2html.c | [
"Unlicense"
] | C | output_path_as_links | void | static void output_path_as_links(core_file *file, const astring *path, int end_is_directory, int link_to_file)
{
astring *substr = astring_alloc();
int srcdepth, curdepth, depth;
int slashindex, lastslash;
/* first count how deep we are */
srcdepth = 0;
for (slashindex = astring_chr(path, 0, '/'); slashindex != -1; slashindex = astring_chr(path, slashindex + 1, '/'))
srcdepth++;
if (end_is_directory)
srcdepth++;
/* output a link to the root */
core_fprintf(file, "<a href=\"");
for (depth = 0; depth < srcdepth; depth++)
core_fprintf(file, "../");
core_fprintf(file, "index.html\"><root></a>/");
/* now output links to each path up the chain */
curdepth = 0;
lastslash = 0;
for (slashindex = astring_chr(path, lastslash, '/'); slashindex != -1; slashindex = astring_chr(path, lastslash, '/'))
{
astring_cpysubstr(substr, path, lastslash, slashindex - lastslash);
curdepth++;
core_fprintf(file, "<a href=\"");
for (depth = curdepth; depth < srcdepth; depth++)
core_fprintf(file, "../");
core_fprintf(file, "index.html\">%s</a>/", astring_c(substr));
lastslash = slashindex + 1;
}
/* and a final link to the current directory */
astring_cpysubstr(substr, path, lastslash, -1);
if (end_is_directory)
core_fprintf(file, "<a href=\"index.html\">%s</a>", astring_c(substr));
else if (link_to_file)
core_fprintf(file, "<a href=\"%s\">%s</a>", astring_c(substr), astring_c(substr));
else
core_fprintf(file, "<a href=\"%s.html\">%s</a>", astring_c(substr), astring_c(substr));
astring_free(substr);
} | /*-------------------------------------------------
output_path_as_links - output a path as a
series of links
-------------------------------------------------*/ | output a path as a
series of links | [
"output",
"a",
"path",
"as",
"a",
"series",
"of",
"links"
] | static void output_path_as_links(core_file *file, const astring *path, int end_is_directory, int link_to_file)
{
astring *substr = astring_alloc();
int srcdepth, curdepth, depth;
int slashindex, lastslash;
srcdepth = 0;
for (slashindex = astring_chr(path, 0, '/'); slashindex != -1; slashindex = astring_chr(path, slashindex + 1, '/'))
srcdepth++;
if (end_is_directory)
srcdepth++;
core_fprintf(file, "<a href=\"");
for (depth = 0; depth < srcdepth; depth++)
core_fprintf(file, "../");
core_fprintf(file, "index.html\"><root></a>/");
curdepth = 0;
lastslash = 0;
for (slashindex = astring_chr(path, lastslash, '/'); slashindex != -1; slashindex = astring_chr(path, lastslash, '/'))
{
astring_cpysubstr(substr, path, lastslash, slashindex - lastslash);
curdepth++;
core_fprintf(file, "<a href=\"");
for (depth = curdepth; depth < srcdepth; depth++)
core_fprintf(file, "../");
core_fprintf(file, "index.html\">%s</a>/", astring_c(substr));
lastslash = slashindex + 1;
}
astring_cpysubstr(substr, path, lastslash, -1);
if (end_is_directory)
core_fprintf(file, "<a href=\"index.html\">%s</a>", astring_c(substr));
else if (link_to_file)
core_fprintf(file, "<a href=\"%s\">%s</a>", astring_c(substr), astring_c(substr));
else
core_fprintf(file, "<a href=\"%s.html\">%s</a>", astring_c(substr), astring_c(substr));
astring_free(substr);
} | [
"static",
"void",
"output_path_as_links",
"(",
"core_file",
"*",
"file",
",",
"const",
"astring",
"*",
"path",
",",
"int",
"end_is_directory",
",",
"int",
"link_to_file",
")",
"{",
"astring",
"*",
"substr",
"=",
"astring_alloc",
"(",
")",
";",
"int",
"srcdepth",
",",
"curdepth",
",",
"depth",
";",
"int",
"slashindex",
",",
"lastslash",
";",
"srcdepth",
"=",
"0",
";",
"for",
"(",
"slashindex",
"=",
"astring_chr",
"(",
"path",
",",
"0",
",",
"'",
"'",
")",
";",
"slashindex",
"!=",
"-1",
";",
"slashindex",
"=",
"astring_chr",
"(",
"path",
",",
"slashindex",
"+",
"1",
",",
"'",
"'",
")",
")",
"srcdepth",
"++",
";",
"if",
"(",
"end_is_directory",
")",
"srcdepth",
"++",
";",
"core_fprintf",
"(",
"file",
",",
"\"",
"\\\"",
"\"",
")",
";",
"for",
"(",
"depth",
"=",
"0",
";",
"depth",
"<",
"srcdepth",
";",
"depth",
"++",
")",
"core_fprintf",
"(",
"file",
",",
"\"",
"\"",
")",
";",
"core_fprintf",
"(",
"file",
",",
"\"",
"\\\"",
"\"",
")",
";",
"curdepth",
"=",
"0",
";",
"lastslash",
"=",
"0",
";",
"for",
"(",
"slashindex",
"=",
"astring_chr",
"(",
"path",
",",
"lastslash",
",",
"'",
"'",
")",
";",
"slashindex",
"!=",
"-1",
";",
"slashindex",
"=",
"astring_chr",
"(",
"path",
",",
"lastslash",
",",
"'",
"'",
")",
")",
"{",
"astring_cpysubstr",
"(",
"substr",
",",
"path",
",",
"lastslash",
",",
"slashindex",
"-",
"lastslash",
")",
";",
"curdepth",
"++",
";",
"core_fprintf",
"(",
"file",
",",
"\"",
"\\\"",
"\"",
")",
";",
"for",
"(",
"depth",
"=",
"curdepth",
";",
"depth",
"<",
"srcdepth",
";",
"depth",
"++",
")",
"core_fprintf",
"(",
"file",
",",
"\"",
"\"",
")",
";",
"core_fprintf",
"(",
"file",
",",
"\"",
"\\\"",
"\"",
",",
"astring_c",
"(",
"substr",
")",
")",
";",
"lastslash",
"=",
"slashindex",
"+",
"1",
";",
"}",
"astring_cpysubstr",
"(",
"substr",
",",
"path",
",",
"lastslash",
",",
"-1",
")",
";",
"if",
"(",
"end_is_directory",
")",
"core_fprintf",
"(",
"file",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"astring_c",
"(",
"substr",
")",
")",
";",
"else",
"if",
"(",
"link_to_file",
")",
"core_fprintf",
"(",
"file",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"astring_c",
"(",
"substr",
")",
",",
"astring_c",
"(",
"substr",
")",
")",
";",
"else",
"core_fprintf",
"(",
"file",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"astring_c",
"(",
"substr",
")",
",",
"astring_c",
"(",
"substr",
")",
")",
";",
"astring_free",
"(",
"substr",
")",
";",
"}"
] | output_path_as_links - output a path as a
series of links | [
"output_path_as_links",
"-",
"output",
"a",
"path",
"as",
"a",
"series",
"of",
"links"
] | [
"/* first count how deep we are */",
"/* output a link to the root */",
"/* now output links to each path up the chain */",
"/* and a final link to the current directory */"
] | [
{
"param": "file",
"type": "core_file"
},
{
"param": "path",
"type": "astring"
},
{
"param": "end_is_directory",
"type": "int"
},
{
"param": "link_to_file",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "core_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": "astring",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "end_is_directory",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "link_to_file",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c408a4e0b863227558c065b32762f20458a6646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/state.c | [
"Unlicense"
] | C | state_save_get_reg_count | int | int state_save_get_reg_count(running_machine *machine)
{
state_private *global = machine->state_data;
state_entry *entry;
int count = 0;
/* count entries */
for (entry = global->entrylist; entry != NULL; entry = entry->next)
count++;
return count;
} | /*-------------------------------------------------
state_save_get_reg_count - return the number
of total registrations so far
-------------------------------------------------*/ | return the number
of total registrations so far | [
"return",
"the",
"number",
"of",
"total",
"registrations",
"so",
"far"
] | int state_save_get_reg_count(running_machine *machine)
{
state_private *global = machine->state_data;
state_entry *entry;
int count = 0;
for (entry = global->entrylist; entry != NULL; entry = entry->next)
count++;
return count;
} | [
"int",
"state_save_get_reg_count",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"state_private",
"*",
"global",
"=",
"machine",
"->",
"state_data",
";",
"state_entry",
"*",
"entry",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"entry",
"=",
"global",
"->",
"entrylist",
";",
"entry",
"!=",
"NULL",
";",
"entry",
"=",
"entry",
"->",
"next",
")",
"count",
"++",
";",
"return",
"count",
";",
"}"
] | state_save_get_reg_count - return the number
of total registrations so far | [
"state_save_get_reg_count",
"-",
"return",
"the",
"number",
"of",
"total",
"registrations",
"so",
"far"
] | [
"/* count entries */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c408a4e0b863227558c065b32762f20458a6646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/state.c | [
"Unlicense"
] | C | state_save_allow_registration | void | void state_save_allow_registration(running_machine *machine, int allowed)
{
/* allow/deny registration */
machine->state_data->reg_allowed = allowed;
if (!allowed)
state_save_dump_registry(machine);
} | /*-------------------------------------------------
state_save_allow_registration - allow/disallow
registrations to happen
-------------------------------------------------*/ | allow/disallow
registrations to happen | [
"allow",
"/",
"disallow",
"registrations",
"to",
"happen"
] | void state_save_allow_registration(running_machine *machine, int allowed)
{
machine->state_data->reg_allowed = allowed;
if (!allowed)
state_save_dump_registry(machine);
} | [
"void",
"state_save_allow_registration",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"allowed",
")",
"{",
"machine",
"->",
"state_data",
"->",
"reg_allowed",
"=",
"allowed",
";",
"if",
"(",
"!",
"allowed",
")",
"state_save_dump_registry",
"(",
"machine",
")",
";",
"}"
] | state_save_allow_registration - allow/disallow
registrations to happen | [
"state_save_allow_registration",
"-",
"allow",
"/",
"disallow",
"registrations",
"to",
"happen"
] | [
"/* allow/deny registration */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "allowed",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c408a4e0b863227558c065b32762f20458a6646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/state.c | [
"Unlicense"
] | C | state_save_register_memory | void | void state_save_register_memory(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount)
{
state_private *global = machine->state_data;
state_entry **entryptr, *next;
astring *totalname;
assert(valsize == 1 || valsize == 2 || valsize == 4 || valsize == 8);
/* check for invalid timing */
if (!global->reg_allowed)
{
logerror("Attempt to register save state entry after state registration is closed! module %s tag %s name %s\n",module, tag, name);
if (machine->gamedrv->flags & GAME_SUPPORTS_SAVE)
fatalerror("Attempt to register save state entry after state registration is closed! module %s tag %s name %s\n", module, tag, name);
global->illegal_regs++;
return;
}
/* create the full name */
totalname = astring_alloc();
if (tag != NULL)
astring_printf(totalname, "%s/%s/%X/%s", module, tag, index, name);
else
astring_printf(totalname, "%s/%X/%s", module, index, name);
/* look for duplicates and an entry to insert in front of */
for (entryptr = &global->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next)
{
/* stop if the next guy's string is greater than ours */
int cmpval = astring_cmp((*entryptr)->name, totalname);
if (cmpval > 0)
break;
/* error if we are equal */
if (cmpval == 0)
fatalerror("Duplicate save state registration entry (%s)", astring_c(totalname));
}
/* didn't find one; allocate a new one */
next = *entryptr;
*entryptr = alloc_clear_or_die(state_entry);
/* fill in the rest */
(*entryptr)->next = next;
(*entryptr)->machine = machine;
(*entryptr)->data = val;
(*entryptr)->name = totalname;
(*entryptr)->typesize = valsize;
(*entryptr)->typecount = valcount;
restrack_register_object(OBJTYPE_STATEREG, *entryptr, 0, __FILE__, __LINE__);
} | /*-------------------------------------------------
state_save_register_memory - register an
array of data in memory
-------------------------------------------------*/ | register an
array of data in memory | [
"register",
"an",
"array",
"of",
"data",
"in",
"memory"
] | void state_save_register_memory(running_machine *machine, const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount)
{
state_private *global = machine->state_data;
state_entry **entryptr, *next;
astring *totalname;
assert(valsize == 1 || valsize == 2 || valsize == 4 || valsize == 8);
if (!global->reg_allowed)
{
logerror("Attempt to register save state entry after state registration is closed! module %s tag %s name %s\n",module, tag, name);
if (machine->gamedrv->flags & GAME_SUPPORTS_SAVE)
fatalerror("Attempt to register save state entry after state registration is closed! module %s tag %s name %s\n", module, tag, name);
global->illegal_regs++;
return;
}
totalname = astring_alloc();
if (tag != NULL)
astring_printf(totalname, "%s/%s/%X/%s", module, tag, index, name);
else
astring_printf(totalname, "%s/%X/%s", module, index, name);
for (entryptr = &global->entrylist; *entryptr != NULL; entryptr = &(*entryptr)->next)
{
int cmpval = astring_cmp((*entryptr)->name, totalname);
if (cmpval > 0)
break;
if (cmpval == 0)
fatalerror("Duplicate save state registration entry (%s)", astring_c(totalname));
}
next = *entryptr;
*entryptr = alloc_clear_or_die(state_entry);
(*entryptr)->next = next;
(*entryptr)->machine = machine;
(*entryptr)->data = val;
(*entryptr)->name = totalname;
(*entryptr)->typesize = valsize;
(*entryptr)->typecount = valcount;
restrack_register_object(OBJTYPE_STATEREG, *entryptr, 0, __FILE__, __LINE__);
} | [
"void",
"state_save_register_memory",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"module",
",",
"const",
"char",
"*",
"tag",
",",
"UINT32",
"index",
",",
"const",
"char",
"*",
"name",
",",
"void",
"*",
"val",
",",
"UINT32",
"valsize",
",",
"UINT32",
"valcount",
")",
"{",
"state_private",
"*",
"global",
"=",
"machine",
"->",
"state_data",
";",
"state_entry",
"*",
"*",
"entryptr",
",",
"*",
"next",
";",
"astring",
"*",
"totalname",
";",
"assert",
"(",
"valsize",
"==",
"1",
"||",
"valsize",
"==",
"2",
"||",
"valsize",
"==",
"4",
"||",
"valsize",
"==",
"8",
")",
";",
"if",
"(",
"!",
"global",
"->",
"reg_allowed",
")",
"{",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"module",
",",
"tag",
",",
"name",
")",
";",
"if",
"(",
"machine",
"->",
"gamedrv",
"->",
"flags",
"&",
"GAME_SUPPORTS_SAVE",
")",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"module",
",",
"tag",
",",
"name",
")",
";",
"global",
"->",
"illegal_regs",
"++",
";",
"return",
";",
"}",
"totalname",
"=",
"astring_alloc",
"(",
")",
";",
"if",
"(",
"tag",
"!=",
"NULL",
")",
"astring_printf",
"(",
"totalname",
",",
"\"",
"\"",
",",
"module",
",",
"tag",
",",
"index",
",",
"name",
")",
";",
"else",
"astring_printf",
"(",
"totalname",
",",
"\"",
"\"",
",",
"module",
",",
"index",
",",
"name",
")",
";",
"for",
"(",
"entryptr",
"=",
"&",
"global",
"->",
"entrylist",
";",
"*",
"entryptr",
"!=",
"NULL",
";",
"entryptr",
"=",
"&",
"(",
"*",
"entryptr",
")",
"->",
"next",
")",
"{",
"int",
"cmpval",
"=",
"astring_cmp",
"(",
"(",
"*",
"entryptr",
")",
"->",
"name",
",",
"totalname",
")",
";",
"if",
"(",
"cmpval",
">",
"0",
")",
"break",
";",
"if",
"(",
"cmpval",
"==",
"0",
")",
"fatalerror",
"(",
"\"",
"\"",
",",
"astring_c",
"(",
"totalname",
")",
")",
";",
"}",
"next",
"=",
"*",
"entryptr",
";",
"*",
"entryptr",
"=",
"alloc_clear_or_die",
"(",
"state_entry",
")",
";",
"(",
"*",
"entryptr",
")",
"->",
"next",
"=",
"next",
";",
"(",
"*",
"entryptr",
")",
"->",
"machine",
"=",
"machine",
";",
"(",
"*",
"entryptr",
")",
"->",
"data",
"=",
"val",
";",
"(",
"*",
"entryptr",
")",
"->",
"name",
"=",
"totalname",
";",
"(",
"*",
"entryptr",
")",
"->",
"typesize",
"=",
"valsize",
";",
"(",
"*",
"entryptr",
")",
"->",
"typecount",
"=",
"valcount",
";",
"restrack_register_object",
"(",
"OBJTYPE_STATEREG",
",",
"*",
"entryptr",
",",
"0",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"}"
] | state_save_register_memory - register an
array of data in memory | [
"state_save_register_memory",
"-",
"register",
"an",
"array",
"of",
"data",
"in",
"memory"
] | [
"/* check for invalid timing */",
"/* create the full name */",
"/* look for duplicates and an entry to insert in front of */",
"/* stop if the next guy's string is greater than ours */",
"/* error if we are equal */",
"/* didn't find one; allocate a new one */",
"/* fill in the rest */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "module",
"type": "char"
},
{
"param": "tag",
"type": "char"
},
{
"param": "index",
"type": "UINT32"
},
{
"param": "name",
"type": "char"
},
{
"param": "val",
"type": "void"
},
{
"param": "valsize",
"type": "UINT32"
},
{
"param": "valcount",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "module",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "val",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "valsize",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "valcount",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c408a4e0b863227558c065b32762f20458a6646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/state.c | [
"Unlicense"
] | C | state_save_register_presave | void | void state_save_register_presave(running_machine *machine, state_presave_func func, void *param)
{
state_private *global = machine->state_data;
state_callback **cbptr;
/* check for invalid timing */
if (!global->reg_allowed)
fatalerror("Attempt to register callback function after state registration is closed!");
/* scan for duplicates and push through to the end */
for (cbptr = &global->prefunclist; *cbptr != NULL; cbptr = &(*cbptr)->next)
if ((*cbptr)->func.presave == func && (*cbptr)->param == param)
fatalerror("Duplicate save state function (%p, %p)", param, func);
/* allocate a new entry */
*cbptr = alloc_or_die(state_callback);
/* fill it in */
(*cbptr)->next = NULL;
(*cbptr)->machine = machine;
(*cbptr)->func.presave = func;
(*cbptr)->param = param;
restrack_register_object(OBJTYPE_STATEREG, *cbptr, 1, __FILE__, __LINE__);
} | /*-------------------------------------------------
state_save_register_presave -
register a pre-save function callback
-------------------------------------------------*/ | state_save_register_presave
register a pre-save function callback | [
"state_save_register_presave",
"register",
"a",
"pre",
"-",
"save",
"function",
"callback"
] | void state_save_register_presave(running_machine *machine, state_presave_func func, void *param)
{
state_private *global = machine->state_data;
state_callback **cbptr;
if (!global->reg_allowed)
fatalerror("Attempt to register callback function after state registration is closed!");
for (cbptr = &global->prefunclist; *cbptr != NULL; cbptr = &(*cbptr)->next)
if ((*cbptr)->func.presave == func && (*cbptr)->param == param)
fatalerror("Duplicate save state function (%p, %p)", param, func);
*cbptr = alloc_or_die(state_callback);
(*cbptr)->next = NULL;
(*cbptr)->machine = machine;
(*cbptr)->func.presave = func;
(*cbptr)->param = param;
restrack_register_object(OBJTYPE_STATEREG, *cbptr, 1, __FILE__, __LINE__);
} | [
"void",
"state_save_register_presave",
"(",
"running_machine",
"*",
"machine",
",",
"state_presave_func",
"func",
",",
"void",
"*",
"param",
")",
"{",
"state_private",
"*",
"global",
"=",
"machine",
"->",
"state_data",
";",
"state_callback",
"*",
"*",
"cbptr",
";",
"if",
"(",
"!",
"global",
"->",
"reg_allowed",
")",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"for",
"(",
"cbptr",
"=",
"&",
"global",
"->",
"prefunclist",
";",
"*",
"cbptr",
"!=",
"NULL",
";",
"cbptr",
"=",
"&",
"(",
"*",
"cbptr",
")",
"->",
"next",
")",
"if",
"(",
"(",
"*",
"cbptr",
")",
"->",
"func",
".",
"presave",
"==",
"func",
"&&",
"(",
"*",
"cbptr",
")",
"->",
"param",
"==",
"param",
")",
"fatalerror",
"(",
"\"",
"\"",
",",
"param",
",",
"func",
")",
";",
"*",
"cbptr",
"=",
"alloc_or_die",
"(",
"state_callback",
")",
";",
"(",
"*",
"cbptr",
")",
"->",
"next",
"=",
"NULL",
";",
"(",
"*",
"cbptr",
")",
"->",
"machine",
"=",
"machine",
";",
"(",
"*",
"cbptr",
")",
"->",
"func",
".",
"presave",
"=",
"func",
";",
"(",
"*",
"cbptr",
")",
"->",
"param",
"=",
"param",
";",
"restrack_register_object",
"(",
"OBJTYPE_STATEREG",
",",
"*",
"cbptr",
",",
"1",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"}"
] | state_save_register_presave
register a pre-save function callback | [
"state_save_register_presave",
"register",
"a",
"pre",
"-",
"save",
"function",
"callback"
] | [
"/* check for invalid timing */",
"/* scan for duplicates and push through to the end */",
"/* allocate a new entry */",
"/* fill it in */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "func",
"type": "state_presave_func"
},
{
"param": "param",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "func",
"type": "state_presave_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c408a4e0b863227558c065b32762f20458a6646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/state.c | [
"Unlicense"
] | C | state_save_register_postload | void | void state_save_register_postload(running_machine *machine, state_postload_func func, void *param)
{
state_private *global = machine->state_data;
state_callback **cbptr;
/* check for invalid timing */
if (!global->reg_allowed)
fatalerror("Attempt to register callback function after state registration is closed!");
/* scan for duplicates and push through to the end */
for (cbptr = &global->postfunclist; *cbptr != NULL; cbptr = &(*cbptr)->next)
if ((*cbptr)->func.postload == func && (*cbptr)->param == param)
fatalerror("Duplicate save state function (%p, %p)", param, func);
/* allocate a new entry */
*cbptr = alloc_or_die(state_callback);
/* fill it in */
(*cbptr)->next = NULL;
(*cbptr)->machine = machine;
(*cbptr)->func.postload = func;
(*cbptr)->param = param;
restrack_register_object(OBJTYPE_STATEREG, *cbptr, 2, __FILE__, __LINE__);
} | /*-------------------------------------------------
state_save_register_postload -
register a post-load function callback
-------------------------------------------------*/ | state_save_register_postload
register a post-load function callback | [
"state_save_register_postload",
"register",
"a",
"post",
"-",
"load",
"function",
"callback"
] | void state_save_register_postload(running_machine *machine, state_postload_func func, void *param)
{
state_private *global = machine->state_data;
state_callback **cbptr;
if (!global->reg_allowed)
fatalerror("Attempt to register callback function after state registration is closed!");
for (cbptr = &global->postfunclist; *cbptr != NULL; cbptr = &(*cbptr)->next)
if ((*cbptr)->func.postload == func && (*cbptr)->param == param)
fatalerror("Duplicate save state function (%p, %p)", param, func);
*cbptr = alloc_or_die(state_callback);
(*cbptr)->next = NULL;
(*cbptr)->machine = machine;
(*cbptr)->func.postload = func;
(*cbptr)->param = param;
restrack_register_object(OBJTYPE_STATEREG, *cbptr, 2, __FILE__, __LINE__);
} | [
"void",
"state_save_register_postload",
"(",
"running_machine",
"*",
"machine",
",",
"state_postload_func",
"func",
",",
"void",
"*",
"param",
")",
"{",
"state_private",
"*",
"global",
"=",
"machine",
"->",
"state_data",
";",
"state_callback",
"*",
"*",
"cbptr",
";",
"if",
"(",
"!",
"global",
"->",
"reg_allowed",
")",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"for",
"(",
"cbptr",
"=",
"&",
"global",
"->",
"postfunclist",
";",
"*",
"cbptr",
"!=",
"NULL",
";",
"cbptr",
"=",
"&",
"(",
"*",
"cbptr",
")",
"->",
"next",
")",
"if",
"(",
"(",
"*",
"cbptr",
")",
"->",
"func",
".",
"postload",
"==",
"func",
"&&",
"(",
"*",
"cbptr",
")",
"->",
"param",
"==",
"param",
")",
"fatalerror",
"(",
"\"",
"\"",
",",
"param",
",",
"func",
")",
";",
"*",
"cbptr",
"=",
"alloc_or_die",
"(",
"state_callback",
")",
";",
"(",
"*",
"cbptr",
")",
"->",
"next",
"=",
"NULL",
";",
"(",
"*",
"cbptr",
")",
"->",
"machine",
"=",
"machine",
";",
"(",
"*",
"cbptr",
")",
"->",
"func",
".",
"postload",
"=",
"func",
";",
"(",
"*",
"cbptr",
")",
"->",
"param",
"=",
"param",
";",
"restrack_register_object",
"(",
"OBJTYPE_STATEREG",
",",
"*",
"cbptr",
",",
"2",
",",
"__FILE__",
",",
"__LINE__",
")",
";",
"}"
] | state_save_register_postload
register a post-load function callback | [
"state_save_register_postload",
"register",
"a",
"post",
"-",
"load",
"function",
"callback"
] | [
"/* check for invalid timing */",
"/* scan for duplicates and push through to the end */",
"/* allocate a new entry */",
"/* fill it in */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "func",
"type": "state_postload_func"
},
{
"param": "param",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "func",
"type": "state_postload_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c408a4e0b863227558c065b32762f20458a6646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/state.c | [
"Unlicense"
] | C | state_save_write_file | state_save_error | state_save_error state_save_write_file(running_machine *machine, mame_file *file)
{
state_private *global = machine->state_data;
UINT32 signature = get_signature(machine);
UINT8 header[HEADER_SIZE];
state_callback *func;
state_entry *entry;
/* if we have illegal registrations, return an error */
if (global->illegal_regs > 0)
return STATERR_ILLEGAL_REGISTRATIONS;
/* generate the header */
memcpy(&header[0], ss_magic_num, 8);
header[8] = SAVE_VERSION;
header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST);
strncpy((char *)&header[0x0a], machine->gamedrv->name, 0x1c - 0x0a);
*(UINT32 *)&header[0x1c] = LITTLE_ENDIANIZE_INT32(signature);
/* write the header and turn on compression for the rest of the file */
mame_fcompress(file, FCOMPRESS_NONE);
mame_fseek(file, 0, SEEK_SET);
if (mame_fwrite(file, header, sizeof(header)) != sizeof(header))
return STATERR_WRITE_ERROR;
mame_fcompress(file, FCOMPRESS_MEDIUM);
/* call the pre-save functions */
for (func = global->prefunclist; func != NULL; func = func->next)
(*func->func.presave)(machine, func->param);
/* then write all the data */
for (entry = global->entrylist; entry != NULL; entry = entry->next)
{
UINT32 totalsize = entry->typesize * entry->typecount;
if (mame_fwrite(file, entry->data, totalsize) != totalsize)
return STATERR_WRITE_ERROR;
}
return STATERR_NONE;
} | /*-------------------------------------------------
state_save_write_file - writes the data to
a file
-------------------------------------------------*/ | writes the data to
a file | [
"writes",
"the",
"data",
"to",
"a",
"file"
] | state_save_error state_save_write_file(running_machine *machine, mame_file *file)
{
state_private *global = machine->state_data;
UINT32 signature = get_signature(machine);
UINT8 header[HEADER_SIZE];
state_callback *func;
state_entry *entry;
if (global->illegal_regs > 0)
return STATERR_ILLEGAL_REGISTRATIONS;
memcpy(&header[0], ss_magic_num, 8);
header[8] = SAVE_VERSION;
header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST);
strncpy((char *)&header[0x0a], machine->gamedrv->name, 0x1c - 0x0a);
*(UINT32 *)&header[0x1c] = LITTLE_ENDIANIZE_INT32(signature);
mame_fcompress(file, FCOMPRESS_NONE);
mame_fseek(file, 0, SEEK_SET);
if (mame_fwrite(file, header, sizeof(header)) != sizeof(header))
return STATERR_WRITE_ERROR;
mame_fcompress(file, FCOMPRESS_MEDIUM);
for (func = global->prefunclist; func != NULL; func = func->next)
(*func->func.presave)(machine, func->param);
for (entry = global->entrylist; entry != NULL; entry = entry->next)
{
UINT32 totalsize = entry->typesize * entry->typecount;
if (mame_fwrite(file, entry->data, totalsize) != totalsize)
return STATERR_WRITE_ERROR;
}
return STATERR_NONE;
} | [
"state_save_error",
"state_save_write_file",
"(",
"running_machine",
"*",
"machine",
",",
"mame_file",
"*",
"file",
")",
"{",
"state_private",
"*",
"global",
"=",
"machine",
"->",
"state_data",
";",
"UINT32",
"signature",
"=",
"get_signature",
"(",
"machine",
")",
";",
"UINT8",
"header",
"[",
"HEADER_SIZE",
"]",
";",
"state_callback",
"*",
"func",
";",
"state_entry",
"*",
"entry",
";",
"if",
"(",
"global",
"->",
"illegal_regs",
">",
"0",
")",
"return",
"STATERR_ILLEGAL_REGISTRATIONS",
";",
"memcpy",
"(",
"&",
"header",
"[",
"0",
"]",
",",
"ss_magic_num",
",",
"8",
")",
";",
"header",
"[",
"8",
"]",
"=",
"SAVE_VERSION",
";",
"header",
"[",
"9",
"]",
"=",
"NATIVE_ENDIAN_VALUE_LE_BE",
"(",
"0",
",",
"SS_MSB_FIRST",
")",
";",
"strncpy",
"(",
"(",
"char",
"*",
")",
"&",
"header",
"[",
"0x0a",
"]",
",",
"machine",
"->",
"gamedrv",
"->",
"name",
",",
"0x1c",
"-",
"0x0a",
")",
";",
"*",
"(",
"UINT32",
"*",
")",
"&",
"header",
"[",
"0x1c",
"]",
"=",
"LITTLE_ENDIANIZE_INT32",
"(",
"signature",
")",
";",
"mame_fcompress",
"(",
"file",
",",
"FCOMPRESS_NONE",
")",
";",
"mame_fseek",
"(",
"file",
",",
"0",
",",
"SEEK_SET",
")",
";",
"if",
"(",
"mame_fwrite",
"(",
"file",
",",
"header",
",",
"sizeof",
"(",
"header",
")",
")",
"!=",
"sizeof",
"(",
"header",
")",
")",
"return",
"STATERR_WRITE_ERROR",
";",
"mame_fcompress",
"(",
"file",
",",
"FCOMPRESS_MEDIUM",
")",
";",
"for",
"(",
"func",
"=",
"global",
"->",
"prefunclist",
";",
"func",
"!=",
"NULL",
";",
"func",
"=",
"func",
"->",
"next",
")",
"(",
"*",
"func",
"->",
"func",
".",
"presave",
")",
"(",
"machine",
",",
"func",
"->",
"param",
")",
";",
"for",
"(",
"entry",
"=",
"global",
"->",
"entrylist",
";",
"entry",
"!=",
"NULL",
";",
"entry",
"=",
"entry",
"->",
"next",
")",
"{",
"UINT32",
"totalsize",
"=",
"entry",
"->",
"typesize",
"*",
"entry",
"->",
"typecount",
";",
"if",
"(",
"mame_fwrite",
"(",
"file",
",",
"entry",
"->",
"data",
",",
"totalsize",
")",
"!=",
"totalsize",
")",
"return",
"STATERR_WRITE_ERROR",
";",
"}",
"return",
"STATERR_NONE",
";",
"}"
] | state_save_write_file - writes the data to
a file | [
"state_save_write_file",
"-",
"writes",
"the",
"data",
"to",
"a",
"file"
] | [
"/* if we have illegal registrations, return an error */",
"/* generate the header */",
"/* write the header and turn on compression for the rest of the file */",
"/* call the pre-save functions */",
"/* then write all the data */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "file",
"type": "mame_file"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": "mame_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c408a4e0b863227558c065b32762f20458a6646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/state.c | [
"Unlicense"
] | C | state_save_read_file | state_save_error | state_save_error state_save_read_file(running_machine *machine, mame_file *file)
{
state_private *global = machine->state_data;
UINT32 signature = get_signature(machine);
UINT8 header[HEADER_SIZE];
state_callback *func;
state_entry *entry;
int flip;
/* if we have illegal registrations, return an error */
if (global->illegal_regs > 0)
return STATERR_ILLEGAL_REGISTRATIONS;
/* read the header and turn on compression for the rest of the file */
mame_fcompress(file, FCOMPRESS_NONE);
mame_fseek(file, 0, SEEK_SET);
if (mame_fread(file, header, sizeof(header)) != sizeof(header))
return STATERR_READ_ERROR;
mame_fcompress(file, FCOMPRESS_MEDIUM);
/* verify the header and report an error if it doesn't match */
if (validate_header(header, machine->gamedrv->name, signature, popmessage, "Error: ") != STATERR_NONE)
return STATERR_INVALID_HEADER;
/* determine whether or not to flip the data when done */
flip = NATIVE_ENDIAN_VALUE_LE_BE((header[9] & SS_MSB_FIRST) != 0, (header[9] & SS_MSB_FIRST) == 0);
/* read all the data, flipping if necessary */
for (entry = global->entrylist; entry != NULL; entry = entry->next)
{
UINT32 totalsize = entry->typesize * entry->typecount;
if (mame_fread(file, entry->data, totalsize) != totalsize)
return STATERR_READ_ERROR;
/* handle flipping */
if (flip)
flip_data(entry);
}
/* call the post-load functions */
for (func = global->postfunclist; func != NULL; func = func->next)
(*func->func.postload)(machine, func->param);
return STATERR_NONE;
} | /*-------------------------------------------------
state_save_read_file - read the data from a
file
-------------------------------------------------*/ | read the data from a
file | [
"read",
"the",
"data",
"from",
"a",
"file"
] | state_save_error state_save_read_file(running_machine *machine, mame_file *file)
{
state_private *global = machine->state_data;
UINT32 signature = get_signature(machine);
UINT8 header[HEADER_SIZE];
state_callback *func;
state_entry *entry;
int flip;
if (global->illegal_regs > 0)
return STATERR_ILLEGAL_REGISTRATIONS;
mame_fcompress(file, FCOMPRESS_NONE);
mame_fseek(file, 0, SEEK_SET);
if (mame_fread(file, header, sizeof(header)) != sizeof(header))
return STATERR_READ_ERROR;
mame_fcompress(file, FCOMPRESS_MEDIUM);
if (validate_header(header, machine->gamedrv->name, signature, popmessage, "Error: ") != STATERR_NONE)
return STATERR_INVALID_HEADER;
flip = NATIVE_ENDIAN_VALUE_LE_BE((header[9] & SS_MSB_FIRST) != 0, (header[9] & SS_MSB_FIRST) == 0);
for (entry = global->entrylist; entry != NULL; entry = entry->next)
{
UINT32 totalsize = entry->typesize * entry->typecount;
if (mame_fread(file, entry->data, totalsize) != totalsize)
return STATERR_READ_ERROR;
if (flip)
flip_data(entry);
}
for (func = global->postfunclist; func != NULL; func = func->next)
(*func->func.postload)(machine, func->param);
return STATERR_NONE;
} | [
"state_save_error",
"state_save_read_file",
"(",
"running_machine",
"*",
"machine",
",",
"mame_file",
"*",
"file",
")",
"{",
"state_private",
"*",
"global",
"=",
"machine",
"->",
"state_data",
";",
"UINT32",
"signature",
"=",
"get_signature",
"(",
"machine",
")",
";",
"UINT8",
"header",
"[",
"HEADER_SIZE",
"]",
";",
"state_callback",
"*",
"func",
";",
"state_entry",
"*",
"entry",
";",
"int",
"flip",
";",
"if",
"(",
"global",
"->",
"illegal_regs",
">",
"0",
")",
"return",
"STATERR_ILLEGAL_REGISTRATIONS",
";",
"mame_fcompress",
"(",
"file",
",",
"FCOMPRESS_NONE",
")",
";",
"mame_fseek",
"(",
"file",
",",
"0",
",",
"SEEK_SET",
")",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"header",
",",
"sizeof",
"(",
"header",
")",
")",
"!=",
"sizeof",
"(",
"header",
")",
")",
"return",
"STATERR_READ_ERROR",
";",
"mame_fcompress",
"(",
"file",
",",
"FCOMPRESS_MEDIUM",
")",
";",
"if",
"(",
"validate_header",
"(",
"header",
",",
"machine",
"->",
"gamedrv",
"->",
"name",
",",
"signature",
",",
"popmessage",
",",
"\"",
"\"",
")",
"!=",
"STATERR_NONE",
")",
"return",
"STATERR_INVALID_HEADER",
";",
"flip",
"=",
"NATIVE_ENDIAN_VALUE_LE_BE",
"(",
"(",
"header",
"[",
"9",
"]",
"&",
"SS_MSB_FIRST",
")",
"!=",
"0",
",",
"(",
"header",
"[",
"9",
"]",
"&",
"SS_MSB_FIRST",
")",
"==",
"0",
")",
";",
"for",
"(",
"entry",
"=",
"global",
"->",
"entrylist",
";",
"entry",
"!=",
"NULL",
";",
"entry",
"=",
"entry",
"->",
"next",
")",
"{",
"UINT32",
"totalsize",
"=",
"entry",
"->",
"typesize",
"*",
"entry",
"->",
"typecount",
";",
"if",
"(",
"mame_fread",
"(",
"file",
",",
"entry",
"->",
"data",
",",
"totalsize",
")",
"!=",
"totalsize",
")",
"return",
"STATERR_READ_ERROR",
";",
"if",
"(",
"flip",
")",
"flip_data",
"(",
"entry",
")",
";",
"}",
"for",
"(",
"func",
"=",
"global",
"->",
"postfunclist",
";",
"func",
"!=",
"NULL",
";",
"func",
"=",
"func",
"->",
"next",
")",
"(",
"*",
"func",
"->",
"func",
".",
"postload",
")",
"(",
"machine",
",",
"func",
"->",
"param",
")",
";",
"return",
"STATERR_NONE",
";",
"}"
] | state_save_read_file - read the data from a
file | [
"state_save_read_file",
"-",
"read",
"the",
"data",
"from",
"a",
"file"
] | [
"/* if we have illegal registrations, return an error */",
"/* read the header and turn on compression for the rest of the file */",
"/* verify the header and report an error if it doesn't match */",
"/* determine whether or not to flip the data when done */",
"/* read all the data, flipping if necessary */",
"/* handle flipping */",
"/* call the post-load functions */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "file",
"type": "mame_file"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": "mame_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c408a4e0b863227558c065b32762f20458a6646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/state.c | [
"Unlicense"
] | C | state_save_get_indexed_item | char | const char *state_save_get_indexed_item(running_machine *machine, int index, void **base, UINT32 *valsize, UINT32 *valcount)
{
state_private *global = machine->state_data;
state_entry *ss;
for (ss = global->entrylist; ss != NULL; ss = ss->next)
if (index-- == 0)
{
if (base != NULL)
*base = ss->data;
if (valsize != NULL)
*valsize = ss->typesize;
if (valcount != NULL)
*valcount = ss->typecount;
return astring_c(ss->name);
}
return NULL;
} | /*-------------------------------------------------
state_save_get_indexed_item - return an item
with the given index
-------------------------------------------------*/ | return an item
with the given index | [
"return",
"an",
"item",
"with",
"the",
"given",
"index"
] | const char *state_save_get_indexed_item(running_machine *machine, int index, void **base, UINT32 *valsize, UINT32 *valcount)
{
state_private *global = machine->state_data;
state_entry *ss;
for (ss = global->entrylist; ss != NULL; ss = ss->next)
if (index-- == 0)
{
if (base != NULL)
*base = ss->data;
if (valsize != NULL)
*valsize = ss->typesize;
if (valcount != NULL)
*valcount = ss->typecount;
return astring_c(ss->name);
}
return NULL;
} | [
"const",
"char",
"*",
"state_save_get_indexed_item",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"index",
",",
"void",
"*",
"*",
"base",
",",
"UINT32",
"*",
"valsize",
",",
"UINT32",
"*",
"valcount",
")",
"{",
"state_private",
"*",
"global",
"=",
"machine",
"->",
"state_data",
";",
"state_entry",
"*",
"ss",
";",
"for",
"(",
"ss",
"=",
"global",
"->",
"entrylist",
";",
"ss",
"!=",
"NULL",
";",
"ss",
"=",
"ss",
"->",
"next",
")",
"if",
"(",
"index",
"--",
"==",
"0",
")",
"{",
"if",
"(",
"base",
"!=",
"NULL",
")",
"*",
"base",
"=",
"ss",
"->",
"data",
";",
"if",
"(",
"valsize",
"!=",
"NULL",
")",
"*",
"valsize",
"=",
"ss",
"->",
"typesize",
";",
"if",
"(",
"valcount",
"!=",
"NULL",
")",
"*",
"valcount",
"=",
"ss",
"->",
"typecount",
";",
"return",
"astring_c",
"(",
"ss",
"->",
"name",
")",
";",
"}",
"return",
"NULL",
";",
"}"
] | state_save_get_indexed_item - return an item
with the given index | [
"state_save_get_indexed_item",
"-",
"return",
"an",
"item",
"with",
"the",
"given",
"index"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "index",
"type": "int"
},
{
"param": "base",
"type": "void"
},
{
"param": "valsize",
"type": "UINT32"
},
{
"param": "valcount",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "base",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "valsize",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "valcount",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c408a4e0b863227558c065b32762f20458a6646 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/state.c | [
"Unlicense"
] | C | state_save_dump_registry | void | void state_save_dump_registry(running_machine *machine)
{
state_private *global = machine->state_data;
state_entry *entry;
for (entry = global->entrylist; entry; entry=entry->next)
LOG(("%s: %d x %d\n", astring_c(entry->name), entry->typesize, entry->typecount));
} | /*-------------------------------------------------
state_save_dump_registry - dump the registry
to the logfile
-------------------------------------------------*/ | dump the registry
to the logfile | [
"dump",
"the",
"registry",
"to",
"the",
"logfile"
] | void state_save_dump_registry(running_machine *machine)
{
state_private *global = machine->state_data;
state_entry *entry;
for (entry = global->entrylist; entry; entry=entry->next)
LOG(("%s: %d x %d\n", astring_c(entry->name), entry->typesize, entry->typecount));
} | [
"void",
"state_save_dump_registry",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"state_private",
"*",
"global",
"=",
"machine",
"->",
"state_data",
";",
"state_entry",
"*",
"entry",
";",
"for",
"(",
"entry",
"=",
"global",
"->",
"entrylist",
";",
"entry",
";",
"entry",
"=",
"entry",
"->",
"next",
")",
"LOG",
"(",
"(",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"entry",
"->",
"name",
")",
",",
"entry",
"->",
"typesize",
",",
"entry",
"->",
"typecount",
")",
")",
";",
"}"
] | state_save_dump_registry - dump the registry
to the logfile | [
"state_save_dump_registry",
"-",
"dump",
"the",
"registry",
"to",
"the",
"logfile"
] | [] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
67f47efc559e3de068e2060748a26a3ec21f16e1 | lofunz/mieme | Reloaded/trunk/src/mame/video/suprnova.c | [
"Unlicense"
] | C | suprnova_draw_roz | void | static void suprnova_draw_roz(bitmap_t* bitmap, bitmap_t* bitmapflags, const rectangle *cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound, int columnscroll, UINT32* scrollram)
{
//bitmap_t *destbitmap = bitmap;
bitmap_t *srcbitmap = tilemap_get_pixmap(tmap);
bitmap_t *srcbitmapflags = tilemap_get_flagsmap(tmap);
const int xmask = srcbitmap->width-1;
const int ymask = srcbitmap->height-1;
const int widthshifted = srcbitmap->width << 16;
const int heightshifted = srcbitmap->height << 16;
UINT32 cx;
UINT32 cy;
int x;
int sx;
int sy;
int ex;
int ey;
UINT16 *dest;
UINT8* destflags;
// UINT8 *pri;
//const UINT16 *src;
//const UINT8 *maskptr;
//int destadvance = destbitmap->bpp / 8;
/* pre-advance based on the cliprect */
startx += cliprect->min_x * incxx + cliprect->min_y * incyx;
starty += cliprect->min_x * incxy + cliprect->min_y * incyy;
/* extract start/end points */
sx = cliprect->min_x;
sy = cliprect->min_y;
ex = cliprect->max_x;
ey = cliprect->max_y;
{
/* loop over rows */
while (sy <= ey)
{
/* initialize X counters */
x = sx;
cx = startx;
cy = starty;
/* get dest and priority pointers */
dest = BITMAP_ADDR16( bitmap, sy, sx);
destflags = BITMAP_ADDR8( bitmapflags, sy, sx);
/* loop over columns */
while (x <= ex)
{
if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll..
{
if (columnscroll)
{
dest[0] = BITMAP_ADDR16(srcbitmap, ((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask)[0];
destflags[0] = BITMAP_ADDR8(srcbitmapflags, ((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask)[0];
}
else
{
dest[0] = BITMAP_ADDR16(srcbitmap, (cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask)[0];
destflags[0] = BITMAP_ADDR8(srcbitmapflags, (cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask)[0];
}
}
/* advance in X */
cx += incxx;
cy += incxy;
x++;
dest++;
destflags++;
// pri++;
}
/* advance in Y */
startx += incyx;
starty += incyy;
sy++;
}
}
} | /* draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap */ | draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap | [
"draws",
"ROZ",
"with",
"linescroll",
"OR",
"columnscroll",
"to",
"16",
"-",
"bit",
"indexed",
"bitmap"
] | static void suprnova_draw_roz(bitmap_t* bitmap, bitmap_t* bitmapflags, const rectangle *cliprect, tilemap_t *tmap, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, int wraparound, int columnscroll, UINT32* scrollram)
{
bitmap_t *srcbitmap = tilemap_get_pixmap(tmap);
bitmap_t *srcbitmapflags = tilemap_get_flagsmap(tmap);
const int xmask = srcbitmap->width-1;
const int ymask = srcbitmap->height-1;
const int widthshifted = srcbitmap->width << 16;
const int heightshifted = srcbitmap->height << 16;
UINT32 cx;
UINT32 cy;
int x;
int sx;
int sy;
int ex;
int ey;
UINT16 *dest;
UINT8* destflags;
startx += cliprect->min_x * incxx + cliprect->min_y * incyx;
starty += cliprect->min_x * incxy + cliprect->min_y * incyy;
sx = cliprect->min_x;
sy = cliprect->min_y;
ex = cliprect->max_x;
ey = cliprect->max_y;
{
while (sy <= ey)
{
x = sx;
cx = startx;
cy = starty;
dest = BITMAP_ADDR16( bitmap, sy, sx);
destflags = BITMAP_ADDR8( bitmapflags, sy, sx);
while (x <= ex)
{
if ((wraparound) || (cx < widthshifted && cy < heightshifted))
{
if (columnscroll)
{
dest[0] = BITMAP_ADDR16(srcbitmap, ((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask)[0];
destflags[0] = BITMAP_ADDR8(srcbitmapflags, ((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask)[0];
}
else
{
dest[0] = BITMAP_ADDR16(srcbitmap, (cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask)[0];
destflags[0] = BITMAP_ADDR8(srcbitmapflags, (cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask)[0];
}
}
cx += incxx;
cy += incxy;
x++;
dest++;
destflags++;
}
startx += incyx;
starty += incyy;
sy++;
}
}
} | [
"static",
"void",
"suprnova_draw_roz",
"(",
"bitmap_t",
"*",
"bitmap",
",",
"bitmap_t",
"*",
"bitmapflags",
",",
"const",
"rectangle",
"*",
"cliprect",
",",
"tilemap_t",
"*",
"tmap",
",",
"UINT32",
"startx",
",",
"UINT32",
"starty",
",",
"int",
"incxx",
",",
"int",
"incxy",
",",
"int",
"incyx",
",",
"int",
"incyy",
",",
"int",
"wraparound",
",",
"int",
"columnscroll",
",",
"UINT32",
"*",
"scrollram",
")",
"{",
"bitmap_t",
"*",
"srcbitmap",
"=",
"tilemap_get_pixmap",
"(",
"tmap",
")",
";",
"bitmap_t",
"*",
"srcbitmapflags",
"=",
"tilemap_get_flagsmap",
"(",
"tmap",
")",
";",
"const",
"int",
"xmask",
"=",
"srcbitmap",
"->",
"width",
"-",
"1",
";",
"const",
"int",
"ymask",
"=",
"srcbitmap",
"->",
"height",
"-",
"1",
";",
"const",
"int",
"widthshifted",
"=",
"srcbitmap",
"->",
"width",
"<<",
"16",
";",
"const",
"int",
"heightshifted",
"=",
"srcbitmap",
"->",
"height",
"<<",
"16",
";",
"UINT32",
"cx",
";",
"UINT32",
"cy",
";",
"int",
"x",
";",
"int",
"sx",
";",
"int",
"sy",
";",
"int",
"ex",
";",
"int",
"ey",
";",
"UINT16",
"*",
"dest",
";",
"UINT8",
"*",
"destflags",
";",
"startx",
"+=",
"cliprect",
"->",
"min_x",
"*",
"incxx",
"+",
"cliprect",
"->",
"min_y",
"*",
"incyx",
";",
"starty",
"+=",
"cliprect",
"->",
"min_x",
"*",
"incxy",
"+",
"cliprect",
"->",
"min_y",
"*",
"incyy",
";",
"sx",
"=",
"cliprect",
"->",
"min_x",
";",
"sy",
"=",
"cliprect",
"->",
"min_y",
";",
"ex",
"=",
"cliprect",
"->",
"max_x",
";",
"ey",
"=",
"cliprect",
"->",
"max_y",
";",
"{",
"while",
"(",
"sy",
"<=",
"ey",
")",
"{",
"x",
"=",
"sx",
";",
"cx",
"=",
"startx",
";",
"cy",
"=",
"starty",
";",
"dest",
"=",
"BITMAP_ADDR16",
"(",
"bitmap",
",",
"sy",
",",
"sx",
")",
";",
"destflags",
"=",
"BITMAP_ADDR8",
"(",
"bitmapflags",
",",
"sy",
",",
"sx",
")",
";",
"while",
"(",
"x",
"<=",
"ex",
")",
"{",
"if",
"(",
"(",
"wraparound",
")",
"||",
"(",
"cx",
"<",
"widthshifted",
"&&",
"cy",
"<",
"heightshifted",
")",
")",
"{",
"if",
"(",
"columnscroll",
")",
"{",
"dest",
"[",
"0",
"]",
"=",
"BITMAP_ADDR16",
"(",
"srcbitmap",
",",
"(",
"(",
"cy",
">>",
"16",
")",
"-",
"scrollram",
"[",
"(",
"cx",
">>",
"16",
")",
"&",
"0x3ff",
"]",
")",
"&",
"ymask",
",",
"(",
"cx",
">>",
"16",
")",
"&",
"xmask",
")",
"[",
"0",
"]",
";",
"destflags",
"[",
"0",
"]",
"=",
"BITMAP_ADDR8",
"(",
"srcbitmapflags",
",",
"(",
"(",
"cy",
">>",
"16",
")",
"-",
"scrollram",
"[",
"(",
"cx",
">>",
"16",
")",
"&",
"0x3ff",
"]",
")",
"&",
"ymask",
",",
"(",
"cx",
">>",
"16",
")",
"&",
"xmask",
")",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"dest",
"[",
"0",
"]",
"=",
"BITMAP_ADDR16",
"(",
"srcbitmap",
",",
"(",
"cy",
">>",
"16",
")",
"&",
"ymask",
",",
"(",
"(",
"cx",
">>",
"16",
")",
"-",
"scrollram",
"[",
"(",
"cy",
">>",
"16",
")",
"&",
"0x3ff",
"]",
")",
"&",
"xmask",
")",
"[",
"0",
"]",
";",
"destflags",
"[",
"0",
"]",
"=",
"BITMAP_ADDR8",
"(",
"srcbitmapflags",
",",
"(",
"cy",
">>",
"16",
")",
"&",
"ymask",
",",
"(",
"(",
"cx",
">>",
"16",
")",
"-",
"scrollram",
"[",
"(",
"cy",
">>",
"16",
")",
"&",
"0x3ff",
"]",
")",
"&",
"xmask",
")",
"[",
"0",
"]",
";",
"}",
"}",
"cx",
"+=",
"incxx",
";",
"cy",
"+=",
"incxy",
";",
"x",
"++",
";",
"dest",
"++",
";",
"destflags",
"++",
";",
"}",
"startx",
"+=",
"incyx",
";",
"starty",
"+=",
"incyy",
";",
"sy",
"++",
";",
"}",
"}",
"}"
] | draws ROZ with linescroll OR columnscroll to 16-bit indexed bitmap | [
"draws",
"ROZ",
"with",
"linescroll",
"OR",
"columnscroll",
"to",
"16",
"-",
"bit",
"indexed",
"bitmap"
] | [
"//bitmap_t *destbitmap = bitmap;\r",
"// UINT8 *pri;\r",
"//const UINT16 *src;\r",
"//const UINT8 *maskptr;\r",
"//int destadvance = destbitmap->bpp / 8;\r",
"/* pre-advance based on the cliprect */",
"/* extract start/end points */",
"/* loop over rows */",
"/* initialize X counters */",
"/* get dest and priority pointers */",
"/* loop over columns */",
"// not sure how this will cope with no wraparound, but row/col scroll..\r",
"/* advance in X */",
"// pri++;\r",
"/* advance in Y */"
] | [
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "bitmapflags",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
},
{
"param": "tmap",
"type": "tilemap_t"
},
{
"param": "startx",
"type": "UINT32"
},
{
"param": "starty",
"type": "UINT32"
},
{
"param": "incxx",
"type": "int"
},
{
"param": "incxy",
"type": "int"
},
{
"param": "incyx",
"type": "int"
},
{
"param": "incyy",
"type": "int"
},
{
"param": "wraparound",
"type": "int"
},
{
"param": "columnscroll",
"type": "int"
},
{
"param": "scrollram",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmapflags",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tmap",
"type": "tilemap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "startx",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "starty",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incxx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incxy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incyx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "incyy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wraparound",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "columnscroll",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scrollram",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | LXI_S_w | void | static void LXI_S_w(upd7810_state *cpustate)
{
RDOPARG( SPL );
RDOPARG( SPH );
} | /* 04: 0000 0100 llll llll hhhh hhhh */ | 0000 0100 llll llll hhhh hhhh | [
"0000",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | static void LXI_S_w(upd7810_state *cpustate)
{
RDOPARG( SPL );
RDOPARG( SPH );
} | [
"static",
"void",
"LXI_S_w",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"RDOPARG",
"(",
"SPL",
")",
";",
"RDOPARG",
"(",
"SPH",
")",
";",
"}"
] | 04: 0000 0100 llll llll hhhh hhhh | [
"04",
":",
"0000",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | ANIW_wa_xx | void | static void ANIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
m &= imm;
WM( ea.d, m );
SET_Z(m);
} | /* 05: 0000 0101 oooo oooo xxxx xxxx */ | 0000 0101 oooo oooo xxxx xxxx | [
"0000",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | static void ANIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
m &= imm;
WM( ea.d, m );
SET_Z(m);
} | [
"static",
"void",
"ANIW_wa_xx",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"ea",
"=",
"cpustate",
"->",
"va",
";",
"UINT8",
"m",
",",
"imm",
";",
"RDOPARG",
"(",
"ea",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"imm",
")",
";",
"m",
"=",
"RM",
"(",
"ea",
".",
"d",
")",
";",
"m",
"&=",
"imm",
";",
"WM",
"(",
"ea",
".",
"d",
",",
"m",
")",
";",
"SET_Z",
"(",
"m",
")",
";",
"}"
] | 05: 0000 0101 oooo oooo xxxx xxxx | [
"05",
":",
"0000",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | LXI_B_w | void | static void LXI_B_w(upd7810_state *cpustate)
{
RDOPARG( C );
RDOPARG( B );
} | /* 14: 0001 0100 llll llll hhhh hhhh */ | 0001 0100 llll llll hhhh hhhh | [
"0001",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | static void LXI_B_w(upd7810_state *cpustate)
{
RDOPARG( C );
RDOPARG( B );
} | [
"static",
"void",
"LXI_B_w",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"RDOPARG",
"(",
"C",
")",
";",
"RDOPARG",
"(",
"B",
")",
";",
"}"
] | 14: 0001 0100 llll llll hhhh hhhh | [
"14",
":",
"0001",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | ORIW_wa_xx | void | static void ORIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
m |= imm;
WM( ea.d, m );
SET_Z(m);
} | /* 15: 0001 0101 oooo oooo xxxx xxxx */ | 0001 0101 oooo oooo xxxx xxxx | [
"0001",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | static void ORIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
m |= imm;
WM( ea.d, m );
SET_Z(m);
} | [
"static",
"void",
"ORIW_wa_xx",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"ea",
"=",
"cpustate",
"->",
"va",
";",
"UINT8",
"m",
",",
"imm",
";",
"RDOPARG",
"(",
"ea",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"imm",
")",
";",
"m",
"=",
"RM",
"(",
"ea",
".",
"d",
")",
";",
"m",
"|=",
"imm",
";",
"WM",
"(",
"ea",
".",
"d",
",",
"m",
")",
";",
"SET_Z",
"(",
"m",
")",
";",
"}"
] | 15: 0001 0101 oooo oooo xxxx xxxx | [
"15",
":",
"0001",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | LXI_D_w | void | static void LXI_D_w(upd7810_state *cpustate)
{
RDOPARG( E );
RDOPARG( D );
} | /* 24: 0010 0100 llll llll hhhh hhhh */ | 0010 0100 llll llll hhhh hhhh | [
"0010",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | static void LXI_D_w(upd7810_state *cpustate)
{
RDOPARG( E );
RDOPARG( D );
} | [
"static",
"void",
"LXI_D_w",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"RDOPARG",
"(",
"E",
")",
";",
"RDOPARG",
"(",
"D",
")",
";",
"}"
] | 24: 0010 0100 llll llll hhhh hhhh | [
"24",
":",
"0010",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | GTIW_wa_xx | void | static void GTIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 m, imm;
UINT16 tmp;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
tmp = m - imm - 1;
ZHC_SUB( tmp, m, 0 );
SKIP_NC;
} | /* 25: 0010 0101 oooo oooo xxxx xxxx */ | 0010 0101 oooo oooo xxxx xxxx | [
"0010",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | static void GTIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 m, imm;
UINT16 tmp;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
tmp = m - imm - 1;
ZHC_SUB( tmp, m, 0 );
SKIP_NC;
} | [
"static",
"void",
"GTIW_wa_xx",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"ea",
"=",
"cpustate",
"->",
"va",
";",
"UINT8",
"m",
",",
"imm",
";",
"UINT16",
"tmp",
";",
"RDOPARG",
"(",
"ea",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"imm",
")",
";",
"m",
"=",
"RM",
"(",
"ea",
".",
"d",
")",
";",
"tmp",
"=",
"m",
"-",
"imm",
"-",
"1",
";",
"ZHC_SUB",
"(",
"tmp",
",",
"m",
",",
"0",
")",
";",
"SKIP_NC",
";",
"}"
] | 25: 0010 0101 oooo oooo xxxx xxxx | [
"25",
":",
"0010",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | LXI_H_w | void | static void LXI_H_w(upd7810_state *cpustate)
{
if (PSW & L0) { /* overlay active? */
PC+=2;
return;
}
RDOPARG( L );
RDOPARG( H );
PSW |= L0;
} | /* 34: 0011 0100 llll llll hhhh hhhh */ | 0011 0100 llll llll hhhh hhhh | [
"0011",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | static void LXI_H_w(upd7810_state *cpustate)
{
if (PSW & L0) {
PC+=2;
return;
}
RDOPARG( L );
RDOPARG( H );
PSW |= L0;
} | [
"static",
"void",
"LXI_H_w",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"if",
"(",
"PSW",
"&",
"L0",
")",
"{",
"PC",
"+=",
"2",
";",
"return",
";",
"}",
"RDOPARG",
"(",
"L",
")",
";",
"RDOPARG",
"(",
"H",
")",
";",
"PSW",
"|=",
"L0",
";",
"}"
] | 34: 0011 0100 llll llll hhhh hhhh | [
"34",
":",
"0011",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | [
"/* overlay active? */"
] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | LTIW_wa_xx | void | static void LTIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 tmp, m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
tmp = m - imm;
ZHC_SUB( tmp, m, 0 );
SKIP_CY;
} | /* 35: 0011 0101 oooo oooo xxxx xxxx */ | 0011 0101 oooo oooo xxxx xxxx | [
"0011",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | static void LTIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 tmp, m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
tmp = m - imm;
ZHC_SUB( tmp, m, 0 );
SKIP_CY;
} | [
"static",
"void",
"LTIW_wa_xx",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"ea",
"=",
"cpustate",
"->",
"va",
";",
"UINT8",
"tmp",
",",
"m",
",",
"imm",
";",
"RDOPARG",
"(",
"ea",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"imm",
")",
";",
"m",
"=",
"RM",
"(",
"ea",
".",
"d",
")",
";",
"tmp",
"=",
"m",
"-",
"imm",
";",
"ZHC_SUB",
"(",
"tmp",
",",
"m",
",",
"0",
")",
";",
"SKIP_CY",
";",
"}"
] | 35: 0011 0101 oooo oooo xxxx xxxx | [
"35",
":",
"0011",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | CALL_w | void | static void CALL_w(upd7810_state *cpustate)
{
PAIR w;
w.d = 0;
RDOPARG( w.b.l );
RDOPARG( w.b.h );
SP--;
WM( SPD, PCH );
SP--;
WM( SPD, PCL );
PC = w.w.l;
} | /* 40: 0100 0000 llll llll hhhh hhhh */ | 0100 0000 llll llll hhhh hhhh | [
"0100",
"0000",
"llll",
"llll",
"hhhh",
"hhhh"
] | static void CALL_w(upd7810_state *cpustate)
{
PAIR w;
w.d = 0;
RDOPARG( w.b.l );
RDOPARG( w.b.h );
SP--;
WM( SPD, PCH );
SP--;
WM( SPD, PCL );
PC = w.w.l;
} | [
"static",
"void",
"CALL_w",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"w",
";",
"w",
".",
"d",
"=",
"0",
";",
"RDOPARG",
"(",
"w",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"w",
".",
"b",
".",
"h",
")",
";",
"SP",
"--",
";",
"WM",
"(",
"SPD",
",",
"PCH",
")",
";",
"SP",
"--",
";",
"WM",
"(",
"SPD",
",",
"PCL",
")",
";",
"PC",
"=",
"w",
".",
"w",
".",
"l",
";",
"}"
] | 40: 0100 0000 llll llll hhhh hhhh | [
"40",
":",
"0100",
"0000",
"llll",
"llll",
"hhhh",
"hhhh"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | LXI_EA_s | void | static void LXI_EA_s(upd7810_state *cpustate)
{
RDOPARG( EAL );
RDOPARG( EAH );
} | /* 44: 0100 0100 llll llll hhhh hhhh */ | 0100 0100 llll llll hhhh hhhh | [
"0100",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | static void LXI_EA_s(upd7810_state *cpustate)
{
RDOPARG( EAL );
RDOPARG( EAH );
} | [
"static",
"void",
"LXI_EA_s",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"RDOPARG",
"(",
"EAL",
")",
";",
"RDOPARG",
"(",
"EAH",
")",
";",
"}"
] | 44: 0100 0100 llll llll hhhh hhhh | [
"44",
":",
"0100",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | ONIW_wa_xx | void | static void ONIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
if (RM( ea.d ) & imm)
PSW |= SK;
} | /* 45: 0100 0101 oooo oooo xxxx xxxx */ | 0100 0101 oooo oooo xxxx xxxx | [
"0100",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | static void ONIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
if (RM( ea.d ) & imm)
PSW |= SK;
} | [
"static",
"void",
"ONIW_wa_xx",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"ea",
"=",
"cpustate",
"->",
"va",
";",
"UINT8",
"imm",
";",
"RDOPARG",
"(",
"ea",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"imm",
")",
";",
"if",
"(",
"RM",
"(",
"ea",
".",
"d",
")",
"&",
"imm",
")",
"PSW",
"|=",
"SK",
";",
"}"
] | 45: 0100 0101 oooo oooo xxxx xxxx | [
"45",
":",
"0100",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | JMP_w | void | static void JMP_w(upd7810_state *cpustate)
{
PAIR w;
w.d = 0;
RDOPARG( w.b.l );
RDOPARG( w.b.h );
PCD = w.d;
} | /* 54: 0101 0100 llll llll hhhh hhhh */ | 0101 0100 llll llll hhhh hhhh | [
"0101",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | static void JMP_w(upd7810_state *cpustate)
{
PAIR w;
w.d = 0;
RDOPARG( w.b.l );
RDOPARG( w.b.h );
PCD = w.d;
} | [
"static",
"void",
"JMP_w",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"w",
";",
"w",
".",
"d",
"=",
"0",
";",
"RDOPARG",
"(",
"w",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"w",
".",
"b",
".",
"h",
")",
";",
"PCD",
"=",
"w",
".",
"d",
";",
"}"
] | 54: 0101 0100 llll llll hhhh hhhh | [
"54",
":",
"0101",
"0100",
"llll",
"llll",
"hhhh",
"hhhh"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | OFFIW_wa_xx | void | static void OFFIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
if (0 == (RM( ea.d ) & imm))
PSW |= SK;
} | /* 55: 0101 0101 oooo oooo xxxx xxxx */ | 0101 0101 oooo oooo xxxx xxxx | [
"0101",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | static void OFFIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
if (0 == (RM( ea.d ) & imm))
PSW |= SK;
} | [
"static",
"void",
"OFFIW_wa_xx",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"ea",
"=",
"cpustate",
"->",
"va",
";",
"UINT8",
"imm",
";",
"RDOPARG",
"(",
"ea",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"imm",
")",
";",
"if",
"(",
"0",
"==",
"(",
"RM",
"(",
"ea",
".",
"d",
")",
"&",
"imm",
")",
")",
"PSW",
"|=",
"SK",
";",
"}"
] | 55: 0101 0101 oooo oooo xxxx xxxx | [
"55",
":",
"0101",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | NEIW_wa_xx | void | static void NEIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 tmp, m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
tmp = m - imm;
ZHC_SUB( tmp, m, 0 );
SKIP_NZ;
} | /* 65: 0110 0101 oooo oooo xxxx xxxx */ | 0110 0101 oooo oooo xxxx xxxx | [
"0110",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | static void NEIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 tmp, m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
tmp = m - imm;
ZHC_SUB( tmp, m, 0 );
SKIP_NZ;
} | [
"static",
"void",
"NEIW_wa_xx",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"ea",
"=",
"cpustate",
"->",
"va",
";",
"UINT8",
"tmp",
",",
"m",
",",
"imm",
";",
"RDOPARG",
"(",
"ea",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"imm",
")",
";",
"m",
"=",
"RM",
"(",
"ea",
".",
"d",
")",
";",
"tmp",
"=",
"m",
"-",
"imm",
";",
"ZHC_SUB",
"(",
"tmp",
",",
"m",
",",
"0",
")",
";",
"SKIP_NZ",
";",
"}"
] | 65: 0110 0101 oooo oooo xxxx xxxx | [
"65",
":",
"0110",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | MVIW_wa_xx | void | static void MVIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
WM( ea.d, imm );
} | /* 71: 0111 0001 oooo oooo xxxx xxxx */ | 0111 0001 oooo oooo xxxx xxxx | [
"0111",
"0001",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | static void MVIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
WM( ea.d, imm );
} | [
"static",
"void",
"MVIW_wa_xx",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"ea",
"=",
"cpustate",
"->",
"va",
";",
"UINT8",
"imm",
";",
"RDOPARG",
"(",
"ea",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"imm",
")",
";",
"WM",
"(",
"ea",
".",
"d",
",",
"imm",
")",
";",
"}"
] | 71: 0111 0001 oooo oooo xxxx xxxx | [
"71",
":",
"0111",
"0001",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | EQIW_wa_xx | void | static void EQIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 tmp, m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
tmp = m - imm;
ZHC_SUB( tmp, m, 0 );
SKIP_Z;
} | /* 75: 0111 0101 oooo oooo xxxx xxxx */ | 0111 0101 oooo oooo xxxx xxxx | [
"0111",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | static void EQIW_wa_xx(upd7810_state *cpustate)
{
PAIR ea = cpustate->va;
UINT8 tmp, m, imm;
RDOPARG( ea.b.l );
RDOPARG( imm );
m = RM( ea.d );
tmp = m - imm;
ZHC_SUB( tmp, m, 0 );
SKIP_Z;
} | [
"static",
"void",
"EQIW_wa_xx",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"PAIR",
"ea",
"=",
"cpustate",
"->",
"va",
";",
"UINT8",
"tmp",
",",
"m",
",",
"imm",
";",
"RDOPARG",
"(",
"ea",
".",
"b",
".",
"l",
")",
";",
"RDOPARG",
"(",
"imm",
")",
";",
"m",
"=",
"RM",
"(",
"ea",
".",
"d",
")",
";",
"tmp",
"=",
"m",
"-",
"imm",
";",
"ZHC_SUB",
"(",
"tmp",
",",
"m",
",",
"0",
")",
";",
"SKIP_Z",
";",
"}"
] | 75: 0111 0101 oooo oooo xxxx xxxx | [
"75",
":",
"0111",
"0101",
"oooo",
"oooo",
"xxxx",
"xxxx"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a6d9ba3962b2af526fd9668906976a2145588c7f | lofunz/mieme | Reloaded/trunk/src/emu/cpu/upd7810/7810ops.c | [
"Unlicense"
] | C | DCR_A_7801 | void | static void DCR_A_7801(upd7810_state *cpustate)
{
UINT32 old_CY = PSW & CY;
DCR_A(cpustate);
PSW = ( PSW & ~CY ) | old_CY;
} | /* DCR(W) and INR(W) instructions do not modify the CY register on at least 78c05 and 78c06 */ | DCR(W) and INR(W) instructions do not modify the CY register on at least 78c05 and 78c06 | [
"DCR",
"(",
"W",
")",
"and",
"INR",
"(",
"W",
")",
"instructions",
"do",
"not",
"modify",
"the",
"CY",
"register",
"on",
"at",
"least",
"78c05",
"and",
"78c06"
] | static void DCR_A_7801(upd7810_state *cpustate)
{
UINT32 old_CY = PSW & CY;
DCR_A(cpustate);
PSW = ( PSW & ~CY ) | old_CY;
} | [
"static",
"void",
"DCR_A_7801",
"(",
"upd7810_state",
"*",
"cpustate",
")",
"{",
"UINT32",
"old_CY",
"=",
"PSW",
"&",
"CY",
";",
"DCR_A",
"(",
"cpustate",
")",
";",
"PSW",
"=",
"(",
"PSW",
"&",
"~",
"CY",
")",
"|",
"old_CY",
";",
"}"
] | DCR(W) and INR(W) instructions do not modify the CY register on at least 78c05 and 78c06 | [
"DCR",
"(",
"W",
")",
"and",
"INR",
"(",
"W",
")",
"instructions",
"do",
"not",
"modify",
"the",
"CY",
"register",
"on",
"at",
"least",
"78c05",
"and",
"78c06"
] | [] | [
{
"param": "cpustate",
"type": "upd7810_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "upd7810_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7b96301ffb67c4df80df3ba3c98e3547afa9e4aa | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/machine/6850acia.c | [
"Unlicense"
] | C | acia6850_tx_clock_in | void | void acia6850_tx_clock_in(const device_config *device)
{
acia6850_t *acia_p = get_token(device);
int cts = devcb_call_read_line(&acia_p->in_cts_func);
if (cts)
{
acia_p->status |= ACIA6850_STATUS_CTS;
}
else
{
acia_p->status &= ~ACIA6850_STATUS_CTS;
}
acia_p->tx_counter ++;
if ( acia_p->tx_counter > acia_p->divide-1)
{
tx_tick(device);
acia_p->tx_counter = 0;
}
} | /*-------------------------------------------------
acia6850_tx_clock_in - As above, but using the tx pin
-------------------------------------------------*/ | As above, but using the tx pin | [
"As",
"above",
"but",
"using",
"the",
"tx",
"pin"
] | void acia6850_tx_clock_in(const device_config *device)
{
acia6850_t *acia_p = get_token(device);
int cts = devcb_call_read_line(&acia_p->in_cts_func);
if (cts)
{
acia_p->status |= ACIA6850_STATUS_CTS;
}
else
{
acia_p->status &= ~ACIA6850_STATUS_CTS;
}
acia_p->tx_counter ++;
if ( acia_p->tx_counter > acia_p->divide-1)
{
tx_tick(device);
acia_p->tx_counter = 0;
}
} | [
"void",
"acia6850_tx_clock_in",
"(",
"const",
"device_config",
"*",
"device",
")",
"{",
"acia6850_t",
"*",
"acia_p",
"=",
"get_token",
"(",
"device",
")",
";",
"int",
"cts",
"=",
"devcb_call_read_line",
"(",
"&",
"acia_p",
"->",
"in_cts_func",
")",
";",
"if",
"(",
"cts",
")",
"{",
"acia_p",
"->",
"status",
"|=",
"ACIA6850_STATUS_CTS",
";",
"}",
"else",
"{",
"acia_p",
"->",
"status",
"&=",
"~",
"ACIA6850_STATUS_CTS",
";",
"}",
"acia_p",
"->",
"tx_counter",
"++",
";",
"if",
"(",
"acia_p",
"->",
"tx_counter",
">",
"acia_p",
"->",
"divide",
"-",
"1",
")",
"{",
"tx_tick",
"(",
"device",
")",
";",
"acia_p",
"->",
"tx_counter",
"=",
"0",
";",
"}",
"}"
] | acia6850_tx_clock_in - As above, but using the tx pin | [
"acia6850_tx_clock_in",
"-",
"As",
"above",
"but",
"using",
"the",
"tx",
"pin"
] | [] | [
{
"param": "device",
"type": "device_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7b96301ffb67c4df80df3ba3c98e3547afa9e4aa | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/machine/6850acia.c | [
"Unlicense"
] | C | acia6850_rx_clock_in | void | void acia6850_rx_clock_in(const device_config *device)
{
acia6850_t *acia_p = get_token(device);
int dcd = devcb_call_read_line(&acia_p->in_dcd_func);
if (dcd)
{
acia_p->status |= ACIA6850_STATUS_DCD;
acia6850_check_interrupts(device);
}
else if ((acia_p->status & (ACIA6850_STATUS_DCD|ACIA6850_STATUS_IRQ)) == ACIA6850_STATUS_DCD)
{
acia_p->status &= ~ACIA6850_STATUS_DCD;
}
acia_p->rx_counter ++;
if ( acia_p->rx_counter > acia_p->divide-1)
{
rx_tick(device);
acia_p->rx_counter = 0;
}
} | /*-------------------------------------------------
acia6850_rx_clock_in - As above, but using the rx pin
-------------------------------------------------*/ | As above, but using the rx pin | [
"As",
"above",
"but",
"using",
"the",
"rx",
"pin"
] | void acia6850_rx_clock_in(const device_config *device)
{
acia6850_t *acia_p = get_token(device);
int dcd = devcb_call_read_line(&acia_p->in_dcd_func);
if (dcd)
{
acia_p->status |= ACIA6850_STATUS_DCD;
acia6850_check_interrupts(device);
}
else if ((acia_p->status & (ACIA6850_STATUS_DCD|ACIA6850_STATUS_IRQ)) == ACIA6850_STATUS_DCD)
{
acia_p->status &= ~ACIA6850_STATUS_DCD;
}
acia_p->rx_counter ++;
if ( acia_p->rx_counter > acia_p->divide-1)
{
rx_tick(device);
acia_p->rx_counter = 0;
}
} | [
"void",
"acia6850_rx_clock_in",
"(",
"const",
"device_config",
"*",
"device",
")",
"{",
"acia6850_t",
"*",
"acia_p",
"=",
"get_token",
"(",
"device",
")",
";",
"int",
"dcd",
"=",
"devcb_call_read_line",
"(",
"&",
"acia_p",
"->",
"in_dcd_func",
")",
";",
"if",
"(",
"dcd",
")",
"{",
"acia_p",
"->",
"status",
"|=",
"ACIA6850_STATUS_DCD",
";",
"acia6850_check_interrupts",
"(",
"device",
")",
";",
"}",
"else",
"if",
"(",
"(",
"acia_p",
"->",
"status",
"&",
"(",
"ACIA6850_STATUS_DCD",
"|",
"ACIA6850_STATUS_IRQ",
")",
")",
"==",
"ACIA6850_STATUS_DCD",
")",
"{",
"acia_p",
"->",
"status",
"&=",
"~",
"ACIA6850_STATUS_DCD",
";",
"}",
"acia_p",
"->",
"rx_counter",
"++",
";",
"if",
"(",
"acia_p",
"->",
"rx_counter",
">",
"acia_p",
"->",
"divide",
"-",
"1",
")",
"{",
"rx_tick",
"(",
"device",
")",
";",
"acia_p",
"->",
"rx_counter",
"=",
"0",
";",
"}",
"}"
] | acia6850_rx_clock_in - As above, but using the rx pin | [
"acia6850_rx_clock_in",
"-",
"As",
"above",
"but",
"using",
"the",
"rx",
"pin"
] | [] | [
{
"param": "device",
"type": "device_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18dcbac9d0506bbfdcc031097132376d58f421ff | lofunz/mieme | Reloaded/trunk/src/emu/cpu/pic16c62x/pic16c62x.c | [
"Unlicense"
] | C | pic16c62x_reset_regs | void | static void pic16c62x_reset_regs(pic16c62x_state *cpustate)
{
cpustate->PC = cpustate->reset_vector;
cpustate->TRISA = 0x1f;
cpustate->TRISB = 0xff;
cpustate->OPTION = 0xff;
cpustate->STATUS = 0x18;
cpustate->PCL = 0;
cpustate->FSR |= (UINT8)(~cpustate->picRAMmask);
cpustate->PORTA = 0;
cpustate->prescaler = 0;
cpustate->delay_timer = 0;
cpustate->old_T0 = 0;
cpustate->inst_cycles = 0;
PIC16C62x_RAM_WRMEM(0x85,cpustate->TRISA);
PIC16C62x_RAM_WRMEM(0x86,cpustate->TRISB);
PIC16C62x_RAM_WRMEM(0x81,cpustate->OPTION);
} | /****************************************************************************
* Reset registers to their initial values
****************************************************************************/ | Reset registers to their initial values | [
"Reset",
"registers",
"to",
"their",
"initial",
"values"
] | static void pic16c62x_reset_regs(pic16c62x_state *cpustate)
{
cpustate->PC = cpustate->reset_vector;
cpustate->TRISA = 0x1f;
cpustate->TRISB = 0xff;
cpustate->OPTION = 0xff;
cpustate->STATUS = 0x18;
cpustate->PCL = 0;
cpustate->FSR |= (UINT8)(~cpustate->picRAMmask);
cpustate->PORTA = 0;
cpustate->prescaler = 0;
cpustate->delay_timer = 0;
cpustate->old_T0 = 0;
cpustate->inst_cycles = 0;
PIC16C62x_RAM_WRMEM(0x85,cpustate->TRISA);
PIC16C62x_RAM_WRMEM(0x86,cpustate->TRISB);
PIC16C62x_RAM_WRMEM(0x81,cpustate->OPTION);
} | [
"static",
"void",
"pic16c62x_reset_regs",
"(",
"pic16c62x_state",
"*",
"cpustate",
")",
"{",
"cpustate",
"->",
"PC",
"=",
"cpustate",
"->",
"reset_vector",
";",
"cpustate",
"->",
"TRISA",
"=",
"0x1f",
";",
"cpustate",
"->",
"TRISB",
"=",
"0xff",
";",
"cpustate",
"->",
"OPTION",
"=",
"0xff",
";",
"cpustate",
"->",
"STATUS",
"=",
"0x18",
";",
"cpustate",
"->",
"PCL",
"=",
"0",
";",
"cpustate",
"->",
"FSR",
"|=",
"(",
"UINT8",
")",
"(",
"~",
"cpustate",
"->",
"picRAMmask",
")",
";",
"cpustate",
"->",
"PORTA",
"=",
"0",
";",
"cpustate",
"->",
"prescaler",
"=",
"0",
";",
"cpustate",
"->",
"delay_timer",
"=",
"0",
";",
"cpustate",
"->",
"old_T0",
"=",
"0",
";",
"cpustate",
"->",
"inst_cycles",
"=",
"0",
";",
"PIC16C62x_RAM_WRMEM",
"(",
"0x85",
",",
"cpustate",
"->",
"TRISA",
")",
";",
"PIC16C62x_RAM_WRMEM",
"(",
"0x86",
",",
"cpustate",
"->",
"TRISB",
")",
";",
"PIC16C62x_RAM_WRMEM",
"(",
"0x81",
",",
"cpustate",
"->",
"OPTION",
")",
";",
"}"
] | Reset registers to their initial values | [
"Reset",
"registers",
"to",
"their",
"initial",
"values"
] | [] | [
{
"param": "cpustate",
"type": "pic16c62x_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "pic16c62x_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c327ae8c551ab177fdea8b2f256d662b309ed5eb | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugcmd.c | [
"Unlicense"
] | C | debug_command_parameter_cpu | int | int debug_command_parameter_cpu(running_machine *machine, const char *param, const device_config **result)
{
UINT64 cpunum;
EXPRERR err;
/* if no parameter, use the visible CPU */
if (param == NULL)
{
*result = debug_cpu_get_visible_cpu(machine);
if (*result == NULL)
{
debug_console_printf(machine, "No valid CPU is currently selected\n");
return FALSE;
}
return TRUE;
}
/* first look for a tag match */
*result = cputag_get_cpu(machine, param);
if (*result != NULL)
return TRUE;
/* then evaluate as an expression; on an error assume it was a tag */
err = expression_evaluate(param, debug_cpu_get_visible_symtable(machine), &debug_expression_callbacks, machine, &cpunum);
if (err != EXPRERR_NONE)
{
debug_console_printf(machine, "Unable to find CPU '%s'\n", param);
return FALSE;
}
/* if we got a valid one, return */
*result = device_list_find_by_index(machine->config->devicelist, CPU, cpunum);
if (*result != NULL)
return TRUE;
/* if out of range, complain */
debug_console_printf(machine, "Invalid CPU index %d\n", (UINT32)cpunum);
return FALSE;
} | /*-------------------------------------------------
debug_command_parameter_cpu - validates a
parameter as a cpu
-------------------------------------------------*/ | validates a
parameter as a cpu | [
"validates",
"a",
"parameter",
"as",
"a",
"cpu"
] | int debug_command_parameter_cpu(running_machine *machine, const char *param, const device_config **result)
{
UINT64 cpunum;
EXPRERR err;
if (param == NULL)
{
*result = debug_cpu_get_visible_cpu(machine);
if (*result == NULL)
{
debug_console_printf(machine, "No valid CPU is currently selected\n");
return FALSE;
}
return TRUE;
}
*result = cputag_get_cpu(machine, param);
if (*result != NULL)
return TRUE;
err = expression_evaluate(param, debug_cpu_get_visible_symtable(machine), &debug_expression_callbacks, machine, &cpunum);
if (err != EXPRERR_NONE)
{
debug_console_printf(machine, "Unable to find CPU '%s'\n", param);
return FALSE;
}
*result = device_list_find_by_index(machine->config->devicelist, CPU, cpunum);
if (*result != NULL)
return TRUE;
debug_console_printf(machine, "Invalid CPU index %d\n", (UINT32)cpunum);
return FALSE;
} | [
"int",
"debug_command_parameter_cpu",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"param",
",",
"const",
"device_config",
"*",
"*",
"result",
")",
"{",
"UINT64",
"cpunum",
";",
"EXPRERR",
"err",
";",
"if",
"(",
"param",
"==",
"NULL",
")",
"{",
"*",
"result",
"=",
"debug_cpu_get_visible_cpu",
"(",
"machine",
")",
";",
"if",
"(",
"*",
"result",
"==",
"NULL",
")",
"{",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
"FALSE",
";",
"}",
"return",
"TRUE",
";",
"}",
"*",
"result",
"=",
"cputag_get_cpu",
"(",
"machine",
",",
"param",
")",
";",
"if",
"(",
"*",
"result",
"!=",
"NULL",
")",
"return",
"TRUE",
";",
"err",
"=",
"expression_evaluate",
"(",
"param",
",",
"debug_cpu_get_visible_symtable",
"(",
"machine",
")",
",",
"&",
"debug_expression_callbacks",
",",
"machine",
",",
"&",
"cpunum",
")",
";",
"if",
"(",
"err",
"!=",
"EXPRERR_NONE",
")",
"{",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"param",
")",
";",
"return",
"FALSE",
";",
"}",
"*",
"result",
"=",
"device_list_find_by_index",
"(",
"machine",
"->",
"config",
"->",
"devicelist",
",",
"CPU",
",",
"cpunum",
")",
";",
"if",
"(",
"*",
"result",
"!=",
"NULL",
")",
"return",
"TRUE",
";",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"(",
"UINT32",
")",
"cpunum",
")",
";",
"return",
"FALSE",
";",
"}"
] | debug_command_parameter_cpu - validates a
parameter as a cpu | [
"debug_command_parameter_cpu",
"-",
"validates",
"a",
"parameter",
"as",
"a",
"cpu"
] | [
"/* if no parameter, use the visible CPU */",
"/* first look for a tag match */",
"/* then evaluate as an expression; on an error assume it was a tag */",
"/* if we got a valid one, return */",
"/* if out of range, complain */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "param",
"type": "char"
},
{
"param": "result",
"type": "device_config"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "result",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c327ae8c551ab177fdea8b2f256d662b309ed5eb | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugcmd.c | [
"Unlicense"
] | C | debug_command_parameter_cpu_space | int | int debug_command_parameter_cpu_space(running_machine *machine, const char *param, int spacenum, const address_space **result)
{
const device_config *cpu;
/* first do the standard CPU thing */
if (!debug_command_parameter_cpu(machine, param, &cpu))
return FALSE;
/* fetch the space pointer */
*result = cpu_get_address_space(cpu, spacenum);
if (*result == NULL)
{
debug_console_printf(machine, "No %s memory space found for CPU '%s'\n", address_space_names[spacenum], cpu->tag);
return FALSE;
}
return TRUE;
} | /*-------------------------------------------------
debug_command_parameter_cpu_space - validates
a parameter as a cpu and retrieves the given
address space
-------------------------------------------------*/ | validates
a parameter as a cpu and retrieves the given
address space | [
"validates",
"a",
"parameter",
"as",
"a",
"cpu",
"and",
"retrieves",
"the",
"given",
"address",
"space"
] | int debug_command_parameter_cpu_space(running_machine *machine, const char *param, int spacenum, const address_space **result)
{
const device_config *cpu;
if (!debug_command_parameter_cpu(machine, param, &cpu))
return FALSE;
*result = cpu_get_address_space(cpu, spacenum);
if (*result == NULL)
{
debug_console_printf(machine, "No %s memory space found for CPU '%s'\n", address_space_names[spacenum], cpu->tag);
return FALSE;
}
return TRUE;
} | [
"int",
"debug_command_parameter_cpu_space",
"(",
"running_machine",
"*",
"machine",
",",
"const",
"char",
"*",
"param",
",",
"int",
"spacenum",
",",
"const",
"address_space",
"*",
"*",
"result",
")",
"{",
"const",
"device_config",
"*",
"cpu",
";",
"if",
"(",
"!",
"debug_command_parameter_cpu",
"(",
"machine",
",",
"param",
",",
"&",
"cpu",
")",
")",
"return",
"FALSE",
";",
"*",
"result",
"=",
"cpu_get_address_space",
"(",
"cpu",
",",
"spacenum",
")",
";",
"if",
"(",
"*",
"result",
"==",
"NULL",
")",
"{",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"address_space_names",
"[",
"spacenum",
"]",
",",
"cpu",
"->",
"tag",
")",
";",
"return",
"FALSE",
";",
"}",
"return",
"TRUE",
";",
"}"
] | debug_command_parameter_cpu_space - validates
a parameter as a cpu and retrieves the given
address space | [
"debug_command_parameter_cpu_space",
"-",
"validates",
"a",
"parameter",
"as",
"a",
"cpu",
"and",
"retrieves",
"the",
"given",
"address",
"space"
] | [
"/* first do the standard CPU thing */",
"/* fetch the space pointer */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "param",
"type": "char"
},
{
"param": "spacenum",
"type": "int"
},
{
"param": "result",
"type": "address_space"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spacenum",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "result",
"type": "address_space",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c327ae8c551ab177fdea8b2f256d662b309ed5eb | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugcmd.c | [
"Unlicense"
] | C | execute_comment | void | static void execute_comment(running_machine *machine, int ref, int params, const char *param[])
{
const device_config *cpu;
UINT64 address;
/* param 1 is the address for the comment */
if (!debug_command_parameter_number(machine, param[0], &address))
return;
/* CPU parameter is implicit */
if (!debug_command_parameter_cpu(machine, NULL, &cpu))
return;
/* make sure param 2 exists */
if (strlen(param[1]) == 0)
{
debug_console_printf(machine, "Error : comment text empty\n");
return;
}
/* Now try adding the comment */
debug_comment_add(cpu, address, param[1], 0x00ff0000, debug_comment_get_opcode_crc32(cpu, address));
debug_view_update_type(cpu->machine, DVT_DISASSEMBLY);
} | /*-------------------------------------------------
execute_comment - add a comment to a line
-------------------------------------------------*/ | add a comment to a line | [
"add",
"a",
"comment",
"to",
"a",
"line"
] | static void execute_comment(running_machine *machine, int ref, int params, const char *param[])
{
const device_config *cpu;
UINT64 address;
if (!debug_command_parameter_number(machine, param[0], &address))
return;
if (!debug_command_parameter_cpu(machine, NULL, &cpu))
return;
if (strlen(param[1]) == 0)
{
debug_console_printf(machine, "Error : comment text empty\n");
return;
}
debug_comment_add(cpu, address, param[1], 0x00ff0000, debug_comment_get_opcode_crc32(cpu, address));
debug_view_update_type(cpu->machine, DVT_DISASSEMBLY);
} | [
"static",
"void",
"execute_comment",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"ref",
",",
"int",
"params",
",",
"const",
"char",
"*",
"param",
"[",
"]",
")",
"{",
"const",
"device_config",
"*",
"cpu",
";",
"UINT64",
"address",
";",
"if",
"(",
"!",
"debug_command_parameter_number",
"(",
"machine",
",",
"param",
"[",
"0",
"]",
",",
"&",
"address",
")",
")",
"return",
";",
"if",
"(",
"!",
"debug_command_parameter_cpu",
"(",
"machine",
",",
"NULL",
",",
"&",
"cpu",
")",
")",
"return",
";",
"if",
"(",
"strlen",
"(",
"param",
"[",
"1",
"]",
")",
"==",
"0",
")",
"{",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}",
"debug_comment_add",
"(",
"cpu",
",",
"address",
",",
"param",
"[",
"1",
"]",
",",
"0x00ff0000",
",",
"debug_comment_get_opcode_crc32",
"(",
"cpu",
",",
"address",
")",
")",
";",
"debug_view_update_type",
"(",
"cpu",
"->",
"machine",
",",
"DVT_DISASSEMBLY",
")",
";",
"}"
] | execute_comment - add a comment to a line | [
"execute_comment",
"-",
"add",
"a",
"comment",
"to",
"a",
"line"
] | [
"/* param 1 is the address for the comment */",
"/* CPU parameter is implicit */",
"/* make sure param 2 exists */",
"/* Now try adding the comment */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "ref",
"type": "int"
},
{
"param": "params",
"type": "int"
},
{
"param": "param",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ref",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c327ae8c551ab177fdea8b2f256d662b309ed5eb | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugcmd.c | [
"Unlicense"
] | C | execute_comment_del | void | static void execute_comment_del(running_machine *machine, int ref, int params, const char *param[])
{
const device_config *cpu;
UINT64 address;
/* param 1 can either be a command or the address for the comment */
if (!debug_command_parameter_number(machine, param[0], &address))
return;
/* CPU parameter is implicit */
if (!debug_command_parameter_cpu(machine, NULL, &cpu))
return;
/* If it's a number, it must be an address */
/* The bankoff and cbn will be pulled from what's currently active */
debug_comment_remove(cpu, address, debug_comment_get_opcode_crc32(cpu, address));
debug_view_update_type(cpu->machine, DVT_DISASSEMBLY);
} | /*------------------------------------------------------
execute_comment_del - remove a comment from an addr
--------------------------------------------------------*/ | remove a comment from an addr | [
"remove",
"a",
"comment",
"from",
"an",
"addr"
] | static void execute_comment_del(running_machine *machine, int ref, int params, const char *param[])
{
const device_config *cpu;
UINT64 address;
if (!debug_command_parameter_number(machine, param[0], &address))
return;
if (!debug_command_parameter_cpu(machine, NULL, &cpu))
return;
debug_comment_remove(cpu, address, debug_comment_get_opcode_crc32(cpu, address));
debug_view_update_type(cpu->machine, DVT_DISASSEMBLY);
} | [
"static",
"void",
"execute_comment_del",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"ref",
",",
"int",
"params",
",",
"const",
"char",
"*",
"param",
"[",
"]",
")",
"{",
"const",
"device_config",
"*",
"cpu",
";",
"UINT64",
"address",
";",
"if",
"(",
"!",
"debug_command_parameter_number",
"(",
"machine",
",",
"param",
"[",
"0",
"]",
",",
"&",
"address",
")",
")",
"return",
";",
"if",
"(",
"!",
"debug_command_parameter_cpu",
"(",
"machine",
",",
"NULL",
",",
"&",
"cpu",
")",
")",
"return",
";",
"debug_comment_remove",
"(",
"cpu",
",",
"address",
",",
"debug_comment_get_opcode_crc32",
"(",
"cpu",
",",
"address",
")",
")",
";",
"debug_view_update_type",
"(",
"cpu",
"->",
"machine",
",",
"DVT_DISASSEMBLY",
")",
";",
"}"
] | execute_comment_del - remove a comment from an addr | [
"execute_comment_del",
"-",
"remove",
"a",
"comment",
"from",
"an",
"addr"
] | [
"/* param 1 can either be a command or the address for the comment */",
"/* CPU parameter is implicit */",
"/* If it's a number, it must be an address */",
"/* The bankoff and cbn will be pulled from what's currently active */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "ref",
"type": "int"
},
{
"param": "params",
"type": "int"
},
{
"param": "param",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ref",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c327ae8c551ab177fdea8b2f256d662b309ed5eb | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugcmd.c | [
"Unlicense"
] | C | execute_bpdisenable | void | static void execute_bpdisenable(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 bpindex;
/* if 0 parameters, clear all */
if (params == 0)
{
const device_config *cpu;
for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
debug_cpu_breakpoint *bp;
for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
debug_cpu_breakpoint_enable(machine, bp->index, ref);
}
if (ref == 0)
debug_console_printf(machine, "Disabled all breakpoints\n");
else
debug_console_printf(machine, "Enabled all breakpoints\n");
}
/* otherwise, clear the specific one */
else if (!debug_command_parameter_number(machine, param[0], &bpindex))
return;
else
{
int found = debug_cpu_breakpoint_enable(machine, bpindex, ref);
if (found)
debug_console_printf(machine, "Breakpoint %X %s\n", (UINT32)bpindex, ref ? "enabled" : "disabled");
else
debug_console_printf(machine, "Invalid breakpoint number %X\n", (UINT32)bpindex);
}
} | /*-------------------------------------------------
execute_bpdisenable - execute the breakpoint
disable/enable commands
-------------------------------------------------*/ | execute the breakpoint
disable/enable commands | [
"execute",
"the",
"breakpoint",
"disable",
"/",
"enable",
"commands"
] | static void execute_bpdisenable(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 bpindex;
if (params == 0)
{
const device_config *cpu;
for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
debug_cpu_breakpoint *bp;
for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
debug_cpu_breakpoint_enable(machine, bp->index, ref);
}
if (ref == 0)
debug_console_printf(machine, "Disabled all breakpoints\n");
else
debug_console_printf(machine, "Enabled all breakpoints\n");
}
else if (!debug_command_parameter_number(machine, param[0], &bpindex))
return;
else
{
int found = debug_cpu_breakpoint_enable(machine, bpindex, ref);
if (found)
debug_console_printf(machine, "Breakpoint %X %s\n", (UINT32)bpindex, ref ? "enabled" : "disabled");
else
debug_console_printf(machine, "Invalid breakpoint number %X\n", (UINT32)bpindex);
}
} | [
"static",
"void",
"execute_bpdisenable",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"ref",
",",
"int",
"params",
",",
"const",
"char",
"*",
"param",
"[",
"]",
")",
"{",
"UINT64",
"bpindex",
";",
"if",
"(",
"params",
"==",
"0",
")",
"{",
"const",
"device_config",
"*",
"cpu",
";",
"for",
"(",
"cpu",
"=",
"machine",
"->",
"firstcpu",
";",
"cpu",
"!=",
"NULL",
";",
"cpu",
"=",
"cpu_next",
"(",
"cpu",
")",
")",
"{",
"const",
"cpu_debug_data",
"*",
"cpuinfo",
"=",
"cpu_get_debug_data",
"(",
"cpu",
")",
";",
"debug_cpu_breakpoint",
"*",
"bp",
";",
"for",
"(",
"bp",
"=",
"cpuinfo",
"->",
"bplist",
";",
"bp",
"!=",
"NULL",
";",
"bp",
"=",
"bp",
"->",
"next",
")",
"debug_cpu_breakpoint_enable",
"(",
"machine",
",",
"bp",
"->",
"index",
",",
"ref",
")",
";",
"}",
"if",
"(",
"ref",
"==",
"0",
")",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
")",
";",
"else",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"debug_command_parameter_number",
"(",
"machine",
",",
"param",
"[",
"0",
"]",
",",
"&",
"bpindex",
")",
")",
"return",
";",
"else",
"{",
"int",
"found",
"=",
"debug_cpu_breakpoint_enable",
"(",
"machine",
",",
"bpindex",
",",
"ref",
")",
";",
"if",
"(",
"found",
")",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"(",
"UINT32",
")",
"bpindex",
",",
"ref",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"else",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"(",
"UINT32",
")",
"bpindex",
")",
";",
"}",
"}"
] | execute_bpdisenable - execute the breakpoint
disable/enable commands | [
"execute_bpdisenable",
"-",
"execute",
"the",
"breakpoint",
"disable",
"/",
"enable",
"commands"
] | [
"/* if 0 parameters, clear all */",
"/* otherwise, clear the specific one */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "ref",
"type": "int"
},
{
"param": "params",
"type": "int"
},
{
"param": "param",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ref",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c327ae8c551ab177fdea8b2f256d662b309ed5eb | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugcmd.c | [
"Unlicense"
] | C | execute_wpdisenable | void | static void execute_wpdisenable(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 wpindex;
/* if 0 parameters, clear all */
if (params == 0)
{
const device_config *cpu;
for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
int spacenum;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
debug_cpu_watchpoint *wp;
for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
debug_cpu_watchpoint_enable(machine, wp->index, ref);
}
}
if (ref == 0)
debug_console_printf(machine, "Disabled all watchpoints\n");
else
debug_console_printf(machine, "Enabled all watchpoints\n");
}
/* otherwise, clear the specific one */
else if (!debug_command_parameter_number(machine, param[0], &wpindex))
return;
else
{
int found = debug_cpu_watchpoint_enable(machine, wpindex, ref);
if (found)
debug_console_printf(machine, "Watchpoint %X %s\n", (UINT32)wpindex, ref ? "enabled" : "disabled");
else
debug_console_printf(machine, "Invalid watchpoint number %X\n", (UINT32)wpindex);
}
} | /*-------------------------------------------------
execute_wpdisenable - execute the watchpoint
disable/enable commands
-------------------------------------------------*/ | execute the watchpoint
disable/enable commands | [
"execute",
"the",
"watchpoint",
"disable",
"/",
"enable",
"commands"
] | static void execute_wpdisenable(running_machine *machine, int ref, int params, const char *param[])
{
UINT64 wpindex;
if (params == 0)
{
const device_config *cpu;
for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu))
{
const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
int spacenum;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
{
debug_cpu_watchpoint *wp;
for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
debug_cpu_watchpoint_enable(machine, wp->index, ref);
}
}
if (ref == 0)
debug_console_printf(machine, "Disabled all watchpoints\n");
else
debug_console_printf(machine, "Enabled all watchpoints\n");
}
else if (!debug_command_parameter_number(machine, param[0], &wpindex))
return;
else
{
int found = debug_cpu_watchpoint_enable(machine, wpindex, ref);
if (found)
debug_console_printf(machine, "Watchpoint %X %s\n", (UINT32)wpindex, ref ? "enabled" : "disabled");
else
debug_console_printf(machine, "Invalid watchpoint number %X\n", (UINT32)wpindex);
}
} | [
"static",
"void",
"execute_wpdisenable",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"ref",
",",
"int",
"params",
",",
"const",
"char",
"*",
"param",
"[",
"]",
")",
"{",
"UINT64",
"wpindex",
";",
"if",
"(",
"params",
"==",
"0",
")",
"{",
"const",
"device_config",
"*",
"cpu",
";",
"for",
"(",
"cpu",
"=",
"machine",
"->",
"firstcpu",
";",
"cpu",
"!=",
"NULL",
";",
"cpu",
"=",
"cpu_next",
"(",
"cpu",
")",
")",
"{",
"const",
"cpu_debug_data",
"*",
"cpuinfo",
"=",
"cpu_get_debug_data",
"(",
"cpu",
")",
";",
"int",
"spacenum",
";",
"for",
"(",
"spacenum",
"=",
"0",
";",
"spacenum",
"<",
"ADDRESS_SPACES",
";",
"spacenum",
"++",
")",
"{",
"debug_cpu_watchpoint",
"*",
"wp",
";",
"for",
"(",
"wp",
"=",
"cpuinfo",
"->",
"wplist",
"[",
"spacenum",
"]",
";",
"wp",
"!=",
"NULL",
";",
"wp",
"=",
"wp",
"->",
"next",
")",
"debug_cpu_watchpoint_enable",
"(",
"machine",
",",
"wp",
"->",
"index",
",",
"ref",
")",
";",
"}",
"}",
"if",
"(",
"ref",
"==",
"0",
")",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
")",
";",
"else",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"debug_command_parameter_number",
"(",
"machine",
",",
"param",
"[",
"0",
"]",
",",
"&",
"wpindex",
")",
")",
"return",
";",
"else",
"{",
"int",
"found",
"=",
"debug_cpu_watchpoint_enable",
"(",
"machine",
",",
"wpindex",
",",
"ref",
")",
";",
"if",
"(",
"found",
")",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"(",
"UINT32",
")",
"wpindex",
",",
"ref",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"else",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"(",
"UINT32",
")",
"wpindex",
")",
";",
"}",
"}"
] | execute_wpdisenable - execute the watchpoint
disable/enable commands | [
"execute_wpdisenable",
"-",
"execute",
"the",
"watchpoint",
"disable",
"/",
"enable",
"commands"
] | [
"/* if 0 parameters, clear all */",
"/* otherwise, clear the specific one */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "ref",
"type": "int"
},
{
"param": "params",
"type": "int"
},
{
"param": "param",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ref",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c327ae8c551ab177fdea8b2f256d662b309ed5eb | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugcmd.c | [
"Unlicense"
] | C | execute_cheatlist | void | static void execute_cheatlist(running_machine *machine, int ref, int params, const char *param[])
{
char spaceletter, sizeletter;
const address_space *space;
const device_config *cpu;
UINT32 active_cheat = 0;
UINT64 cheatindex;
UINT64 sizemask;
FILE *f = NULL;
if (!debug_command_parameter_cpu_space(machine, &cheat.cpu, ADDRESS_SPACE_PROGRAM, &space))
return;
if (!debug_command_parameter_cpu(machine, &cheat.cpu, &cpu))
return;
if (params > 0)
f = fopen(param[0], "w");
switch (space->spacenum)
{
default:
case ADDRESS_SPACE_PROGRAM: spaceletter = 'p'; break;
case ADDRESS_SPACE_DATA: spaceletter = 'd'; break;
case ADDRESS_SPACE_IO: spaceletter = 'i'; break;
}
switch (cheat.width)
{
default:
case 1: sizeletter = 'b'; sizemask = 0xff; break;
case 2: sizeletter = 'w'; sizemask = 0xffff; break;
case 4: sizeletter = 'd'; sizemask = 0xffffffff; break;
case 8: sizeletter = 'q'; sizemask = U64(0xffffffffffffffff); break;
}
/* write the cheat list */
for (cheatindex = 0; cheatindex < cheat.length; cheatindex += 1)
{
if (cheat.cheatmap[cheatindex].state == 1)
{
UINT64 value = cheat_byte_swap(&cheat, cheat_read_extended(&cheat, space, cheat.cheatmap[cheatindex].offset)) & sizemask;
offs_t address = memory_byte_to_address(space, cheat.cheatmap[cheatindex].offset);
if (params > 0)
{
active_cheat++;
fprintf(f, " <cheat desc=\"Possibility %d : %s (%s)\">\n", active_cheat, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(value, cheat.width * 2));
fprintf(f, " <script state=\"run\">\n");
fprintf(f, " <action>%s.p%c%c@%s=%s</action>\n", cpu->tag, spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2));
fprintf(f, " </script>\n");
fprintf(f, " </cheat>\n\n");
}
else
debug_console_printf(machine, "Address=%s Start=%s Current=%s\n", core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2), core_i64_hex_format(value, cheat.width * 2));
}
}
if (params > 0)
fclose(f);
} | /*-------------------------------------------------
execute_cheatlist - show a list of active cheat
-------------------------------------------------*/ | show a list of active cheat | [
"show",
"a",
"list",
"of",
"active",
"cheat"
] | static void execute_cheatlist(running_machine *machine, int ref, int params, const char *param[])
{
char spaceletter, sizeletter;
const address_space *space;
const device_config *cpu;
UINT32 active_cheat = 0;
UINT64 cheatindex;
UINT64 sizemask;
FILE *f = NULL;
if (!debug_command_parameter_cpu_space(machine, &cheat.cpu, ADDRESS_SPACE_PROGRAM, &space))
return;
if (!debug_command_parameter_cpu(machine, &cheat.cpu, &cpu))
return;
if (params > 0)
f = fopen(param[0], "w");
switch (space->spacenum)
{
default:
case ADDRESS_SPACE_PROGRAM: spaceletter = 'p'; break;
case ADDRESS_SPACE_DATA: spaceletter = 'd'; break;
case ADDRESS_SPACE_IO: spaceletter = 'i'; break;
}
switch (cheat.width)
{
default:
case 1: sizeletter = 'b'; sizemask = 0xff; break;
case 2: sizeletter = 'w'; sizemask = 0xffff; break;
case 4: sizeletter = 'd'; sizemask = 0xffffffff; break;
case 8: sizeletter = 'q'; sizemask = U64(0xffffffffffffffff); break;
}
for (cheatindex = 0; cheatindex < cheat.length; cheatindex += 1)
{
if (cheat.cheatmap[cheatindex].state == 1)
{
UINT64 value = cheat_byte_swap(&cheat, cheat_read_extended(&cheat, space, cheat.cheatmap[cheatindex].offset)) & sizemask;
offs_t address = memory_byte_to_address(space, cheat.cheatmap[cheatindex].offset);
if (params > 0)
{
active_cheat++;
fprintf(f, " <cheat desc=\"Possibility %d : %s (%s)\">\n", active_cheat, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(value, cheat.width * 2));
fprintf(f, " <script state=\"run\">\n");
fprintf(f, " <action>%s.p%c%c@%s=%s</action>\n", cpu->tag, spaceletter, sizeletter, core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2));
fprintf(f, " </script>\n");
fprintf(f, " </cheat>\n\n");
}
else
debug_console_printf(machine, "Address=%s Start=%s Current=%s\n", core_i64_hex_format(address, space->logaddrchars), core_i64_hex_format(cheat_byte_swap(&cheat, cheat.cheatmap[cheatindex].first_value) & sizemask, cheat.width * 2), core_i64_hex_format(value, cheat.width * 2));
}
}
if (params > 0)
fclose(f);
} | [
"static",
"void",
"execute_cheatlist",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"ref",
",",
"int",
"params",
",",
"const",
"char",
"*",
"param",
"[",
"]",
")",
"{",
"char",
"spaceletter",
",",
"sizeletter",
";",
"const",
"address_space",
"*",
"space",
";",
"const",
"device_config",
"*",
"cpu",
";",
"UINT32",
"active_cheat",
"=",
"0",
";",
"UINT64",
"cheatindex",
";",
"UINT64",
"sizemask",
";",
"FILE",
"*",
"f",
"=",
"NULL",
";",
"if",
"(",
"!",
"debug_command_parameter_cpu_space",
"(",
"machine",
",",
"&",
"cheat",
".",
"cpu",
",",
"ADDRESS_SPACE_PROGRAM",
",",
"&",
"space",
")",
")",
"return",
";",
"if",
"(",
"!",
"debug_command_parameter_cpu",
"(",
"machine",
",",
"&",
"cheat",
".",
"cpu",
",",
"&",
"cpu",
")",
")",
"return",
";",
"if",
"(",
"params",
">",
"0",
")",
"f",
"=",
"fopen",
"(",
"param",
"[",
"0",
"]",
",",
"\"",
"\"",
")",
";",
"switch",
"(",
"space",
"->",
"spacenum",
")",
"{",
"default",
":",
"case",
"ADDRESS_SPACE_PROGRAM",
":",
"spaceletter",
"=",
"'",
"'",
";",
"break",
";",
"case",
"ADDRESS_SPACE_DATA",
":",
"spaceletter",
"=",
"'",
"'",
";",
"break",
";",
"case",
"ADDRESS_SPACE_IO",
":",
"spaceletter",
"=",
"'",
"'",
";",
"break",
";",
"}",
"switch",
"(",
"cheat",
".",
"width",
")",
"{",
"default",
":",
"case",
"1",
":",
"sizeletter",
"=",
"'",
"'",
";",
"sizemask",
"=",
"0xff",
";",
"break",
";",
"case",
"2",
":",
"sizeletter",
"=",
"'",
"'",
";",
"sizemask",
"=",
"0xffff",
";",
"break",
";",
"case",
"4",
":",
"sizeletter",
"=",
"'",
"'",
";",
"sizemask",
"=",
"0xffffffff",
";",
"break",
";",
"case",
"8",
":",
"sizeletter",
"=",
"'",
"'",
";",
"sizemask",
"=",
"U64",
"(",
"0xffffffffffffffff",
")",
";",
"break",
";",
"}",
"for",
"(",
"cheatindex",
"=",
"0",
";",
"cheatindex",
"<",
"cheat",
".",
"length",
";",
"cheatindex",
"+=",
"1",
")",
"{",
"if",
"(",
"cheat",
".",
"cheatmap",
"[",
"cheatindex",
"]",
".",
"state",
"==",
"1",
")",
"{",
"UINT64",
"value",
"=",
"cheat_byte_swap",
"(",
"&",
"cheat",
",",
"cheat_read_extended",
"(",
"&",
"cheat",
",",
"space",
",",
"cheat",
".",
"cheatmap",
"[",
"cheatindex",
"]",
".",
"offset",
")",
")",
"&",
"sizemask",
";",
"offs_t",
"address",
"=",
"memory_byte_to_address",
"(",
"space",
",",
"cheat",
".",
"cheatmap",
"[",
"cheatindex",
"]",
".",
"offset",
")",
";",
"if",
"(",
"params",
">",
"0",
")",
"{",
"active_cheat",
"++",
";",
"fprintf",
"(",
"f",
",",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"active_cheat",
",",
"core_i64_hex_format",
"(",
"address",
",",
"space",
"->",
"logaddrchars",
")",
",",
"core_i64_hex_format",
"(",
"value",
",",
"cheat",
".",
"width",
"*",
"2",
")",
")",
";",
"fprintf",
"(",
"f",
",",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"f",
",",
"\"",
"\\n",
"\"",
",",
"cpu",
"->",
"tag",
",",
"spaceletter",
",",
"sizeletter",
",",
"core_i64_hex_format",
"(",
"address",
",",
"space",
"->",
"logaddrchars",
")",
",",
"core_i64_hex_format",
"(",
"cheat_byte_swap",
"(",
"&",
"cheat",
",",
"cheat",
".",
"cheatmap",
"[",
"cheatindex",
"]",
".",
"first_value",
")",
"&",
"sizemask",
",",
"cheat",
".",
"width",
"*",
"2",
")",
")",
";",
"fprintf",
"(",
"f",
",",
"\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"f",
",",
"\"",
"\\n",
"\\n",
"\"",
")",
";",
"}",
"else",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"core_i64_hex_format",
"(",
"address",
",",
"space",
"->",
"logaddrchars",
")",
",",
"core_i64_hex_format",
"(",
"cheat_byte_swap",
"(",
"&",
"cheat",
",",
"cheat",
".",
"cheatmap",
"[",
"cheatindex",
"]",
".",
"first_value",
")",
"&",
"sizemask",
",",
"cheat",
".",
"width",
"*",
"2",
")",
",",
"core_i64_hex_format",
"(",
"value",
",",
"cheat",
".",
"width",
"*",
"2",
")",
")",
";",
"}",
"}",
"if",
"(",
"params",
">",
"0",
")",
"fclose",
"(",
"f",
")",
";",
"}"
] | execute_cheatlist - show a list of active cheat | [
"execute_cheatlist",
"-",
"show",
"a",
"list",
"of",
"active",
"cheat"
] | [
"/* write the cheat list */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "ref",
"type": "int"
},
{
"param": "params",
"type": "int"
},
{
"param": "param",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ref",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
c327ae8c551ab177fdea8b2f256d662b309ed5eb | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugcmd.c | [
"Unlicense"
] | C | execute_trace_internal | void | static void execute_trace_internal(running_machine *machine, int ref, int params, const char *param[], int trace_over)
{
const char *action = NULL, *filename = param[0];
const device_config *cpu;
FILE *f = NULL;
const char *mode;
/* validate parameters */
if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : NULL, &cpu))
return;
if (!debug_command_parameter_command(machine, action = param[2]))
return;
/* further validation */
if (mame_stricmp(filename, "off") == 0)
filename = NULL;
/* open the file */
if (filename)
{
mode = "w";
/* opening for append? */
if ((filename[0] == '>') && (filename[1] == '>'))
{
mode = "a";
filename += 2;
}
f = fopen(filename, mode);
if (!f)
{
debug_console_printf(machine, "Error opening file '%s'\n", param[0]);
return;
}
}
/* do it */
debug_cpu_trace(cpu, f, trace_over, action);
if (f)
debug_console_printf(machine, "Tracing CPU '%s' to file %s\n", cpu->tag, filename);
else
debug_console_printf(machine, "Stopped tracing on CPU '%s'\n", cpu->tag);
} | /*-------------------------------------------------
execute_trace_internal - functionality for
trace over and trace info
-------------------------------------------------*/ | functionality for
trace over and trace info | [
"functionality",
"for",
"trace",
"over",
"and",
"trace",
"info"
] | static void execute_trace_internal(running_machine *machine, int ref, int params, const char *param[], int trace_over)
{
const char *action = NULL, *filename = param[0];
const device_config *cpu;
FILE *f = NULL;
const char *mode;
if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : NULL, &cpu))
return;
if (!debug_command_parameter_command(machine, action = param[2]))
return;
if (mame_stricmp(filename, "off") == 0)
filename = NULL;
if (filename)
{
mode = "w";
if ((filename[0] == '>') && (filename[1] == '>'))
{
mode = "a";
filename += 2;
}
f = fopen(filename, mode);
if (!f)
{
debug_console_printf(machine, "Error opening file '%s'\n", param[0]);
return;
}
}
debug_cpu_trace(cpu, f, trace_over, action);
if (f)
debug_console_printf(machine, "Tracing CPU '%s' to file %s\n", cpu->tag, filename);
else
debug_console_printf(machine, "Stopped tracing on CPU '%s'\n", cpu->tag);
} | [
"static",
"void",
"execute_trace_internal",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"ref",
",",
"int",
"params",
",",
"const",
"char",
"*",
"param",
"[",
"]",
",",
"int",
"trace_over",
")",
"{",
"const",
"char",
"*",
"action",
"=",
"NULL",
",",
"*",
"filename",
"=",
"param",
"[",
"0",
"]",
";",
"const",
"device_config",
"*",
"cpu",
";",
"FILE",
"*",
"f",
"=",
"NULL",
";",
"const",
"char",
"*",
"mode",
";",
"if",
"(",
"!",
"debug_command_parameter_cpu",
"(",
"machine",
",",
"(",
"params",
">",
"1",
")",
"?",
"param",
"[",
"1",
"]",
":",
"NULL",
",",
"&",
"cpu",
")",
")",
"return",
";",
"if",
"(",
"!",
"debug_command_parameter_command",
"(",
"machine",
",",
"action",
"=",
"param",
"[",
"2",
"]",
")",
")",
"return",
";",
"if",
"(",
"mame_stricmp",
"(",
"filename",
",",
"\"",
"\"",
")",
"==",
"0",
")",
"filename",
"=",
"NULL",
";",
"if",
"(",
"filename",
")",
"{",
"mode",
"=",
"\"",
"\"",
";",
"if",
"(",
"(",
"filename",
"[",
"0",
"]",
"==",
"'",
"'",
")",
"&&",
"(",
"filename",
"[",
"1",
"]",
"==",
"'",
"'",
")",
")",
"{",
"mode",
"=",
"\"",
"\"",
";",
"filename",
"+=",
"2",
";",
"}",
"f",
"=",
"fopen",
"(",
"filename",
",",
"mode",
")",
";",
"if",
"(",
"!",
"f",
")",
"{",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"param",
"[",
"0",
"]",
")",
";",
"return",
";",
"}",
"}",
"debug_cpu_trace",
"(",
"cpu",
",",
"f",
",",
"trace_over",
",",
"action",
")",
";",
"if",
"(",
"f",
")",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"cpu",
"->",
"tag",
",",
"filename",
")",
";",
"else",
"debug_console_printf",
"(",
"machine",
",",
"\"",
"\\n",
"\"",
",",
"cpu",
"->",
"tag",
")",
";",
"}"
] | execute_trace_internal - functionality for
trace over and trace info | [
"execute_trace_internal",
"-",
"functionality",
"for",
"trace",
"over",
"and",
"trace",
"info"
] | [
"/* validate parameters */",
"/* further validation */",
"/* open the file */",
"/* opening for append? */",
"/* do it */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "ref",
"type": "int"
},
{
"param": "params",
"type": "int"
},
{
"param": "param",
"type": "char"
},
{
"param": "trace_over",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ref",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "trace_over",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b238f3c4d4b36cfa9733eb2b2ce87a5eab2c8462 | lofunz/mieme | Reloaded/trunk/src/emu/audio/generic.c | [
"Unlicense"
] | C | generic_sound_init | int | int generic_sound_init(running_machine *machine)
{
generic_audio_private *state;
state = machine->generic_audio_data = auto_alloc_clear(machine, generic_audio_private);
/* register globals with the save state system */
state_save_register_global_array(machine, state->latched_value);
state_save_register_global_array(machine, state->latch_read);
return 0;
} | /*-------------------------------------------------
generic_sound_init - initialize globals and
register for save states
-------------------------------------------------*/ | initialize globals and
register for save states | [
"initialize",
"globals",
"and",
"register",
"for",
"save",
"states"
] | int generic_sound_init(running_machine *machine)
{
generic_audio_private *state;
state = machine->generic_audio_data = auto_alloc_clear(machine, generic_audio_private);
state_save_register_global_array(machine, state->latched_value);
state_save_register_global_array(machine, state->latch_read);
return 0;
} | [
"int",
"generic_sound_init",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"generic_audio_private",
"*",
"state",
";",
"state",
"=",
"machine",
"->",
"generic_audio_data",
"=",
"auto_alloc_clear",
"(",
"machine",
",",
"generic_audio_private",
")",
";",
"state_save_register_global_array",
"(",
"machine",
",",
"state",
"->",
"latched_value",
")",
";",
"state_save_register_global_array",
"(",
"machine",
",",
"state",
"->",
"latch_read",
")",
";",
"return",
"0",
";",
"}"
] | generic_sound_init - initialize globals and
register for save states | [
"generic_sound_init",
"-",
"initialize",
"globals",
"and",
"register",
"for",
"save",
"states"
] | [
"/* register globals with the save state system */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b238f3c4d4b36cfa9733eb2b2ce87a5eab2c8462 | lofunz/mieme | Reloaded/trunk/src/emu/audio/generic.c | [
"Unlicense"
] | C | soundlatch_setclearedvalue | void | void soundlatch_setclearedvalue(running_machine *machine, int value)
{
generic_audio_private *state = machine->generic_audio_data;
assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
state->latch_clear_value = value;
} | /*-------------------------------------------------
soundlatch_setclearedvalue - set the "clear"
value for all sound latches
-------------------------------------------------*/ | set the "clear"
value for all sound latches | [
"set",
"the",
"\"",
"clear",
"\"",
"value",
"for",
"all",
"sound",
"latches"
] | void soundlatch_setclearedvalue(running_machine *machine, int value)
{
generic_audio_private *state = machine->generic_audio_data;
assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call soundlatch_setclearedvalue at init time!");
state->latch_clear_value = value;
} | [
"void",
"soundlatch_setclearedvalue",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"value",
")",
"{",
"generic_audio_private",
"*",
"state",
"=",
"machine",
"->",
"generic_audio_data",
";",
"assert_always",
"(",
"machine",
"->",
"phase",
"(",
")",
"==",
"MACHINE_PHASE_INIT",
",",
"\"",
"\"",
")",
";",
"state",
"->",
"latch_clear_value",
"=",
"value",
";",
"}"
] | soundlatch_setclearedvalue - set the "clear"
value for all sound latches | [
"soundlatch_setclearedvalue",
"-",
"set",
"the",
"\"",
"clear",
"\"",
"value",
"for",
"all",
"sound",
"latches"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "value",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8842ce816fd51574309e6d3f57d4668bb99bce25 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/centiped.c | [
"Unlicense"
] | C | melliped_mazeinv_set_color | void | static void melliped_mazeinv_set_color(running_machine *machine, offs_t offset, UINT8 data)
{
rgb_t color;
int bit0, bit1, bit2;
int r, g, b;
/* red component */
bit0 = (~data >> 5) & 0x01;
bit1 = (~data >> 6) & 0x01;
bit2 = (~data >> 7) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* green component */
bit0 = 0;
bit1 = (~data >> 3) & 0x01;
bit2 = (~data >> 4) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* blue component */
bit0 = (~data >> 0) & 0x01;
bit1 = (~data >> 1) & 0x01;
bit2 = (~data >> 2) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
color = MAKE_RGB(r, g, b);
/* character colors, set directly */
if (offset < 0x10)
palette_set_color(machine, offset, color);
/* sprite colors - set all the applicable ones */
else
{
int i;
int base = offset & 0x0c;
offset = offset & 0x03;
for (i = (base << 6); i < (base << 6) + 0x100; i += 4)
{
if (offset == ((i >> 2) & 0x03))
palette_set_color(machine, i + 0x10 + 1, color);
if (offset == ((i >> 4) & 0x03))
palette_set_color(machine, i + 0x10 + 2, color);
if (offset == ((i >> 6) & 0x03))
palette_set_color(machine, i + 0x10 + 3, color);
}
}
} | /***************************************************************************
Millipede doesn't have a color PROM, it uses RAM.
The RAM seems to be conncted to the video output this way:
bit 7 red
red
red
green
green
blue
blue
bit 0 blue
Millipede is unusual because the sprite color code specifies the
colors to use one by one, instead of a combination code.
bit 7-6 = palette bank (there are 4 groups of 4 colors)
bit 5-4 = color to use for pen 11
bit 3-2 = color to use for pen 10
bit 1-0 = color to use for pen 01
pen 00 is transparent
***************************************************************************/ | Millipede doesn't have a color PROM, it uses RAM.
The RAM seems to be conncted to the video output this way.
bit 7 red
red
red
green
green
blue
blue
bit 0 blue
Millipede is unusual because the sprite color code specifies the
colors to use one by one, instead of a combination code.
bit 7-6 = palette bank (there are 4 groups of 4 colors)
bit 5-4 = color to use for pen 11
bit 3-2 = color to use for pen 10
bit 1-0 = color to use for pen 01
pen 00 is transparent | [
"Millipede",
"doesn",
"'",
"t",
"have",
"a",
"color",
"PROM",
"it",
"uses",
"RAM",
".",
"The",
"RAM",
"seems",
"to",
"be",
"conncted",
"to",
"the",
"video",
"output",
"this",
"way",
".",
"bit",
"7",
"red",
"red",
"red",
"green",
"green",
"blue",
"blue",
"bit",
"0",
"blue",
"Millipede",
"is",
"unusual",
"because",
"the",
"sprite",
"color",
"code",
"specifies",
"the",
"colors",
"to",
"use",
"one",
"by",
"one",
"instead",
"of",
"a",
"combination",
"code",
".",
"bit",
"7",
"-",
"6",
"=",
"palette",
"bank",
"(",
"there",
"are",
"4",
"groups",
"of",
"4",
"colors",
")",
"bit",
"5",
"-",
"4",
"=",
"color",
"to",
"use",
"for",
"pen",
"11",
"bit",
"3",
"-",
"2",
"=",
"color",
"to",
"use",
"for",
"pen",
"10",
"bit",
"1",
"-",
"0",
"=",
"color",
"to",
"use",
"for",
"pen",
"01",
"pen",
"00",
"is",
"transparent"
] | static void melliped_mazeinv_set_color(running_machine *machine, offs_t offset, UINT8 data)
{
rgb_t color;
int bit0, bit1, bit2;
int r, g, b;
bit0 = (~data >> 5) & 0x01;
bit1 = (~data >> 6) & 0x01;
bit2 = (~data >> 7) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = 0;
bit1 = (~data >> 3) & 0x01;
bit2 = (~data >> 4) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = (~data >> 0) & 0x01;
bit1 = (~data >> 1) & 0x01;
bit2 = (~data >> 2) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
color = MAKE_RGB(r, g, b);
if (offset < 0x10)
palette_set_color(machine, offset, color);
else
{
int i;
int base = offset & 0x0c;
offset = offset & 0x03;
for (i = (base << 6); i < (base << 6) + 0x100; i += 4)
{
if (offset == ((i >> 2) & 0x03))
palette_set_color(machine, i + 0x10 + 1, color);
if (offset == ((i >> 4) & 0x03))
palette_set_color(machine, i + 0x10 + 2, color);
if (offset == ((i >> 6) & 0x03))
palette_set_color(machine, i + 0x10 + 3, color);
}
}
} | [
"static",
"void",
"melliped_mazeinv_set_color",
"(",
"running_machine",
"*",
"machine",
",",
"offs_t",
"offset",
",",
"UINT8",
"data",
")",
"{",
"rgb_t",
"color",
";",
"int",
"bit0",
",",
"bit1",
",",
"bit2",
";",
"int",
"r",
",",
"g",
",",
"b",
";",
"bit0",
"=",
"(",
"~",
"data",
">>",
"5",
")",
"&",
"0x01",
";",
"bit1",
"=",
"(",
"~",
"data",
">>",
"6",
")",
"&",
"0x01",
";",
"bit2",
"=",
"(",
"~",
"data",
">>",
"7",
")",
"&",
"0x01",
";",
"r",
"=",
"0x21",
"*",
"bit0",
"+",
"0x47",
"*",
"bit1",
"+",
"0x97",
"*",
"bit2",
";",
"bit0",
"=",
"0",
";",
"bit1",
"=",
"(",
"~",
"data",
">>",
"3",
")",
"&",
"0x01",
";",
"bit2",
"=",
"(",
"~",
"data",
">>",
"4",
")",
"&",
"0x01",
";",
"g",
"=",
"0x21",
"*",
"bit0",
"+",
"0x47",
"*",
"bit1",
"+",
"0x97",
"*",
"bit2",
";",
"bit0",
"=",
"(",
"~",
"data",
">>",
"0",
")",
"&",
"0x01",
";",
"bit1",
"=",
"(",
"~",
"data",
">>",
"1",
")",
"&",
"0x01",
";",
"bit2",
"=",
"(",
"~",
"data",
">>",
"2",
")",
"&",
"0x01",
";",
"b",
"=",
"0x21",
"*",
"bit0",
"+",
"0x47",
"*",
"bit1",
"+",
"0x97",
"*",
"bit2",
";",
"color",
"=",
"MAKE_RGB",
"(",
"r",
",",
"g",
",",
"b",
")",
";",
"if",
"(",
"offset",
"<",
"0x10",
")",
"palette_set_color",
"(",
"machine",
",",
"offset",
",",
"color",
")",
";",
"else",
"{",
"int",
"i",
";",
"int",
"base",
"=",
"offset",
"&",
"0x0c",
";",
"offset",
"=",
"offset",
"&",
"0x03",
";",
"for",
"(",
"i",
"=",
"(",
"base",
"<<",
"6",
")",
";",
"i",
"<",
"(",
"base",
"<<",
"6",
")",
"+",
"0x100",
";",
"i",
"+=",
"4",
")",
"{",
"if",
"(",
"offset",
"==",
"(",
"(",
"i",
">>",
"2",
")",
"&",
"0x03",
")",
")",
"palette_set_color",
"(",
"machine",
",",
"i",
"+",
"0x10",
"+",
"1",
",",
"color",
")",
";",
"if",
"(",
"offset",
"==",
"(",
"(",
"i",
">>",
"4",
")",
"&",
"0x03",
")",
")",
"palette_set_color",
"(",
"machine",
",",
"i",
"+",
"0x10",
"+",
"2",
",",
"color",
")",
";",
"if",
"(",
"offset",
"==",
"(",
"(",
"i",
">>",
"6",
")",
"&",
"0x03",
")",
")",
"palette_set_color",
"(",
"machine",
",",
"i",
"+",
"0x10",
"+",
"3",
",",
"color",
")",
";",
"}",
"}",
"}"
] | Millipede doesn't have a color PROM, it uses RAM. | [
"Millipede",
"doesn",
"'",
"t",
"have",
"a",
"color",
"PROM",
"it",
"uses",
"RAM",
"."
] | [
"/* red component */",
"/* green component */",
"/* blue component */",
"/* character colors, set directly */",
"/* sprite colors - set all the applicable ones */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "offset",
"type": "offs_t"
},
{
"param": "data",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": "offs_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9fd5cc6d65de56ba3aab163bd76921e7c2a8de10 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/drivers/cps3.c | [
"Unlicense"
] | C | cps3_draw_tilemapsprite_line | void | static void cps3_draw_tilemapsprite_line(running_machine *machine, int tmnum, int drawline, bitmap_t *bitmap, const rectangle *cliprect )
{
UINT32* tmapregs[4] = { tilemap20_regs_base, tilemap30_regs_base, tilemap40_regs_base, tilemap50_regs_base };
UINT32* regs;
int line;
int scrolly;
if (tmnum>3)
{
printf("cps3_draw_tilemapsprite_line Illegal tilemap number %d\n",tmnum);
return;
}
regs = tmapregs[tmnum];
scrolly = ((regs[0]&0x0000ffff)>>0)+4;
line = drawline+scrolly;
line&=0x3ff;
if (!(regs[1]&0x00008000)) return;
{
UINT32 mapbase = (regs[2]&0x007f0000)>>16;
UINT32 linebase= (regs[2]&0x7f000000)>>24;
int linescroll_enable = (regs[1]&0x00004000);
int scrollx;
int x;
int tileline = (line/16)+1;
int tilesubline = line % 16;
rectangle clip;
mapbase = mapbase << 10;
linebase = linebase << 10;
if (!linescroll_enable)
{
scrollx = (regs[0]&0xffff0000)>>16;
}
else
{
// printf("linebase %08x\n", linebase);
scrollx = (regs[0]&0xffff0000)>>16;
scrollx+= (cps3_spriteram[linebase+((line+16-4)&0x3ff)]>>16)&0x3ff;
}
// zoombase = (layerregs[1]&0xffff0000)>>16;
drawline&=0x3ff;
if (drawline>cliprect->max_y+4) return;
clip.min_x = cliprect->min_x;
clip.max_x = cliprect->max_x;
clip.min_y = drawline;
clip.max_y = drawline;
for (x=0;x<(cliprect->max_x/16)+2;x++)
{
UINT32 dat;
int tileno;
int colour;
int bpp;
int xflip,yflip;
dat = cps3_spriteram[mapbase+((tileline&63)*64)+((x+scrollx/16)&63)];
tileno = (dat & 0xffff0000)>>17;
colour = (dat & 0x000001ff)>>0;
bpp = (dat & 0x0000200)>>9;
yflip = (dat & 0x00000800)>>11;
xflip = (dat & 0x00001000)>>12;
if (!bpp) machine->gfx[1]->color_granularity=256;
else machine->gfx[1]->color_granularity=64;
cps3_drawgfxzoom(bitmap,&clip,machine->gfx[1],tileno,colour,xflip,yflip,(x*16)-scrollx%16,drawline-tilesubline,CPS3_TRANSPARENCY_PEN_INDEX,0, 0x10000, 0x10000, NULL, 0);
}
}
} | // the 0x400 bit in the tilemap regs is "draw it upside-down" (bios tilemap during flashing, otherwise capcom logo is flipped) | the 0x400 bit in the tilemap regs is "draw it upside-down" (bios tilemap during flashing, otherwise capcom logo is flipped) | [
"the",
"0x400",
"bit",
"in",
"the",
"tilemap",
"regs",
"is",
"\"",
"draw",
"it",
"upside",
"-",
"down",
"\"",
"(",
"bios",
"tilemap",
"during",
"flashing",
"otherwise",
"capcom",
"logo",
"is",
"flipped",
")"
] | static void cps3_draw_tilemapsprite_line(running_machine *machine, int tmnum, int drawline, bitmap_t *bitmap, const rectangle *cliprect )
{
UINT32* tmapregs[4] = { tilemap20_regs_base, tilemap30_regs_base, tilemap40_regs_base, tilemap50_regs_base };
UINT32* regs;
int line;
int scrolly;
if (tmnum>3)
{
printf("cps3_draw_tilemapsprite_line Illegal tilemap number %d\n",tmnum);
return;
}
regs = tmapregs[tmnum];
scrolly = ((regs[0]&0x0000ffff)>>0)+4;
line = drawline+scrolly;
line&=0x3ff;
if (!(regs[1]&0x00008000)) return;
{
UINT32 mapbase = (regs[2]&0x007f0000)>>16;
UINT32 linebase= (regs[2]&0x7f000000)>>24;
int linescroll_enable = (regs[1]&0x00004000);
int scrollx;
int x;
int tileline = (line/16)+1;
int tilesubline = line % 16;
rectangle clip;
mapbase = mapbase << 10;
linebase = linebase << 10;
if (!linescroll_enable)
{
scrollx = (regs[0]&0xffff0000)>>16;
}
else
{
scrollx = (regs[0]&0xffff0000)>>16;
scrollx+= (cps3_spriteram[linebase+((line+16-4)&0x3ff)]>>16)&0x3ff;
}
drawline&=0x3ff;
if (drawline>cliprect->max_y+4) return;
clip.min_x = cliprect->min_x;
clip.max_x = cliprect->max_x;
clip.min_y = drawline;
clip.max_y = drawline;
for (x=0;x<(cliprect->max_x/16)+2;x++)
{
UINT32 dat;
int tileno;
int colour;
int bpp;
int xflip,yflip;
dat = cps3_spriteram[mapbase+((tileline&63)*64)+((x+scrollx/16)&63)];
tileno = (dat & 0xffff0000)>>17;
colour = (dat & 0x000001ff)>>0;
bpp = (dat & 0x0000200)>>9;
yflip = (dat & 0x00000800)>>11;
xflip = (dat & 0x00001000)>>12;
if (!bpp) machine->gfx[1]->color_granularity=256;
else machine->gfx[1]->color_granularity=64;
cps3_drawgfxzoom(bitmap,&clip,machine->gfx[1],tileno,colour,xflip,yflip,(x*16)-scrollx%16,drawline-tilesubline,CPS3_TRANSPARENCY_PEN_INDEX,0, 0x10000, 0x10000, NULL, 0);
}
}
} | [
"static",
"void",
"cps3_draw_tilemapsprite_line",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"tmnum",
",",
"int",
"drawline",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
")",
"{",
"UINT32",
"*",
"tmapregs",
"[",
"4",
"]",
"=",
"{",
"tilemap20_regs_base",
",",
"tilemap30_regs_base",
",",
"tilemap40_regs_base",
",",
"tilemap50_regs_base",
"}",
";",
"UINT32",
"*",
"regs",
";",
"int",
"line",
";",
"int",
"scrolly",
";",
"if",
"(",
"tmnum",
">",
"3",
")",
"{",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"tmnum",
")",
";",
"return",
";",
"}",
"regs",
"=",
"tmapregs",
"[",
"tmnum",
"]",
";",
"scrolly",
"=",
"(",
"(",
"regs",
"[",
"0",
"]",
"&",
"0x0000ffff",
")",
">>",
"0",
")",
"+",
"4",
";",
"line",
"=",
"drawline",
"+",
"scrolly",
";",
"line",
"&=",
"0x3ff",
";",
"if",
"(",
"!",
"(",
"regs",
"[",
"1",
"]",
"&",
"0x00008000",
")",
")",
"return",
";",
"{",
"UINT32",
"mapbase",
"=",
"(",
"regs",
"[",
"2",
"]",
"&",
"0x007f0000",
")",
">>",
"16",
";",
"UINT32",
"linebase",
"=",
"(",
"regs",
"[",
"2",
"]",
"&",
"0x7f000000",
")",
">>",
"24",
";",
"int",
"linescroll_enable",
"=",
"(",
"regs",
"[",
"1",
"]",
"&",
"0x00004000",
")",
";",
"int",
"scrollx",
";",
"int",
"x",
";",
"int",
"tileline",
"=",
"(",
"line",
"/",
"16",
")",
"+",
"1",
";",
"int",
"tilesubline",
"=",
"line",
"%",
"16",
";",
"rectangle",
"clip",
";",
"mapbase",
"=",
"mapbase",
"<<",
"10",
";",
"linebase",
"=",
"linebase",
"<<",
"10",
";",
"if",
"(",
"!",
"linescroll_enable",
")",
"{",
"scrollx",
"=",
"(",
"regs",
"[",
"0",
"]",
"&",
"0xffff0000",
")",
">>",
"16",
";",
"}",
"else",
"{",
"scrollx",
"=",
"(",
"regs",
"[",
"0",
"]",
"&",
"0xffff0000",
")",
">>",
"16",
";",
"scrollx",
"+=",
"(",
"cps3_spriteram",
"[",
"linebase",
"+",
"(",
"(",
"line",
"+",
"16",
"-",
"4",
")",
"&",
"0x3ff",
")",
"]",
">>",
"16",
")",
"&",
"0x3ff",
";",
"}",
"drawline",
"&=",
"0x3ff",
";",
"if",
"(",
"drawline",
">",
"cliprect",
"->",
"max_y",
"+",
"4",
")",
"return",
";",
"clip",
".",
"min_x",
"=",
"cliprect",
"->",
"min_x",
";",
"clip",
".",
"max_x",
"=",
"cliprect",
"->",
"max_x",
";",
"clip",
".",
"min_y",
"=",
"drawline",
";",
"clip",
".",
"max_y",
"=",
"drawline",
";",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"(",
"cliprect",
"->",
"max_x",
"/",
"16",
")",
"+",
"2",
";",
"x",
"++",
")",
"{",
"UINT32",
"dat",
";",
"int",
"tileno",
";",
"int",
"colour",
";",
"int",
"bpp",
";",
"int",
"xflip",
",",
"yflip",
";",
"dat",
"=",
"cps3_spriteram",
"[",
"mapbase",
"+",
"(",
"(",
"tileline",
"&",
"63",
")",
"*",
"64",
")",
"+",
"(",
"(",
"x",
"+",
"scrollx",
"/",
"16",
")",
"&",
"63",
")",
"]",
";",
"tileno",
"=",
"(",
"dat",
"&",
"0xffff0000",
")",
">>",
"17",
";",
"colour",
"=",
"(",
"dat",
"&",
"0x000001ff",
")",
">>",
"0",
";",
"bpp",
"=",
"(",
"dat",
"&",
"0x0000200",
")",
">>",
"9",
";",
"yflip",
"=",
"(",
"dat",
"&",
"0x00000800",
")",
">>",
"11",
";",
"xflip",
"=",
"(",
"dat",
"&",
"0x00001000",
")",
">>",
"12",
";",
"if",
"(",
"!",
"bpp",
")",
"machine",
"->",
"gfx",
"[",
"1",
"]",
"->",
"color_granularity",
"=",
"256",
";",
"else",
"machine",
"->",
"gfx",
"[",
"1",
"]",
"->",
"color_granularity",
"=",
"64",
";",
"cps3_drawgfxzoom",
"(",
"bitmap",
",",
"&",
"clip",
",",
"machine",
"->",
"gfx",
"[",
"1",
"]",
",",
"tileno",
",",
"colour",
",",
"xflip",
",",
"yflip",
",",
"(",
"x",
"*",
"16",
")",
"-",
"scrollx",
"%",
"16",
",",
"drawline",
"-",
"tilesubline",
",",
"CPS3_TRANSPARENCY_PEN_INDEX",
",",
"0",
",",
"0x10000",
",",
"0x10000",
",",
"NULL",
",",
"0",
")",
";",
"}",
"}",
"}"
] | the 0x400 bit in the tilemap regs is "draw it upside-down" (bios tilemap during flashing, otherwise capcom logo is flipped) | [
"the",
"0x400",
"bit",
"in",
"the",
"tilemap",
"regs",
"is",
"\"",
"draw",
"it",
"upside",
"-",
"down",
"\"",
"(",
"bios",
"tilemap",
"during",
"flashing",
"otherwise",
"capcom",
"logo",
"is",
"flipped",
")"
] | [
"// printf(\"linebase %08x\\n\", linebase);",
"// zoombase = (layerregs[1]&0xffff0000)>>16;"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "tmnum",
"type": "int"
},
{
"param": "drawline",
"type": "int"
},
{
"param": "bitmap",
"type": "bitmap_t"
},
{
"param": "cliprect",
"type": "rectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tmnum",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "drawline",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitmap",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cliprect",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9fd5cc6d65de56ba3aab163bd76921e7c2a8de10 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/drivers/cps3.c | [
"Unlicense"
] | C | copy_from_nvram | void | static void copy_from_nvram(running_machine *machine)
{
UINT32* romdata = (UINT32*)cps3_user4region;
UINT32* romdata2 = (UINT32*)decrypted_gamerom;
int i;
/* copy + decrypt program roms which have been loaded from flashroms/nvram */
for (i=0;i<0x800000;i+=4)
{
UINT32 data;
UINT8* ptr1 = (UINT8*)intelflash_getmemptr(0);
UINT8* ptr2 = (UINT8*)intelflash_getmemptr(1);
UINT8* ptr3 = (UINT8*)intelflash_getmemptr(2);
UINT8* ptr4 = (UINT8*)intelflash_getmemptr(3);
data = ((ptr1[i/4]<<24) | (ptr2[i/4]<<16) | (ptr3[i/4]<<8) | (ptr4[i/4]<<0));
// printf("%08x %08x %08x %08x\n",romdata[i/4],data, romdata2[i/4], data ^ cps3_mask(i+0x6000000, cps3_key1, cps3_key2));
romdata[i/4] = data;
romdata2[i/4] = data ^ cps3_mask(i+0x6000000, cps3_key1, cps3_key2);
}
romdata += 0x800000/4;
romdata2 += 0x800000/4;
for (i=0;i<0x800000;i+=4)
{
UINT32 data;
UINT8* ptr1 = (UINT8*)intelflash_getmemptr(4);
UINT8* ptr2 = (UINT8*)intelflash_getmemptr(5);
UINT8* ptr3 = (UINT8*)intelflash_getmemptr(6);
UINT8* ptr4 = (UINT8*)intelflash_getmemptr(7);
data = ((ptr1[i/4]<<24) | (ptr2[i/4]<<16) | (ptr3[i/4]<<8) | (ptr4[i/4]<<0));
// printf("%08x %08x %08x %08x\n",romdata[i/4],data, romdata2[i/4], data ^ cps3_mask(i+0x6800000, cps3_key1, cps3_key2) );
romdata[i/4] = data;
romdata2[i/4] = data ^ cps3_mask(i+0x6800000, cps3_key1, cps3_key2);
}
/* copy gfx from loaded flashroms to user reigon 5, where it's used */
{
UINT32 thebase, len = USER5REGION_LENGTH;
int flashnum = 8;
int countoffset = 0;
romdata = (UINT32*)cps3_user5region;
for (thebase = 0;thebase < len/2; thebase+=0x200000)
{
// printf("flashnums %d. %d\n",flashnum, flashnum+1);
for (i=0;i<0x200000;i+=2)
{
UINT8* ptr1 = (UINT8*)intelflash_getmemptr(flashnum);
UINT8* ptr2 = (UINT8*)intelflash_getmemptr(flashnum+1);
UINT32 dat = (ptr1[i+0]<<8) |
(ptr1[i+1]<<24) |
(ptr2[i+0]<<0) |
(ptr2[i+1]<<16);
//printf("%08x %08x\n",romdata[countoffset],dat);
romdata[countoffset] = dat;
countoffset++;
}
flashnum+=2;
}
}
/*
{
FILE *fp;
const char *gamename = machine->gamedrv->name;
char filename[256];
sprintf(filename, "%s_bios.dump", gamename);
fp=fopen(filename, "w+b");
if (fp)
{
fwrite(rom, 0x080000, 1, fp);
fclose(fp);
}
}
*/
} | // make a copy in the regions we execute code / draw gfx from | make a copy in the regions we execute code / draw gfx from | [
"make",
"a",
"copy",
"in",
"the",
"regions",
"we",
"execute",
"code",
"/",
"draw",
"gfx",
"from"
] | static void copy_from_nvram(running_machine *machine)
{
UINT32* romdata = (UINT32*)cps3_user4region;
UINT32* romdata2 = (UINT32*)decrypted_gamerom;
int i;
for (i=0;i<0x800000;i+=4)
{
UINT32 data;
UINT8* ptr1 = (UINT8*)intelflash_getmemptr(0);
UINT8* ptr2 = (UINT8*)intelflash_getmemptr(1);
UINT8* ptr3 = (UINT8*)intelflash_getmemptr(2);
UINT8* ptr4 = (UINT8*)intelflash_getmemptr(3);
data = ((ptr1[i/4]<<24) | (ptr2[i/4]<<16) | (ptr3[i/4]<<8) | (ptr4[i/4]<<0));
romdata[i/4] = data;
romdata2[i/4] = data ^ cps3_mask(i+0x6000000, cps3_key1, cps3_key2);
}
romdata += 0x800000/4;
romdata2 += 0x800000/4;
for (i=0;i<0x800000;i+=4)
{
UINT32 data;
UINT8* ptr1 = (UINT8*)intelflash_getmemptr(4);
UINT8* ptr2 = (UINT8*)intelflash_getmemptr(5);
UINT8* ptr3 = (UINT8*)intelflash_getmemptr(6);
UINT8* ptr4 = (UINT8*)intelflash_getmemptr(7);
data = ((ptr1[i/4]<<24) | (ptr2[i/4]<<16) | (ptr3[i/4]<<8) | (ptr4[i/4]<<0));
romdata[i/4] = data;
romdata2[i/4] = data ^ cps3_mask(i+0x6800000, cps3_key1, cps3_key2);
}
{
UINT32 thebase, len = USER5REGION_LENGTH;
int flashnum = 8;
int countoffset = 0;
romdata = (UINT32*)cps3_user5region;
for (thebase = 0;thebase < len/2; thebase+=0x200000)
{
for (i=0;i<0x200000;i+=2)
{
UINT8* ptr1 = (UINT8*)intelflash_getmemptr(flashnum);
UINT8* ptr2 = (UINT8*)intelflash_getmemptr(flashnum+1);
UINT32 dat = (ptr1[i+0]<<8) |
(ptr1[i+1]<<24) |
(ptr2[i+0]<<0) |
(ptr2[i+1]<<16);
romdata[countoffset] = dat;
countoffset++;
}
flashnum+=2;
}
}
} | [
"static",
"void",
"copy_from_nvram",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"UINT32",
"*",
"romdata",
"=",
"(",
"UINT32",
"*",
")",
"cps3_user4region",
";",
"UINT32",
"*",
"romdata2",
"=",
"(",
"UINT32",
"*",
")",
"decrypted_gamerom",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"0x800000",
";",
"i",
"+=",
"4",
")",
"{",
"UINT32",
"data",
";",
"UINT8",
"*",
"ptr1",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"0",
")",
";",
"UINT8",
"*",
"ptr2",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"1",
")",
";",
"UINT8",
"*",
"ptr3",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"2",
")",
";",
"UINT8",
"*",
"ptr4",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"3",
")",
";",
"data",
"=",
"(",
"(",
"ptr1",
"[",
"i",
"/",
"4",
"]",
"<<",
"24",
")",
"|",
"(",
"ptr2",
"[",
"i",
"/",
"4",
"]",
"<<",
"16",
")",
"|",
"(",
"ptr3",
"[",
"i",
"/",
"4",
"]",
"<<",
"8",
")",
"|",
"(",
"ptr4",
"[",
"i",
"/",
"4",
"]",
"<<",
"0",
")",
")",
";",
"romdata",
"[",
"i",
"/",
"4",
"]",
"=",
"data",
";",
"romdata2",
"[",
"i",
"/",
"4",
"]",
"=",
"data",
"^",
"cps3_mask",
"(",
"i",
"+",
"0x6000000",
",",
"cps3_key1",
",",
"cps3_key2",
")",
";",
"}",
"romdata",
"+=",
"0x800000",
"/",
"4",
";",
"romdata2",
"+=",
"0x800000",
"/",
"4",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"0x800000",
";",
"i",
"+=",
"4",
")",
"{",
"UINT32",
"data",
";",
"UINT8",
"*",
"ptr1",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"4",
")",
";",
"UINT8",
"*",
"ptr2",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"5",
")",
";",
"UINT8",
"*",
"ptr3",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"6",
")",
";",
"UINT8",
"*",
"ptr4",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"7",
")",
";",
"data",
"=",
"(",
"(",
"ptr1",
"[",
"i",
"/",
"4",
"]",
"<<",
"24",
")",
"|",
"(",
"ptr2",
"[",
"i",
"/",
"4",
"]",
"<<",
"16",
")",
"|",
"(",
"ptr3",
"[",
"i",
"/",
"4",
"]",
"<<",
"8",
")",
"|",
"(",
"ptr4",
"[",
"i",
"/",
"4",
"]",
"<<",
"0",
")",
")",
";",
"romdata",
"[",
"i",
"/",
"4",
"]",
"=",
"data",
";",
"romdata2",
"[",
"i",
"/",
"4",
"]",
"=",
"data",
"^",
"cps3_mask",
"(",
"i",
"+",
"0x6800000",
",",
"cps3_key1",
",",
"cps3_key2",
")",
";",
"}",
"{",
"UINT32",
"thebase",
",",
"len",
"=",
"USER5REGION_LENGTH",
";",
"int",
"flashnum",
"=",
"8",
";",
"int",
"countoffset",
"=",
"0",
";",
"romdata",
"=",
"(",
"UINT32",
"*",
")",
"cps3_user5region",
";",
"for",
"(",
"thebase",
"=",
"0",
";",
"thebase",
"<",
"len",
"/",
"2",
";",
"thebase",
"+=",
"0x200000",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"0x200000",
";",
"i",
"+=",
"2",
")",
"{",
"UINT8",
"*",
"ptr1",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"flashnum",
")",
";",
"UINT8",
"*",
"ptr2",
"=",
"(",
"UINT8",
"*",
")",
"intelflash_getmemptr",
"(",
"flashnum",
"+",
"1",
")",
";",
"UINT32",
"dat",
"=",
"(",
"ptr1",
"[",
"i",
"+",
"0",
"]",
"<<",
"8",
")",
"|",
"(",
"ptr1",
"[",
"i",
"+",
"1",
"]",
"<<",
"24",
")",
"|",
"(",
"ptr2",
"[",
"i",
"+",
"0",
"]",
"<<",
"0",
")",
"|",
"(",
"ptr2",
"[",
"i",
"+",
"1",
"]",
"<<",
"16",
")",
";",
"romdata",
"[",
"countoffset",
"]",
"=",
"dat",
";",
"countoffset",
"++",
";",
"}",
"flashnum",
"+=",
"2",
";",
"}",
"}",
"}"
] | make a copy in the regions we execute code / draw gfx from | [
"make",
"a",
"copy",
"in",
"the",
"regions",
"we",
"execute",
"code",
"/",
"draw",
"gfx",
"from"
] | [
"/* copy + decrypt program roms which have been loaded from flashroms/nvram */",
"// printf(\"%08x %08x %08x %08x\\n\",romdata[i/4],data, romdata2[i/4], data ^ cps3_mask(i+0x6000000, cps3_key1, cps3_key2));",
"// printf(\"%08x %08x %08x %08x\\n\",romdata[i/4],data, romdata2[i/4], data ^ cps3_mask(i+0x6800000, cps3_key1, cps3_key2) );",
"/* copy gfx from loaded flashroms to user reigon 5, where it's used */",
"// printf(\"flashnums %d. %d\\n\",flashnum, flashnum+1);",
"//printf(\"%08x %08x\\n\",romdata[countoffset],dat);",
"/*\n {\n FILE *fp;\n const char *gamename = machine->gamedrv->name;\n char filename[256];\n sprintf(filename, \"%s_bios.dump\", gamename);\n\n fp=fopen(filename, \"w+b\");\n if (fp)\n {\n fwrite(rom, 0x080000, 1, fp);\n fclose(fp);\n }\n }\n */"
] | [
{
"param": "machine",
"type": "running_machine"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | code_flush_cache | void | static void code_flush_cache(powerpc_state *ppc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
int mode;
/* empty the transient cache contents */
drcuml_reset(drcuml);
/* generate the entry point and out-of-cycles handlers */
static_generate_entry_point(ppc);
static_generate_nocode_handler(ppc);
static_generate_out_of_cycles(ppc);
static_generate_tlb_mismatch(ppc);
if (ppc->cap & PPCCAP_603_MMU)
static_generate_swap_tgpr(ppc);
/* append exception handlers for various types */
static_generate_exception(ppc, EXCEPTION_RESET, TRUE, "exception_reset");
static_generate_exception(ppc, EXCEPTION_MACHCHECK, TRUE, "exception_machine_check");
static_generate_exception(ppc, EXCEPTION_DSI, TRUE, "exception_dsi");
static_generate_exception(ppc, EXCEPTION_ISI, TRUE, "exception_isi");
static_generate_exception(ppc, EXCEPTION_EI, TRUE, "exception_ei");
static_generate_exception(ppc, EXCEPTION_EI, FALSE, "exception_ei_norecover");
static_generate_exception(ppc, EXCEPTION_ALIGN, TRUE, "exception_align");
static_generate_exception(ppc, EXCEPTION_PROGRAM, TRUE, "exception_program");
static_generate_exception(ppc, EXCEPTION_NOFPU, TRUE, "exception_fpu_unavailable");
static_generate_exception(ppc, EXCEPTION_DECREMENT, TRUE, "exception_decrementer");
static_generate_exception(ppc, EXCEPTION_SYSCALL, TRUE, "exception_syscall");
static_generate_exception(ppc, EXCEPTION_TRACE, TRUE, "exception_trace");
static_generate_exception(ppc, EXCEPTION_FPASSIST, TRUE, "exception_floating_point_assist");
if (ppc->cap & PPCCAP_603_MMU)
{
static_generate_exception(ppc, EXCEPTION_ITLBMISS, TRUE, "exception_itlb_miss");
static_generate_exception(ppc, EXCEPTION_DTLBMISSL, TRUE, "exception_dtlb_miss_load");
static_generate_exception(ppc, EXCEPTION_DTLBMISSS, TRUE, "exception_dtlb_miss_store");
}
/* add subroutines for memory accesses */
for (mode = 0; mode < 8; mode++)
{
static_generate_memory_accessor(ppc, mode, 1, FALSE, FALSE, "read8", &ppc->impstate->read8[mode], NULL);
static_generate_memory_accessor(ppc, mode, 1, TRUE, FALSE, "write8", &ppc->impstate->write8[mode], NULL);
static_generate_memory_accessor(ppc, mode, 2, FALSE, TRUE, "read16mask", &ppc->impstate->read16mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 2, FALSE, FALSE, "read16", &ppc->impstate->read16[mode], ppc->impstate->read16mask[mode]);
static_generate_memory_accessor(ppc, mode, 2, TRUE, TRUE, "write16mask", &ppc->impstate->write16mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 2, TRUE, FALSE, "write16", &ppc->impstate->write16[mode], ppc->impstate->write16mask[mode]);
static_generate_memory_accessor(ppc, mode, 4, FALSE, TRUE, "read32mask", &ppc->impstate->read32mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 4, FALSE, FALSE, "read32align", &ppc->impstate->read32align[mode], NULL);
static_generate_memory_accessor(ppc, mode, 4, FALSE, FALSE, "read32", &ppc->impstate->read32[mode], ppc->impstate->read32mask[mode]);
static_generate_memory_accessor(ppc, mode, 4, TRUE, TRUE, "write32mask", &ppc->impstate->write32mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 4, TRUE, FALSE, "write32align",&ppc->impstate->write32align[mode],NULL);
static_generate_memory_accessor(ppc, mode, 4, TRUE, FALSE, "write32", &ppc->impstate->write32[mode], ppc->impstate->write32mask[mode]);
static_generate_memory_accessor(ppc, mode, 8, FALSE, TRUE, "read64mask", &ppc->impstate->read64mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 8, FALSE, FALSE, "read64", &ppc->impstate->read64[mode], ppc->impstate->read64mask[mode]);
static_generate_memory_accessor(ppc, mode, 8, TRUE, TRUE, "write64mask", &ppc->impstate->write64mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 8, TRUE, FALSE, "write64", &ppc->impstate->write64[mode], ppc->impstate->write64mask[mode]);
static_generate_lsw_entries(ppc, mode);
static_generate_stsw_entries(ppc, mode);
}
} | /*-------------------------------------------------
code_flush_cache - flush the cache and
regenerate static code
-------------------------------------------------*/ | flush the cache and
regenerate static code | [
"flush",
"the",
"cache",
"and",
"regenerate",
"static",
"code"
] | static void code_flush_cache(powerpc_state *ppc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
int mode;
drcuml_reset(drcuml);
static_generate_entry_point(ppc);
static_generate_nocode_handler(ppc);
static_generate_out_of_cycles(ppc);
static_generate_tlb_mismatch(ppc);
if (ppc->cap & PPCCAP_603_MMU)
static_generate_swap_tgpr(ppc);
static_generate_exception(ppc, EXCEPTION_RESET, TRUE, "exception_reset");
static_generate_exception(ppc, EXCEPTION_MACHCHECK, TRUE, "exception_machine_check");
static_generate_exception(ppc, EXCEPTION_DSI, TRUE, "exception_dsi");
static_generate_exception(ppc, EXCEPTION_ISI, TRUE, "exception_isi");
static_generate_exception(ppc, EXCEPTION_EI, TRUE, "exception_ei");
static_generate_exception(ppc, EXCEPTION_EI, FALSE, "exception_ei_norecover");
static_generate_exception(ppc, EXCEPTION_ALIGN, TRUE, "exception_align");
static_generate_exception(ppc, EXCEPTION_PROGRAM, TRUE, "exception_program");
static_generate_exception(ppc, EXCEPTION_NOFPU, TRUE, "exception_fpu_unavailable");
static_generate_exception(ppc, EXCEPTION_DECREMENT, TRUE, "exception_decrementer");
static_generate_exception(ppc, EXCEPTION_SYSCALL, TRUE, "exception_syscall");
static_generate_exception(ppc, EXCEPTION_TRACE, TRUE, "exception_trace");
static_generate_exception(ppc, EXCEPTION_FPASSIST, TRUE, "exception_floating_point_assist");
if (ppc->cap & PPCCAP_603_MMU)
{
static_generate_exception(ppc, EXCEPTION_ITLBMISS, TRUE, "exception_itlb_miss");
static_generate_exception(ppc, EXCEPTION_DTLBMISSL, TRUE, "exception_dtlb_miss_load");
static_generate_exception(ppc, EXCEPTION_DTLBMISSS, TRUE, "exception_dtlb_miss_store");
}
for (mode = 0; mode < 8; mode++)
{
static_generate_memory_accessor(ppc, mode, 1, FALSE, FALSE, "read8", &ppc->impstate->read8[mode], NULL);
static_generate_memory_accessor(ppc, mode, 1, TRUE, FALSE, "write8", &ppc->impstate->write8[mode], NULL);
static_generate_memory_accessor(ppc, mode, 2, FALSE, TRUE, "read16mask", &ppc->impstate->read16mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 2, FALSE, FALSE, "read16", &ppc->impstate->read16[mode], ppc->impstate->read16mask[mode]);
static_generate_memory_accessor(ppc, mode, 2, TRUE, TRUE, "write16mask", &ppc->impstate->write16mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 2, TRUE, FALSE, "write16", &ppc->impstate->write16[mode], ppc->impstate->write16mask[mode]);
static_generate_memory_accessor(ppc, mode, 4, FALSE, TRUE, "read32mask", &ppc->impstate->read32mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 4, FALSE, FALSE, "read32align", &ppc->impstate->read32align[mode], NULL);
static_generate_memory_accessor(ppc, mode, 4, FALSE, FALSE, "read32", &ppc->impstate->read32[mode], ppc->impstate->read32mask[mode]);
static_generate_memory_accessor(ppc, mode, 4, TRUE, TRUE, "write32mask", &ppc->impstate->write32mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 4, TRUE, FALSE, "write32align",&ppc->impstate->write32align[mode],NULL);
static_generate_memory_accessor(ppc, mode, 4, TRUE, FALSE, "write32", &ppc->impstate->write32[mode], ppc->impstate->write32mask[mode]);
static_generate_memory_accessor(ppc, mode, 8, FALSE, TRUE, "read64mask", &ppc->impstate->read64mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 8, FALSE, FALSE, "read64", &ppc->impstate->read64[mode], ppc->impstate->read64mask[mode]);
static_generate_memory_accessor(ppc, mode, 8, TRUE, TRUE, "write64mask", &ppc->impstate->write64mask[mode], NULL);
static_generate_memory_accessor(ppc, mode, 8, TRUE, FALSE, "write64", &ppc->impstate->write64[mode], ppc->impstate->write64mask[mode]);
static_generate_lsw_entries(ppc, mode);
static_generate_stsw_entries(ppc, mode);
}
} | [
"static",
"void",
"code_flush_cache",
"(",
"powerpc_state",
"*",
"ppc",
")",
"{",
"drcuml_state",
"*",
"drcuml",
"=",
"ppc",
"->",
"impstate",
"->",
"drcuml",
";",
"int",
"mode",
";",
"drcuml_reset",
"(",
"drcuml",
")",
";",
"static_generate_entry_point",
"(",
"ppc",
")",
";",
"static_generate_nocode_handler",
"(",
"ppc",
")",
";",
"static_generate_out_of_cycles",
"(",
"ppc",
")",
";",
"static_generate_tlb_mismatch",
"(",
"ppc",
")",
";",
"if",
"(",
"ppc",
"->",
"cap",
"&",
"PPCCAP_603_MMU",
")",
"static_generate_swap_tgpr",
"(",
"ppc",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_RESET",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_MACHCHECK",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_DSI",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_ISI",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_EI",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_EI",
",",
"FALSE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_ALIGN",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_PROGRAM",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_NOFPU",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_DECREMENT",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_SYSCALL",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_TRACE",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_FPASSIST",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"ppc",
"->",
"cap",
"&",
"PPCCAP_603_MMU",
")",
"{",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_ITLBMISS",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_DTLBMISSL",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"static_generate_exception",
"(",
"ppc",
",",
"EXCEPTION_DTLBMISSS",
",",
"TRUE",
",",
"\"",
"\"",
")",
";",
"}",
"for",
"(",
"mode",
"=",
"0",
";",
"mode",
"<",
"8",
";",
"mode",
"++",
")",
"{",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"1",
",",
"FALSE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"read8",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"1",
",",
"TRUE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"write8",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"2",
",",
"FALSE",
",",
"TRUE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"read16mask",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"2",
",",
"FALSE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"read16",
"[",
"mode",
"]",
",",
"ppc",
"->",
"impstate",
"->",
"read16mask",
"[",
"mode",
"]",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"2",
",",
"TRUE",
",",
"TRUE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"write16mask",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"2",
",",
"TRUE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"write16",
"[",
"mode",
"]",
",",
"ppc",
"->",
"impstate",
"->",
"write16mask",
"[",
"mode",
"]",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"4",
",",
"FALSE",
",",
"TRUE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"read32mask",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"4",
",",
"FALSE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"read32align",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"4",
",",
"FALSE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"read32",
"[",
"mode",
"]",
",",
"ppc",
"->",
"impstate",
"->",
"read32mask",
"[",
"mode",
"]",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"4",
",",
"TRUE",
",",
"TRUE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"write32mask",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"4",
",",
"TRUE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"write32align",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"4",
",",
"TRUE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"write32",
"[",
"mode",
"]",
",",
"ppc",
"->",
"impstate",
"->",
"write32mask",
"[",
"mode",
"]",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"8",
",",
"FALSE",
",",
"TRUE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"read64mask",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"8",
",",
"FALSE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"read64",
"[",
"mode",
"]",
",",
"ppc",
"->",
"impstate",
"->",
"read64mask",
"[",
"mode",
"]",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"8",
",",
"TRUE",
",",
"TRUE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"write64mask",
"[",
"mode",
"]",
",",
"NULL",
")",
";",
"static_generate_memory_accessor",
"(",
"ppc",
",",
"mode",
",",
"8",
",",
"TRUE",
",",
"FALSE",
",",
"\"",
"\"",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"write64",
"[",
"mode",
"]",
",",
"ppc",
"->",
"impstate",
"->",
"write64mask",
"[",
"mode",
"]",
")",
";",
"static_generate_lsw_entries",
"(",
"ppc",
",",
"mode",
")",
";",
"static_generate_stsw_entries",
"(",
"ppc",
",",
"mode",
")",
";",
"}",
"}"
] | code_flush_cache - flush the cache and
regenerate static code | [
"code_flush_cache",
"-",
"flush",
"the",
"cache",
"and",
"regenerate",
"static",
"code"
] | [
"/* empty the transient cache contents */",
"/* generate the entry point and out-of-cycles handlers */",
"/* append exception handlers for various types */",
"/* add subroutines for memory accesses */"
] | [
{
"param": "ppc",
"type": "powerpc_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | code_compile_block | void | static void code_compile_block(powerpc_state *ppc, UINT8 mode, offs_t pc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
compiler_state compiler = { 0 };
const opcode_desc *seqhead, *seqlast;
const opcode_desc *desclist;
int override = FALSE;
drcuml_block *block;
jmp_buf errorbuf;
profiler_mark_start(PROFILER_DRC_COMPILE);
/* get a description of this sequence */
desclist = drcfe_describe_code(ppc->impstate->drcfe, pc);
if (LOG_UML || LOG_NATIVE)
log_opcode_desc(drcuml, desclist, 0);
/* if we get an error back, flush the cache and try again */
if (setjmp(errorbuf) != 0)
code_flush_cache(ppc);
/* start the block */
block = drcuml_block_begin(drcuml, 4096, &errorbuf);
/* loop until we get through all instruction sequences */
for (seqhead = desclist; seqhead != NULL; seqhead = seqlast->next)
{
const opcode_desc *curdesc;
UINT32 nextpc;
/* add a code log entry */
if (LOG_UML)
UML_COMMENT(block, "-------------------------"); // comment
/* determine the last instruction in this sequence */
for (seqlast = seqhead; seqlast != NULL; seqlast = seqlast->next)
if (seqlast->flags & OPFLAG_END_SEQUENCE)
break;
assert(seqlast != NULL);
/* if we don't have a hash for this mode/pc, or if we are overriding all, add one */
if (override || !drcuml_hash_exists(drcuml, mode, seqhead->pc))
UML_HASH(block, mode, seqhead->pc); // hash mode,pc
/* if we already have a hash, and this is the first sequence, assume that we */
/* are recompiling due to being out of sync and allow future overrides */
else if (seqhead == desclist)
{
override = TRUE;
UML_HASH(block, mode, seqhead->pc); // hash mode,pc
}
/* otherwise, redispatch to that fixed PC and skip the rest of the processing */
else
{
UML_LABEL(block, seqhead->pc | 0x80000000); // label seqhead->pc | 0x80000000
UML_HASHJMP(block, IMM(ppc->impstate->mode), IMM(seqhead->pc), ppc->impstate->nocode);
// hashjmp <mode>,seqhead->pc,nocode
continue;
}
/* validate this code block if we're not pointing into ROM */
if (memory_get_write_ptr(ppc->program, seqhead->physpc) != NULL)
generate_checksum_block(ppc, block, &compiler, seqhead, seqlast); // <checksum>
/* label this instruction, if it may be jumped to locally */
if (seqhead->flags & OPFLAG_IS_BRANCH_TARGET)
UML_LABEL(block, seqhead->pc | 0x80000000); // label seqhead->pc | 0x80000000
/* iterate over instructions in the sequence and compile them */
for (curdesc = seqhead; curdesc != seqlast->next; curdesc = curdesc->next)
generate_sequence_instruction(ppc, block, &compiler, curdesc); // <instruction>
/* if we need to return to the start, do it */
if (seqlast->flags & OPFLAG_RETURN_TO_START)
nextpc = pc;
/* otherwise we just go to the next instruction */
else
nextpc = seqlast->pc + (seqlast->skipslots + 1) * 4;
/* count off cycles and go there */
generate_update_cycles(ppc, block, &compiler, IMM(nextpc), TRUE); // <subtract cycles>
/* if the last instruction can change modes, use a variable mode; otherwise, assume the same mode */
if (seqlast->flags & OPFLAG_CAN_CHANGE_MODES)
UML_HASHJMP(block, MEM(&ppc->impstate->mode), IMM(nextpc), ppc->impstate->nocode);// hashjmp <mode>,nextpc,nocode
else if (seqlast->next == NULL || seqlast->next->pc != nextpc)
UML_HASHJMP(block, IMM(ppc->impstate->mode), IMM(nextpc), ppc->impstate->nocode);// hashjmp <mode>,nextpc,nocode
}
/* end the sequence */
drcuml_block_end(block);
profiler_mark_end();
} | /*-------------------------------------------------
code_compile_block - compile a block of the
given mode at the specified pc
-------------------------------------------------*/ | compile a block of the
given mode at the specified pc | [
"compile",
"a",
"block",
"of",
"the",
"given",
"mode",
"at",
"the",
"specified",
"pc"
] | static void code_compile_block(powerpc_state *ppc, UINT8 mode, offs_t pc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
compiler_state compiler = { 0 };
const opcode_desc *seqhead, *seqlast;
const opcode_desc *desclist;
int override = FALSE;
drcuml_block *block;
jmp_buf errorbuf;
profiler_mark_start(PROFILER_DRC_COMPILE);
desclist = drcfe_describe_code(ppc->impstate->drcfe, pc);
if (LOG_UML || LOG_NATIVE)
log_opcode_desc(drcuml, desclist, 0);
if (setjmp(errorbuf) != 0)
code_flush_cache(ppc);
block = drcuml_block_begin(drcuml, 4096, &errorbuf);
for (seqhead = desclist; seqhead != NULL; seqhead = seqlast->next)
{
const opcode_desc *curdesc;
UINT32 nextpc;
if (LOG_UML)
UML_COMMENT(block, "-------------------------");
for (seqlast = seqhead; seqlast != NULL; seqlast = seqlast->next)
if (seqlast->flags & OPFLAG_END_SEQUENCE)
break;
assert(seqlast != NULL);
if (override || !drcuml_hash_exists(drcuml, mode, seqhead->pc))
UML_HASH(block, mode, seqhead->pc);
else if (seqhead == desclist)
{
override = TRUE;
UML_HASH(block, mode, seqhead->pc);
}
else
{
UML_LABEL(block, seqhead->pc | 0x80000000);
UML_HASHJMP(block, IMM(ppc->impstate->mode), IMM(seqhead->pc), ppc->impstate->nocode);
continue;
}
if (memory_get_write_ptr(ppc->program, seqhead->physpc) != NULL)
generate_checksum_block(ppc, block, &compiler, seqhead, seqlast);
if (seqhead->flags & OPFLAG_IS_BRANCH_TARGET)
UML_LABEL(block, seqhead->pc | 0x80000000);
for (curdesc = seqhead; curdesc != seqlast->next; curdesc = curdesc->next)
generate_sequence_instruction(ppc, block, &compiler, curdesc);
if (seqlast->flags & OPFLAG_RETURN_TO_START)
nextpc = pc;
else
nextpc = seqlast->pc + (seqlast->skipslots + 1) * 4;
generate_update_cycles(ppc, block, &compiler, IMM(nextpc), TRUE);
if (seqlast->flags & OPFLAG_CAN_CHANGE_MODES)
UML_HASHJMP(block, MEM(&ppc->impstate->mode), IMM(nextpc), ppc->impstate->nocode);
else if (seqlast->next == NULL || seqlast->next->pc != nextpc)
UML_HASHJMP(block, IMM(ppc->impstate->mode), IMM(nextpc), ppc->impstate->nocode);
}
drcuml_block_end(block);
profiler_mark_end();
} | [
"static",
"void",
"code_compile_block",
"(",
"powerpc_state",
"*",
"ppc",
",",
"UINT8",
"mode",
",",
"offs_t",
"pc",
")",
"{",
"drcuml_state",
"*",
"drcuml",
"=",
"ppc",
"->",
"impstate",
"->",
"drcuml",
";",
"compiler_state",
"compiler",
"=",
"{",
"0",
"}",
";",
"const",
"opcode_desc",
"*",
"seqhead",
",",
"*",
"seqlast",
";",
"const",
"opcode_desc",
"*",
"desclist",
";",
"int",
"override",
"=",
"FALSE",
";",
"drcuml_block",
"*",
"block",
";",
"jmp_buf",
"errorbuf",
";",
"profiler_mark_start",
"(",
"PROFILER_DRC_COMPILE",
")",
";",
"desclist",
"=",
"drcfe_describe_code",
"(",
"ppc",
"->",
"impstate",
"->",
"drcfe",
",",
"pc",
")",
";",
"if",
"(",
"LOG_UML",
"||",
"LOG_NATIVE",
")",
"log_opcode_desc",
"(",
"drcuml",
",",
"desclist",
",",
"0",
")",
";",
"if",
"(",
"setjmp",
"(",
"errorbuf",
")",
"!=",
"0",
")",
"code_flush_cache",
"(",
"ppc",
")",
";",
"block",
"=",
"drcuml_block_begin",
"(",
"drcuml",
",",
"4096",
",",
"&",
"errorbuf",
")",
";",
"for",
"(",
"seqhead",
"=",
"desclist",
";",
"seqhead",
"!=",
"NULL",
";",
"seqhead",
"=",
"seqlast",
"->",
"next",
")",
"{",
"const",
"opcode_desc",
"*",
"curdesc",
";",
"UINT32",
"nextpc",
";",
"if",
"(",
"LOG_UML",
")",
"UML_COMMENT",
"(",
"block",
",",
"\"",
"\"",
")",
";",
"for",
"(",
"seqlast",
"=",
"seqhead",
";",
"seqlast",
"!=",
"NULL",
";",
"seqlast",
"=",
"seqlast",
"->",
"next",
")",
"if",
"(",
"seqlast",
"->",
"flags",
"&",
"OPFLAG_END_SEQUENCE",
")",
"break",
";",
"assert",
"(",
"seqlast",
"!=",
"NULL",
")",
";",
"if",
"(",
"override",
"||",
"!",
"drcuml_hash_exists",
"(",
"drcuml",
",",
"mode",
",",
"seqhead",
"->",
"pc",
")",
")",
"UML_HASH",
"(",
"block",
",",
"mode",
",",
"seqhead",
"->",
"pc",
")",
";",
"else",
"if",
"(",
"seqhead",
"==",
"desclist",
")",
"{",
"override",
"=",
"TRUE",
";",
"UML_HASH",
"(",
"block",
",",
"mode",
",",
"seqhead",
"->",
"pc",
")",
";",
"}",
"else",
"{",
"UML_LABEL",
"(",
"block",
",",
"seqhead",
"->",
"pc",
"|",
"0x80000000",
")",
";",
"UML_HASHJMP",
"(",
"block",
",",
"IMM",
"(",
"ppc",
"->",
"impstate",
"->",
"mode",
")",
",",
"IMM",
"(",
"seqhead",
"->",
"pc",
")",
",",
"ppc",
"->",
"impstate",
"->",
"nocode",
")",
";",
"continue",
";",
"}",
"if",
"(",
"memory_get_write_ptr",
"(",
"ppc",
"->",
"program",
",",
"seqhead",
"->",
"physpc",
")",
"!=",
"NULL",
")",
"generate_checksum_block",
"(",
"ppc",
",",
"block",
",",
"&",
"compiler",
",",
"seqhead",
",",
"seqlast",
")",
";",
"if",
"(",
"seqhead",
"->",
"flags",
"&",
"OPFLAG_IS_BRANCH_TARGET",
")",
"UML_LABEL",
"(",
"block",
",",
"seqhead",
"->",
"pc",
"|",
"0x80000000",
")",
";",
"for",
"(",
"curdesc",
"=",
"seqhead",
";",
"curdesc",
"!=",
"seqlast",
"->",
"next",
";",
"curdesc",
"=",
"curdesc",
"->",
"next",
")",
"generate_sequence_instruction",
"(",
"ppc",
",",
"block",
",",
"&",
"compiler",
",",
"curdesc",
")",
";",
"if",
"(",
"seqlast",
"->",
"flags",
"&",
"OPFLAG_RETURN_TO_START",
")",
"nextpc",
"=",
"pc",
";",
"else",
"nextpc",
"=",
"seqlast",
"->",
"pc",
"+",
"(",
"seqlast",
"->",
"skipslots",
"+",
"1",
")",
"*",
"4",
";",
"generate_update_cycles",
"(",
"ppc",
",",
"block",
",",
"&",
"compiler",
",",
"IMM",
"(",
"nextpc",
")",
",",
"TRUE",
")",
";",
"if",
"(",
"seqlast",
"->",
"flags",
"&",
"OPFLAG_CAN_CHANGE_MODES",
")",
"UML_HASHJMP",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"mode",
")",
",",
"IMM",
"(",
"nextpc",
")",
",",
"ppc",
"->",
"impstate",
"->",
"nocode",
")",
";",
"else",
"if",
"(",
"seqlast",
"->",
"next",
"==",
"NULL",
"||",
"seqlast",
"->",
"next",
"->",
"pc",
"!=",
"nextpc",
")",
"UML_HASHJMP",
"(",
"block",
",",
"IMM",
"(",
"ppc",
"->",
"impstate",
"->",
"mode",
")",
",",
"IMM",
"(",
"nextpc",
")",
",",
"ppc",
"->",
"impstate",
"->",
"nocode",
")",
";",
"}",
"drcuml_block_end",
"(",
"block",
")",
";",
"profiler_mark_end",
"(",
")",
";",
"}"
] | code_compile_block - compile a block of the
given mode at the specified pc | [
"code_compile_block",
"-",
"compile",
"a",
"block",
"of",
"the",
"given",
"mode",
"at",
"the",
"specified",
"pc"
] | [
"/* get a description of this sequence */",
"/* if we get an error back, flush the cache and try again */",
"/* start the block */",
"/* loop until we get through all instruction sequences */",
"/* add a code log entry */",
"// comment\r",
"/* determine the last instruction in this sequence */",
"/* if we don't have a hash for this mode/pc, or if we are overriding all, add one */",
"// hash mode,pc\r",
"/* if we already have a hash, and this is the first sequence, assume that we */",
"/* are recompiling due to being out of sync and allow future overrides */",
"// hash mode,pc\r",
"/* otherwise, redispatch to that fixed PC and skip the rest of the processing */",
"// label seqhead->pc | 0x80000000\r",
"// hashjmp <mode>,seqhead->pc,nocode\r",
"/* validate this code block if we're not pointing into ROM */",
"// <checksum>\r",
"/* label this instruction, if it may be jumped to locally */",
"// label seqhead->pc | 0x80000000\r",
"/* iterate over instructions in the sequence and compile them */",
"// <instruction>\r",
"/* if we need to return to the start, do it */",
"/* otherwise we just go to the next instruction */",
"/* count off cycles and go there */",
"// <subtract cycles>\r",
"/* if the last instruction can change modes, use a variable mode; otherwise, assume the same mode */",
"// hashjmp <mode>,nextpc,nocode\r",
"// hashjmp <mode>,nextpc,nocode\r",
"/* end the sequence */"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "mode",
"type": "UINT8"
},
{
"param": "pc",
"type": "offs_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pc",
"type": "offs_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | cfunc_printf_exception | void | static void cfunc_printf_exception(void *param)
{
powerpc_state *ppc = (powerpc_state *)param;
printf("Exception: type=%2d EPC=%08X MSR=%08X\n", ppc->param0, ppc->spr[SPROEA_SRR0], ppc->spr[SPROEA_SRR1]);
cfunc_printf_probe(ppc);
} | /*-------------------------------------------------
cfunc_printf_exception - log any exceptions that
aren't interrupts
-------------------------------------------------*/ | log any exceptions that
aren't interrupts | [
"log",
"any",
"exceptions",
"that",
"aren",
"'",
"t",
"interrupts"
] | static void cfunc_printf_exception(void *param)
{
powerpc_state *ppc = (powerpc_state *)param;
printf("Exception: type=%2d EPC=%08X MSR=%08X\n", ppc->param0, ppc->spr[SPROEA_SRR0], ppc->spr[SPROEA_SRR1]);
cfunc_printf_probe(ppc);
} | [
"static",
"void",
"cfunc_printf_exception",
"(",
"void",
"*",
"param",
")",
"{",
"powerpc_state",
"*",
"ppc",
"=",
"(",
"powerpc_state",
"*",
")",
"param",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"ppc",
"->",
"param0",
",",
"ppc",
"->",
"spr",
"[",
"SPROEA_SRR0",
"]",
",",
"ppc",
"->",
"spr",
"[",
"SPROEA_SRR1",
"]",
")",
";",
"cfunc_printf_probe",
"(",
"ppc",
")",
";",
"}"
] | cfunc_printf_exception - log any exceptions that
aren't interrupts | [
"cfunc_printf_exception",
"-",
"log",
"any",
"exceptions",
"that",
"aren",
"'",
"t",
"interrupts"
] | [] | [
{
"param": "param",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "param",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | cfunc_printf_probe | void | static void cfunc_printf_probe(void *param)
{
powerpc_state *ppc = (powerpc_state *)param;
UINT32 pc = (UINT32)(FPTR)param;
printf(" PC=%08X\n", pc);
printf(" r0=%08X r1=%08X r2=%08X r3=%08X\n",
ppc->r[0], ppc->r[1], ppc->r[2], ppc->r[3]);
printf(" r4=%08X r5=%08X r6=%08X r7=%08X\n",
ppc->r[4], ppc->r[5], ppc->r[6], ppc->r[7]);
printf(" r8=%08X r9=%08X r10=%08X r11=%08X\n",
ppc->r[8], ppc->r[9], ppc->r[10], ppc->r[11]);
printf("r12=%08X r13=%08X r14=%08X r15=%08X\n",
ppc->r[12], ppc->r[13], ppc->r[14], ppc->r[15]);
printf("r16=%08X r17=%08X r18=%08X r19=%08X\n",
ppc->r[16], ppc->r[17], ppc->r[18], ppc->r[19]);
printf("r20=%08X r21=%08X r22=%08X r23=%08X\n",
ppc->r[20], ppc->r[21], ppc->r[22], ppc->r[23]);
printf("r24=%08X r25=%08X r26=%08X r27=%08X\n",
ppc->r[24], ppc->r[25], ppc->r[26], ppc->r[27]);
printf("r28=%08X r29=%08X r30=%08X r31=%08X\n",
ppc->r[28], ppc->r[29], ppc->r[30], ppc->r[31]);
} | /*-------------------------------------------------
cfunc_printf_probe - print the current CPU
state and return
-------------------------------------------------*/ | print the current CPU
state and return | [
"print",
"the",
"current",
"CPU",
"state",
"and",
"return"
] | static void cfunc_printf_probe(void *param)
{
powerpc_state *ppc = (powerpc_state *)param;
UINT32 pc = (UINT32)(FPTR)param;
printf(" PC=%08X\n", pc);
printf(" r0=%08X r1=%08X r2=%08X r3=%08X\n",
ppc->r[0], ppc->r[1], ppc->r[2], ppc->r[3]);
printf(" r4=%08X r5=%08X r6=%08X r7=%08X\n",
ppc->r[4], ppc->r[5], ppc->r[6], ppc->r[7]);
printf(" r8=%08X r9=%08X r10=%08X r11=%08X\n",
ppc->r[8], ppc->r[9], ppc->r[10], ppc->r[11]);
printf("r12=%08X r13=%08X r14=%08X r15=%08X\n",
ppc->r[12], ppc->r[13], ppc->r[14], ppc->r[15]);
printf("r16=%08X r17=%08X r18=%08X r19=%08X\n",
ppc->r[16], ppc->r[17], ppc->r[18], ppc->r[19]);
printf("r20=%08X r21=%08X r22=%08X r23=%08X\n",
ppc->r[20], ppc->r[21], ppc->r[22], ppc->r[23]);
printf("r24=%08X r25=%08X r26=%08X r27=%08X\n",
ppc->r[24], ppc->r[25], ppc->r[26], ppc->r[27]);
printf("r28=%08X r29=%08X r30=%08X r31=%08X\n",
ppc->r[28], ppc->r[29], ppc->r[30], ppc->r[31]);
} | [
"static",
"void",
"cfunc_printf_probe",
"(",
"void",
"*",
"param",
")",
"{",
"powerpc_state",
"*",
"ppc",
"=",
"(",
"powerpc_state",
"*",
")",
"param",
";",
"UINT32",
"pc",
"=",
"(",
"UINT32",
")",
"(",
"FPTR",
")",
"param",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"pc",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"ppc",
"->",
"r",
"[",
"0",
"]",
",",
"ppc",
"->",
"r",
"[",
"1",
"]",
",",
"ppc",
"->",
"r",
"[",
"2",
"]",
",",
"ppc",
"->",
"r",
"[",
"3",
"]",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"ppc",
"->",
"r",
"[",
"4",
"]",
",",
"ppc",
"->",
"r",
"[",
"5",
"]",
",",
"ppc",
"->",
"r",
"[",
"6",
"]",
",",
"ppc",
"->",
"r",
"[",
"7",
"]",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"ppc",
"->",
"r",
"[",
"8",
"]",
",",
"ppc",
"->",
"r",
"[",
"9",
"]",
",",
"ppc",
"->",
"r",
"[",
"10",
"]",
",",
"ppc",
"->",
"r",
"[",
"11",
"]",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"ppc",
"->",
"r",
"[",
"12",
"]",
",",
"ppc",
"->",
"r",
"[",
"13",
"]",
",",
"ppc",
"->",
"r",
"[",
"14",
"]",
",",
"ppc",
"->",
"r",
"[",
"15",
"]",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"ppc",
"->",
"r",
"[",
"16",
"]",
",",
"ppc",
"->",
"r",
"[",
"17",
"]",
",",
"ppc",
"->",
"r",
"[",
"18",
"]",
",",
"ppc",
"->",
"r",
"[",
"19",
"]",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"ppc",
"->",
"r",
"[",
"20",
"]",
",",
"ppc",
"->",
"r",
"[",
"21",
"]",
",",
"ppc",
"->",
"r",
"[",
"22",
"]",
",",
"ppc",
"->",
"r",
"[",
"23",
"]",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"ppc",
"->",
"r",
"[",
"24",
"]",
",",
"ppc",
"->",
"r",
"[",
"25",
"]",
",",
"ppc",
"->",
"r",
"[",
"26",
"]",
",",
"ppc",
"->",
"r",
"[",
"27",
"]",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"ppc",
"->",
"r",
"[",
"28",
"]",
",",
"ppc",
"->",
"r",
"[",
"29",
"]",
",",
"ppc",
"->",
"r",
"[",
"30",
"]",
",",
"ppc",
"->",
"r",
"[",
"31",
"]",
")",
";",
"}"
] | cfunc_printf_probe - print the current CPU
state and return | [
"cfunc_printf_probe",
"-",
"print",
"the",
"current",
"CPU",
"state",
"and",
"return"
] | [] | [
{
"param": "param",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "param",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | static_generate_nocode_handler | void | static void static_generate_nocode_handler(powerpc_state *ppc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
/* if we get an error back, we're screwed */
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_nocode_handler");
/* begin generating */
block = drcuml_block_begin(drcuml, 10, &errorbuf);
/* generate a hash jump via the current mode and PC */
alloc_handle(drcuml, &ppc->impstate->nocode, "nocode");
UML_HANDLE(block, ppc->impstate->nocode); // handle nocode
UML_GETEXP(block, IREG(0)); // getexp i0
UML_MOV(block, MEM(&ppc->pc), IREG(0)); // mov [pc],i0
save_fast_iregs(ppc, block); // <save fastregs>
UML_EXIT(block, IMM(EXECUTE_MISSING_CODE)); // exit EXECUTE_MISSING_CODE
drcuml_block_end(block);
} | /*-------------------------------------------------
static_generate_nocode_handler - generate an
exception handler for "out of code"
-------------------------------------------------*/ | generate an
exception handler for "out of code" | [
"generate",
"an",
"exception",
"handler",
"for",
"\"",
"out",
"of",
"code",
"\""
] | static void static_generate_nocode_handler(powerpc_state *ppc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_nocode_handler");
block = drcuml_block_begin(drcuml, 10, &errorbuf);
alloc_handle(drcuml, &ppc->impstate->nocode, "nocode");
UML_HANDLE(block, ppc->impstate->nocode);
UML_GETEXP(block, IREG(0));
UML_MOV(block, MEM(&ppc->pc), IREG(0));
save_fast_iregs(ppc, block);
UML_EXIT(block, IMM(EXECUTE_MISSING_CODE));
drcuml_block_end(block);
} | [
"static",
"void",
"static_generate_nocode_handler",
"(",
"powerpc_state",
"*",
"ppc",
")",
"{",
"drcuml_state",
"*",
"drcuml",
"=",
"ppc",
"->",
"impstate",
"->",
"drcuml",
";",
"drcuml_block",
"*",
"block",
";",
"jmp_buf",
"errorbuf",
";",
"if",
"(",
"setjmp",
"(",
"errorbuf",
")",
"!=",
"0",
")",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"block",
"=",
"drcuml_block_begin",
"(",
"drcuml",
",",
"10",
",",
"&",
"errorbuf",
")",
";",
"alloc_handle",
"(",
"drcuml",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"nocode",
",",
"\"",
"\"",
")",
";",
"UML_HANDLE",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"nocode",
")",
";",
"UML_GETEXP",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
")",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"pc",
")",
",",
"IREG",
"(",
"0",
")",
")",
";",
"save_fast_iregs",
"(",
"ppc",
",",
"block",
")",
";",
"UML_EXIT",
"(",
"block",
",",
"IMM",
"(",
"EXECUTE_MISSING_CODE",
")",
")",
";",
"drcuml_block_end",
"(",
"block",
")",
";",
"}"
] | static_generate_nocode_handler - generate an
exception handler for "out of code" | [
"static_generate_nocode_handler",
"-",
"generate",
"an",
"exception",
"handler",
"for",
"\"",
"out",
"of",
"code",
"\""
] | [
"/* if we get an error back, we're screwed */",
"/* begin generating */",
"/* generate a hash jump via the current mode and PC */",
"// handle nocode\r",
"// getexp i0\r",
"// mov [pc],i0\r",
"// <save fastregs>\r",
"// exit EXECUTE_MISSING_CODE\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | static_generate_out_of_cycles | void | static void static_generate_out_of_cycles(powerpc_state *ppc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
/* if we get an error back, we're screwed */
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_out_of_cycles");
/* begin generating */
block = drcuml_block_begin(drcuml, 10, &errorbuf);
/* generate a hash jump via the current mode and PC */
alloc_handle(drcuml, &ppc->impstate->out_of_cycles, "out_of_cycles");
UML_HANDLE(block, ppc->impstate->out_of_cycles); // handle out_of_cycles
UML_GETEXP(block, IREG(0)); // getexp i0
UML_MOV(block, MEM(&ppc->pc), IREG(0)); // mov <pc>,i0
save_fast_iregs(ppc, block); // <save fastregs>
UML_EXIT(block, IMM(EXECUTE_OUT_OF_CYCLES)); // exit EXECUTE_OUT_OF_CYCLES
drcuml_block_end(block);
} | /*-------------------------------------------------
static_generate_out_of_cycles - generate an
out of cycles exception handler
-------------------------------------------------*/ | generate an
out of cycles exception handler | [
"generate",
"an",
"out",
"of",
"cycles",
"exception",
"handler"
] | static void static_generate_out_of_cycles(powerpc_state *ppc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_out_of_cycles");
block = drcuml_block_begin(drcuml, 10, &errorbuf);
alloc_handle(drcuml, &ppc->impstate->out_of_cycles, "out_of_cycles");
UML_HANDLE(block, ppc->impstate->out_of_cycles);
UML_GETEXP(block, IREG(0));
UML_MOV(block, MEM(&ppc->pc), IREG(0));
save_fast_iregs(ppc, block);
UML_EXIT(block, IMM(EXECUTE_OUT_OF_CYCLES));
drcuml_block_end(block);
} | [
"static",
"void",
"static_generate_out_of_cycles",
"(",
"powerpc_state",
"*",
"ppc",
")",
"{",
"drcuml_state",
"*",
"drcuml",
"=",
"ppc",
"->",
"impstate",
"->",
"drcuml",
";",
"drcuml_block",
"*",
"block",
";",
"jmp_buf",
"errorbuf",
";",
"if",
"(",
"setjmp",
"(",
"errorbuf",
")",
"!=",
"0",
")",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"block",
"=",
"drcuml_block_begin",
"(",
"drcuml",
",",
"10",
",",
"&",
"errorbuf",
")",
";",
"alloc_handle",
"(",
"drcuml",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"out_of_cycles",
",",
"\"",
"\"",
")",
";",
"UML_HANDLE",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"out_of_cycles",
")",
";",
"UML_GETEXP",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
")",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"pc",
")",
",",
"IREG",
"(",
"0",
")",
")",
";",
"save_fast_iregs",
"(",
"ppc",
",",
"block",
")",
";",
"UML_EXIT",
"(",
"block",
",",
"IMM",
"(",
"EXECUTE_OUT_OF_CYCLES",
")",
")",
";",
"drcuml_block_end",
"(",
"block",
")",
";",
"}"
] | static_generate_out_of_cycles - generate an
out of cycles exception handler | [
"static_generate_out_of_cycles",
"-",
"generate",
"an",
"out",
"of",
"cycles",
"exception",
"handler"
] | [
"/* if we get an error back, we're screwed */",
"/* begin generating */",
"/* generate a hash jump via the current mode and PC */",
"// handle out_of_cycles\r",
"// getexp i0\r",
"// mov <pc>,i0\r",
"// <save fastregs>\r",
"// exit EXECUTE_OUT_OF_CYCLES\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | static_generate_swap_tgpr | void | static void static_generate_swap_tgpr(powerpc_state *ppc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
int regnum;
/* if we get an error back, we're screwed */
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_swap_tgpr");
/* begin generating */
block = drcuml_block_begin(drcuml, 30, &errorbuf);
/* generate a hash jump via the current mode and PC */
alloc_handle(drcuml, &ppc->impstate->swap_tgpr, "swap_tgpr");
UML_HANDLE(block, ppc->impstate->swap_tgpr); // handle swap_tgpr
for (regnum = 0; regnum < 4; regnum++)
{
UML_MOV(block, IREG(1), R32(regnum)); // mov i1,r[regnum]
UML_MOV(block, R32(regnum), MEM(&ppc->mmu603_r[regnum])); // mov r[regnum],mmu603_r[regnum]
UML_MOV(block, MEM(&ppc->mmu603_r[regnum]), IREG(1)); // mov mmu603_r[regnum],i1
}
UML_RET(block); // ret
drcuml_block_end(block);
} | /*-------------------------------------------------
static_generate_swap_tgpr - generate a
subroutine to swap GPR0-3 with TGPR0-3
-------------------------------------------------*/ | generate a
subroutine to swap GPR0-3 with TGPR0-3 | [
"generate",
"a",
"subroutine",
"to",
"swap",
"GPR0",
"-",
"3",
"with",
"TGPR0",
"-",
"3"
] | static void static_generate_swap_tgpr(powerpc_state *ppc)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
int regnum;
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_swap_tgpr");
block = drcuml_block_begin(drcuml, 30, &errorbuf);
alloc_handle(drcuml, &ppc->impstate->swap_tgpr, "swap_tgpr");
UML_HANDLE(block, ppc->impstate->swap_tgpr);
for (regnum = 0; regnum < 4; regnum++)
{
UML_MOV(block, IREG(1), R32(regnum));
UML_MOV(block, R32(regnum), MEM(&ppc->mmu603_r[regnum]));
UML_MOV(block, MEM(&ppc->mmu603_r[regnum]), IREG(1));
}
UML_RET(block);
drcuml_block_end(block);
} | [
"static",
"void",
"static_generate_swap_tgpr",
"(",
"powerpc_state",
"*",
"ppc",
")",
"{",
"drcuml_state",
"*",
"drcuml",
"=",
"ppc",
"->",
"impstate",
"->",
"drcuml",
";",
"drcuml_block",
"*",
"block",
";",
"jmp_buf",
"errorbuf",
";",
"int",
"regnum",
";",
"if",
"(",
"setjmp",
"(",
"errorbuf",
")",
"!=",
"0",
")",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"block",
"=",
"drcuml_block_begin",
"(",
"drcuml",
",",
"30",
",",
"&",
"errorbuf",
")",
";",
"alloc_handle",
"(",
"drcuml",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"swap_tgpr",
",",
"\"",
"\"",
")",
";",
"UML_HANDLE",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"swap_tgpr",
")",
";",
"for",
"(",
"regnum",
"=",
"0",
";",
"regnum",
"<",
"4",
";",
"regnum",
"++",
")",
"{",
"UML_MOV",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"R32",
"(",
"regnum",
")",
")",
";",
"UML_MOV",
"(",
"block",
",",
"R32",
"(",
"regnum",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"mmu603_r",
"[",
"regnum",
"]",
")",
")",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"mmu603_r",
"[",
"regnum",
"]",
")",
",",
"IREG",
"(",
"1",
")",
")",
";",
"}",
"UML_RET",
"(",
"block",
")",
";",
"drcuml_block_end",
"(",
"block",
")",
";",
"}"
] | static_generate_swap_tgpr - generate a
subroutine to swap GPR0-3 with TGPR0-3 | [
"static_generate_swap_tgpr",
"-",
"generate",
"a",
"subroutine",
"to",
"swap",
"GPR0",
"-",
"3",
"with",
"TGPR0",
"-",
"3"
] | [
"/* if we get an error back, we're screwed */",
"/* begin generating */",
"/* generate a hash jump via the current mode and PC */",
"// handle swap_tgpr\r",
"// mov i1,r[regnum]\r",
"// mov r[regnum],mmu603_r[regnum]\r",
"// mov mmu603_r[regnum],i1\r",
"// ret\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | static_generate_lsw_entries | void | static void static_generate_lsw_entries(powerpc_state *ppc, int mode)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
int regnum;
/* if we get an error back, we're screwed */
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_lsw_entries");
/* begin generating */
block = drcuml_block_begin(drcuml, 32 * 30, &errorbuf);
/* iterate over all possible registers */
for (regnum = 0; regnum < 32; regnum++)
{
char temp[20];
/* allocate a handle */
sprintf(temp, "lsw%d", regnum);
alloc_handle(drcuml, &ppc->impstate->lsw[mode][regnum], temp);
UML_HANDLE(block, ppc->impstate->lsw[mode][regnum]); // handle lsw<regnum>
UML_LABEL(block, regnum); // regnum:
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(0)); // add i0,[updateaddr],0
UML_CALLH(block, ppc->impstate->read8[mode]); // callh read8
UML_ROLAND(block, R32(regnum), IREG(0), IMM(24), IMM(0xff000000)); // roland reg,i0,24,0xff000000
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1
UML_RETc(block, IF_Z); // ret z
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(1)); // add i0,[updateaddr],1
UML_CALLH(block, ppc->impstate->read8[mode]); // callh read8
UML_ROLAND(block, IREG(0), IREG(0), IMM(16), IMM(0x00ff0000)); // roland i0,i0,16,0x00ff0000
UML_OR(block, R32(regnum), R32(regnum), IREG(0)); // or reg,i0
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1
UML_RETc(block, IF_Z); // ret z
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(2)); // add i0,[updateaddr],2
UML_CALLH(block, ppc->impstate->read8[mode]); // callh read8
UML_ROLAND(block, IREG(0), IREG(0), IMM(8), IMM(0x0000ff00)); // roland i0,i0,8,0x0000ff00
UML_OR(block, R32(regnum), R32(regnum), IREG(0)); // or reg,i0
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1
UML_RETc(block, IF_Z); // ret z
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(3)); // add i0,[updateaddr],3
UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1)); // add [updateaddr],i0,1
UML_CALLH(block, ppc->impstate->read8[mode]); // callh read8
UML_ROLAND(block, IREG(0), IREG(0), IMM(0), IMM(0x000000ff)); // roland i0,i0,0,0x000000ff
UML_OR(block, R32(regnum), R32(regnum), IREG(0)); // or reg,i0
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1
UML_RETc(block, IF_Z); // ret z
UML_JMP(block, (regnum + 1) % 32); // jmp nextreg
}
drcuml_block_end(block);
} | /*-------------------------------------------------
static_generate_lsw_entries - generate a
subroutine to perform LSWI/LSWX; one handle
for each possible register
-------------------------------------------------*/ | generate a
subroutine to perform LSWI/LSWX; one handle
for each possible register | [
"generate",
"a",
"subroutine",
"to",
"perform",
"LSWI",
"/",
"LSWX",
";",
"one",
"handle",
"for",
"each",
"possible",
"register"
] | static void static_generate_lsw_entries(powerpc_state *ppc, int mode)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
int regnum;
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_lsw_entries");
block = drcuml_block_begin(drcuml, 32 * 30, &errorbuf);
for (regnum = 0; regnum < 32; regnum++)
{
char temp[20];
sprintf(temp, "lsw%d", regnum);
alloc_handle(drcuml, &ppc->impstate->lsw[mode][regnum], temp);
UML_HANDLE(block, ppc->impstate->lsw[mode][regnum]);
UML_LABEL(block, regnum);
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(0));
UML_CALLH(block, ppc->impstate->read8[mode]);
UML_ROLAND(block, R32(regnum), IREG(0), IMM(24), IMM(0xff000000));
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1));
UML_RETc(block, IF_Z);
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(1));
UML_CALLH(block, ppc->impstate->read8[mode]);
UML_ROLAND(block, IREG(0), IREG(0), IMM(16), IMM(0x00ff0000));
UML_OR(block, R32(regnum), R32(regnum), IREG(0));
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1));
UML_RETc(block, IF_Z);
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(2));
UML_CALLH(block, ppc->impstate->read8[mode]);
UML_ROLAND(block, IREG(0), IREG(0), IMM(8), IMM(0x0000ff00));
UML_OR(block, R32(regnum), R32(regnum), IREG(0));
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1));
UML_RETc(block, IF_Z);
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(3));
UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1));
UML_CALLH(block, ppc->impstate->read8[mode]);
UML_ROLAND(block, IREG(0), IREG(0), IMM(0), IMM(0x000000ff));
UML_OR(block, R32(regnum), R32(regnum), IREG(0));
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1));
UML_RETc(block, IF_Z);
UML_JMP(block, (regnum + 1) % 32);
}
drcuml_block_end(block);
} | [
"static",
"void",
"static_generate_lsw_entries",
"(",
"powerpc_state",
"*",
"ppc",
",",
"int",
"mode",
")",
"{",
"drcuml_state",
"*",
"drcuml",
"=",
"ppc",
"->",
"impstate",
"->",
"drcuml",
";",
"drcuml_block",
"*",
"block",
";",
"jmp_buf",
"errorbuf",
";",
"int",
"regnum",
";",
"if",
"(",
"setjmp",
"(",
"errorbuf",
")",
"!=",
"0",
")",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"block",
"=",
"drcuml_block_begin",
"(",
"drcuml",
",",
"32",
"*",
"30",
",",
"&",
"errorbuf",
")",
";",
"for",
"(",
"regnum",
"=",
"0",
";",
"regnum",
"<",
"32",
";",
"regnum",
"++",
")",
"{",
"char",
"temp",
"[",
"20",
"]",
";",
"sprintf",
"(",
"temp",
",",
"\"",
"\"",
",",
"regnum",
")",
";",
"alloc_handle",
"(",
"drcuml",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"lsw",
"[",
"mode",
"]",
"[",
"regnum",
"]",
",",
"temp",
")",
";",
"UML_HANDLE",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"lsw",
"[",
"mode",
"]",
"[",
"regnum",
"]",
")",
";",
"UML_LABEL",
"(",
"block",
",",
"regnum",
")",
";",
"UML_ADD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IMM",
"(",
"0",
")",
")",
";",
"UML_CALLH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"read8",
"[",
"mode",
"]",
")",
";",
"UML_ROLAND",
"(",
"block",
",",
"R32",
"(",
"regnum",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"24",
")",
",",
"IMM",
"(",
"0xff000000",
")",
")",
";",
"UML_SUB",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_RETc",
"(",
"block",
",",
"IF_Z",
")",
";",
"UML_ADD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_CALLH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"read8",
"[",
"mode",
"]",
")",
";",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"16",
")",
",",
"IMM",
"(",
"0x00ff0000",
")",
")",
";",
"UML_OR",
"(",
"block",
",",
"R32",
"(",
"regnum",
")",
",",
"R32",
"(",
"regnum",
")",
",",
"IREG",
"(",
"0",
")",
")",
";",
"UML_SUB",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_RETc",
"(",
"block",
",",
"IF_Z",
")",
";",
"UML_ADD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IMM",
"(",
"2",
")",
")",
";",
"UML_CALLH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"read8",
"[",
"mode",
"]",
")",
";",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"8",
")",
",",
"IMM",
"(",
"0x0000ff00",
")",
")",
";",
"UML_OR",
"(",
"block",
",",
"R32",
"(",
"regnum",
")",
",",
"R32",
"(",
"regnum",
")",
",",
"IREG",
"(",
"0",
")",
")",
";",
"UML_SUB",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_RETc",
"(",
"block",
",",
"IF_Z",
")",
";",
"UML_ADD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IMM",
"(",
"3",
")",
")",
";",
"UML_ADD",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_CALLH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"read8",
"[",
"mode",
"]",
")",
";",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"0",
")",
",",
"IMM",
"(",
"0x000000ff",
")",
")",
";",
"UML_OR",
"(",
"block",
",",
"R32",
"(",
"regnum",
")",
",",
"R32",
"(",
"regnum",
")",
",",
"IREG",
"(",
"0",
")",
")",
";",
"UML_SUB",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_RETc",
"(",
"block",
",",
"IF_Z",
")",
";",
"UML_JMP",
"(",
"block",
",",
"(",
"regnum",
"+",
"1",
")",
"%",
"32",
")",
";",
"}",
"drcuml_block_end",
"(",
"block",
")",
";",
"}"
] | static_generate_lsw_entries - generate a
subroutine to perform LSWI/LSWX; one handle
for each possible register | [
"static_generate_lsw_entries",
"-",
"generate",
"a",
"subroutine",
"to",
"perform",
"LSWI",
"/",
"LSWX",
";",
"one",
"handle",
"for",
"each",
"possible",
"register"
] | [
"/* if we get an error back, we're screwed */",
"/* begin generating */",
"/* iterate over all possible registers */",
"/* allocate a handle */",
"// handle lsw<regnum>\r",
"// regnum:\r",
"// add i0,[updateaddr],0\r",
"// callh read8\r",
"// roland reg,i0,24,0xff000000\r",
"// sub [swcount],[swcount],1\r",
"// ret z\r",
"// add i0,[updateaddr],1\r",
"// callh read8\r",
"// roland i0,i0,16,0x00ff0000\r",
"// or reg,i0\r",
"// sub [swcount],[swcount],1\r",
"// ret z\r",
"// add i0,[updateaddr],2\r",
"// callh read8\r",
"// roland i0,i0,8,0x0000ff00\r",
"// or reg,i0\r",
"// sub [swcount],[swcount],1\r",
"// ret z\r",
"// add i0,[updateaddr],3\r",
"// add [updateaddr],i0,1\r",
"// callh read8\r",
"// roland i0,i0,0,0x000000ff\r",
"// or reg,i0\r",
"// sub [swcount],[swcount],1\r",
"// ret z\r",
"// jmp nextreg\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "mode",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | static_generate_stsw_entries | void | static void static_generate_stsw_entries(powerpc_state *ppc, int mode)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
int regnum;
/* if we get an error back, we're screwed */
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_stsw_entries");
/* begin generating */
block = drcuml_block_begin(drcuml, 32 * 30, &errorbuf);
/* iterate over all possible registers */
for (regnum = 0; regnum < 32; regnum++)
{
char temp[20];
/* allocate a handle */
sprintf(temp, "stsw%d", regnum);
alloc_handle(drcuml, &ppc->impstate->stsw[mode][regnum], temp);
UML_HANDLE(block, ppc->impstate->stsw[mode][regnum]); // handle stsw<regnum>
UML_LABEL(block, regnum); // regnum:
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(0)); // add i0,[updateaddr],0
UML_ROLAND(block, IREG(1), R32(regnum), IMM(8), IMM(0xff)); // roland i1,regnum,8,0xff
UML_CALLH(block, ppc->impstate->write8[mode]); // callh write8
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1
UML_RETc(block, IF_Z); // ret z
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(1)); // add i0,[updateaddr],1
UML_ROLAND(block, IREG(1), R32(regnum), IMM(16), IMM(0xff)); // roland i1,regnum,16,0xff
UML_CALLH(block, ppc->impstate->write8[mode]); // callh write8
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1
UML_RETc(block, IF_Z); // ret z
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(2)); // add i0,[updateaddr],2
UML_ROLAND(block, IREG(1), R32(regnum), IMM(24), IMM(0xff)); // roland i1,regnum,24,0xff
UML_CALLH(block, ppc->impstate->write8[mode]); // callh write8
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1
UML_RETc(block, IF_Z); // ret z
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(3)); // add i0,[updateaddr],3
UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1)); // add [updateaddr],i0,1
UML_ROLAND(block, IREG(1), R32(regnum), IMM(0), IMM(0xff)); // roland i1,regnum,0,0xff
UML_CALLH(block, ppc->impstate->write8[mode]); // callh write8
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1)); // sub [swcount],[swcount],1
UML_RETc(block, IF_Z); // ret z
UML_JMP(block, (regnum + 1) % 32); // jmp nextreg
}
drcuml_block_end(block);
} | /*-------------------------------------------------
static_generate_stsw_entries - generate a
subroutine to perform LSWI/LSWX; one handle
for each possible register
-------------------------------------------------*/ | generate a
subroutine to perform LSWI/LSWX; one handle
for each possible register | [
"generate",
"a",
"subroutine",
"to",
"perform",
"LSWI",
"/",
"LSWX",
";",
"one",
"handle",
"for",
"each",
"possible",
"register"
] | static void static_generate_stsw_entries(powerpc_state *ppc, int mode)
{
drcuml_state *drcuml = ppc->impstate->drcuml;
drcuml_block *block;
jmp_buf errorbuf;
int regnum;
if (setjmp(errorbuf) != 0)
fatalerror("Unrecoverable error in static_generate_stsw_entries");
block = drcuml_block_begin(drcuml, 32 * 30, &errorbuf);
for (regnum = 0; regnum < 32; regnum++)
{
char temp[20];
sprintf(temp, "stsw%d", regnum);
alloc_handle(drcuml, &ppc->impstate->stsw[mode][regnum], temp);
UML_HANDLE(block, ppc->impstate->stsw[mode][regnum]);
UML_LABEL(block, regnum);
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(0));
UML_ROLAND(block, IREG(1), R32(regnum), IMM(8), IMM(0xff));
UML_CALLH(block, ppc->impstate->write8[mode]);
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1));
UML_RETc(block, IF_Z);
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(1));
UML_ROLAND(block, IREG(1), R32(regnum), IMM(16), IMM(0xff));
UML_CALLH(block, ppc->impstate->write8[mode]);
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1));
UML_RETc(block, IF_Z);
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(2));
UML_ROLAND(block, IREG(1), R32(regnum), IMM(24), IMM(0xff));
UML_CALLH(block, ppc->impstate->write8[mode]);
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1));
UML_RETc(block, IF_Z);
UML_ADD(block, IREG(0), MEM(&ppc->impstate->updateaddr), IMM(3));
UML_ADD(block, MEM(&ppc->impstate->updateaddr), IREG(0), IMM(1));
UML_ROLAND(block, IREG(1), R32(regnum), IMM(0), IMM(0xff));
UML_CALLH(block, ppc->impstate->write8[mode]);
UML_SUB(block, MEM(&ppc->impstate->swcount), MEM(&ppc->impstate->swcount), IMM(1));
UML_RETc(block, IF_Z);
UML_JMP(block, (regnum + 1) % 32);
}
drcuml_block_end(block);
} | [
"static",
"void",
"static_generate_stsw_entries",
"(",
"powerpc_state",
"*",
"ppc",
",",
"int",
"mode",
")",
"{",
"drcuml_state",
"*",
"drcuml",
"=",
"ppc",
"->",
"impstate",
"->",
"drcuml",
";",
"drcuml_block",
"*",
"block",
";",
"jmp_buf",
"errorbuf",
";",
"int",
"regnum",
";",
"if",
"(",
"setjmp",
"(",
"errorbuf",
")",
"!=",
"0",
")",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"block",
"=",
"drcuml_block_begin",
"(",
"drcuml",
",",
"32",
"*",
"30",
",",
"&",
"errorbuf",
")",
";",
"for",
"(",
"regnum",
"=",
"0",
";",
"regnum",
"<",
"32",
";",
"regnum",
"++",
")",
"{",
"char",
"temp",
"[",
"20",
"]",
";",
"sprintf",
"(",
"temp",
",",
"\"",
"\"",
",",
"regnum",
")",
";",
"alloc_handle",
"(",
"drcuml",
",",
"&",
"ppc",
"->",
"impstate",
"->",
"stsw",
"[",
"mode",
"]",
"[",
"regnum",
"]",
",",
"temp",
")",
";",
"UML_HANDLE",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"stsw",
"[",
"mode",
"]",
"[",
"regnum",
"]",
")",
";",
"UML_LABEL",
"(",
"block",
",",
"regnum",
")",
";",
"UML_ADD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IMM",
"(",
"0",
")",
")",
";",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"R32",
"(",
"regnum",
")",
",",
"IMM",
"(",
"8",
")",
",",
"IMM",
"(",
"0xff",
")",
")",
";",
"UML_CALLH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"write8",
"[",
"mode",
"]",
")",
";",
"UML_SUB",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_RETc",
"(",
"block",
",",
"IF_Z",
")",
";",
"UML_ADD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"R32",
"(",
"regnum",
")",
",",
"IMM",
"(",
"16",
")",
",",
"IMM",
"(",
"0xff",
")",
")",
";",
"UML_CALLH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"write8",
"[",
"mode",
"]",
")",
";",
"UML_SUB",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_RETc",
"(",
"block",
",",
"IF_Z",
")",
";",
"UML_ADD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IMM",
"(",
"2",
")",
")",
";",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"R32",
"(",
"regnum",
")",
",",
"IMM",
"(",
"24",
")",
",",
"IMM",
"(",
"0xff",
")",
")",
";",
"UML_CALLH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"write8",
"[",
"mode",
"]",
")",
";",
"UML_SUB",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_RETc",
"(",
"block",
",",
"IF_Z",
")",
";",
"UML_ADD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IMM",
"(",
"3",
")",
")",
";",
"UML_ADD",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"updateaddr",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"R32",
"(",
"regnum",
")",
",",
"IMM",
"(",
"0",
")",
",",
"IMM",
"(",
"0xff",
")",
")",
";",
"UML_CALLH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"write8",
"[",
"mode",
"]",
")",
";",
"UML_SUB",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"swcount",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_RETc",
"(",
"block",
",",
"IF_Z",
")",
";",
"UML_JMP",
"(",
"block",
",",
"(",
"regnum",
"+",
"1",
")",
"%",
"32",
")",
";",
"}",
"drcuml_block_end",
"(",
"block",
")",
";",
"}"
] | static_generate_stsw_entries - generate a
subroutine to perform LSWI/LSWX; one handle
for each possible register | [
"static_generate_stsw_entries",
"-",
"generate",
"a",
"subroutine",
"to",
"perform",
"LSWI",
"/",
"LSWX",
";",
"one",
"handle",
"for",
"each",
"possible",
"register"
] | [
"/* if we get an error back, we're screwed */",
"/* begin generating */",
"/* iterate over all possible registers */",
"/* allocate a handle */",
"// handle stsw<regnum>\r",
"// regnum:\r",
"// add i0,[updateaddr],0\r",
"// roland i1,regnum,8,0xff\r",
"// callh write8\r",
"// sub [swcount],[swcount],1\r",
"// ret z\r",
"// add i0,[updateaddr],1\r",
"// roland i1,regnum,16,0xff\r",
"// callh write8\r",
"// sub [swcount],[swcount],1\r",
"// ret z\r",
"// add i0,[updateaddr],2\r",
"// roland i1,regnum,24,0xff\r",
"// callh write8\r",
"// sub [swcount],[swcount],1\r",
"// ret z\r",
"// add i0,[updateaddr],3\r",
"// add [updateaddr],i0,1\r",
"// roland i1,regnum,0,0xff\r",
"// callh write8\r",
"// sub [swcount],[swcount],1\r",
"// ret z\r",
"// jmp nextreg\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "mode",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | generate_update_mode | void | static void generate_update_mode(powerpc_state *ppc, drcuml_block *block)
{
/* LE in bit 0 of mode */
UML_AND(block, IREG(0), MSR32, IMM(MSR_LE)); // and i0,msr,MSR_LE
/* DR (OEA and 403GCX) in bit 1 of mode */
if ((ppc->cap & PPCCAP_OEA) || ppc->flavor == PPC_MODEL_403GCX)
{
UML_ROLAND(block, IREG(1), MSR32, IMM(29), IMM(0x02)); // roland i1,[msr],29,0x02
UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1
}
/* (4XX) in bit 1 of mode */
if (ppc->cap & PPCCAP_4XX)
{
UML_ROLAND(block, IREG(1), MSR32, IMM(30), IMM(0x02)); // roland i1,[msr],30,0x02
UML_OR(block, IREG(0), IREG(0), IREG(1)); // or i0,i0,i1
}
/* PR in bit 2 of mode */
UML_ROLAND(block, IREG(1), MSR32, IMM(20), IMM(0x04)); // roland i1,[msr],20,0x04
UML_OR(block, MEM(&ppc->impstate->mode), IREG(0), IREG(1)); // or [mode],i0,i1
} | /*-------------------------------------------------
generate_update_mode - update the mode based
on the MSR
-------------------------------------------------*/ | update the mode based
on the MSR | [
"update",
"the",
"mode",
"based",
"on",
"the",
"MSR"
] | static void generate_update_mode(powerpc_state *ppc, drcuml_block *block)
{
UML_AND(block, IREG(0), MSR32, IMM(MSR_LE));
if ((ppc->cap & PPCCAP_OEA) || ppc->flavor == PPC_MODEL_403GCX)
{
UML_ROLAND(block, IREG(1), MSR32, IMM(29), IMM(0x02));
UML_OR(block, IREG(0), IREG(0), IREG(1));
}
if (ppc->cap & PPCCAP_4XX)
{
UML_ROLAND(block, IREG(1), MSR32, IMM(30), IMM(0x02));
UML_OR(block, IREG(0), IREG(0), IREG(1));
}
UML_ROLAND(block, IREG(1), MSR32, IMM(20), IMM(0x04));
UML_OR(block, MEM(&ppc->impstate->mode), IREG(0), IREG(1));
} | [
"static",
"void",
"generate_update_mode",
"(",
"powerpc_state",
"*",
"ppc",
",",
"drcuml_block",
"*",
"block",
")",
"{",
"UML_AND",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"MSR32",
",",
"IMM",
"(",
"MSR_LE",
")",
")",
";",
"if",
"(",
"(",
"ppc",
"->",
"cap",
"&",
"PPCCAP_OEA",
")",
"||",
"ppc",
"->",
"flavor",
"==",
"PPC_MODEL_403GCX",
")",
"{",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"MSR32",
",",
"IMM",
"(",
"29",
")",
",",
"IMM",
"(",
"0x02",
")",
")",
";",
"UML_OR",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"1",
")",
")",
";",
"}",
"if",
"(",
"ppc",
"->",
"cap",
"&",
"PPCCAP_4XX",
")",
"{",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"MSR32",
",",
"IMM",
"(",
"30",
")",
",",
"IMM",
"(",
"0x02",
")",
")",
";",
"UML_OR",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"1",
")",
")",
";",
"}",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"MSR32",
",",
"IMM",
"(",
"20",
")",
",",
"IMM",
"(",
"0x04",
")",
")",
";",
"UML_OR",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"mode",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"1",
")",
")",
";",
"}"
] | generate_update_mode - update the mode based
on the MSR | [
"generate_update_mode",
"-",
"update",
"the",
"mode",
"based",
"on",
"the",
"MSR"
] | [
"/* LE in bit 0 of mode */",
"// and i0,msr,MSR_LE\r",
"/* DR (OEA and 403GCX) in bit 1 of mode */",
"// roland i1,[msr],29,0x02\r",
"// or i0,i0,i1\r",
"/* (4XX) in bit 1 of mode */",
"// roland i1,[msr],30,0x02\r",
"// or i0,i0,i1\r",
"/* PR in bit 2 of mode */",
"// roland i1,[msr],20,0x04\r",
"// or [mode],i0,i1\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "block",
"type": "drcuml_block"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | generate_update_cycles | void | static void generate_update_cycles(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception)
{
/* check full interrupts if pending */
if (compiler->checkints)
{
drcuml_codelabel skip;
compiler->checkints = FALSE;
UML_TEST(block, MEM(&ppc->irq_pending), IMM(~0)); // test [irq_pending],0
UML_JMPc(block, IF_Z, skip = compiler->labelnum++); // jmp skip,Z
UML_TEST(block, MSR32, IMM(MSR_EE)); // test [msr],MSR_EE
UML_JMPc(block, IF_Z, skip); // jmp skip,Z
UML_MOV(block, IREG(0), PARAM(ptype, pvalue)); // mov i0,nextpc
UML_MOV(block, IREG(1), IMM(compiler->cycles)); // mov i1,cycles
UML_CALLH(block, ppc->impstate->exception_norecover[EXCEPTION_EI]); // callh interrupt_norecover
UML_LABEL(block, skip); // skip:
}
/* account for cycles */
if (compiler->cycles > 0)
{
UML_SUB(block, MEM(&ppc->icount), MEM(&ppc->icount), MAPVAR_CYCLES); // sub icount,icount,cycles
UML_MAPVAR(block, MAPVAR_CYCLES, 0); // mapvar cycles,0
if (allow_exception)
UML_EXHc(block, IF_S, ppc->impstate->out_of_cycles, PARAM(ptype, pvalue)); // exh out_of_cycles,nextpc
}
compiler->cycles = 0;
} | /*-------------------------------------------------
generate_update_cycles - generate code to
subtract cycles from the icount and generate
an exception if out
-------------------------------------------------*/ | generate code to
subtract cycles from the icount and generate
an exception if out | [
"generate",
"code",
"to",
"subtract",
"cycles",
"from",
"the",
"icount",
"and",
"generate",
"an",
"exception",
"if",
"out"
] | static void generate_update_cycles(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception)
{
if (compiler->checkints)
{
drcuml_codelabel skip;
compiler->checkints = FALSE;
UML_TEST(block, MEM(&ppc->irq_pending), IMM(~0));
UML_JMPc(block, IF_Z, skip = compiler->labelnum++);
UML_TEST(block, MSR32, IMM(MSR_EE));
UML_JMPc(block, IF_Z, skip);
UML_MOV(block, IREG(0), PARAM(ptype, pvalue));
UML_MOV(block, IREG(1), IMM(compiler->cycles));
UML_CALLH(block, ppc->impstate->exception_norecover[EXCEPTION_EI]);
UML_LABEL(block, skip);
}
if (compiler->cycles > 0)
{
UML_SUB(block, MEM(&ppc->icount), MEM(&ppc->icount), MAPVAR_CYCLES);
UML_MAPVAR(block, MAPVAR_CYCLES, 0);
if (allow_exception)
UML_EXHc(block, IF_S, ppc->impstate->out_of_cycles, PARAM(ptype, pvalue));
}
compiler->cycles = 0;
} | [
"static",
"void",
"generate_update_cycles",
"(",
"powerpc_state",
"*",
"ppc",
",",
"drcuml_block",
"*",
"block",
",",
"compiler_state",
"*",
"compiler",
",",
"drcuml_ptype",
"ptype",
",",
"UINT64",
"pvalue",
",",
"int",
"allow_exception",
")",
"{",
"if",
"(",
"compiler",
"->",
"checkints",
")",
"{",
"drcuml_codelabel",
"skip",
";",
"compiler",
"->",
"checkints",
"=",
"FALSE",
";",
"UML_TEST",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"irq_pending",
")",
",",
"IMM",
"(",
"~",
"0",
")",
")",
";",
"UML_JMPc",
"(",
"block",
",",
"IF_Z",
",",
"skip",
"=",
"compiler",
"->",
"labelnum",
"++",
")",
";",
"UML_TEST",
"(",
"block",
",",
"MSR32",
",",
"IMM",
"(",
"MSR_EE",
")",
")",
";",
"UML_JMPc",
"(",
"block",
",",
"IF_Z",
",",
"skip",
")",
";",
"UML_MOV",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"PARAM",
"(",
"ptype",
",",
"pvalue",
")",
")",
";",
"UML_MOV",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"IMM",
"(",
"compiler",
"->",
"cycles",
")",
")",
";",
"UML_CALLH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"exception_norecover",
"[",
"EXCEPTION_EI",
"]",
")",
";",
"UML_LABEL",
"(",
"block",
",",
"skip",
")",
";",
"}",
"if",
"(",
"compiler",
"->",
"cycles",
">",
"0",
")",
"{",
"UML_SUB",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"icount",
")",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"icount",
")",
",",
"MAPVAR_CYCLES",
")",
";",
"UML_MAPVAR",
"(",
"block",
",",
"MAPVAR_CYCLES",
",",
"0",
")",
";",
"if",
"(",
"allow_exception",
")",
"UML_EXHc",
"(",
"block",
",",
"IF_S",
",",
"ppc",
"->",
"impstate",
"->",
"out_of_cycles",
",",
"PARAM",
"(",
"ptype",
",",
"pvalue",
")",
")",
";",
"}",
"compiler",
"->",
"cycles",
"=",
"0",
";",
"}"
] | generate_update_cycles - generate code to
subtract cycles from the icount and generate
an exception if out | [
"generate_update_cycles",
"-",
"generate",
"code",
"to",
"subtract",
"cycles",
"from",
"the",
"icount",
"and",
"generate",
"an",
"exception",
"if",
"out"
] | [
"/* check full interrupts if pending */",
"// test [irq_pending],0\r",
"// jmp skip,Z\r",
"// test [msr],MSR_EE\r",
"// jmp skip,Z\r",
"// mov i0,nextpc\r",
"// mov i1,cycles\r",
"// callh interrupt_norecover\r",
"// skip:\r",
"/* account for cycles */",
"// sub icount,icount,cycles\r",
"// mapvar cycles,0\r",
"// exh out_of_cycles,nextpc\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "block",
"type": "drcuml_block"
},
{
"param": "compiler",
"type": "compiler_state"
},
{
"param": "ptype",
"type": "drcuml_ptype"
},
{
"param": "pvalue",
"type": "UINT64"
},
{
"param": "allow_exception",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "compiler",
"type": "compiler_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ptype",
"type": "drcuml_ptype",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pvalue",
"type": "UINT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allow_exception",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | generate_checksum_block | void | static void generate_checksum_block(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast)
{
const opcode_desc *curdesc;
if (LOG_UML)
UML_COMMENT(block, "[Validation for %08X]", seqhead->pc); // comment
/* loose verify or single instruction: just compare and fail */
if (!(ppc->impstate->drcoptions & PPCDRC_STRICT_VERIFY) || seqhead->next == NULL)
{
if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP))
{
void *base = memory_decrypted_read_ptr(ppc->program, seqhead->physpc ^ ppc->codexor);
UML_LOAD(block, IREG(0), base, IMM(0), DWORD); // load i0,base,dword
UML_CMP(block, IREG(0), IMM(seqhead->opptr.l[0])); // cmp i0,*opptr
UML_EXHc(block, IF_NE, ppc->impstate->nocode, IMM(seqhead->pc)); // exne nocode,seqhead->pc
}
}
/* full verification; sum up everything */
else
{
#if 0
for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
void *base = memory_decrypted_read_ptr(ppc->program, seqhead->physpc ^ ppc->codexor);
UML_LOAD(block, IREG(0), base, IMM(0), DWORD); // load i0,base,dword
UML_CMP(block, IREG(0), IMM(curdesc->opptr.l[0])); // cmp i0,*opptr
UML_EXHc(block, IF_NE, ppc->impstate->nocode, IMM(seqhead->pc)); // exne nocode,seqhead->pc
}
#else
UINT32 sum = 0;
void *base = memory_decrypted_read_ptr(ppc->program, seqhead->physpc ^ ppc->codexor);
UML_LOAD(block, IREG(0), base, IMM(0), DWORD); // load i0,base,dword
sum += seqhead->opptr.l[0];
for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
base = memory_decrypted_read_ptr(ppc->program, curdesc->physpc ^ ppc->codexor);
UML_LOAD(block, IREG(1), base, IMM(0), DWORD); // load i1,base,dword
UML_ADD(block, IREG(0), IREG(0), IREG(1)); // add i0,i0,i1
sum += curdesc->opptr.l[0];
}
UML_CMP(block, IREG(0), IMM(sum)); // cmp i0,sum
UML_EXHc(block, IF_NE, ppc->impstate->nocode, IMM(seqhead->pc)); // exne nocode,seqhead->pc
#endif
}
} | /*-------------------------------------------------
generate_checksum_block - generate code to
validate a sequence of opcodes
-------------------------------------------------*/ | generate code to
validate a sequence of opcodes | [
"generate",
"code",
"to",
"validate",
"a",
"sequence",
"of",
"opcodes"
] | static void generate_checksum_block(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast)
{
const opcode_desc *curdesc;
if (LOG_UML)
UML_COMMENT(block, "[Validation for %08X]", seqhead->pc);
if (!(ppc->impstate->drcoptions & PPCDRC_STRICT_VERIFY) || seqhead->next == NULL)
{
if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP))
{
void *base = memory_decrypted_read_ptr(ppc->program, seqhead->physpc ^ ppc->codexor);
UML_LOAD(block, IREG(0), base, IMM(0), DWORD);
UML_CMP(block, IREG(0), IMM(seqhead->opptr.l[0]));
UML_EXHc(block, IF_NE, ppc->impstate->nocode, IMM(seqhead->pc));
}
}
else
{
#if 0
for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
void *base = memory_decrypted_read_ptr(ppc->program, seqhead->physpc ^ ppc->codexor);
UML_LOAD(block, IREG(0), base, IMM(0), DWORD);
UML_CMP(block, IREG(0), IMM(curdesc->opptr.l[0]));
UML_EXHc(block, IF_NE, ppc->impstate->nocode, IMM(seqhead->pc));
}
#else
UINT32 sum = 0;
void *base = memory_decrypted_read_ptr(ppc->program, seqhead->physpc ^ ppc->codexor);
UML_LOAD(block, IREG(0), base, IMM(0), DWORD);
sum += seqhead->opptr.l[0];
for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
base = memory_decrypted_read_ptr(ppc->program, curdesc->physpc ^ ppc->codexor);
UML_LOAD(block, IREG(1), base, IMM(0), DWORD);
UML_ADD(block, IREG(0), IREG(0), IREG(1));
sum += curdesc->opptr.l[0];
}
UML_CMP(block, IREG(0), IMM(sum));
UML_EXHc(block, IF_NE, ppc->impstate->nocode, IMM(seqhead->pc));
#endif
}
} | [
"static",
"void",
"generate_checksum_block",
"(",
"powerpc_state",
"*",
"ppc",
",",
"drcuml_block",
"*",
"block",
",",
"compiler_state",
"*",
"compiler",
",",
"const",
"opcode_desc",
"*",
"seqhead",
",",
"const",
"opcode_desc",
"*",
"seqlast",
")",
"{",
"const",
"opcode_desc",
"*",
"curdesc",
";",
"if",
"(",
"LOG_UML",
")",
"UML_COMMENT",
"(",
"block",
",",
"\"",
"\"",
",",
"seqhead",
"->",
"pc",
")",
";",
"if",
"(",
"!",
"(",
"ppc",
"->",
"impstate",
"->",
"drcoptions",
"&",
"PPCDRC_STRICT_VERIFY",
")",
"||",
"seqhead",
"->",
"next",
"==",
"NULL",
")",
"{",
"if",
"(",
"!",
"(",
"seqhead",
"->",
"flags",
"&",
"OPFLAG_VIRTUAL_NOOP",
")",
")",
"{",
"void",
"*",
"base",
"=",
"memory_decrypted_read_ptr",
"(",
"ppc",
"->",
"program",
",",
"seqhead",
"->",
"physpc",
"^",
"ppc",
"->",
"codexor",
")",
";",
"UML_LOAD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"base",
",",
"IMM",
"(",
"0",
")",
",",
"DWORD",
")",
";",
"UML_CMP",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"seqhead",
"->",
"opptr",
".",
"l",
"[",
"0",
"]",
")",
")",
";",
"UML_EXHc",
"(",
"block",
",",
"IF_NE",
",",
"ppc",
"->",
"impstate",
"->",
"nocode",
",",
"IMM",
"(",
"seqhead",
"->",
"pc",
")",
")",
";",
"}",
"}",
"else",
"{",
"#if",
"0",
"\n",
"for",
"(",
"curdesc",
"=",
"seqhead",
"->",
"next",
";",
"curdesc",
"!=",
"seqlast",
"->",
"next",
";",
"curdesc",
"=",
"curdesc",
"->",
"next",
")",
"if",
"(",
"!",
"(",
"curdesc",
"->",
"flags",
"&",
"OPFLAG_VIRTUAL_NOOP",
")",
")",
"{",
"void",
"*",
"base",
"=",
"memory_decrypted_read_ptr",
"(",
"ppc",
"->",
"program",
",",
"seqhead",
"->",
"physpc",
"^",
"ppc",
"->",
"codexor",
")",
";",
"UML_LOAD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"base",
",",
"IMM",
"(",
"0",
")",
",",
"DWORD",
")",
";",
"UML_CMP",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"curdesc",
"->",
"opptr",
".",
"l",
"[",
"0",
"]",
")",
")",
";",
"UML_EXHc",
"(",
"block",
",",
"IF_NE",
",",
"ppc",
"->",
"impstate",
"->",
"nocode",
",",
"IMM",
"(",
"seqhead",
"->",
"pc",
")",
")",
";",
"}",
"#else",
"UINT32",
"sum",
"=",
"0",
";",
"void",
"*",
"base",
"=",
"memory_decrypted_read_ptr",
"(",
"ppc",
"->",
"program",
",",
"seqhead",
"->",
"physpc",
"^",
"ppc",
"->",
"codexor",
")",
";",
"UML_LOAD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"base",
",",
"IMM",
"(",
"0",
")",
",",
"DWORD",
")",
";",
"sum",
"+=",
"seqhead",
"->",
"opptr",
".",
"l",
"[",
"0",
"]",
";",
"for",
"(",
"curdesc",
"=",
"seqhead",
"->",
"next",
";",
"curdesc",
"!=",
"seqlast",
"->",
"next",
";",
"curdesc",
"=",
"curdesc",
"->",
"next",
")",
"if",
"(",
"!",
"(",
"curdesc",
"->",
"flags",
"&",
"OPFLAG_VIRTUAL_NOOP",
")",
")",
"{",
"base",
"=",
"memory_decrypted_read_ptr",
"(",
"ppc",
"->",
"program",
",",
"curdesc",
"->",
"physpc",
"^",
"ppc",
"->",
"codexor",
")",
";",
"UML_LOAD",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"base",
",",
"IMM",
"(",
"0",
")",
",",
"DWORD",
")",
";",
"UML_ADD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"1",
")",
")",
";",
"sum",
"+=",
"curdesc",
"->",
"opptr",
".",
"l",
"[",
"0",
"]",
";",
"}",
"UML_CMP",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"sum",
")",
")",
";",
"UML_EXHc",
"(",
"block",
",",
"IF_NE",
",",
"ppc",
"->",
"impstate",
"->",
"nocode",
",",
"IMM",
"(",
"seqhead",
"->",
"pc",
")",
")",
";",
"#endif",
"}",
"}"
] | generate_checksum_block - generate code to
validate a sequence of opcodes | [
"generate_checksum_block",
"-",
"generate",
"code",
"to",
"validate",
"a",
"sequence",
"of",
"opcodes"
] | [
"// comment\r",
"/* loose verify or single instruction: just compare and fail */",
"// load i0,base,dword\r",
"// cmp i0,*opptr\r",
"// exne nocode,seqhead->pc\r",
"/* full verification; sum up everything */",
"// load i0,base,dword\r",
"// cmp i0,*opptr\r",
"// exne nocode,seqhead->pc\r",
"// load i0,base,dword\r",
"// load i1,base,dword\r",
"// add i0,i0,i1\r",
"// cmp i0,sum\r",
"// exne nocode,seqhead->pc\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "block",
"type": "drcuml_block"
},
{
"param": "compiler",
"type": "compiler_state"
},
{
"param": "seqhead",
"type": "opcode_desc"
},
{
"param": "seqlast",
"type": "opcode_desc"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "compiler",
"type": "compiler_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seqhead",
"type": "opcode_desc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seqlast",
"type": "opcode_desc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | generate_sequence_instruction | void | static void generate_sequence_instruction(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
{
int hotnum;
/* add an entry for the log */
if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
log_add_disasm_comment(block, desc->pc, desc->opptr.l[0]);
/* set the PC map variable */
UML_MAPVAR(block, MAPVAR_PC, desc->pc); // mapvar PC,desc->pc
/* accumulate total cycles */
compiler->cycles += desc->cycles;
/* is this a hotspot? */
for (hotnum = 0; hotnum < PPC_MAX_HOTSPOTS; hotnum++)
if (ppc->impstate->hotspot[hotnum].pc != 0 && desc->pc == ppc->impstate->hotspot[hotnum].pc && desc->opptr.l[0] == ppc->impstate->hotspot[hotnum].opcode)
{
compiler->cycles += ppc->impstate->hotspot[hotnum].cycles;
break;
}
/* update the icount map variable */
UML_MAPVAR(block, MAPVAR_CYCLES, compiler->cycles); // mapvar CYCLES,compiler->cycles
/* if we want a probe, add it here */
if (desc->pc == PROBE_ADDRESS)
{
UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc)); // mov [pc],desc->pc
UML_CALLC(block, cfunc_printf_probe, desc->pc); // callc cfunc_printf_probe,desc->pc
}
/* if we are debugging, call the debugger */
if ((ppc->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
{
UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc)); // mov [pc],desc->pc
save_fast_iregs(ppc, block); // <save fastregs>
UML_DEBUG(block, IMM(desc->pc)); // debug desc->pc
}
/* if we hit an unmapped address, fatal error */
if (desc->flags & OPFLAG_COMPILER_UNMAPPED)
{
UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc)); // mov [pc],desc->pc
save_fast_iregs(ppc, block); // <save fastregs>
UML_EXIT(block, IMM(EXECUTE_UNMAPPED_CODE)); // exit EXECUTE_UNMAPPED_CODE
}
/* if we hit a compiler page fault, it's just like a TLB mismatch */
if (desc->flags & OPFLAG_COMPILER_PAGE_FAULT)
{
if (PRINTF_MMU)
{
const char *text = "Compiler page fault @ %08X\n";
UML_MOV(block, MEM(&ppc->impstate->format), IMM((FPTR)text)); // mov [format],text
UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->pc)); // mov [arg0],desc->pc
UML_CALLC(block, cfunc_printf_debug, ppc); // callc printf_debug
}
UML_EXH(block, ppc->impstate->tlb_mismatch, IMM(0)); // exh tlb_mismatch,0
}
/* validate our TLB entry at this PC; if we fail, we need to handle it */
if ((desc->flags & OPFLAG_VALIDATE_TLB) && (ppc->impstate->mode & MODE_DATA_TRANSLATION))
{
const vtlb_entry *tlbtable = vtlb_table(ppc->vtlb);
/* if we currently have a valid TLB read entry, we just verify */
if (tlbtable[desc->pc >> 12] != 0)
{
if (PRINTF_MMU)
{
const char *text = "Checking TLB at @ %08X\n";
UML_MOV(block, MEM(&ppc->impstate->format), IMM((FPTR)text)); // mov [format],text
UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->pc)); // mov [arg0],desc->pc
UML_CALLC(block, cfunc_printf_debug, ppc); // callc printf_debug
}
UML_LOAD(block, IREG(0), &tlbtable[desc->pc >> 12], IMM(0), DWORD); // load i0,tlbtable[desc->pc >> 12],dword
UML_CMP(block, IREG(0), IMM(tlbtable[desc->pc >> 12])); // cmp i0,*tlbentry
UML_EXHc(block, IF_NE, ppc->impstate->tlb_mismatch, IMM(0)); // exh tlb_mismatch,0,NE
}
/* otherwise, we generate an unconditional exception */
else
{
if (PRINTF_MMU)
{
const char *text = "No valid TLB @ %08X\n";
UML_MOV(block, MEM(&ppc->impstate->format), IMM((FPTR)text)); // mov [format],text
UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->pc)); // mov [arg0],desc->pc
UML_CALLC(block, cfunc_printf_debug, ppc); // callc printf_debug
}
UML_EXH(block, ppc->impstate->tlb_mismatch, IMM(0)); // exh tlb_mismatch,0
}
}
/* if this is an invalid opcode, generate the exception now */
if (desc->flags & OPFLAG_INVALID_OPCODE)
UML_EXH(block, ppc->impstate->exception[EXCEPTION_PROGRAM], IMM(0x80000)); // exh exception_program,0x80000
/* if this is a privileged opcode in user mode, generate the exception */
else if ((desc->flags & OPFLAG_PRIVILEGED) && (ppc->impstate->mode & MODE_USER))
UML_EXH(block, ppc->impstate->exception[EXCEPTION_PROGRAM], IMM(0x40000)); // exh exception_program,0x40000
/* otherwise, unless this is a virtual no-op, it's a regular instruction */
else if (!(desc->flags & OPFLAG_VIRTUAL_NOOP))
{
/* compile the instruction */
if (!generate_opcode(ppc, block, compiler, desc))
{
UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc)); // mov [pc],desc->pc
UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->opptr.l[0])); // mov [arg0],*desc->opptr.l
UML_CALLC(block, cfunc_unimplemented, ppc); // callc cfunc_unimplemented,ppc
}
}
} | /*-------------------------------------------------
generate_sequence_instruction - generate code
for a single instruction in a sequence
-------------------------------------------------*/ | generate code
for a single instruction in a sequence | [
"generate",
"code",
"for",
"a",
"single",
"instruction",
"in",
"a",
"sequence"
] | static void generate_sequence_instruction(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
{
int hotnum;
if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
log_add_disasm_comment(block, desc->pc, desc->opptr.l[0]);
UML_MAPVAR(block, MAPVAR_PC, desc->pc);
compiler->cycles += desc->cycles;
for (hotnum = 0; hotnum < PPC_MAX_HOTSPOTS; hotnum++)
if (ppc->impstate->hotspot[hotnum].pc != 0 && desc->pc == ppc->impstate->hotspot[hotnum].pc && desc->opptr.l[0] == ppc->impstate->hotspot[hotnum].opcode)
{
compiler->cycles += ppc->impstate->hotspot[hotnum].cycles;
break;
}
UML_MAPVAR(block, MAPVAR_CYCLES, compiler->cycles);
if (desc->pc == PROBE_ADDRESS)
{
UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc));
UML_CALLC(block, cfunc_printf_probe, desc->pc);
}
if ((ppc->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
{
UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc));
save_fast_iregs(ppc, block);
UML_DEBUG(block, IMM(desc->pc));
}
if (desc->flags & OPFLAG_COMPILER_UNMAPPED)
{
UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc));
save_fast_iregs(ppc, block);
UML_EXIT(block, IMM(EXECUTE_UNMAPPED_CODE));
}
if (desc->flags & OPFLAG_COMPILER_PAGE_FAULT)
{
if (PRINTF_MMU)
{
const char *text = "Compiler page fault @ %08X\n";
UML_MOV(block, MEM(&ppc->impstate->format), IMM((FPTR)text));
UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->pc));
UML_CALLC(block, cfunc_printf_debug, ppc);
}
UML_EXH(block, ppc->impstate->tlb_mismatch, IMM(0));
}
if ((desc->flags & OPFLAG_VALIDATE_TLB) && (ppc->impstate->mode & MODE_DATA_TRANSLATION))
{
const vtlb_entry *tlbtable = vtlb_table(ppc->vtlb);
if (tlbtable[desc->pc >> 12] != 0)
{
if (PRINTF_MMU)
{
const char *text = "Checking TLB at @ %08X\n";
UML_MOV(block, MEM(&ppc->impstate->format), IMM((FPTR)text));
UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->pc));
UML_CALLC(block, cfunc_printf_debug, ppc);
}
UML_LOAD(block, IREG(0), &tlbtable[desc->pc >> 12], IMM(0), DWORD);
UML_CMP(block, IREG(0), IMM(tlbtable[desc->pc >> 12]));
UML_EXHc(block, IF_NE, ppc->impstate->tlb_mismatch, IMM(0));
}
else
{
if (PRINTF_MMU)
{
const char *text = "No valid TLB @ %08X\n";
UML_MOV(block, MEM(&ppc->impstate->format), IMM((FPTR)text));
UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->pc));
UML_CALLC(block, cfunc_printf_debug, ppc);
}
UML_EXH(block, ppc->impstate->tlb_mismatch, IMM(0));
}
}
if (desc->flags & OPFLAG_INVALID_OPCODE)
UML_EXH(block, ppc->impstate->exception[EXCEPTION_PROGRAM], IMM(0x80000));
else if ((desc->flags & OPFLAG_PRIVILEGED) && (ppc->impstate->mode & MODE_USER))
UML_EXH(block, ppc->impstate->exception[EXCEPTION_PROGRAM], IMM(0x40000));
else if (!(desc->flags & OPFLAG_VIRTUAL_NOOP))
{
if (!generate_opcode(ppc, block, compiler, desc))
{
UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc));
UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->opptr.l[0]));
UML_CALLC(block, cfunc_unimplemented, ppc);
}
}
} | [
"static",
"void",
"generate_sequence_instruction",
"(",
"powerpc_state",
"*",
"ppc",
",",
"drcuml_block",
"*",
"block",
",",
"compiler_state",
"*",
"compiler",
",",
"const",
"opcode_desc",
"*",
"desc",
")",
"{",
"int",
"hotnum",
";",
"if",
"(",
"LOG_UML",
"&&",
"!",
"(",
"desc",
"->",
"flags",
"&",
"OPFLAG_VIRTUAL_NOOP",
")",
")",
"log_add_disasm_comment",
"(",
"block",
",",
"desc",
"->",
"pc",
",",
"desc",
"->",
"opptr",
".",
"l",
"[",
"0",
"]",
")",
";",
"UML_MAPVAR",
"(",
"block",
",",
"MAPVAR_PC",
",",
"desc",
"->",
"pc",
")",
";",
"compiler",
"->",
"cycles",
"+=",
"desc",
"->",
"cycles",
";",
"for",
"(",
"hotnum",
"=",
"0",
";",
"hotnum",
"<",
"PPC_MAX_HOTSPOTS",
";",
"hotnum",
"++",
")",
"if",
"(",
"ppc",
"->",
"impstate",
"->",
"hotspot",
"[",
"hotnum",
"]",
".",
"pc",
"!=",
"0",
"&&",
"desc",
"->",
"pc",
"==",
"ppc",
"->",
"impstate",
"->",
"hotspot",
"[",
"hotnum",
"]",
".",
"pc",
"&&",
"desc",
"->",
"opptr",
".",
"l",
"[",
"0",
"]",
"==",
"ppc",
"->",
"impstate",
"->",
"hotspot",
"[",
"hotnum",
"]",
".",
"opcode",
")",
"{",
"compiler",
"->",
"cycles",
"+=",
"ppc",
"->",
"impstate",
"->",
"hotspot",
"[",
"hotnum",
"]",
".",
"cycles",
";",
"break",
";",
"}",
"UML_MAPVAR",
"(",
"block",
",",
"MAPVAR_CYCLES",
",",
"compiler",
"->",
"cycles",
")",
";",
"if",
"(",
"desc",
"->",
"pc",
"==",
"PROBE_ADDRESS",
")",
"{",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"pc",
")",
",",
"IMM",
"(",
"desc",
"->",
"pc",
")",
")",
";",
"UML_CALLC",
"(",
"block",
",",
"cfunc_printf_probe",
",",
"desc",
"->",
"pc",
")",
";",
"}",
"if",
"(",
"(",
"ppc",
"->",
"device",
"->",
"machine",
"->",
"debug_flags",
"&",
"DEBUG_FLAG_ENABLED",
")",
"!=",
"0",
")",
"{",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"pc",
")",
",",
"IMM",
"(",
"desc",
"->",
"pc",
")",
")",
";",
"save_fast_iregs",
"(",
"ppc",
",",
"block",
")",
";",
"UML_DEBUG",
"(",
"block",
",",
"IMM",
"(",
"desc",
"->",
"pc",
")",
")",
";",
"}",
"if",
"(",
"desc",
"->",
"flags",
"&",
"OPFLAG_COMPILER_UNMAPPED",
")",
"{",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"pc",
")",
",",
"IMM",
"(",
"desc",
"->",
"pc",
")",
")",
";",
"save_fast_iregs",
"(",
"ppc",
",",
"block",
")",
";",
"UML_EXIT",
"(",
"block",
",",
"IMM",
"(",
"EXECUTE_UNMAPPED_CODE",
")",
")",
";",
"}",
"if",
"(",
"desc",
"->",
"flags",
"&",
"OPFLAG_COMPILER_PAGE_FAULT",
")",
"{",
"if",
"(",
"PRINTF_MMU",
")",
"{",
"const",
"char",
"*",
"text",
"=",
"\"",
"\\n",
"\"",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"format",
")",
",",
"IMM",
"(",
"(",
"FPTR",
")",
"text",
")",
")",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"arg0",
")",
",",
"IMM",
"(",
"desc",
"->",
"pc",
")",
")",
";",
"UML_CALLC",
"(",
"block",
",",
"cfunc_printf_debug",
",",
"ppc",
")",
";",
"}",
"UML_EXH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"tlb_mismatch",
",",
"IMM",
"(",
"0",
")",
")",
";",
"}",
"if",
"(",
"(",
"desc",
"->",
"flags",
"&",
"OPFLAG_VALIDATE_TLB",
")",
"&&",
"(",
"ppc",
"->",
"impstate",
"->",
"mode",
"&",
"MODE_DATA_TRANSLATION",
")",
")",
"{",
"const",
"vtlb_entry",
"*",
"tlbtable",
"=",
"vtlb_table",
"(",
"ppc",
"->",
"vtlb",
")",
";",
"if",
"(",
"tlbtable",
"[",
"desc",
"->",
"pc",
">>",
"12",
"]",
"!=",
"0",
")",
"{",
"if",
"(",
"PRINTF_MMU",
")",
"{",
"const",
"char",
"*",
"text",
"=",
"\"",
"\\n",
"\"",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"format",
")",
",",
"IMM",
"(",
"(",
"FPTR",
")",
"text",
")",
")",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"arg0",
")",
",",
"IMM",
"(",
"desc",
"->",
"pc",
")",
")",
";",
"UML_CALLC",
"(",
"block",
",",
"cfunc_printf_debug",
",",
"ppc",
")",
";",
"}",
"UML_LOAD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"&",
"tlbtable",
"[",
"desc",
"->",
"pc",
">>",
"12",
"]",
",",
"IMM",
"(",
"0",
")",
",",
"DWORD",
")",
";",
"UML_CMP",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"tlbtable",
"[",
"desc",
"->",
"pc",
">>",
"12",
"]",
")",
")",
";",
"UML_EXHc",
"(",
"block",
",",
"IF_NE",
",",
"ppc",
"->",
"impstate",
"->",
"tlb_mismatch",
",",
"IMM",
"(",
"0",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"PRINTF_MMU",
")",
"{",
"const",
"char",
"*",
"text",
"=",
"\"",
"\\n",
"\"",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"format",
")",
",",
"IMM",
"(",
"(",
"FPTR",
")",
"text",
")",
")",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"arg0",
")",
",",
"IMM",
"(",
"desc",
"->",
"pc",
")",
")",
";",
"UML_CALLC",
"(",
"block",
",",
"cfunc_printf_debug",
",",
"ppc",
")",
";",
"}",
"UML_EXH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"tlb_mismatch",
",",
"IMM",
"(",
"0",
")",
")",
";",
"}",
"}",
"if",
"(",
"desc",
"->",
"flags",
"&",
"OPFLAG_INVALID_OPCODE",
")",
"UML_EXH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"exception",
"[",
"EXCEPTION_PROGRAM",
"]",
",",
"IMM",
"(",
"0x80000",
")",
")",
";",
"else",
"if",
"(",
"(",
"desc",
"->",
"flags",
"&",
"OPFLAG_PRIVILEGED",
")",
"&&",
"(",
"ppc",
"->",
"impstate",
"->",
"mode",
"&",
"MODE_USER",
")",
")",
"UML_EXH",
"(",
"block",
",",
"ppc",
"->",
"impstate",
"->",
"exception",
"[",
"EXCEPTION_PROGRAM",
"]",
",",
"IMM",
"(",
"0x40000",
")",
")",
";",
"else",
"if",
"(",
"!",
"(",
"desc",
"->",
"flags",
"&",
"OPFLAG_VIRTUAL_NOOP",
")",
")",
"{",
"if",
"(",
"!",
"generate_opcode",
"(",
"ppc",
",",
"block",
",",
"compiler",
",",
"desc",
")",
")",
"{",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"pc",
")",
",",
"IMM",
"(",
"desc",
"->",
"pc",
")",
")",
";",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"impstate",
"->",
"arg0",
")",
",",
"IMM",
"(",
"desc",
"->",
"opptr",
".",
"l",
"[",
"0",
"]",
")",
")",
";",
"UML_CALLC",
"(",
"block",
",",
"cfunc_unimplemented",
",",
"ppc",
")",
";",
"}",
"}",
"}"
] | generate_sequence_instruction - generate code
for a single instruction in a sequence | [
"generate_sequence_instruction",
"-",
"generate",
"code",
"for",
"a",
"single",
"instruction",
"in",
"a",
"sequence"
] | [
"/* add an entry for the log */",
"/* set the PC map variable */",
"// mapvar PC,desc->pc\r",
"/* accumulate total cycles */",
"/* is this a hotspot? */",
"/* update the icount map variable */",
"// mapvar CYCLES,compiler->cycles\r",
"/* if we want a probe, add it here */",
"// mov [pc],desc->pc\r",
"// callc cfunc_printf_probe,desc->pc\r",
"/* if we are debugging, call the debugger */",
"// mov [pc],desc->pc\r",
"// <save fastregs>\r",
"// debug desc->pc\r",
"/* if we hit an unmapped address, fatal error */",
"// mov [pc],desc->pc\r",
"// <save fastregs>\r",
"// exit EXECUTE_UNMAPPED_CODE\r",
"/* if we hit a compiler page fault, it's just like a TLB mismatch */",
"// mov [format],text\r",
"// mov [arg0],desc->pc\r",
"// callc printf_debug\r",
"// exh tlb_mismatch,0\r",
"/* validate our TLB entry at this PC; if we fail, we need to handle it */",
"/* if we currently have a valid TLB read entry, we just verify */",
"// mov [format],text\r",
"// mov [arg0],desc->pc\r",
"// callc printf_debug\r",
"// load i0,tlbtable[desc->pc >> 12],dword\r",
"// cmp i0,*tlbentry\r",
"// exh tlb_mismatch,0,NE\r",
"/* otherwise, we generate an unconditional exception */",
"// mov [format],text\r",
"// mov [arg0],desc->pc\r",
"// callc printf_debug\r",
"// exh tlb_mismatch,0\r",
"/* if this is an invalid opcode, generate the exception now */",
"// exh exception_program,0x80000\r",
"/* if this is a privileged opcode in user mode, generate the exception */",
"// exh exception_program,0x40000\r",
"/* otherwise, unless this is a virtual no-op, it's a regular instruction */",
"/* compile the instruction */",
"// mov [pc],desc->pc\r",
"// mov [arg0],*desc->opptr.l\r",
"// callc cfunc_unimplemented,ppc\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "block",
"type": "drcuml_block"
},
{
"param": "compiler",
"type": "compiler_state"
},
{
"param": "desc",
"type": "opcode_desc"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "compiler",
"type": "compiler_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desc",
"type": "opcode_desc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | generate_compute_flags | void | static void generate_compute_flags(powerpc_state *ppc, drcuml_block *block, const opcode_desc *desc, int updatecr, UINT32 xermask, int invertcarry)
{
UINT32 xerflags;
/* modify inputs based on required flags */
if (!DISABLE_FLAG_OPTIMIZATIONS)
{
if (!(desc->regreq[3] & REGFLAG_XER_CA))
xermask &= ~XER_CA;
if (!(desc->regreq[2] & REGFLAG_CR(0)))
updatecr = 0;
}
xerflags = ((xermask & XER_OV) ? DRCUML_FLAG_V : 0) | ((xermask & XER_CA) ? DRCUML_FLAG_C : 0);
/* easy case: nothing to do */
if (!updatecr && xermask == 0)
return;
/* semi-easy case: crfield only */
if (xermask == 0)
{
UML_GETFLGS(block, IREG(0), DRCUML_FLAG_S | DRCUML_FLAG_Z); // getflgs i0,sz
UML_LOAD(block, IREG(0), ppc->impstate->sz_cr_table, IREG(0), BYTE); // load i0,sz_cr_table,i0,byte
UML_OR(block, CR32(0), IREG(0), XERSO32); // or [cr0],i0,[xerso]
return;
}
/* semi-easy case: xer only */
if (!updatecr)
{
if (xermask & XER_OV)
{
UML_GETFLGS(block, IREG(0), xerflags); // getflgs i0,xerflags
if (invertcarry && (xermask & XER_CA))
UML_XOR(block, IREG(0), IREG(0), IMM(DRCUML_FLAG_C)); // xor i0,i0,FLAG_C
UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(xermask)); // rolins [xer],i0,29,xermask
UML_SHR(block, IREG(0), IREG(0), IMM(1)); // shr i0,i0,1
UML_OR(block, XERSO32, XERSO32, IREG(0)); // or [xerso],i0
}
else
{
UML_SETc(block, invertcarry ? IF_NC : IF_C, IREG(0)); // setc i0,nc/c
UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(XER_CA)); // rolins [xer],i0,29,XER_CA
}
return;
}
/* tricky case: both */
UML_GETFLGS(block, IREG(0), DRCUML_FLAG_S | DRCUML_FLAG_Z | xerflags); // getflgs i0,SZ | xerflags
UML_LOAD(block, IREG(1), ppc->impstate->sz_cr_table, IREG(0), BYTE); // load i1,sz_cr_table,i0,byte
if (invertcarry && (xermask & XER_CA))
UML_XOR(block, IREG(0), IREG(0), IMM(DRCUML_FLAG_C)); // xor i0,i0,FLAG_C
UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(xermask)); // rolins [xer],i0,29,xermask
if (xermask & XER_OV)
{
UML_ROLAND(block, IREG(0), IREG(0), IMM(31), IMM(1)); // roland i0,i0,31,0x0001
UML_OR(block, XERSO32, XERSO32, IREG(0)); // or [xerso],i0
UML_OR(block, CR32(0), IREG(1), IREG(0)); // or [cr0],i1,i0
}
else
UML_OR(block, CR32(0), IREG(1), XERSO32); // or [cr0],i1,[xerso]
} | /*------------------------------------------------------------------
generate_compute_flags - compute CR0 and/or XER flags
------------------------------------------------------------------*/ | compute CR0 and/or XER flags | [
"compute",
"CR0",
"and",
"/",
"or",
"XER",
"flags"
] | static void generate_compute_flags(powerpc_state *ppc, drcuml_block *block, const opcode_desc *desc, int updatecr, UINT32 xermask, int invertcarry)
{
UINT32 xerflags;
if (!DISABLE_FLAG_OPTIMIZATIONS)
{
if (!(desc->regreq[3] & REGFLAG_XER_CA))
xermask &= ~XER_CA;
if (!(desc->regreq[2] & REGFLAG_CR(0)))
updatecr = 0;
}
xerflags = ((xermask & XER_OV) ? DRCUML_FLAG_V : 0) | ((xermask & XER_CA) ? DRCUML_FLAG_C : 0);
if (!updatecr && xermask == 0)
return;
if (xermask == 0)
{
UML_GETFLGS(block, IREG(0), DRCUML_FLAG_S | DRCUML_FLAG_Z);
UML_LOAD(block, IREG(0), ppc->impstate->sz_cr_table, IREG(0), BYTE);
UML_OR(block, CR32(0), IREG(0), XERSO32);
return;
}
if (!updatecr)
{
if (xermask & XER_OV)
{
UML_GETFLGS(block, IREG(0), xerflags);
if (invertcarry && (xermask & XER_CA))
UML_XOR(block, IREG(0), IREG(0), IMM(DRCUML_FLAG_C));
UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(xermask));
UML_SHR(block, IREG(0), IREG(0), IMM(1));
UML_OR(block, XERSO32, XERSO32, IREG(0));
}
else
{
UML_SETc(block, invertcarry ? IF_NC : IF_C, IREG(0));
UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(XER_CA));
}
return;
}
UML_GETFLGS(block, IREG(0), DRCUML_FLAG_S | DRCUML_FLAG_Z | xerflags);
UML_LOAD(block, IREG(1), ppc->impstate->sz_cr_table, IREG(0), BYTE);
if (invertcarry && (xermask & XER_CA))
UML_XOR(block, IREG(0), IREG(0), IMM(DRCUML_FLAG_C));
UML_ROLINS(block, SPR32(SPR_XER), IREG(0), IMM(29), IMM(xermask));
if (xermask & XER_OV)
{
UML_ROLAND(block, IREG(0), IREG(0), IMM(31), IMM(1));
UML_OR(block, XERSO32, XERSO32, IREG(0));
UML_OR(block, CR32(0), IREG(1), IREG(0));
}
else
UML_OR(block, CR32(0), IREG(1), XERSO32);
} | [
"static",
"void",
"generate_compute_flags",
"(",
"powerpc_state",
"*",
"ppc",
",",
"drcuml_block",
"*",
"block",
",",
"const",
"opcode_desc",
"*",
"desc",
",",
"int",
"updatecr",
",",
"UINT32",
"xermask",
",",
"int",
"invertcarry",
")",
"{",
"UINT32",
"xerflags",
";",
"if",
"(",
"!",
"DISABLE_FLAG_OPTIMIZATIONS",
")",
"{",
"if",
"(",
"!",
"(",
"desc",
"->",
"regreq",
"[",
"3",
"]",
"&",
"REGFLAG_XER_CA",
")",
")",
"xermask",
"&=",
"~",
"XER_CA",
";",
"if",
"(",
"!",
"(",
"desc",
"->",
"regreq",
"[",
"2",
"]",
"&",
"REGFLAG_CR",
"(",
"0",
")",
")",
")",
"updatecr",
"=",
"0",
";",
"}",
"xerflags",
"=",
"(",
"(",
"xermask",
"&",
"XER_OV",
")",
"?",
"DRCUML_FLAG_V",
":",
"0",
")",
"|",
"(",
"(",
"xermask",
"&",
"XER_CA",
")",
"?",
"DRCUML_FLAG_C",
":",
"0",
")",
";",
"if",
"(",
"!",
"updatecr",
"&&",
"xermask",
"==",
"0",
")",
"return",
";",
"if",
"(",
"xermask",
"==",
"0",
")",
"{",
"UML_GETFLGS",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"DRCUML_FLAG_S",
"|",
"DRCUML_FLAG_Z",
")",
";",
"UML_LOAD",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"ppc",
"->",
"impstate",
"->",
"sz_cr_table",
",",
"IREG",
"(",
"0",
")",
",",
"BYTE",
")",
";",
"UML_OR",
"(",
"block",
",",
"CR32",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"XERSO32",
")",
";",
"return",
";",
"}",
"if",
"(",
"!",
"updatecr",
")",
"{",
"if",
"(",
"xermask",
"&",
"XER_OV",
")",
"{",
"UML_GETFLGS",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"xerflags",
")",
";",
"if",
"(",
"invertcarry",
"&&",
"(",
"xermask",
"&",
"XER_CA",
")",
")",
"UML_XOR",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"DRCUML_FLAG_C",
")",
")",
";",
"UML_ROLINS",
"(",
"block",
",",
"SPR32",
"(",
"SPR_XER",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"29",
")",
",",
"IMM",
"(",
"xermask",
")",
")",
";",
"UML_SHR",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_OR",
"(",
"block",
",",
"XERSO32",
",",
"XERSO32",
",",
"IREG",
"(",
"0",
")",
")",
";",
"}",
"else",
"{",
"UML_SETc",
"(",
"block",
",",
"invertcarry",
"?",
"IF_NC",
":",
"IF_C",
",",
"IREG",
"(",
"0",
")",
")",
";",
"UML_ROLINS",
"(",
"block",
",",
"SPR32",
"(",
"SPR_XER",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"29",
")",
",",
"IMM",
"(",
"XER_CA",
")",
")",
";",
"}",
"return",
";",
"}",
"UML_GETFLGS",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"DRCUML_FLAG_S",
"|",
"DRCUML_FLAG_Z",
"|",
"xerflags",
")",
";",
"UML_LOAD",
"(",
"block",
",",
"IREG",
"(",
"1",
")",
",",
"ppc",
"->",
"impstate",
"->",
"sz_cr_table",
",",
"IREG",
"(",
"0",
")",
",",
"BYTE",
")",
";",
"if",
"(",
"invertcarry",
"&&",
"(",
"xermask",
"&",
"XER_CA",
")",
")",
"UML_XOR",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"DRCUML_FLAG_C",
")",
")",
";",
"UML_ROLINS",
"(",
"block",
",",
"SPR32",
"(",
"SPR_XER",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"29",
")",
",",
"IMM",
"(",
"xermask",
")",
")",
";",
"if",
"(",
"xermask",
"&",
"XER_OV",
")",
"{",
"UML_ROLAND",
"(",
"block",
",",
"IREG",
"(",
"0",
")",
",",
"IREG",
"(",
"0",
")",
",",
"IMM",
"(",
"31",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_OR",
"(",
"block",
",",
"XERSO32",
",",
"XERSO32",
",",
"IREG",
"(",
"0",
")",
")",
";",
"UML_OR",
"(",
"block",
",",
"CR32",
"(",
"0",
")",
",",
"IREG",
"(",
"1",
")",
",",
"IREG",
"(",
"0",
")",
")",
";",
"}",
"else",
"UML_OR",
"(",
"block",
",",
"CR32",
"(",
"0",
")",
",",
"IREG",
"(",
"1",
")",
",",
"XERSO32",
")",
";",
"}"
] | generate_compute_flags - compute CR0 and/or XER flags | [
"generate_compute_flags",
"-",
"compute",
"CR0",
"and",
"/",
"or",
"XER",
"flags"
] | [
"/* modify inputs based on required flags */",
"/* easy case: nothing to do */",
"/* semi-easy case: crfield only */",
"// getflgs i0,sz\r",
"// load i0,sz_cr_table,i0,byte\r",
"// or [cr0],i0,[xerso]\r",
"/* semi-easy case: xer only */",
"// getflgs i0,xerflags\r",
"// xor i0,i0,FLAG_C\r",
"// rolins [xer],i0,29,xermask\r",
"// shr i0,i0,1\r",
"// or [xerso],i0\r",
"// setc i0,nc/c\r",
"// rolins [xer],i0,29,XER_CA\r",
"/* tricky case: both */",
"// getflgs i0,SZ | xerflags\r",
"// load i1,sz_cr_table,i0,byte\r",
"// xor i0,i0,FLAG_C\r",
"// rolins [xer],i0,29,xermask\r",
"// roland i0,i0,31,0x0001\r",
"// or [xerso],i0\r",
"// or [cr0],i1,i0\r",
"// or [cr0],i1,[xerso]\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "block",
"type": "drcuml_block"
},
{
"param": "desc",
"type": "opcode_desc"
},
{
"param": "updatecr",
"type": "int"
},
{
"param": "xermask",
"type": "UINT32"
},
{
"param": "invertcarry",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desc",
"type": "opcode_desc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "updatecr",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xermask",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "invertcarry",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | generate_fp_flags | void | static void generate_fp_flags(powerpc_state *ppc, drcuml_block *block, const opcode_desc *desc, int updatefprf)
{
/* for now, only handle the FPRF field */
if (updatefprf)
{
UML_MOV(block, MEM(&ppc->param0), IMM(G_RD(desc->opptr.l[0])));
UML_CALLC(block, ppccom_update_fprf, ppc);
}
} | /*-------------------------------------------------
generate_fp_flags - compute FPSCR floating
point status flags
-------------------------------------------------*/ | compute FPSCR floating
point status flags | [
"compute",
"FPSCR",
"floating",
"point",
"status",
"flags"
] | static void generate_fp_flags(powerpc_state *ppc, drcuml_block *block, const opcode_desc *desc, int updatefprf)
{
if (updatefprf)
{
UML_MOV(block, MEM(&ppc->param0), IMM(G_RD(desc->opptr.l[0])));
UML_CALLC(block, ppccom_update_fprf, ppc);
}
} | [
"static",
"void",
"generate_fp_flags",
"(",
"powerpc_state",
"*",
"ppc",
",",
"drcuml_block",
"*",
"block",
",",
"const",
"opcode_desc",
"*",
"desc",
",",
"int",
"updatefprf",
")",
"{",
"if",
"(",
"updatefprf",
")",
"{",
"UML_MOV",
"(",
"block",
",",
"MEM",
"(",
"&",
"ppc",
"->",
"param0",
")",
",",
"IMM",
"(",
"G_RD",
"(",
"desc",
"->",
"opptr",
".",
"l",
"[",
"0",
"]",
")",
")",
")",
";",
"UML_CALLC",
"(",
"block",
",",
"ppccom_update_fprf",
",",
"ppc",
")",
";",
"}",
"}"
] | generate_fp_flags - compute FPSCR floating
point status flags | [
"generate_fp_flags",
"-",
"compute",
"FPSCR",
"floating",
"point",
"status",
"flags"
] | [
"/* for now, only handle the FPRF field */"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "block",
"type": "drcuml_block"
},
{
"param": "desc",
"type": "opcode_desc"
},
{
"param": "updatefprf",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desc",
"type": "opcode_desc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "updatefprf",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | generate_branch_bo | void | static void generate_branch_bo(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT32 bo, UINT32 bi, int source, int link)
{
int skip = compiler->labelnum++;
if (!(bo & 0x04))
{
UML_SUB(block, SPR32(SPR_CTR), SPR32(SPR_CTR), IMM(1)); // sub [ctr],[ctr],1
UML_JMPc(block, (bo & 0x02) ? IF_NZ : IF_Z, skip); // jmp skip,nz/z
}
if (!(bo & 0x10))
{
UML_TEST(block, CR32(bi / 4), IMM(8 >> (bi % 4))); // test cr32(bi/4),8 >> (bi % 4)
UML_JMPc(block, (bo & 0x08) ? IF_Z : IF_NZ, skip); // jmp skip,z/nz
}
generate_branch(ppc, block, compiler, desc, source, link); // <branch>
UML_LABEL(block, skip); // skip:
} | /*-------------------------------------------------
generate_branch_bo - generate a conditional
branch based on the BO and BI fields
-------------------------------------------------*/ | generate a conditional
branch based on the BO and BI fields | [
"generate",
"a",
"conditional",
"branch",
"based",
"on",
"the",
"BO",
"and",
"BI",
"fields"
] | static void generate_branch_bo(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT32 bo, UINT32 bi, int source, int link)
{
int skip = compiler->labelnum++;
if (!(bo & 0x04))
{
UML_SUB(block, SPR32(SPR_CTR), SPR32(SPR_CTR), IMM(1));
UML_JMPc(block, (bo & 0x02) ? IF_NZ : IF_Z, skip);
}
if (!(bo & 0x10))
{
UML_TEST(block, CR32(bi / 4), IMM(8 >> (bi % 4)));
UML_JMPc(block, (bo & 0x08) ? IF_Z : IF_NZ, skip);
}
generate_branch(ppc, block, compiler, desc, source, link);
UML_LABEL(block, skip);
} | [
"static",
"void",
"generate_branch_bo",
"(",
"powerpc_state",
"*",
"ppc",
",",
"drcuml_block",
"*",
"block",
",",
"compiler_state",
"*",
"compiler",
",",
"const",
"opcode_desc",
"*",
"desc",
",",
"UINT32",
"bo",
",",
"UINT32",
"bi",
",",
"int",
"source",
",",
"int",
"link",
")",
"{",
"int",
"skip",
"=",
"compiler",
"->",
"labelnum",
"++",
";",
"if",
"(",
"!",
"(",
"bo",
"&",
"0x04",
")",
")",
"{",
"UML_SUB",
"(",
"block",
",",
"SPR32",
"(",
"SPR_CTR",
")",
",",
"SPR32",
"(",
"SPR_CTR",
")",
",",
"IMM",
"(",
"1",
")",
")",
";",
"UML_JMPc",
"(",
"block",
",",
"(",
"bo",
"&",
"0x02",
")",
"?",
"IF_NZ",
":",
"IF_Z",
",",
"skip",
")",
";",
"}",
"if",
"(",
"!",
"(",
"bo",
"&",
"0x10",
")",
")",
"{",
"UML_TEST",
"(",
"block",
",",
"CR32",
"(",
"bi",
"/",
"4",
")",
",",
"IMM",
"(",
"8",
">>",
"(",
"bi",
"%",
"4",
")",
")",
")",
";",
"UML_JMPc",
"(",
"block",
",",
"(",
"bo",
"&",
"0x08",
")",
"?",
"IF_Z",
":",
"IF_NZ",
",",
"skip",
")",
";",
"}",
"generate_branch",
"(",
"ppc",
",",
"block",
",",
"compiler",
",",
"desc",
",",
"source",
",",
"link",
")",
";",
"UML_LABEL",
"(",
"block",
",",
"skip",
")",
";",
"}"
] | generate_branch_bo - generate a conditional
branch based on the BO and BI fields | [
"generate_branch_bo",
"-",
"generate",
"a",
"conditional",
"branch",
"based",
"on",
"the",
"BO",
"and",
"BI",
"fields"
] | [
"// sub [ctr],[ctr],1\r",
"// jmp skip,nz/z\r",
"// test cr32(bi/4),8 >> (bi % 4)\r",
"// jmp skip,z/nz\r",
"// <branch>\r",
"// skip:\r"
] | [
{
"param": "ppc",
"type": "powerpc_state"
},
{
"param": "block",
"type": "drcuml_block"
},
{
"param": "compiler",
"type": "compiler_state"
},
{
"param": "desc",
"type": "opcode_desc"
},
{
"param": "bo",
"type": "UINT32"
},
{
"param": "bi",
"type": "UINT32"
},
{
"param": "source",
"type": "int"
},
{
"param": "link",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ppc",
"type": "powerpc_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "compiler",
"type": "compiler_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "desc",
"type": "opcode_desc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bo",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bi",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "source",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "link",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | log_add_disasm_comment | void | static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op)
{
char buffer[100];
if (LOG_UML)
{
ppc_dasm_one(buffer, pc, op);
UML_COMMENT(block, "%08X: %s", pc, buffer); // comment
}
} | /*-------------------------------------------------
log_add_disasm_comment - add a comment
including disassembly of a PowerPC instruction
-------------------------------------------------*/ | add a comment
including disassembly of a PowerPC instruction | [
"add",
"a",
"comment",
"including",
"disassembly",
"of",
"a",
"PowerPC",
"instruction"
] | static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op)
{
char buffer[100];
if (LOG_UML)
{
ppc_dasm_one(buffer, pc, op);
UML_COMMENT(block, "%08X: %s", pc, buffer);
}
} | [
"static",
"void",
"log_add_disasm_comment",
"(",
"drcuml_block",
"*",
"block",
",",
"UINT32",
"pc",
",",
"UINT32",
"op",
")",
"{",
"char",
"buffer",
"[",
"100",
"]",
";",
"if",
"(",
"LOG_UML",
")",
"{",
"ppc_dasm_one",
"(",
"buffer",
",",
"pc",
",",
"op",
")",
";",
"UML_COMMENT",
"(",
"block",
",",
"\"",
"\"",
",",
"pc",
",",
"buffer",
")",
";",
"}",
"}"
] | log_add_disasm_comment - add a comment
including disassembly of a PowerPC instruction | [
"log_add_disasm_comment",
"-",
"add",
"a",
"comment",
"including",
"disassembly",
"of",
"a",
"PowerPC",
"instruction"
] | [
"// comment\r"
] | [
{
"param": "block",
"type": "drcuml_block"
},
{
"param": "pc",
"type": "UINT32"
},
{
"param": "op",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "block",
"type": "drcuml_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pc",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
767ef81b6a49102f19867becac19790e3e855390 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/powerpc/ppcdrc.c | [
"Unlicense"
] | C | log_register_list | void | static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 *reglist, const UINT32 *regnostarlist)
{
static const char *const crtext[4] = { "lt", "gt", "eq", "so" };
int count = 0;
int regnum;
int crnum;
/* skip if nothing */
if (reglist[0] == 0 && reglist[1] == 0 && reglist[2] == 0 && reglist[3] == 0)
return;
drcuml_log_printf(drcuml, "[%s:", string);
for (regnum = 0; regnum < 32; regnum++)
if (reglist[0] & REGFLAG_R(regnum))
{
drcuml_log_printf(drcuml, "%sr%d", (count++ == 0) ? "" : ",", regnum);
if (regnostarlist != NULL && !(regnostarlist[0] & REGFLAG_R(regnum)))
drcuml_log_printf(drcuml, "*");
}
for (regnum = 0; regnum < 32; regnum++)
if (reglist[1] & REGFLAG_FR(regnum))
{
drcuml_log_printf(drcuml, "%sfr%d", (count++ == 0) ? "" : ",", regnum);
if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_FR(regnum)))
drcuml_log_printf(drcuml, "*");
}
for (regnum = 0; regnum < 8; regnum++)
if (reglist[2] & REGFLAG_CR(regnum))
{
if ((reglist[2] & REGFLAG_CR(regnum)) == REGFLAG_CR(regnum) && (regnostarlist == NULL || (regnostarlist[2] & REGFLAG_CR(regnum)) == REGFLAG_CR(regnum)))
{
drcuml_log_printf(drcuml, "%scr%d", (count++ == 0) ? "" : ",", regnum);
if (regnostarlist != NULL && !(regnostarlist[2] & REGFLAG_CR(regnum)))
drcuml_log_printf(drcuml, "*");
}
else
{
for (crnum = 0; crnum < 4; crnum++)
if (reglist[2] & REGFLAG_CR_BIT(regnum * 4 + crnum))
{
drcuml_log_printf(drcuml, "%scr%d[%s]", (count++ == 0) ? "" : ",", regnum, crtext[crnum]);
if (regnostarlist != NULL && !(regnostarlist[2] & REGFLAG_CR_BIT(regnum * 4 + crnum)))
drcuml_log_printf(drcuml, "*");
}
}
}
if (reglist[3] & REGFLAG_XER_CA)
{
drcuml_log_printf(drcuml, "%sxer_ca", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_CA))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_XER_OV)
{
drcuml_log_printf(drcuml, "%sxer_ov", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_OV))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_XER_SO)
{
drcuml_log_printf(drcuml, "%sxer_so", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_SO))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_XER_COUNT)
{
drcuml_log_printf(drcuml, "%sxer_count", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_COUNT))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_CTR)
{
drcuml_log_printf(drcuml, "%sctr", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_CTR))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_LR)
{
drcuml_log_printf(drcuml, "%slr", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_LR))
drcuml_log_printf(drcuml, "*");
}
for (regnum = 0; regnum < 8; regnum++)
if (reglist[3] & REGFLAG_FPSCR(regnum))
{
drcuml_log_printf(drcuml, "%sfpscr%d", (count++ == 0) ? "" : ",", regnum);
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_FPSCR(regnum)))
drcuml_log_printf(drcuml, "*");
}
drcuml_log_printf(drcuml, "] ");
} | /*-------------------------------------------------
log_register_list - log a list of GPR registers
-------------------------------------------------*/ | log a list of GPR registers | [
"log",
"a",
"list",
"of",
"GPR",
"registers"
] | static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 *reglist, const UINT32 *regnostarlist)
{
static const char *const crtext[4] = { "lt", "gt", "eq", "so" };
int count = 0;
int regnum;
int crnum;
if (reglist[0] == 0 && reglist[1] == 0 && reglist[2] == 0 && reglist[3] == 0)
return;
drcuml_log_printf(drcuml, "[%s:", string);
for (regnum = 0; regnum < 32; regnum++)
if (reglist[0] & REGFLAG_R(regnum))
{
drcuml_log_printf(drcuml, "%sr%d", (count++ == 0) ? "" : ",", regnum);
if (regnostarlist != NULL && !(regnostarlist[0] & REGFLAG_R(regnum)))
drcuml_log_printf(drcuml, "*");
}
for (regnum = 0; regnum < 32; regnum++)
if (reglist[1] & REGFLAG_FR(regnum))
{
drcuml_log_printf(drcuml, "%sfr%d", (count++ == 0) ? "" : ",", regnum);
if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_FR(regnum)))
drcuml_log_printf(drcuml, "*");
}
for (regnum = 0; regnum < 8; regnum++)
if (reglist[2] & REGFLAG_CR(regnum))
{
if ((reglist[2] & REGFLAG_CR(regnum)) == REGFLAG_CR(regnum) && (regnostarlist == NULL || (regnostarlist[2] & REGFLAG_CR(regnum)) == REGFLAG_CR(regnum)))
{
drcuml_log_printf(drcuml, "%scr%d", (count++ == 0) ? "" : ",", regnum);
if (regnostarlist != NULL && !(regnostarlist[2] & REGFLAG_CR(regnum)))
drcuml_log_printf(drcuml, "*");
}
else
{
for (crnum = 0; crnum < 4; crnum++)
if (reglist[2] & REGFLAG_CR_BIT(regnum * 4 + crnum))
{
drcuml_log_printf(drcuml, "%scr%d[%s]", (count++ == 0) ? "" : ",", regnum, crtext[crnum]);
if (regnostarlist != NULL && !(regnostarlist[2] & REGFLAG_CR_BIT(regnum * 4 + crnum)))
drcuml_log_printf(drcuml, "*");
}
}
}
if (reglist[3] & REGFLAG_XER_CA)
{
drcuml_log_printf(drcuml, "%sxer_ca", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_CA))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_XER_OV)
{
drcuml_log_printf(drcuml, "%sxer_ov", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_OV))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_XER_SO)
{
drcuml_log_printf(drcuml, "%sxer_so", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_SO))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_XER_COUNT)
{
drcuml_log_printf(drcuml, "%sxer_count", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_XER_COUNT))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_CTR)
{
drcuml_log_printf(drcuml, "%sctr", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_CTR))
drcuml_log_printf(drcuml, "*");
}
if (reglist[3] & REGFLAG_LR)
{
drcuml_log_printf(drcuml, "%slr", (count++ == 0) ? "" : ",");
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_LR))
drcuml_log_printf(drcuml, "*");
}
for (regnum = 0; regnum < 8; regnum++)
if (reglist[3] & REGFLAG_FPSCR(regnum))
{
drcuml_log_printf(drcuml, "%sfpscr%d", (count++ == 0) ? "" : ",", regnum);
if (regnostarlist != NULL && !(regnostarlist[3] & REGFLAG_FPSCR(regnum)))
drcuml_log_printf(drcuml, "*");
}
drcuml_log_printf(drcuml, "] ");
} | [
"static",
"void",
"log_register_list",
"(",
"drcuml_state",
"*",
"drcuml",
",",
"const",
"char",
"*",
"string",
",",
"const",
"UINT32",
"*",
"reglist",
",",
"const",
"UINT32",
"*",
"regnostarlist",
")",
"{",
"static",
"const",
"char",
"*",
"const",
"crtext",
"[",
"4",
"]",
"=",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
";",
"int",
"count",
"=",
"0",
";",
"int",
"regnum",
";",
"int",
"crnum",
";",
"if",
"(",
"reglist",
"[",
"0",
"]",
"==",
"0",
"&&",
"reglist",
"[",
"1",
"]",
"==",
"0",
"&&",
"reglist",
"[",
"2",
"]",
"==",
"0",
"&&",
"reglist",
"[",
"3",
"]",
"==",
"0",
")",
"return",
";",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"string",
")",
";",
"for",
"(",
"regnum",
"=",
"0",
";",
"regnum",
"<",
"32",
";",
"regnum",
"++",
")",
"if",
"(",
"reglist",
"[",
"0",
"]",
"&",
"REGFLAG_R",
"(",
"regnum",
")",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
",",
"regnum",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"0",
"]",
"&",
"REGFLAG_R",
"(",
"regnum",
")",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"for",
"(",
"regnum",
"=",
"0",
";",
"regnum",
"<",
"32",
";",
"regnum",
"++",
")",
"if",
"(",
"reglist",
"[",
"1",
"]",
"&",
"REGFLAG_FR",
"(",
"regnum",
")",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
",",
"regnum",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"1",
"]",
"&",
"REGFLAG_FR",
"(",
"regnum",
")",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"for",
"(",
"regnum",
"=",
"0",
";",
"regnum",
"<",
"8",
";",
"regnum",
"++",
")",
"if",
"(",
"reglist",
"[",
"2",
"]",
"&",
"REGFLAG_CR",
"(",
"regnum",
")",
")",
"{",
"if",
"(",
"(",
"reglist",
"[",
"2",
"]",
"&",
"REGFLAG_CR",
"(",
"regnum",
")",
")",
"==",
"REGFLAG_CR",
"(",
"regnum",
")",
"&&",
"(",
"regnostarlist",
"==",
"NULL",
"||",
"(",
"regnostarlist",
"[",
"2",
"]",
"&",
"REGFLAG_CR",
"(",
"regnum",
")",
")",
"==",
"REGFLAG_CR",
"(",
"regnum",
")",
")",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
",",
"regnum",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"2",
"]",
"&",
"REGFLAG_CR",
"(",
"regnum",
")",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"else",
"{",
"for",
"(",
"crnum",
"=",
"0",
";",
"crnum",
"<",
"4",
";",
"crnum",
"++",
")",
"if",
"(",
"reglist",
"[",
"2",
"]",
"&",
"REGFLAG_CR_BIT",
"(",
"regnum",
"*",
"4",
"+",
"crnum",
")",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
",",
"regnum",
",",
"crtext",
"[",
"crnum",
"]",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"2",
"]",
"&",
"REGFLAG_CR_BIT",
"(",
"regnum",
"*",
"4",
"+",
"crnum",
")",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"}",
"}",
"if",
"(",
"reglist",
"[",
"3",
"]",
"&",
"REGFLAG_XER_CA",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"3",
"]",
"&",
"REGFLAG_XER_CA",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"reglist",
"[",
"3",
"]",
"&",
"REGFLAG_XER_OV",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"3",
"]",
"&",
"REGFLAG_XER_OV",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"reglist",
"[",
"3",
"]",
"&",
"REGFLAG_XER_SO",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"3",
"]",
"&",
"REGFLAG_XER_SO",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"reglist",
"[",
"3",
"]",
"&",
"REGFLAG_XER_COUNT",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"3",
"]",
"&",
"REGFLAG_XER_COUNT",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"reglist",
"[",
"3",
"]",
"&",
"REGFLAG_CTR",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"3",
"]",
"&",
"REGFLAG_CTR",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"reglist",
"[",
"3",
"]",
"&",
"REGFLAG_LR",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"3",
"]",
"&",
"REGFLAG_LR",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"for",
"(",
"regnum",
"=",
"0",
";",
"regnum",
"<",
"8",
";",
"regnum",
"++",
")",
"if",
"(",
"reglist",
"[",
"3",
"]",
"&",
"REGFLAG_FPSCR",
"(",
"regnum",
")",
")",
"{",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
",",
"(",
"count",
"++",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
",",
"regnum",
")",
";",
"if",
"(",
"regnostarlist",
"!=",
"NULL",
"&&",
"!",
"(",
"regnostarlist",
"[",
"3",
"]",
"&",
"REGFLAG_FPSCR",
"(",
"regnum",
")",
")",
")",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}",
"drcuml_log_printf",
"(",
"drcuml",
",",
"\"",
"\"",
")",
";",
"}"
] | log_register_list - log a list of GPR registers | [
"log_register_list",
"-",
"log",
"a",
"list",
"of",
"GPR",
"registers"
] | [
"/* skip if nothing */"
] | [
{
"param": "drcuml",
"type": "drcuml_state"
},
{
"param": "string",
"type": "char"
},
{
"param": "reglist",
"type": "UINT32"
},
{
"param": "regnostarlist",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcuml",
"type": "drcuml_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglist",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regnostarlist",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | tms5220_data_write | void | static void tms5220_data_write(tms5220_state *tms, int data)
{
#ifdef DEBUG_DUMP_INPUT_DATA
fprintf(stdout, "%c",data);
#endif
if (tms->speak_external) // If we're in speak external mode
{
/* add this byte to the FIFO */
if (tms->fifo_count < FIFO_SIZE)
{
tms->fifo[tms->fifo_tail] = data;
tms->fifo_tail = (tms->fifo_tail + 1) % FIFO_SIZE;
tms->fifo_count++;
#ifdef DEBUG_FIFO
logerror("data_write: Added byte to FIFO (current count=%2d)\n", tms->fifo_count);
#endif
update_status_and_ints(tms);
if ((tms->talk_status == 0) && (tms->buffer_low == 0)) // we just unset buffer low with that last write, and talk status *was* zero...
{
int i;
#ifdef DEBUG_FIFO
logerror("data_write triggered talk status to go active!\n");
#endif
/* ...then we now have enough bytes to start talking; clear out the new frame parameters (it will become old frame just before the first call to parse_frame() ) */
/* TODO: the 3 lines below (and others) are needed for victory to not fail its selftest due to a sample ending too late, may require additional investigation */
tms->subcycle = tms->subc_reload;
tms->PC = 0;
tms->interp_period = reload_table[tms->tms5220c_rate&0x3]; // is this correct? should this be always 7 instead, so that the new frame is loaded quickly?
tms->new_frame_energy_idx = 0;
tms->new_frame_pitch_idx = 0;
for (i = 0; i < 4; i++)
tms->new_frame_k_idx[i] = 0;
for (i = 4; i < 7; i++)
tms->new_frame_k_idx[i] = 0xF;
for (i = 7; i < tms->coeff->num_k; i++)
tms->new_frame_k_idx[i] = 0x7;
tms->talk_status = tms->speaking_now = 1;
}
}
else
{
#ifdef DEBUG_FIFO
logerror("data_write: Ran out of room in the tms52xx FIFO! this should never happen!\n");
// at this point, /READY should remain HIGH/inactive until the fifo has at least one byte open in it.
#endif
}
}
else //(! tms->speak_external)
/* R Nabet : we parse commands at once. It is necessary for such commands as read. */
process_command(tms,data);
} | /**********************************************************************************************
tms5220_data_write -- handle a write to the TMS5220
***********************************************************************************************/ | - handle a write to the TMS5220 | [
"-",
"handle",
"a",
"write",
"to",
"the",
"TMS5220"
] | static void tms5220_data_write(tms5220_state *tms, int data)
{
#ifdef DEBUG_DUMP_INPUT_DATA
fprintf(stdout, "%c",data);
#endif
if (tms->speak_external)
{
if (tms->fifo_count < FIFO_SIZE)
{
tms->fifo[tms->fifo_tail] = data;
tms->fifo_tail = (tms->fifo_tail + 1) % FIFO_SIZE;
tms->fifo_count++;
#ifdef DEBUG_FIFO
logerror("data_write: Added byte to FIFO (current count=%2d)\n", tms->fifo_count);
#endif
update_status_and_ints(tms);
if ((tms->talk_status == 0) && (tms->buffer_low == 0))
{
int i;
#ifdef DEBUG_FIFO
logerror("data_write triggered talk status to go active!\n");
#endif
tms->subcycle = tms->subc_reload;
tms->PC = 0;
tms->interp_period = reload_table[tms->tms5220c_rate&0x3];
tms->new_frame_energy_idx = 0;
tms->new_frame_pitch_idx = 0;
for (i = 0; i < 4; i++)
tms->new_frame_k_idx[i] = 0;
for (i = 4; i < 7; i++)
tms->new_frame_k_idx[i] = 0xF;
for (i = 7; i < tms->coeff->num_k; i++)
tms->new_frame_k_idx[i] = 0x7;
tms->talk_status = tms->speaking_now = 1;
}
}
else
{
#ifdef DEBUG_FIFO
logerror("data_write: Ran out of room in the tms52xx FIFO! this should never happen!\n");
#endif
}
}
else
process_command(tms,data);
} | [
"static",
"void",
"tms5220_data_write",
"(",
"tms5220_state",
"*",
"tms",
",",
"int",
"data",
")",
"{",
"#ifdef",
"DEBUG_DUMP_INPUT_DATA",
"fprintf",
"(",
"stdout",
",",
"\"",
"\"",
",",
"data",
")",
";",
"#endif",
"if",
"(",
"tms",
"->",
"speak_external",
")",
"{",
"if",
"(",
"tms",
"->",
"fifo_count",
"<",
"FIFO_SIZE",
")",
"{",
"tms",
"->",
"fifo",
"[",
"tms",
"->",
"fifo_tail",
"]",
"=",
"data",
";",
"tms",
"->",
"fifo_tail",
"=",
"(",
"tms",
"->",
"fifo_tail",
"+",
"1",
")",
"%",
"FIFO_SIZE",
";",
"tms",
"->",
"fifo_count",
"++",
";",
"#ifdef",
"DEBUG_FIFO",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"tms",
"->",
"fifo_count",
")",
";",
"#endif",
"update_status_and_ints",
"(",
"tms",
")",
";",
"if",
"(",
"(",
"tms",
"->",
"talk_status",
"==",
"0",
")",
"&&",
"(",
"tms",
"->",
"buffer_low",
"==",
"0",
")",
")",
"{",
"int",
"i",
";",
"#ifdef",
"DEBUG_FIFO",
"logerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"#endif",
"tms",
"->",
"subcycle",
"=",
"tms",
"->",
"subc_reload",
";",
"tms",
"->",
"PC",
"=",
"0",
";",
"tms",
"->",
"interp_period",
"=",
"reload_table",
"[",
"tms",
"->",
"tms5220c_rate",
"&",
"0x3",
"]",
";",
"tms",
"->",
"new_frame_energy_idx",
"=",
"0",
";",
"tms",
"->",
"new_frame_pitch_idx",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"4",
";",
"i",
"<",
"7",
";",
"i",
"++",
")",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
"=",
"0xF",
";",
"for",
"(",
"i",
"=",
"7",
";",
"i",
"<",
"tms",
"->",
"coeff",
"->",
"num_k",
";",
"i",
"++",
")",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
"=",
"0x7",
";",
"tms",
"->",
"talk_status",
"=",
"tms",
"->",
"speaking_now",
"=",
"1",
";",
"}",
"}",
"else",
"{",
"#ifdef",
"DEBUG_FIFO",
"logerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"#endif",
"}",
"}",
"else",
"process_command",
"(",
"tms",
",",
"data",
")",
";",
"}"
] | tms5220_data_write -- handle a write to the TMS5220 | [
"tms5220_data_write",
"--",
"handle",
"a",
"write",
"to",
"the",
"TMS5220"
] | [
"// If we're in speak external mode\r",
"/* add this byte to the FIFO */",
"// we just unset buffer low with that last write, and talk status *was* zero...\r",
"/* ...then we now have enough bytes to start talking; clear out the new frame parameters (it will become old frame just before the first call to parse_frame() ) */",
"/* TODO: the 3 lines below (and others) are needed for victory to not fail its selftest due to a sample ending too late, may require additional investigation */",
"// is this correct? should this be always 7 instead, so that the new frame is loaded quickly?\r",
"// at this point, /READY should remain HIGH/inactive until the fifo has at least one byte open in it.\r",
"//(! tms->speak_external)\r",
"/* R Nabet : we parse commands at once. It is necessary for such commands as read. */"
] | [
{
"param": "tms",
"type": "tms5220_state"
},
{
"param": "data",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | update_status_and_ints | void | static void update_status_and_ints(tms5220_state *tms)
{
/* update flags and set ints if needed */
update_ready_state(tms);
/* BL is set if neither byte 9 nor 8 of the fifo are in use; this
translates to having fifo_count (which ranges from 0 bytes in use to 16
bytes used) being less than or equal to 8. Victory/Victorba depends on this. */
if (tms->fifo_count <= 8)
{
/* generate an interrupt if necessary; if /BL was inactive and is now active, set int. */
if (!tms->buffer_low)
set_interrupt_state(tms, 1);
tms->buffer_low = 1;
}
else
tms->buffer_low = 0;
/* BE is set if neither byte 15 nor 14 of the fifo are in use; this
translates to having fifo_count equal to exactly 0 */
if (tms->fifo_count == 0)
{
/* generate an interrupt if necessary; if /BE was inactive and is now active, set int. */
if (!tms->buffer_empty)
set_interrupt_state(tms, 1);
tms->buffer_empty = 1;
}
else
tms->buffer_empty = 0;
/* TS is talk status and is set elsewhere in the fifo parser and in
the SPEAK command handler; however, if /BE is true during speak external
mode, it is immediately unset here. */
if ((tms->speak_external == 1) && (tms->buffer_empty == 1))
{
/* generate an interrupt: /TS was active, and is now inactive. */
if (tms->talk_status == 1)
{
tms->talk_status = tms->speak_external = 0;
set_interrupt_state(tms, 1);
}
}
/* Note that TS being unset will also generate an interrupt when a STOP
frame is encountered; this is handled in the sample generator code and not here */
} | /**********************************************************************************************
update_status_and_ints -- check to see if the various flags should be on or off
Description of flags, and their position in the status register:
From the data sheet:
bit D0(bit 7) = TS - Talk Status is active (high) when the VSP is processing speech data.
Talk Status goes active at the initiation of a Speak command or after nine
bytes of data are loaded into the FIFO following a Speak External command. It
goes inactive (low) when the stop code (Energy=1111) is processed, or
immediately by a buffer empty condition or a reset command.
bit D1(bit 6) = BL - Buffer Low is active (high) when the FIFO buffer is more than half empty.
Buffer Low is set when the "Last-In" byte is shifted down past the half-full
boundary of the stack. Buffer Low is cleared when data is loaded to the stack
so that the "Last-In" byte lies above the half-full boundary and becomes the
eighth data byte of the stack.
bit D2(bit 5) = BE - Buffer Empty is active (high) when the FIFO buffer has run out of data
while executing a Speak External command. Buffer Empty is set when the last bit
of the "Last-In" byte is shifted out to the Synthesis Section. This causes
Talk Status to be cleared. Speed is terminated at some abnormal point and the
Speak External command execution is terminated.
***********************************************************************************************/ | - check to see if the various flags should be on or off
Description of flags, and their position in the status register:
From the data sheet:
bit D0(bit 7) = TS - Talk Status is active (high) when the VSP is processing speech data.
Talk Status goes active at the initiation of a Speak command or after nine
bytes of data are loaded into the FIFO following a Speak External command. It
goes inactive (low) when the stop code (Energy=1111) is processed, or
immediately by a buffer empty condition or a reset command.
bit D1(bit 6) = BL - Buffer Low is active (high) when the FIFO buffer is more than half empty.
Buffer Low is set when the "Last-In" byte is shifted down past the half-full
boundary of the stack. Buffer Low is cleared when data is loaded to the stack
so that the "Last-In" byte lies above the half-full boundary and becomes the
eighth data byte of the stack.
bit D2(bit 5) = BE - Buffer Empty is active (high) when the FIFO buffer has run out of data
while executing a Speak External command. Buffer Empty is set when the last bit
of the "Last-In" byte is shifted out to the Synthesis Section. This causes
Talk Status to be cleared. Speed is terminated at some abnormal point and the
Speak External command execution is terminated. | [
"-",
"check",
"to",
"see",
"if",
"the",
"various",
"flags",
"should",
"be",
"on",
"or",
"off",
"Description",
"of",
"flags",
"and",
"their",
"position",
"in",
"the",
"status",
"register",
":",
"From",
"the",
"data",
"sheet",
":",
"bit",
"D0",
"(",
"bit",
"7",
")",
"=",
"TS",
"-",
"Talk",
"Status",
"is",
"active",
"(",
"high",
")",
"when",
"the",
"VSP",
"is",
"processing",
"speech",
"data",
".",
"Talk",
"Status",
"goes",
"active",
"at",
"the",
"initiation",
"of",
"a",
"Speak",
"command",
"or",
"after",
"nine",
"bytes",
"of",
"data",
"are",
"loaded",
"into",
"the",
"FIFO",
"following",
"a",
"Speak",
"External",
"command",
".",
"It",
"goes",
"inactive",
"(",
"low",
")",
"when",
"the",
"stop",
"code",
"(",
"Energy",
"=",
"1111",
")",
"is",
"processed",
"or",
"immediately",
"by",
"a",
"buffer",
"empty",
"condition",
"or",
"a",
"reset",
"command",
".",
"bit",
"D1",
"(",
"bit",
"6",
")",
"=",
"BL",
"-",
"Buffer",
"Low",
"is",
"active",
"(",
"high",
")",
"when",
"the",
"FIFO",
"buffer",
"is",
"more",
"than",
"half",
"empty",
".",
"Buffer",
"Low",
"is",
"set",
"when",
"the",
"\"",
"Last",
"-",
"In",
"\"",
"byte",
"is",
"shifted",
"down",
"past",
"the",
"half",
"-",
"full",
"boundary",
"of",
"the",
"stack",
".",
"Buffer",
"Low",
"is",
"cleared",
"when",
"data",
"is",
"loaded",
"to",
"the",
"stack",
"so",
"that",
"the",
"\"",
"Last",
"-",
"In",
"\"",
"byte",
"lies",
"above",
"the",
"half",
"-",
"full",
"boundary",
"and",
"becomes",
"the",
"eighth",
"data",
"byte",
"of",
"the",
"stack",
".",
"bit",
"D2",
"(",
"bit",
"5",
")",
"=",
"BE",
"-",
"Buffer",
"Empty",
"is",
"active",
"(",
"high",
")",
"when",
"the",
"FIFO",
"buffer",
"has",
"run",
"out",
"of",
"data",
"while",
"executing",
"a",
"Speak",
"External",
"command",
".",
"Buffer",
"Empty",
"is",
"set",
"when",
"the",
"last",
"bit",
"of",
"the",
"\"",
"Last",
"-",
"In",
"\"",
"byte",
"is",
"shifted",
"out",
"to",
"the",
"Synthesis",
"Section",
".",
"This",
"causes",
"Talk",
"Status",
"to",
"be",
"cleared",
".",
"Speed",
"is",
"terminated",
"at",
"some",
"abnormal",
"point",
"and",
"the",
"Speak",
"External",
"command",
"execution",
"is",
"terminated",
"."
] | static void update_status_and_ints(tms5220_state *tms)
{
update_ready_state(tms);
if (tms->fifo_count <= 8)
{
if (!tms->buffer_low)
set_interrupt_state(tms, 1);
tms->buffer_low = 1;
}
else
tms->buffer_low = 0;
if (tms->fifo_count == 0)
{
if (!tms->buffer_empty)
set_interrupt_state(tms, 1);
tms->buffer_empty = 1;
}
else
tms->buffer_empty = 0;
if ((tms->speak_external == 1) && (tms->buffer_empty == 1))
{
if (tms->talk_status == 1)
{
tms->talk_status = tms->speak_external = 0;
set_interrupt_state(tms, 1);
}
}
} | [
"static",
"void",
"update_status_and_ints",
"(",
"tms5220_state",
"*",
"tms",
")",
"{",
"update_ready_state",
"(",
"tms",
")",
";",
"if",
"(",
"tms",
"->",
"fifo_count",
"<=",
"8",
")",
"{",
"if",
"(",
"!",
"tms",
"->",
"buffer_low",
")",
"set_interrupt_state",
"(",
"tms",
",",
"1",
")",
";",
"tms",
"->",
"buffer_low",
"=",
"1",
";",
"}",
"else",
"tms",
"->",
"buffer_low",
"=",
"0",
";",
"if",
"(",
"tms",
"->",
"fifo_count",
"==",
"0",
")",
"{",
"if",
"(",
"!",
"tms",
"->",
"buffer_empty",
")",
"set_interrupt_state",
"(",
"tms",
",",
"1",
")",
";",
"tms",
"->",
"buffer_empty",
"=",
"1",
";",
"}",
"else",
"tms",
"->",
"buffer_empty",
"=",
"0",
";",
"if",
"(",
"(",
"tms",
"->",
"speak_external",
"==",
"1",
")",
"&&",
"(",
"tms",
"->",
"buffer_empty",
"==",
"1",
")",
")",
"{",
"if",
"(",
"tms",
"->",
"talk_status",
"==",
"1",
")",
"{",
"tms",
"->",
"talk_status",
"=",
"tms",
"->",
"speak_external",
"=",
"0",
";",
"set_interrupt_state",
"(",
"tms",
",",
"1",
")",
";",
"}",
"}",
"}"
] | update_status_and_ints -- check to see if the various flags should be on or off
Description of flags, and their position in the status register:
From the data sheet:
bit D0(bit 7) = TS - Talk Status is active (high) when the VSP is processing speech data. | [
"update_status_and_ints",
"--",
"check",
"to",
"see",
"if",
"the",
"various",
"flags",
"should",
"be",
"on",
"or",
"off",
"Description",
"of",
"flags",
"and",
"their",
"position",
"in",
"the",
"status",
"register",
":",
"From",
"the",
"data",
"sheet",
":",
"bit",
"D0",
"(",
"bit",
"7",
")",
"=",
"TS",
"-",
"Talk",
"Status",
"is",
"active",
"(",
"high",
")",
"when",
"the",
"VSP",
"is",
"processing",
"speech",
"data",
"."
] | [
"/* update flags and set ints if needed */",
"/* BL is set if neither byte 9 nor 8 of the fifo are in use; this\r\n translates to having fifo_count (which ranges from 0 bytes in use to 16\r\n bytes used) being less than or equal to 8. Victory/Victorba depends on this. */",
"/* generate an interrupt if necessary; if /BL was inactive and is now active, set int. */",
"/* BE is set if neither byte 15 nor 14 of the fifo are in use; this\r\n translates to having fifo_count equal to exactly 0 */",
"/* generate an interrupt if necessary; if /BE was inactive and is now active, set int. */",
"/* TS is talk status and is set elsewhere in the fifo parser and in\r\n the SPEAK command handler; however, if /BE is true during speak external\r\n mode, it is immediately unset here. */",
"/* generate an interrupt: /TS was active, and is now inactive. */",
"/* Note that TS being unset will also generate an interrupt when a STOP\r\n frame is encountered; this is handled in the sample generator code and not here */"
] | [
{
"param": "tms",
"type": "tms5220_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | extract_bits | int | static int extract_bits(tms5220_state *tms, int count)
{
int val = 0;
if (tms->speak_external)
{
/* extract from FIFO */
while (count--)
{
val = (val << 1) | ((tms->fifo[tms->fifo_head] >> tms->fifo_bits_taken) & 1);
tms->fifo_bits_taken++;
if (tms->fifo_bits_taken >= 8)
{
tms->fifo_count--;
tms->fifo[tms->fifo_head] = 0; // zero the newly depleted fifo head byte
tms->fifo_head = (tms->fifo_head + 1) % FIFO_SIZE;
tms->fifo_bits_taken = 0;
update_status_and_ints(tms);
}
}
}
else
{
/* extract from VSM (speech ROM) */
if (tms->intf->read)
val = (* tms->intf->read)(tms->device, count);
}
return val;
} | /**********************************************************************************************
extract_bits -- extract a specific number of bits from the current input stream (FIFO or VSM)
***********************************************************************************************/ | - extract a specific number of bits from the current input stream (FIFO or VSM) | [
"-",
"extract",
"a",
"specific",
"number",
"of",
"bits",
"from",
"the",
"current",
"input",
"stream",
"(",
"FIFO",
"or",
"VSM",
")"
] | static int extract_bits(tms5220_state *tms, int count)
{
int val = 0;
if (tms->speak_external)
{
while (count--)
{
val = (val << 1) | ((tms->fifo[tms->fifo_head] >> tms->fifo_bits_taken) & 1);
tms->fifo_bits_taken++;
if (tms->fifo_bits_taken >= 8)
{
tms->fifo_count--;
tms->fifo[tms->fifo_head] = 0;
tms->fifo_head = (tms->fifo_head + 1) % FIFO_SIZE;
tms->fifo_bits_taken = 0;
update_status_and_ints(tms);
}
}
}
else
{
if (tms->intf->read)
val = (* tms->intf->read)(tms->device, count);
}
return val;
} | [
"static",
"int",
"extract_bits",
"(",
"tms5220_state",
"*",
"tms",
",",
"int",
"count",
")",
"{",
"int",
"val",
"=",
"0",
";",
"if",
"(",
"tms",
"->",
"speak_external",
")",
"{",
"while",
"(",
"count",
"--",
")",
"{",
"val",
"=",
"(",
"val",
"<<",
"1",
")",
"|",
"(",
"(",
"tms",
"->",
"fifo",
"[",
"tms",
"->",
"fifo_head",
"]",
">>",
"tms",
"->",
"fifo_bits_taken",
")",
"&",
"1",
")",
";",
"tms",
"->",
"fifo_bits_taken",
"++",
";",
"if",
"(",
"tms",
"->",
"fifo_bits_taken",
">=",
"8",
")",
"{",
"tms",
"->",
"fifo_count",
"--",
";",
"tms",
"->",
"fifo",
"[",
"tms",
"->",
"fifo_head",
"]",
"=",
"0",
";",
"tms",
"->",
"fifo_head",
"=",
"(",
"tms",
"->",
"fifo_head",
"+",
"1",
")",
"%",
"FIFO_SIZE",
";",
"tms",
"->",
"fifo_bits_taken",
"=",
"0",
";",
"update_status_and_ints",
"(",
"tms",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"tms",
"->",
"intf",
"->",
"read",
")",
"val",
"=",
"(",
"*",
"tms",
"->",
"intf",
"->",
"read",
")",
"(",
"tms",
"->",
"device",
",",
"count",
")",
";",
"}",
"return",
"val",
";",
"}"
] | extract_bits -- extract a specific number of bits from the current input stream (FIFO or VSM) | [
"extract_bits",
"--",
"extract",
"a",
"specific",
"number",
"of",
"bits",
"from",
"the",
"current",
"input",
"stream",
"(",
"FIFO",
"or",
"VSM",
")"
] | [
"/* extract from FIFO */",
"// zero the newly depleted fifo head byte\r",
"/* extract from VSM (speech ROM) */"
] | [
{
"param": "tms",
"type": "tms5220_state"
},
{
"param": "count",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "count",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | tms5220_status_read | int | static int tms5220_status_read(tms5220_state *tms)
{
if (tms->RDB_flag)
{ /* if last command was read, return data register */
tms->RDB_flag = FALSE;
return(tms->data_register);
}
else
{ /* read status */
/* clear the interrupt pin on status read */
set_interrupt_state(tms, 0);
#ifdef DEBUG_PIN_READS
logerror("Status read: TS=%d BL=%d BE=%d\n", tms->talk_status, tms->buffer_low, tms->buffer_empty);
#endif
return (tms->talk_status << 7) | (tms->buffer_low << 6) | (tms->buffer_empty << 5);
}
} | /**********************************************************************************************
tms5220_status_read -- read status or data from the TMS5220
***********************************************************************************************/ | - read status or data from the TMS5220 | [
"-",
"read",
"status",
"or",
"data",
"from",
"the",
"TMS5220"
] | static int tms5220_status_read(tms5220_state *tms)
{
if (tms->RDB_flag)
{
tms->RDB_flag = FALSE;
return(tms->data_register);
}
else
{
set_interrupt_state(tms, 0);
#ifdef DEBUG_PIN_READS
logerror("Status read: TS=%d BL=%d BE=%d\n", tms->talk_status, tms->buffer_low, tms->buffer_empty);
#endif
return (tms->talk_status << 7) | (tms->buffer_low << 6) | (tms->buffer_empty << 5);
}
} | [
"static",
"int",
"tms5220_status_read",
"(",
"tms5220_state",
"*",
"tms",
")",
"{",
"if",
"(",
"tms",
"->",
"RDB_flag",
")",
"{",
"tms",
"->",
"RDB_flag",
"=",
"FALSE",
";",
"return",
"(",
"tms",
"->",
"data_register",
")",
";",
"}",
"else",
"{",
"set_interrupt_state",
"(",
"tms",
",",
"0",
")",
";",
"#ifdef",
"DEBUG_PIN_READS",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"tms",
"->",
"talk_status",
",",
"tms",
"->",
"buffer_low",
",",
"tms",
"->",
"buffer_empty",
")",
";",
"#endif",
"return",
"(",
"tms",
"->",
"talk_status",
"<<",
"7",
")",
"|",
"(",
"tms",
"->",
"buffer_low",
"<<",
"6",
")",
"|",
"(",
"tms",
"->",
"buffer_empty",
"<<",
"5",
")",
";",
"}",
"}"
] | tms5220_status_read -- read status or data from the TMS5220 | [
"tms5220_status_read",
"--",
"read",
"status",
"or",
"data",
"from",
"the",
"TMS5220"
] | [
"/* if last command was read, return data register */",
"/* read status */",
"/* clear the interrupt pin on status read */"
] | [
{
"param": "tms",
"type": "tms5220_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | tms5220_ready_read | int | static int tms5220_ready_read(tms5220_state *tms)
{
#ifdef DEBUG_PIN_READS
logerror("ready_read: ready pin read, io_ready is %d, fifo count is %d\n", tms->io_ready, tms->fifo_count);
#endif
return ((tms->fifo_count < FIFO_SIZE)||(!tms->speak_external)) && tms->io_ready;
} | /**********************************************************************************************
tms5220_ready_read -- returns the ready state of the TMS5220
***********************************************************************************************/ | - returns the ready state of the TMS5220 | [
"-",
"returns",
"the",
"ready",
"state",
"of",
"the",
"TMS5220"
] | static int tms5220_ready_read(tms5220_state *tms)
{
#ifdef DEBUG_PIN_READS
logerror("ready_read: ready pin read, io_ready is %d, fifo count is %d\n", tms->io_ready, tms->fifo_count);
#endif
return ((tms->fifo_count < FIFO_SIZE)||(!tms->speak_external)) && tms->io_ready;
} | [
"static",
"int",
"tms5220_ready_read",
"(",
"tms5220_state",
"*",
"tms",
")",
"{",
"#ifdef",
"DEBUG_PIN_READS",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"tms",
"->",
"io_ready",
",",
"tms",
"->",
"fifo_count",
")",
";",
"#endif",
"return",
"(",
"(",
"tms",
"->",
"fifo_count",
"<",
"FIFO_SIZE",
")",
"||",
"(",
"!",
"tms",
"->",
"speak_external",
")",
")",
"&&",
"tms",
"->",
"io_ready",
";",
"}"
] | tms5220_ready_read -- returns the ready state of the TMS5220 | [
"tms5220_ready_read",
"--",
"returns",
"the",
"ready",
"state",
"of",
"the",
"TMS5220"
] | [] | [
{
"param": "tms",
"type": "tms5220_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | tms5220_cycles_to_ready | int | static int tms5220_cycles_to_ready(tms5220_state *tms)
{
int answer;
if (tms5220_ready_read(tms))
answer = 0;
else
{
int val;
int samples_per_frame = tms->subc_reload?200:304; // either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW
int current_sample = ((tms->PC*(3-tms->subc_reload))+((tms->subc_reload?38:25)*tms->interp_period));
answer = samples_per_frame-current_sample+8;
/* total number of bits available in current byte is (8 - tms->fifo_bits_taken) */
/* if more than 4 are available, we need to check the energy */
if (tms->fifo_bits_taken < 4)
{
/* read energy */
val = (tms->fifo[tms->fifo_head] >> tms->fifo_bits_taken) & 0xf;
if (val == 0)
/* 0 -> silence frame: we will only read 4 bits, and we will
therefore need to read another frame before the FIFO is not
full any more */
answer += 200;
/* 15 -> stop frame, we will only read 4 bits, but the FIFO will
we cleared */
/* otherwise, we need to parse the repeat flag (1 bit) and the
pitch (6 bits), so everything will be OK. */
}
}
return answer;
} | /**********************************************************************************************
tms5220_cycles_to_ready -- returns the number of cycles until ready is asserted
NOTE: this function is deprecated and is known to be VERY inaccurate.
Use at your own peril!
***********************************************************************************************/ | - returns the number of cycles until ready is asserted
NOTE: this function is deprecated and is known to be VERY inaccurate.
Use at your own peril! | [
"-",
"returns",
"the",
"number",
"of",
"cycles",
"until",
"ready",
"is",
"asserted",
"NOTE",
":",
"this",
"function",
"is",
"deprecated",
"and",
"is",
"known",
"to",
"be",
"VERY",
"inaccurate",
".",
"Use",
"at",
"your",
"own",
"peril!"
] | static int tms5220_cycles_to_ready(tms5220_state *tms)
{
int answer;
if (tms5220_ready_read(tms))
answer = 0;
else
{
int val;
int samples_per_frame = tms->subc_reload?200:304;
int current_sample = ((tms->PC*(3-tms->subc_reload))+((tms->subc_reload?38:25)*tms->interp_period));
answer = samples_per_frame-current_sample+8;
if (tms->fifo_bits_taken < 4)
{
val = (tms->fifo[tms->fifo_head] >> tms->fifo_bits_taken) & 0xf;
if (val == 0)
answer += 200;
}
}
return answer;
} | [
"static",
"int",
"tms5220_cycles_to_ready",
"(",
"tms5220_state",
"*",
"tms",
")",
"{",
"int",
"answer",
";",
"if",
"(",
"tms5220_ready_read",
"(",
"tms",
")",
")",
"answer",
"=",
"0",
";",
"else",
"{",
"int",
"val",
";",
"int",
"samples_per_frame",
"=",
"tms",
"->",
"subc_reload",
"?",
"200",
":",
"304",
";",
"int",
"current_sample",
"=",
"(",
"(",
"tms",
"->",
"PC",
"*",
"(",
"3",
"-",
"tms",
"->",
"subc_reload",
")",
")",
"+",
"(",
"(",
"tms",
"->",
"subc_reload",
"?",
"38",
":",
"25",
")",
"*",
"tms",
"->",
"interp_period",
")",
")",
";",
"answer",
"=",
"samples_per_frame",
"-",
"current_sample",
"+",
"8",
";",
"if",
"(",
"tms",
"->",
"fifo_bits_taken",
"<",
"4",
")",
"{",
"val",
"=",
"(",
"tms",
"->",
"fifo",
"[",
"tms",
"->",
"fifo_head",
"]",
">>",
"tms",
"->",
"fifo_bits_taken",
")",
"&",
"0xf",
";",
"if",
"(",
"val",
"==",
"0",
")",
"answer",
"+=",
"200",
";",
"}",
"}",
"return",
"answer",
";",
"}"
] | tms5220_cycles_to_ready -- returns the number of cycles until ready is asserted
NOTE: this function is deprecated and is known to be VERY inaccurate. | [
"tms5220_cycles_to_ready",
"--",
"returns",
"the",
"number",
"of",
"cycles",
"until",
"ready",
"is",
"asserted",
"NOTE",
":",
"this",
"function",
"is",
"deprecated",
"and",
"is",
"known",
"to",
"be",
"VERY",
"inaccurate",
"."
] | [
"// either (13 A cycles + 12 B cycles) * 8 interps for normal SPEAK/SPKEXT, or (13*2 A cycles + 12 B cycles) * 8 interps for SPKSLOW\r",
"/* total number of bits available in current byte is (8 - tms->fifo_bits_taken) */",
"/* if more than 4 are available, we need to check the energy */",
"/* read energy */",
"/* 0 -> silence frame: we will only read 4 bits, and we will\r\n therefore need to read another frame before the FIFO is not\r\n full any more */",
"/* 15 -> stop frame, we will only read 4 bits, but the FIFO will\r\n we cleared */",
"/* otherwise, we need to parse the repeat flag (1 bit) and the\r\n pitch (6 bits), so everything will be OK. */"
] | [
{
"param": "tms",
"type": "tms5220_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | tms5220_int_read | int | static int tms5220_int_read(tms5220_state *tms)
{
#ifdef DEBUG_PIN_READS
logerror("int_read: irq pin read, state is %d\n", tms->irq_pin);
#endif
return tms->irq_pin;
} | /**********************************************************************************************
tms5220_int_read -- returns the interrupt state of the TMS5220
***********************************************************************************************/ | - returns the interrupt state of the TMS5220 | [
"-",
"returns",
"the",
"interrupt",
"state",
"of",
"the",
"TMS5220"
] | static int tms5220_int_read(tms5220_state *tms)
{
#ifdef DEBUG_PIN_READS
logerror("int_read: irq pin read, state is %d\n", tms->irq_pin);
#endif
return tms->irq_pin;
} | [
"static",
"int",
"tms5220_int_read",
"(",
"tms5220_state",
"*",
"tms",
")",
"{",
"#ifdef",
"DEBUG_PIN_READS",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"tms",
"->",
"irq_pin",
")",
";",
"#endif",
"return",
"tms",
"->",
"irq_pin",
";",
"}"
] | tms5220_int_read -- returns the interrupt state of the TMS5220 | [
"tms5220_int_read",
"--",
"returns",
"the",
"interrupt",
"state",
"of",
"the",
"TMS5220"
] | [] | [
{
"param": "tms",
"type": "tms5220_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | clip_analog | INT16 | static INT16 clip_analog(INT16 cliptemp)
{
/* clipping, just like the patent shows:
the top 10 bits of this result are visible on the digital output IO pin.
next, if the top 3 bits of the 14 bit result are all the same, the lowest of those 3 bits plus the next 7 bits are the signed analog output, otherwise the low bits are all forced to match the inverse of the topmost bit, i.e.:
1x xxxx xxxx xxxx -> 0b10000000
11 1bcd efgh xxxx -> 0b1bcdefgh
00 0bcd efgh xxxx -> 0b0bcdefgh
0x xxxx xxxx xxxx -> 0b01111111
*/
#ifdef DEBUG_CLIP
if ((cliptemp > 2047) || (cliptemp < -2048)) fprintf(stderr,"clipping cliptemp to range; was %d\n", cliptemp);
#endif
if (cliptemp > 2047) cliptemp = 2047;
else if (cliptemp < -2048) cliptemp = -2048;
/* at this point the analog output is tapped */
#ifdef ALLOW_4_LSB
// input: ssss snnn nnnn nnnn
// N taps: ^^^ ^ = 0x0780
// output: snnn nnnn nnnn NNNN
return (cliptemp << 4)|((cliptemp&0x780)>>7); // upshift and range adjust
#else
cliptemp &= ~0xF;
// input: ssss snnn nnnn 0000
// N taps: ^^^ ^^^^ = 0x07F0
// P taps: ^ = 0x0400
// output: snnn nnnn NNNN NNNP
return (cliptemp << 4)|((cliptemp&0x7F0)>>3)|((cliptemp&0x400)>>10); // upshift and range adjust
#endif
} | /**********************************************************************************************
clip_analog -- clips the 14 bit return value from the lattice filter to its final 10 bit value (-512 to 511), and upshifts/range extends this to 16 bits
***********************************************************************************************/ | - clips the 14 bit return value from the lattice filter to its final 10 bit value (-512 to 511), and upshifts/range extends this to 16 bits | [
"-",
"clips",
"the",
"14",
"bit",
"return",
"value",
"from",
"the",
"lattice",
"filter",
"to",
"its",
"final",
"10",
"bit",
"value",
"(",
"-",
"512",
"to",
"511",
")",
"and",
"upshifts",
"/",
"range",
"extends",
"this",
"to",
"16",
"bits"
] | static INT16 clip_analog(INT16 cliptemp)
{
#ifdef DEBUG_CLIP
if ((cliptemp > 2047) || (cliptemp < -2048)) fprintf(stderr,"clipping cliptemp to range; was %d\n", cliptemp);
#endif
if (cliptemp > 2047) cliptemp = 2047;
else if (cliptemp < -2048) cliptemp = -2048;
#ifdef ALLOW_4_LSB
return (cliptemp << 4)|((cliptemp&0x780)>>7);
#else
cliptemp &= ~0xF;
return (cliptemp << 4)|((cliptemp&0x7F0)>>3)|((cliptemp&0x400)>>10);
#endif
} | [
"static",
"INT16",
"clip_analog",
"(",
"INT16",
"cliptemp",
")",
"{",
"#ifdef",
"DEBUG_CLIP",
"if",
"(",
"(",
"cliptemp",
">",
"2047",
")",
"||",
"(",
"cliptemp",
"<",
"-2048",
")",
")",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
",",
"cliptemp",
")",
";",
"#endif",
"if",
"(",
"cliptemp",
">",
"2047",
")",
"cliptemp",
"=",
"2047",
";",
"else",
"if",
"(",
"cliptemp",
"<",
"-2048",
")",
"cliptemp",
"=",
"-2048",
";",
"#ifdef",
"ALLOW_4_LSB",
"return",
"(",
"cliptemp",
"<<",
"4",
")",
"|",
"(",
"(",
"cliptemp",
"&",
"0x780",
")",
">>",
"7",
")",
";",
"#else",
"cliptemp",
"&=",
"~",
"0xF",
";",
"return",
"(",
"cliptemp",
"<<",
"4",
")",
"|",
"(",
"(",
"cliptemp",
"&",
"0x7F0",
")",
">>",
"3",
")",
"|",
"(",
"(",
"cliptemp",
"&",
"0x400",
")",
">>",
"10",
")",
";",
"#endif",
"}"
] | clip_analog -- clips the 14 bit return value from the lattice filter to its final 10 bit value (-512 to 511), and upshifts/range extends this to 16 bits | [
"clip_analog",
"--",
"clips",
"the",
"14",
"bit",
"return",
"value",
"from",
"the",
"lattice",
"filter",
"to",
"its",
"final",
"10",
"bit",
"value",
"(",
"-",
"512",
"to",
"511",
")",
"and",
"upshifts",
"/",
"range",
"extends",
"this",
"to",
"16",
"bits"
] | [
"/* clipping, just like the patent shows:\r\n the top 10 bits of this result are visible on the digital output IO pin.\r\n next, if the top 3 bits of the 14 bit result are all the same, the lowest of those 3 bits plus the next 7 bits are the signed analog output, otherwise the low bits are all forced to match the inverse of the topmost bit, i.e.:\r\n 1x xxxx xxxx xxxx -> 0b10000000\r\n 11 1bcd efgh xxxx -> 0b1bcdefgh\r\n 00 0bcd efgh xxxx -> 0b0bcdefgh\r\n 0x xxxx xxxx xxxx -> 0b01111111\r\n */",
"/* at this point the analog output is tapped */",
"// input: ssss snnn nnnn nnnn\r",
"// N taps: ^^^ ^ = 0x0780\r",
"// output: snnn nnnn nnnn NNNN\r",
"// upshift and range adjust\r",
"// input: ssss snnn nnnn 0000\r",
"// N taps: ^^^ ^^^^ = 0x07F0\r",
"// P taps: ^ = 0x0400\r",
"// output: snnn nnnn NNNN NNNP\r",
"// upshift and range adjust\r"
] | [
{
"param": "cliptemp",
"type": "INT16"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cliptemp",
"type": "INT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | matrix_multiply | INT32 | static INT32 matrix_multiply(INT32 a, INT32 b)
{
INT32 result;
while (a>511) { a-=1024; }
while (a<-512) { a+=1024; }
while (b>16383) { b-=32768; }
while (b<-16384) { b+=32768; }
result = ((a*b)>>9)|1;
#ifdef VERBOSE
if (result>16383) fprintf(stderr,"matrix multiplier overflowed! a: %x, b: %x, result: %x", a, b, result);
if (result<-16384) fprintf(stderr,"matrix multiplier underflowed! a: %x, b: %x, result: %x", a, b, result);
#endif
return result;
} | /**********************************************************************************************
ti_matrix_multiply -- does the proper multiply and shift as the TI chips do.
a is the k coefficient and is clamped to 10 bits (9 bits plus a sign)
b is the running result and is clamped to 14 bits.
output is 14 bits, but note the result LSB bit is always 1. (or is it?)
**********************************************************************************************/ | - does the proper multiply and shift as the TI chips do.
a is the k coefficient and is clamped to 10 bits (9 bits plus a sign)
b is the running result and is clamped to 14 bits.
output is 14 bits, but note the result LSB bit is always 1. (or is it?) | [
"-",
"does",
"the",
"proper",
"multiply",
"and",
"shift",
"as",
"the",
"TI",
"chips",
"do",
".",
"a",
"is",
"the",
"k",
"coefficient",
"and",
"is",
"clamped",
"to",
"10",
"bits",
"(",
"9",
"bits",
"plus",
"a",
"sign",
")",
"b",
"is",
"the",
"running",
"result",
"and",
"is",
"clamped",
"to",
"14",
"bits",
".",
"output",
"is",
"14",
"bits",
"but",
"note",
"the",
"result",
"LSB",
"bit",
"is",
"always",
"1",
".",
"(",
"or",
"is",
"it?",
")"
] | static INT32 matrix_multiply(INT32 a, INT32 b)
{
INT32 result;
while (a>511) { a-=1024; }
while (a<-512) { a+=1024; }
while (b>16383) { b-=32768; }
while (b<-16384) { b+=32768; }
result = ((a*b)>>9)|1;
#ifdef VERBOSE
if (result>16383) fprintf(stderr,"matrix multiplier overflowed! a: %x, b: %x, result: %x", a, b, result);
if (result<-16384) fprintf(stderr,"matrix multiplier underflowed! a: %x, b: %x, result: %x", a, b, result);
#endif
return result;
} | [
"static",
"INT32",
"matrix_multiply",
"(",
"INT32",
"a",
",",
"INT32",
"b",
")",
"{",
"INT32",
"result",
";",
"while",
"(",
"a",
">",
"511",
")",
"{",
"a",
"-=",
"1024",
";",
"}",
"while",
"(",
"a",
"<",
"-512",
")",
"{",
"a",
"+=",
"1024",
";",
"}",
"while",
"(",
"b",
">",
"16383",
")",
"{",
"b",
"-=",
"32768",
";",
"}",
"while",
"(",
"b",
"<",
"-16384",
")",
"{",
"b",
"+=",
"32768",
";",
"}",
"result",
"=",
"(",
"(",
"a",
"*",
"b",
")",
">>",
"9",
")",
"|",
"1",
";",
"#ifdef",
"VERBOSE",
"if",
"(",
"result",
">",
"16383",
")",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
",",
"a",
",",
"b",
",",
"result",
")",
";",
"if",
"(",
"result",
"<",
"-16384",
")",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
",",
"a",
",",
"b",
",",
"result",
")",
";",
"#endif",
"return",
"result",
";",
"}"
] | ti_matrix_multiply -- does the proper multiply and shift as the TI chips do. | [
"ti_matrix_multiply",
"--",
"does",
"the",
"proper",
"multiply",
"and",
"shift",
"as",
"the",
"TI",
"chips",
"do",
"."
] | [] | [
{
"param": "a",
"type": "INT32"
},
{
"param": "b",
"type": "INT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": "INT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | lattice_filter | INT32 | static INT32 lattice_filter(tms5220_state *tms)
{
/* Lattice filter here */
/* Aug/05/07: redone as unrolled loop, for clarity - LN*/
/* Originally Copied verbatim from table I in US patent 4,209,804, now updated to be in same order as the actual chip does it, not that it matters.
notation equivalencies from table:
Yn(i) == tms->u[n-1]
Kn = tms->current_k[n-1]
bn = tms->x[n-1]
*/
tms->u[10] = matrix_multiply(tms->previous_energy, (tms->excitation_data*64)); //Y(11)
tms->u[9] = tms->u[10] - matrix_multiply(tms->current_k[9], tms->x[9]);
tms->u[8] = tms->u[9] - matrix_multiply(tms->current_k[8], tms->x[8]);
tms->u[7] = tms->u[8] - matrix_multiply(tms->current_k[7], tms->x[7]);
tms->u[6] = tms->u[7] - matrix_multiply(tms->current_k[6], tms->x[6]);
tms->u[5] = tms->u[6] - matrix_multiply(tms->current_k[5], tms->x[5]);
tms->u[4] = tms->u[5] - matrix_multiply(tms->current_k[4], tms->x[4]);
tms->u[3] = tms->u[4] - matrix_multiply(tms->current_k[3], tms->x[3]);
tms->u[2] = tms->u[3] - matrix_multiply(tms->current_k[2], tms->x[2]);
tms->u[1] = tms->u[2] - matrix_multiply(tms->current_k[1], tms->x[1]);
tms->u[0] = tms->u[1] - matrix_multiply(tms->current_k[0], tms->x[0]);
tms->x[9] = tms->x[8] + matrix_multiply(tms->current_k[8], tms->u[8]);
tms->x[8] = tms->x[7] + matrix_multiply(tms->current_k[7], tms->u[7]);
tms->x[7] = tms->x[6] + matrix_multiply(tms->current_k[6], tms->u[6]);
tms->x[6] = tms->x[5] + matrix_multiply(tms->current_k[5], tms->u[5]);
tms->x[5] = tms->x[4] + matrix_multiply(tms->current_k[4], tms->u[4]);
tms->x[4] = tms->x[3] + matrix_multiply(tms->current_k[3], tms->u[3]);
tms->x[3] = tms->x[2] + matrix_multiply(tms->current_k[2], tms->u[2]);
tms->x[2] = tms->x[1] + matrix_multiply(tms->current_k[1], tms->u[1]);
tms->x[1] = tms->x[0] + matrix_multiply(tms->current_k[0], tms->u[0]);
tms->x[0] = tms->u[0];
tms->previous_energy = tms->current_energy;
#ifdef DEBUG_LATTICE
int i;
fprintf(stderr,"V:%04d ", tms->u[10]);
for (i = 9; i >= 0; i--)
{
fprintf(stderr,"Y%d:%04d ", i+1, tms->u[i]);
fprintf(stderr,"b%d:%04d ", i+1, tms->x[i]);
if ((i % 5) == 0) fprintf(stderr,"\n");
}
#endif
return tms->u[0];
} | /**********************************************************************************************
lattice_filter -- executes one 'full run' of the lattice filter on a specific byte of
excitation data, and specific values of all the current k constants, and returns the
resulting sample.
***********************************************************************************************/ | - executes one 'full run' of the lattice filter on a specific byte of
excitation data, and specific values of all the current k constants, and returns the
resulting sample. | [
"-",
"executes",
"one",
"'",
"full",
"run",
"'",
"of",
"the",
"lattice",
"filter",
"on",
"a",
"specific",
"byte",
"of",
"excitation",
"data",
"and",
"specific",
"values",
"of",
"all",
"the",
"current",
"k",
"constants",
"and",
"returns",
"the",
"resulting",
"sample",
"."
] | static INT32 lattice_filter(tms5220_state *tms)
{
tms->u[10] = matrix_multiply(tms->previous_energy, (tms->excitation_data*64));
tms->u[9] = tms->u[10] - matrix_multiply(tms->current_k[9], tms->x[9]);
tms->u[8] = tms->u[9] - matrix_multiply(tms->current_k[8], tms->x[8]);
tms->u[7] = tms->u[8] - matrix_multiply(tms->current_k[7], tms->x[7]);
tms->u[6] = tms->u[7] - matrix_multiply(tms->current_k[6], tms->x[6]);
tms->u[5] = tms->u[6] - matrix_multiply(tms->current_k[5], tms->x[5]);
tms->u[4] = tms->u[5] - matrix_multiply(tms->current_k[4], tms->x[4]);
tms->u[3] = tms->u[4] - matrix_multiply(tms->current_k[3], tms->x[3]);
tms->u[2] = tms->u[3] - matrix_multiply(tms->current_k[2], tms->x[2]);
tms->u[1] = tms->u[2] - matrix_multiply(tms->current_k[1], tms->x[1]);
tms->u[0] = tms->u[1] - matrix_multiply(tms->current_k[0], tms->x[0]);
tms->x[9] = tms->x[8] + matrix_multiply(tms->current_k[8], tms->u[8]);
tms->x[8] = tms->x[7] + matrix_multiply(tms->current_k[7], tms->u[7]);
tms->x[7] = tms->x[6] + matrix_multiply(tms->current_k[6], tms->u[6]);
tms->x[6] = tms->x[5] + matrix_multiply(tms->current_k[5], tms->u[5]);
tms->x[5] = tms->x[4] + matrix_multiply(tms->current_k[4], tms->u[4]);
tms->x[4] = tms->x[3] + matrix_multiply(tms->current_k[3], tms->u[3]);
tms->x[3] = tms->x[2] + matrix_multiply(tms->current_k[2], tms->u[2]);
tms->x[2] = tms->x[1] + matrix_multiply(tms->current_k[1], tms->u[1]);
tms->x[1] = tms->x[0] + matrix_multiply(tms->current_k[0], tms->u[0]);
tms->x[0] = tms->u[0];
tms->previous_energy = tms->current_energy;
#ifdef DEBUG_LATTICE
int i;
fprintf(stderr,"V:%04d ", tms->u[10]);
for (i = 9; i >= 0; i--)
{
fprintf(stderr,"Y%d:%04d ", i+1, tms->u[i]);
fprintf(stderr,"b%d:%04d ", i+1, tms->x[i]);
if ((i % 5) == 0) fprintf(stderr,"\n");
}
#endif
return tms->u[0];
} | [
"static",
"INT32",
"lattice_filter",
"(",
"tms5220_state",
"*",
"tms",
")",
"{",
"tms",
"->",
"u",
"[",
"10",
"]",
"=",
"matrix_multiply",
"(",
"tms",
"->",
"previous_energy",
",",
"(",
"tms",
"->",
"excitation_data",
"*",
"64",
")",
")",
";",
"tms",
"->",
"u",
"[",
"9",
"]",
"=",
"tms",
"->",
"u",
"[",
"10",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"9",
"]",
",",
"tms",
"->",
"x",
"[",
"9",
"]",
")",
";",
"tms",
"->",
"u",
"[",
"8",
"]",
"=",
"tms",
"->",
"u",
"[",
"9",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"8",
"]",
",",
"tms",
"->",
"x",
"[",
"8",
"]",
")",
";",
"tms",
"->",
"u",
"[",
"7",
"]",
"=",
"tms",
"->",
"u",
"[",
"8",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"7",
"]",
",",
"tms",
"->",
"x",
"[",
"7",
"]",
")",
";",
"tms",
"->",
"u",
"[",
"6",
"]",
"=",
"tms",
"->",
"u",
"[",
"7",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"6",
"]",
",",
"tms",
"->",
"x",
"[",
"6",
"]",
")",
";",
"tms",
"->",
"u",
"[",
"5",
"]",
"=",
"tms",
"->",
"u",
"[",
"6",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"5",
"]",
",",
"tms",
"->",
"x",
"[",
"5",
"]",
")",
";",
"tms",
"->",
"u",
"[",
"4",
"]",
"=",
"tms",
"->",
"u",
"[",
"5",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"4",
"]",
",",
"tms",
"->",
"x",
"[",
"4",
"]",
")",
";",
"tms",
"->",
"u",
"[",
"3",
"]",
"=",
"tms",
"->",
"u",
"[",
"4",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"3",
"]",
",",
"tms",
"->",
"x",
"[",
"3",
"]",
")",
";",
"tms",
"->",
"u",
"[",
"2",
"]",
"=",
"tms",
"->",
"u",
"[",
"3",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"2",
"]",
",",
"tms",
"->",
"x",
"[",
"2",
"]",
")",
";",
"tms",
"->",
"u",
"[",
"1",
"]",
"=",
"tms",
"->",
"u",
"[",
"2",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"1",
"]",
",",
"tms",
"->",
"x",
"[",
"1",
"]",
")",
";",
"tms",
"->",
"u",
"[",
"0",
"]",
"=",
"tms",
"->",
"u",
"[",
"1",
"]",
"-",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"0",
"]",
",",
"tms",
"->",
"x",
"[",
"0",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"9",
"]",
"=",
"tms",
"->",
"x",
"[",
"8",
"]",
"+",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"8",
"]",
",",
"tms",
"->",
"u",
"[",
"8",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"8",
"]",
"=",
"tms",
"->",
"x",
"[",
"7",
"]",
"+",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"7",
"]",
",",
"tms",
"->",
"u",
"[",
"7",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"7",
"]",
"=",
"tms",
"->",
"x",
"[",
"6",
"]",
"+",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"6",
"]",
",",
"tms",
"->",
"u",
"[",
"6",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"6",
"]",
"=",
"tms",
"->",
"x",
"[",
"5",
"]",
"+",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"5",
"]",
",",
"tms",
"->",
"u",
"[",
"5",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"5",
"]",
"=",
"tms",
"->",
"x",
"[",
"4",
"]",
"+",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"4",
"]",
",",
"tms",
"->",
"u",
"[",
"4",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"4",
"]",
"=",
"tms",
"->",
"x",
"[",
"3",
"]",
"+",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"3",
"]",
",",
"tms",
"->",
"u",
"[",
"3",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"3",
"]",
"=",
"tms",
"->",
"x",
"[",
"2",
"]",
"+",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"2",
"]",
",",
"tms",
"->",
"u",
"[",
"2",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"2",
"]",
"=",
"tms",
"->",
"x",
"[",
"1",
"]",
"+",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"1",
"]",
",",
"tms",
"->",
"u",
"[",
"1",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"1",
"]",
"=",
"tms",
"->",
"x",
"[",
"0",
"]",
"+",
"matrix_multiply",
"(",
"tms",
"->",
"current_k",
"[",
"0",
"]",
",",
"tms",
"->",
"u",
"[",
"0",
"]",
")",
";",
"tms",
"->",
"x",
"[",
"0",
"]",
"=",
"tms",
"->",
"u",
"[",
"0",
"]",
";",
"tms",
"->",
"previous_energy",
"=",
"tms",
"->",
"current_energy",
";",
"#ifdef",
"DEBUG_LATTICE",
"int",
"i",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
",",
"tms",
"->",
"u",
"[",
"10",
"]",
")",
";",
"for",
"(",
"i",
"=",
"9",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
",",
"i",
"+",
"1",
",",
"tms",
"->",
"u",
"[",
"i",
"]",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
",",
"i",
"+",
"1",
",",
"tms",
"->",
"x",
"[",
"i",
"]",
")",
";",
"if",
"(",
"(",
"i",
"%",
"5",
")",
"==",
"0",
")",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"#endif",
"return",
"tms",
"->",
"u",
"[",
"0",
"]",
";",
"}"
] | lattice_filter -- executes one 'full run' of the lattice filter on a specific byte of
excitation data, and specific values of all the current k constants, and returns the
resulting sample. | [
"lattice_filter",
"--",
"executes",
"one",
"'",
"full",
"run",
"'",
"of",
"the",
"lattice",
"filter",
"on",
"a",
"specific",
"byte",
"of",
"excitation",
"data",
"and",
"specific",
"values",
"of",
"all",
"the",
"current",
"k",
"constants",
"and",
"returns",
"the",
"resulting",
"sample",
"."
] | [
"/* Lattice filter here */",
"/* Aug/05/07: redone as unrolled loop, for clarity - LN*/",
"/* Originally Copied verbatim from table I in US patent 4,209,804, now updated to be in same order as the actual chip does it, not that it matters.\r\n notation equivalencies from table:\r\n Yn(i) == tms->u[n-1]\r\n Kn = tms->current_k[n-1]\r\n bn = tms->x[n-1]\r\n */",
"//Y(11)\r"
] | [
{
"param": "tms",
"type": "tms5220_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | process_command | void | static void process_command(tms5220_state *tms, unsigned char cmd)
{
#ifdef DEBUG_COMMAND_DUMP
fprintf(stderr,"process_command called with parameter %02X\n",cmd);
#endif
/* parse the command */
switch (cmd & 0x70)
{
case 0x10 : /* read byte */
if (tms->talk_status == 0) /* TALKST must be clear for RDBY */
{
if (tms->schedule_dummy_read)
{
tms->schedule_dummy_read = FALSE;
if (tms->intf->read)
(*tms->intf->read)(tms->device, 1);
}
if (tms->intf->read)
tms->data_register = (*tms->intf->read)(tms->device, 8); /* read one byte from speech ROM... */
tms->RDB_flag = TRUE;
}
break;
case 0x00: case 0x20: /* set rate (tms5220c only), otherwise NOP */
if (tms->variant == SUBTYPE_TMS5220C)
{
tms->tms5220c_rate = cmd&0x0F;
}
break;
case 0x30 : /* read and branch */
if (tms->talk_status == 0) /* TALKST must be clear for RB */
{
#ifdef VERBOSE
logerror("read and branch command received\n");
#endif
tms->RDB_flag = FALSE;
if (tms->intf->read_and_branch)
(*tms->intf->read_and_branch)(tms->device);
}
break;
case 0x40 : /* load address */
if (tms->talk_status == 0) /* TALKST must be clear for LA */
{
/* tms5220 data sheet says that if we load only one 4-bit nibble, it won't work.
This code does not care about this. */
if (tms->intf->load_address)
(*tms->intf->load_address)(tms->device, cmd & 0x0f);
tms->schedule_dummy_read = TRUE;
}
break;
case 0x50 : /* speak */
if (tms->schedule_dummy_read)
{
tms->schedule_dummy_read = FALSE;
if (tms->intf->read)
(*tms->intf->read)(tms->device, 1);
}
tms->speaking_now = 1;
tms->speak_external = 0;
tms->talk_status = 1; /* start immediately */
/* clear out variables before speaking */
// TODO: similar to the victory case described above, but for VSM speech
tms->subcycle = tms->subc_reload;
tms->PC = 0;
tms->interp_period = reload_table[tms->tms5220c_rate&0x3];
tms->new_frame_energy_idx = 0;
tms->new_frame_pitch_idx = 0;
int i;
for (i = 0; i < 4; i++)
tms->new_frame_k_idx[i] = 0;
for (i = 4; i < 7; i++)
tms->new_frame_k_idx[i] = 0xF;
for (i = 7; i < tms->coeff->num_k; i++)
tms->new_frame_k_idx[i] = 0x7;
break;
case 0x60 : /* speak external */
if (tms->talk_status == 0) /* TALKST must be clear for SPKEXT */
{
//SPKEXT going active activates SPKEE which clears the fifo
tms->fifo_head = tms->fifo_tail = tms->fifo_count = tms->fifo_bits_taken = 0;
tms->speak_external = 1;
tms->RDB_flag = FALSE;
}
break;
case 0x70 : /* reset */
if (tms->schedule_dummy_read)
{
tms->schedule_dummy_read = FALSE;
if (tms->intf->read)
(*tms->intf->read)(tms->device, 1);
}
tms->device->reset();
break;
}
/* update the buffer low state */
update_status_and_ints(tms);
} | /**********************************************************************************************
process_command -- extract a byte from the FIFO and interpret it as a command
***********************************************************************************************/ | - extract a byte from the FIFO and interpret it as a command | [
"-",
"extract",
"a",
"byte",
"from",
"the",
"FIFO",
"and",
"interpret",
"it",
"as",
"a",
"command"
] | static void process_command(tms5220_state *tms, unsigned char cmd)
{
#ifdef DEBUG_COMMAND_DUMP
fprintf(stderr,"process_command called with parameter %02X\n",cmd);
#endif
switch (cmd & 0x70)
{
case 0x10 :
if (tms->talk_status == 0)
{
if (tms->schedule_dummy_read)
{
tms->schedule_dummy_read = FALSE;
if (tms->intf->read)
(*tms->intf->read)(tms->device, 1);
}
if (tms->intf->read)
tms->data_register = (*tms->intf->read)(tms->device, 8);
tms->RDB_flag = TRUE;
}
break;
case 0x00: case 0x20:
if (tms->variant == SUBTYPE_TMS5220C)
{
tms->tms5220c_rate = cmd&0x0F;
}
break;
case 0x30 :
if (tms->talk_status == 0)
{
#ifdef VERBOSE
logerror("read and branch command received\n");
#endif
tms->RDB_flag = FALSE;
if (tms->intf->read_and_branch)
(*tms->intf->read_and_branch)(tms->device);
}
break;
case 0x40 :
if (tms->talk_status == 0)
{
if (tms->intf->load_address)
(*tms->intf->load_address)(tms->device, cmd & 0x0f);
tms->schedule_dummy_read = TRUE;
}
break;
case 0x50 :
if (tms->schedule_dummy_read)
{
tms->schedule_dummy_read = FALSE;
if (tms->intf->read)
(*tms->intf->read)(tms->device, 1);
}
tms->speaking_now = 1;
tms->speak_external = 0;
tms->talk_status = 1;
tms->subcycle = tms->subc_reload;
tms->PC = 0;
tms->interp_period = reload_table[tms->tms5220c_rate&0x3];
tms->new_frame_energy_idx = 0;
tms->new_frame_pitch_idx = 0;
int i;
for (i = 0; i < 4; i++)
tms->new_frame_k_idx[i] = 0;
for (i = 4; i < 7; i++)
tms->new_frame_k_idx[i] = 0xF;
for (i = 7; i < tms->coeff->num_k; i++)
tms->new_frame_k_idx[i] = 0x7;
break;
case 0x60 :
if (tms->talk_status == 0)
{
tms->fifo_head = tms->fifo_tail = tms->fifo_count = tms->fifo_bits_taken = 0;
tms->speak_external = 1;
tms->RDB_flag = FALSE;
}
break;
case 0x70 :
if (tms->schedule_dummy_read)
{
tms->schedule_dummy_read = FALSE;
if (tms->intf->read)
(*tms->intf->read)(tms->device, 1);
}
tms->device->reset();
break;
}
update_status_and_ints(tms);
} | [
"static",
"void",
"process_command",
"(",
"tms5220_state",
"*",
"tms",
",",
"unsigned",
"char",
"cmd",
")",
"{",
"#ifdef",
"DEBUG_COMMAND_DUMP",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
",",
"cmd",
")",
";",
"#endif",
"switch",
"(",
"cmd",
"&",
"0x70",
")",
"{",
"case",
"0x10",
":",
"if",
"(",
"tms",
"->",
"talk_status",
"==",
"0",
")",
"{",
"if",
"(",
"tms",
"->",
"schedule_dummy_read",
")",
"{",
"tms",
"->",
"schedule_dummy_read",
"=",
"FALSE",
";",
"if",
"(",
"tms",
"->",
"intf",
"->",
"read",
")",
"(",
"*",
"tms",
"->",
"intf",
"->",
"read",
")",
"(",
"tms",
"->",
"device",
",",
"1",
")",
";",
"}",
"if",
"(",
"tms",
"->",
"intf",
"->",
"read",
")",
"tms",
"->",
"data_register",
"=",
"(",
"*",
"tms",
"->",
"intf",
"->",
"read",
")",
"(",
"tms",
"->",
"device",
",",
"8",
")",
";",
"tms",
"->",
"RDB_flag",
"=",
"TRUE",
";",
"}",
"break",
";",
"case",
"0x00",
":",
"case",
"0x20",
":",
"if",
"(",
"tms",
"->",
"variant",
"==",
"SUBTYPE_TMS5220C",
")",
"{",
"tms",
"->",
"tms5220c_rate",
"=",
"cmd",
"&",
"0x0F",
";",
"}",
"break",
";",
"case",
"0x30",
":",
"if",
"(",
"tms",
"->",
"talk_status",
"==",
"0",
")",
"{",
"#ifdef",
"VERBOSE",
"logerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"#endif",
"tms",
"->",
"RDB_flag",
"=",
"FALSE",
";",
"if",
"(",
"tms",
"->",
"intf",
"->",
"read_and_branch",
")",
"(",
"*",
"tms",
"->",
"intf",
"->",
"read_and_branch",
")",
"(",
"tms",
"->",
"device",
")",
";",
"}",
"break",
";",
"case",
"0x40",
":",
"if",
"(",
"tms",
"->",
"talk_status",
"==",
"0",
")",
"{",
"if",
"(",
"tms",
"->",
"intf",
"->",
"load_address",
")",
"(",
"*",
"tms",
"->",
"intf",
"->",
"load_address",
")",
"(",
"tms",
"->",
"device",
",",
"cmd",
"&",
"0x0f",
")",
";",
"tms",
"->",
"schedule_dummy_read",
"=",
"TRUE",
";",
"}",
"break",
";",
"case",
"0x50",
":",
"if",
"(",
"tms",
"->",
"schedule_dummy_read",
")",
"{",
"tms",
"->",
"schedule_dummy_read",
"=",
"FALSE",
";",
"if",
"(",
"tms",
"->",
"intf",
"->",
"read",
")",
"(",
"*",
"tms",
"->",
"intf",
"->",
"read",
")",
"(",
"tms",
"->",
"device",
",",
"1",
")",
";",
"}",
"tms",
"->",
"speaking_now",
"=",
"1",
";",
"tms",
"->",
"speak_external",
"=",
"0",
";",
"tms",
"->",
"talk_status",
"=",
"1",
";",
"tms",
"->",
"subcycle",
"=",
"tms",
"->",
"subc_reload",
";",
"tms",
"->",
"PC",
"=",
"0",
";",
"tms",
"->",
"interp_period",
"=",
"reload_table",
"[",
"tms",
"->",
"tms5220c_rate",
"&",
"0x3",
"]",
";",
"tms",
"->",
"new_frame_energy_idx",
"=",
"0",
";",
"tms",
"->",
"new_frame_pitch_idx",
"=",
"0",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"4",
";",
"i",
"<",
"7",
";",
"i",
"++",
")",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
"=",
"0xF",
";",
"for",
"(",
"i",
"=",
"7",
";",
"i",
"<",
"tms",
"->",
"coeff",
"->",
"num_k",
";",
"i",
"++",
")",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
"=",
"0x7",
";",
"break",
";",
"case",
"0x60",
":",
"if",
"(",
"tms",
"->",
"talk_status",
"==",
"0",
")",
"{",
"tms",
"->",
"fifo_head",
"=",
"tms",
"->",
"fifo_tail",
"=",
"tms",
"->",
"fifo_count",
"=",
"tms",
"->",
"fifo_bits_taken",
"=",
"0",
";",
"tms",
"->",
"speak_external",
"=",
"1",
";",
"tms",
"->",
"RDB_flag",
"=",
"FALSE",
";",
"}",
"break",
";",
"case",
"0x70",
":",
"if",
"(",
"tms",
"->",
"schedule_dummy_read",
")",
"{",
"tms",
"->",
"schedule_dummy_read",
"=",
"FALSE",
";",
"if",
"(",
"tms",
"->",
"intf",
"->",
"read",
")",
"(",
"*",
"tms",
"->",
"intf",
"->",
"read",
")",
"(",
"tms",
"->",
"device",
",",
"1",
")",
";",
"}",
"tms",
"->",
"device",
"->",
"reset",
"(",
")",
";",
"break",
";",
"}",
"update_status_and_ints",
"(",
"tms",
")",
";",
"}"
] | process_command -- extract a byte from the FIFO and interpret it as a command | [
"process_command",
"--",
"extract",
"a",
"byte",
"from",
"the",
"FIFO",
"and",
"interpret",
"it",
"as",
"a",
"command"
] | [
"/* parse the command */",
"/* read byte */",
"/* TALKST must be clear for RDBY */",
"/* read one byte from speech ROM... */",
"/* set rate (tms5220c only), otherwise NOP */",
"/* read and branch */",
"/* TALKST must be clear for RB */",
"/* load address */",
"/* TALKST must be clear for LA */",
"/* tms5220 data sheet says that if we load only one 4-bit nibble, it won't work.\r\n This code does not care about this. */",
"/* speak */",
"/* start immediately */",
"/* clear out variables before speaking */",
"// TODO: similar to the victory case described above, but for VSM speech\r",
"/* speak external */",
"/* TALKST must be clear for SPKEXT */",
"//SPKEXT going active activates SPKEE which clears the fifo\r",
"/* reset */",
"/* update the buffer low state */"
] | [
{
"param": "tms",
"type": "tms5220_state"
},
{
"param": "cmd",
"type": "unsigned char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cmd",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | parse_frame | void | static void parse_frame(tms5220_state *tms)
{
int indx, i, rep_flag;
// We actually don't care how many bits are left in the fifo here; the frame subpart will be processed normally, and any bits extracted 'past the end' of the fifo will be read as zeroes; the fifo being emptied will set the /BE latch which will halt speech exactly as if a stop frame had been encountered (instead of whatever partial frame was read); the same exact circuitry is used for both on the real chip, see us patent 4335277 sheet 16, gates 232a (decode stop frame) and 232b (decode /BE plus DDIS (decode disable) which is active during speak external).
/* if the chip is a tms5220C, and the rate mode is set to that each frame (0x04 bit set)
has a 2 bit rate preceeding it, grab two bits here and store them as the rate; */
if ((tms->variant == SUBTYPE_TMS5220C) && (tms->tms5220c_rate & 0x04))
{
indx = extract_bits(tms, 2);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(indx,2);
fprintf(stderr," ");
#endif
tms->interp_period = reload_table[indx];
}
else // non-5220C and 5220C in fixed rate mode
tms->interp_period = reload_table[tms->tms5220c_rate&0x3];
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
/* attempt to extract the energy index */
tms->new_frame_energy_idx = extract_bits(tms,tms->coeff->energy_bits);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(tms->new_frame_energy_idx,tms->coeff->energy_bits);
fprintf(stderr," ");
#endif
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
/* if the energy index is 0 or 15, we're done */
if ((tms->new_frame_energy_idx == 0) || (tms->new_frame_energy_idx == 15))
return;
/* attempt to extract the repeat flag */
rep_flag = extract_bits(tms,1);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(rep_flag, 1);
fprintf(stderr," ");
#endif
/* attempt to extract the pitch */
tms->new_frame_pitch_idx = extract_bits(tms,tms->coeff->pitch_bits);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(tms->new_frame_pitch_idx,tms->coeff->pitch_bits);
fprintf(stderr," ");
#endif
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
/* if this is a repeat frame, just do nothing, it will reuse the old coefficients's */
if (rep_flag)
return;
/* extract first 4 K coefficients */
for (i = 0; i < 4; i++)
{
tms->new_frame_k_idx[i] = extract_bits(tms,tms->coeff->kbits[i]);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(tms->new_frame_k_idx[i],tms->coeff->kbits[i]);
fprintf(stderr," ");
#endif
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
}
/* if the pitch index was zero, we only need 4 K's... */
if (tms->new_frame_pitch_idx == 0)
{
/* and the rest of the coefficients are zeroed, but that's done in the generator code */
return;
}
/* If we got here, we need the remaining 6 K's */
for (i = 4; i < tms->coeff->num_k; i++)
{
tms->new_frame_k_idx[i] = extract_bits(tms, tms->coeff->kbits[i]);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(tms->new_frame_k_idx[i],tms->coeff->kbits[i]);
fprintf(stderr," ");
#endif
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
}
#ifdef VERBOSE
if (tms->speak_external)
logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", (tms->fifo_count*8)-(tms->fifo_bits_taken));
else
logerror("Parsed a frame successfully in ROM\n");
#endif
return;
ranout:
#ifdef DEBUG_FRAME_ERRORS
logerror("Ran out of bits on a parse!\n");
#endif
return;
} | /******************************************************************************************
parse_frame -- parse a new frame's worth of data; returns 0 if not enough bits in buffer
******************************************************************************************/ | - parse a new frame's worth of data; returns 0 if not enough bits in buffer | [
"-",
"parse",
"a",
"new",
"frame",
"'",
"s",
"worth",
"of",
"data",
";",
"returns",
"0",
"if",
"not",
"enough",
"bits",
"in",
"buffer"
] | static void parse_frame(tms5220_state *tms)
{
int indx, i, rep_flag;
if ((tms->variant == SUBTYPE_TMS5220C) && (tms->tms5220c_rate & 0x04))
{
indx = extract_bits(tms, 2);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(indx,2);
fprintf(stderr," ");
#endif
tms->interp_period = reload_table[indx];
}
else
tms->interp_period = reload_table[tms->tms5220c_rate&0x3];
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
tms->new_frame_energy_idx = extract_bits(tms,tms->coeff->energy_bits);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(tms->new_frame_energy_idx,tms->coeff->energy_bits);
fprintf(stderr," ");
#endif
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
if ((tms->new_frame_energy_idx == 0) || (tms->new_frame_energy_idx == 15))
return;
rep_flag = extract_bits(tms,1);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(rep_flag, 1);
fprintf(stderr," ");
#endif
tms->new_frame_pitch_idx = extract_bits(tms,tms->coeff->pitch_bits);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(tms->new_frame_pitch_idx,tms->coeff->pitch_bits);
fprintf(stderr," ");
#endif
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
if (rep_flag)
return;
for (i = 0; i < 4; i++)
{
tms->new_frame_k_idx[i] = extract_bits(tms,tms->coeff->kbits[i]);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(tms->new_frame_k_idx[i],tms->coeff->kbits[i]);
fprintf(stderr," ");
#endif
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
}
if (tms->new_frame_pitch_idx == 0)
{
return;
}
for (i = 4; i < tms->coeff->num_k; i++)
{
tms->new_frame_k_idx[i] = extract_bits(tms, tms->coeff->kbits[i]);
#ifdef DEBUG_PARSE_FRAME_DUMP
printbits(tms->new_frame_k_idx[i],tms->coeff->kbits[i]);
fprintf(stderr," ");
#endif
update_status_and_ints(tms);
if (!tms->talk_status) goto ranout;
}
#ifdef VERBOSE
if (tms->speak_external)
logerror("Parsed a frame successfully in FIFO - %d bits remaining\n", (tms->fifo_count*8)-(tms->fifo_bits_taken));
else
logerror("Parsed a frame successfully in ROM\n");
#endif
return;
ranout:
#ifdef DEBUG_FRAME_ERRORS
logerror("Ran out of bits on a parse!\n");
#endif
return;
} | [
"static",
"void",
"parse_frame",
"(",
"tms5220_state",
"*",
"tms",
")",
"{",
"int",
"indx",
",",
"i",
",",
"rep_flag",
";",
"if",
"(",
"(",
"tms",
"->",
"variant",
"==",
"SUBTYPE_TMS5220C",
")",
"&&",
"(",
"tms",
"->",
"tms5220c_rate",
"&",
"0x04",
")",
")",
"{",
"indx",
"=",
"extract_bits",
"(",
"tms",
",",
"2",
")",
";",
"#ifdef",
"DEBUG_PARSE_FRAME_DUMP",
"printbits",
"(",
"indx",
",",
"2",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
")",
";",
"#endif",
"tms",
"->",
"interp_period",
"=",
"reload_table",
"[",
"indx",
"]",
";",
"}",
"else",
"tms",
"->",
"interp_period",
"=",
"reload_table",
"[",
"tms",
"->",
"tms5220c_rate",
"&",
"0x3",
"]",
";",
"update_status_and_ints",
"(",
"tms",
")",
";",
"if",
"(",
"!",
"tms",
"->",
"talk_status",
")",
"goto",
"ranout",
";",
"tms",
"->",
"new_frame_energy_idx",
"=",
"extract_bits",
"(",
"tms",
",",
"tms",
"->",
"coeff",
"->",
"energy_bits",
")",
";",
"#ifdef",
"DEBUG_PARSE_FRAME_DUMP",
"printbits",
"(",
"tms",
"->",
"new_frame_energy_idx",
",",
"tms",
"->",
"coeff",
"->",
"energy_bits",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
")",
";",
"#endif",
"update_status_and_ints",
"(",
"tms",
")",
";",
"if",
"(",
"!",
"tms",
"->",
"talk_status",
")",
"goto",
"ranout",
";",
"if",
"(",
"(",
"tms",
"->",
"new_frame_energy_idx",
"==",
"0",
")",
"||",
"(",
"tms",
"->",
"new_frame_energy_idx",
"==",
"15",
")",
")",
"return",
";",
"rep_flag",
"=",
"extract_bits",
"(",
"tms",
",",
"1",
")",
";",
"#ifdef",
"DEBUG_PARSE_FRAME_DUMP",
"printbits",
"(",
"rep_flag",
",",
"1",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
")",
";",
"#endif",
"tms",
"->",
"new_frame_pitch_idx",
"=",
"extract_bits",
"(",
"tms",
",",
"tms",
"->",
"coeff",
"->",
"pitch_bits",
")",
";",
"#ifdef",
"DEBUG_PARSE_FRAME_DUMP",
"printbits",
"(",
"tms",
"->",
"new_frame_pitch_idx",
",",
"tms",
"->",
"coeff",
"->",
"pitch_bits",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
")",
";",
"#endif",
"update_status_and_ints",
"(",
"tms",
")",
";",
"if",
"(",
"!",
"tms",
"->",
"talk_status",
")",
"goto",
"ranout",
";",
"if",
"(",
"rep_flag",
")",
"return",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
"=",
"extract_bits",
"(",
"tms",
",",
"tms",
"->",
"coeff",
"->",
"kbits",
"[",
"i",
"]",
")",
";",
"#ifdef",
"DEBUG_PARSE_FRAME_DUMP",
"printbits",
"(",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
",",
"tms",
"->",
"coeff",
"->",
"kbits",
"[",
"i",
"]",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
")",
";",
"#endif",
"update_status_and_ints",
"(",
"tms",
")",
";",
"if",
"(",
"!",
"tms",
"->",
"talk_status",
")",
"goto",
"ranout",
";",
"}",
"if",
"(",
"tms",
"->",
"new_frame_pitch_idx",
"==",
"0",
")",
"{",
"return",
";",
"}",
"for",
"(",
"i",
"=",
"4",
";",
"i",
"<",
"tms",
"->",
"coeff",
"->",
"num_k",
";",
"i",
"++",
")",
"{",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
"=",
"extract_bits",
"(",
"tms",
",",
"tms",
"->",
"coeff",
"->",
"kbits",
"[",
"i",
"]",
")",
";",
"#ifdef",
"DEBUG_PARSE_FRAME_DUMP",
"printbits",
"(",
"tms",
"->",
"new_frame_k_idx",
"[",
"i",
"]",
",",
"tms",
"->",
"coeff",
"->",
"kbits",
"[",
"i",
"]",
")",
";",
"fprintf",
"(",
"stderr",
",",
"\"",
"\"",
")",
";",
"#endif",
"update_status_and_ints",
"(",
"tms",
")",
";",
"if",
"(",
"!",
"tms",
"->",
"talk_status",
")",
"goto",
"ranout",
";",
"}",
"#ifdef",
"VERBOSE",
"if",
"(",
"tms",
"->",
"speak_external",
")",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"(",
"tms",
"->",
"fifo_count",
"*",
"8",
")",
"-",
"(",
"tms",
"->",
"fifo_bits_taken",
")",
")",
";",
"else",
"logerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"#endif",
"return",
";",
"ranout",
":",
"",
"#ifdef",
"DEBUG_FRAME_ERRORS",
"logerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"#endif",
"return",
";",
"}"
] | parse_frame -- parse a new frame's worth of data; returns 0 if not enough bits in buffer | [
"parse_frame",
"--",
"parse",
"a",
"new",
"frame",
"'",
"s",
"worth",
"of",
"data",
";",
"returns",
"0",
"if",
"not",
"enough",
"bits",
"in",
"buffer"
] | [
"// We actually don't care how many bits are left in the fifo here; the frame subpart will be processed normally, and any bits extracted 'past the end' of the fifo will be read as zeroes; the fifo being emptied will set the /BE latch which will halt speech exactly as if a stop frame had been encountered (instead of whatever partial frame was read); the same exact circuitry is used for both on the real chip, see us patent 4335277 sheet 16, gates 232a (decode stop frame) and 232b (decode /BE plus DDIS (decode disable) which is active during speak external).\r",
"/* if the chip is a tms5220C, and the rate mode is set to that each frame (0x04 bit set)\r\n has a 2 bit rate preceeding it, grab two bits here and store them as the rate; */",
"// non-5220C and 5220C in fixed rate mode\r",
"/* attempt to extract the energy index */",
"/* if the energy index is 0 or 15, we're done */",
"/* attempt to extract the repeat flag */",
"/* attempt to extract the pitch */",
"/* if this is a repeat frame, just do nothing, it will reuse the old coefficients's */",
"/* extract first 4 K coefficients */",
"/* if the pitch index was zero, we only need 4 K's... */",
"/* and the rest of the coefficients are zeroed, but that's done in the generator code */",
"/* If we got here, we need the remaining 6 K's */"
] | [
{
"param": "tms",
"type": "tms5220_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tms",
"type": "tms5220_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
74569c28fdc07b864c8f9563a347051b415a255a | lofunz/mieme | Reloaded/trunk/src/emu/sound/tms5220.c | [
"Unlicense"
] | C | tms5220_time_to_ready | double | double tms5220_time_to_ready(running_device *device)
{
tms5220_state *tms = get_safe_token(device);
double cycles;
/* bring up to date first */
stream_update(tms->stream);
cycles = tms5220_cycles_to_ready(tms);
return cycles * 80.0 / tms->clock;
} | /**********************************************************************************************
tms5220_time_to_ready -- return the time in seconds until the ready line is asserted
***********************************************************************************************/ | - return the time in seconds until the ready line is asserted | [
"-",
"return",
"the",
"time",
"in",
"seconds",
"until",
"the",
"ready",
"line",
"is",
"asserted"
] | double tms5220_time_to_ready(running_device *device)
{
tms5220_state *tms = get_safe_token(device);
double cycles;
stream_update(tms->stream);
cycles = tms5220_cycles_to_ready(tms);
return cycles * 80.0 / tms->clock;
} | [
"double",
"tms5220_time_to_ready",
"(",
"running_device",
"*",
"device",
")",
"{",
"tms5220_state",
"*",
"tms",
"=",
"get_safe_token",
"(",
"device",
")",
";",
"double",
"cycles",
";",
"stream_update",
"(",
"tms",
"->",
"stream",
")",
";",
"cycles",
"=",
"tms5220_cycles_to_ready",
"(",
"tms",
")",
";",
"return",
"cycles",
"*",
"80.0",
"/",
"tms",
"->",
"clock",
";",
"}"
] | tms5220_time_to_ready -- return the time in seconds until the ready line is asserted | [
"tms5220_time_to_ready",
"--",
"return",
"the",
"time",
"in",
"seconds",
"until",
"the",
"ready",
"line",
"is",
"asserted"
] | [
"/* bring up to date first */"
] | [
{
"param": "device",
"type": "running_device"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "running_device",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18b1ccba0139c14f3c94ca9e47ec3891eaf1289a | lofunz/mieme | Reloaded/trunk/src/emu/sound.c | [
"Unlicense"
] | C | sound_load | void | static void sound_load(running_machine *machine, int config_type, xml_data_node *parentnode)
{
xml_data_node *channelnode;
int mixernum;
/* we only care about game files */
if (config_type != CONFIG_TYPE_GAME)
return;
/* might not have any data */
if (parentnode == NULL)
return;
/* iterate over channel nodes */
for (channelnode = xml_get_sibling(parentnode->child, "channel"); channelnode; channelnode = xml_get_sibling(channelnode->next, "channel"))
{
mixernum = xml_get_attribute_int(channelnode, "index", -1);
if (mixernum >= 0 && mixernum < MAX_MIXER_CHANNELS)
{
float defvol = xml_get_attribute_float(channelnode, "defvol", -1000.0);
float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0);
if (fabs(defvol - sound_get_default_gain(machine, mixernum)) < 1e-6 && newvol != -1000.0)
sound_set_user_gain(machine, mixernum, newvol);
}
}
} | /*-------------------------------------------------
sound_load - read and apply data from the
configuration file
-------------------------------------------------*/ | read and apply data from the
configuration file | [
"read",
"and",
"apply",
"data",
"from",
"the",
"configuration",
"file"
] | static void sound_load(running_machine *machine, int config_type, xml_data_node *parentnode)
{
xml_data_node *channelnode;
int mixernum;
if (config_type != CONFIG_TYPE_GAME)
return;
if (parentnode == NULL)
return;
for (channelnode = xml_get_sibling(parentnode->child, "channel"); channelnode; channelnode = xml_get_sibling(channelnode->next, "channel"))
{
mixernum = xml_get_attribute_int(channelnode, "index", -1);
if (mixernum >= 0 && mixernum < MAX_MIXER_CHANNELS)
{
float defvol = xml_get_attribute_float(channelnode, "defvol", -1000.0);
float newvol = xml_get_attribute_float(channelnode, "newvol", -1000.0);
if (fabs(defvol - sound_get_default_gain(machine, mixernum)) < 1e-6 && newvol != -1000.0)
sound_set_user_gain(machine, mixernum, newvol);
}
}
} | [
"static",
"void",
"sound_load",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"config_type",
",",
"xml_data_node",
"*",
"parentnode",
")",
"{",
"xml_data_node",
"*",
"channelnode",
";",
"int",
"mixernum",
";",
"if",
"(",
"config_type",
"!=",
"CONFIG_TYPE_GAME",
")",
"return",
";",
"if",
"(",
"parentnode",
"==",
"NULL",
")",
"return",
";",
"for",
"(",
"channelnode",
"=",
"xml_get_sibling",
"(",
"parentnode",
"->",
"child",
",",
"\"",
"\"",
")",
";",
"channelnode",
";",
"channelnode",
"=",
"xml_get_sibling",
"(",
"channelnode",
"->",
"next",
",",
"\"",
"\"",
")",
")",
"{",
"mixernum",
"=",
"xml_get_attribute_int",
"(",
"channelnode",
",",
"\"",
"\"",
",",
"-1",
")",
";",
"if",
"(",
"mixernum",
">=",
"0",
"&&",
"mixernum",
"<",
"MAX_MIXER_CHANNELS",
")",
"{",
"float",
"defvol",
"=",
"xml_get_attribute_float",
"(",
"channelnode",
",",
"\"",
"\"",
",",
"-1000.0",
")",
";",
"float",
"newvol",
"=",
"xml_get_attribute_float",
"(",
"channelnode",
",",
"\"",
"\"",
",",
"-1000.0",
")",
";",
"if",
"(",
"fabs",
"(",
"defvol",
"-",
"sound_get_default_gain",
"(",
"machine",
",",
"mixernum",
")",
")",
"<",
"1e-6",
"&&",
"newvol",
"!=",
"-1000.0",
")",
"sound_set_user_gain",
"(",
"machine",
",",
"mixernum",
",",
"newvol",
")",
";",
"}",
"}",
"}"
] | sound_load - read and apply data from the
configuration file | [
"sound_load",
"-",
"read",
"and",
"apply",
"data",
"from",
"the",
"configuration",
"file"
] | [
"/* we only care about game files */",
"/* might not have any data */",
"/* iterate over channel nodes */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "config_type",
"type": "int"
},
{
"param": "parentnode",
"type": "xml_data_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config_type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parentnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18b1ccba0139c14f3c94ca9e47ec3891eaf1289a | lofunz/mieme | Reloaded/trunk/src/emu/sound.c | [
"Unlicense"
] | C | sound_save | void | static void sound_save(running_machine *machine, int config_type, xml_data_node *parentnode)
{
int mixernum;
/* we only care about game files */
if (config_type != CONFIG_TYPE_GAME)
return;
/* iterate over mixer channels */
if (parentnode != NULL)
for (mixernum = 0; mixernum < MAX_MIXER_CHANNELS; mixernum++)
{
float defvol = sound_get_default_gain(machine, mixernum);
float newvol = sound_get_user_gain(machine, mixernum);
if (defvol != newvol)
{
xml_data_node *channelnode = xml_add_child(parentnode, "channel", NULL);
if (channelnode != NULL)
{
xml_set_attribute_int(channelnode, "index", mixernum);
xml_set_attribute_float(channelnode, "defvol", defvol);
xml_set_attribute_float(channelnode, "newvol", newvol);
}
}
}
} | /*-------------------------------------------------
sound_save - save data to the configuration
file
-------------------------------------------------*/ | save data to the configuration
file | [
"save",
"data",
"to",
"the",
"configuration",
"file"
] | static void sound_save(running_machine *machine, int config_type, xml_data_node *parentnode)
{
int mixernum;
if (config_type != CONFIG_TYPE_GAME)
return;
if (parentnode != NULL)
for (mixernum = 0; mixernum < MAX_MIXER_CHANNELS; mixernum++)
{
float defvol = sound_get_default_gain(machine, mixernum);
float newvol = sound_get_user_gain(machine, mixernum);
if (defvol != newvol)
{
xml_data_node *channelnode = xml_add_child(parentnode, "channel", NULL);
if (channelnode != NULL)
{
xml_set_attribute_int(channelnode, "index", mixernum);
xml_set_attribute_float(channelnode, "defvol", defvol);
xml_set_attribute_float(channelnode, "newvol", newvol);
}
}
}
} | [
"static",
"void",
"sound_save",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"config_type",
",",
"xml_data_node",
"*",
"parentnode",
")",
"{",
"int",
"mixernum",
";",
"if",
"(",
"config_type",
"!=",
"CONFIG_TYPE_GAME",
")",
"return",
";",
"if",
"(",
"parentnode",
"!=",
"NULL",
")",
"for",
"(",
"mixernum",
"=",
"0",
";",
"mixernum",
"<",
"MAX_MIXER_CHANNELS",
";",
"mixernum",
"++",
")",
"{",
"float",
"defvol",
"=",
"sound_get_default_gain",
"(",
"machine",
",",
"mixernum",
")",
";",
"float",
"newvol",
"=",
"sound_get_user_gain",
"(",
"machine",
",",
"mixernum",
")",
";",
"if",
"(",
"defvol",
"!=",
"newvol",
")",
"{",
"xml_data_node",
"*",
"channelnode",
"=",
"xml_add_child",
"(",
"parentnode",
",",
"\"",
"\"",
",",
"NULL",
")",
";",
"if",
"(",
"channelnode",
"!=",
"NULL",
")",
"{",
"xml_set_attribute_int",
"(",
"channelnode",
",",
"\"",
"\"",
",",
"mixernum",
")",
";",
"xml_set_attribute_float",
"(",
"channelnode",
",",
"\"",
"\"",
",",
"defvol",
")",
";",
"xml_set_attribute_float",
"(",
"channelnode",
",",
"\"",
"\"",
",",
"newvol",
")",
";",
"}",
"}",
"}",
"}"
] | sound_save - save data to the configuration
file | [
"sound_save",
"-",
"save",
"data",
"to",
"the",
"configuration",
"file"
] | [
"/* we only care about game files */",
"/* iterate over mixer channels */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "config_type",
"type": "int"
},
{
"param": "parentnode",
"type": "xml_data_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "config_type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parentnode",
"type": "xml_data_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
18b1ccba0139c14f3c94ca9e47ec3891eaf1289a | lofunz/mieme | Reloaded/trunk/src/emu/sound.c | [
"Unlicense"
] | C | sound_set_output_gain | void | void sound_set_output_gain(device_t *device, int output, float gain)
{
sound_stream *stream;
int outputnum;
if (stream_device_output_to_stream_output(device, output, &stream, &outputnum))
stream_set_output_gain(stream, outputnum, gain);
} | /*-------------------------------------------------
sound_set_output_gain - set the gain of a
particular output
-------------------------------------------------*/ | set the gain of a
particular output | [
"set",
"the",
"gain",
"of",
"a",
"particular",
"output"
] | void sound_set_output_gain(device_t *device, int output, float gain)
{
sound_stream *stream;
int outputnum;
if (stream_device_output_to_stream_output(device, output, &stream, &outputnum))
stream_set_output_gain(stream, outputnum, gain);
} | [
"void",
"sound_set_output_gain",
"(",
"device_t",
"*",
"device",
",",
"int",
"output",
",",
"float",
"gain",
")",
"{",
"sound_stream",
"*",
"stream",
";",
"int",
"outputnum",
";",
"if",
"(",
"stream_device_output_to_stream_output",
"(",
"device",
",",
"output",
",",
"&",
"stream",
",",
"&",
"outputnum",
")",
")",
"stream_set_output_gain",
"(",
"stream",
",",
"outputnum",
",",
"gain",
")",
";",
"}"
] | sound_set_output_gain - set the gain of a
particular output | [
"sound_set_output_gain",
"-",
"set",
"the",
"gain",
"of",
"a",
"particular",
"output"
] | [] | [
{
"param": "device",
"type": "device_t"
},
{
"param": "output",
"type": "int"
},
{
"param": "gain",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "device",
"type": "device_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gain",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.