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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5378c372cfa15ba7043ddbc88c0581624db71190 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/machine/amiga.c | [
"Unlicense"
] | C | blit_line | UINT32 | static UINT32 blit_line(void)
{
UINT32 singlemode = (CUSTOM_REG(REG_BLTCON1) & 0x0002) ? 0x0000 : 0xffff;
UINT32 singlemask = 0xffff;
UINT32 blitsum = 0;
UINT32 height;
/* see if folks are breaking the rules */
if (CUSTOM_REG(REG_BLTSIZH) != 0x0002)
logerror("Blitter: Blit width != 2 in line mode!\n");
if ((CUSTOM_REG(REG_BLTCON0) & 0x0a00) != 0x0a00)
logerror("Blitter: Channel selection incorrect in line mode!\n" );
/* extract the length of the line */
height = CUSTOM_REG(REG_BLTSIZV);
/* iterate over the line height */
while (height--)
{
UINT16 abc0, abc1, abc2, abc3;
UINT32 tempa, tempb, tempd = 0;
int b, dx, dy;
/* fetch data for C */
if (CUSTOM_REG(REG_BLTCON0) & 0x0200)
CUSTOM_REG(REG_BLTCDAT) = amiga_chip_ram_r(CUSTOM_REG_LONG(REG_BLTCPTH));
/* rotate the A data according to the shift */
tempa = CUSTOM_REG(REG_BLTADAT) >> (CUSTOM_REG(REG_BLTCON0) >> 12);
/* apply single bit mask */
tempa &= singlemask;
singlemask &= singlemode;
/* rotate the B data according to the shift and expand to 16 bits */
tempb = -((CUSTOM_REG(REG_BLTBDAT) >> (CUSTOM_REG(REG_BLTCON1) >> 12)) & 1);
/* build up 4 16-bit words containing 4 pixels each in 0ABC bit order */
abc0 = ((tempa >> 1) & 0x4444) | (tempb & 0x2222) | ((CUSTOM_REG(REG_BLTCDAT) >> 3) & 0x1111);
abc1 = ((tempa >> 0) & 0x4444) | (tempb & 0x2222) | ((CUSTOM_REG(REG_BLTCDAT) >> 2) & 0x1111);
abc2 = ((tempa << 1) & 0x4444) | (tempb & 0x2222) | ((CUSTOM_REG(REG_BLTCDAT) >> 1) & 0x1111);
abc3 = ((tempa << 2) & 0x4444) | (tempb & 0x2222) | ((CUSTOM_REG(REG_BLTCDAT) >> 0) & 0x1111);
/* now loop over bits and compute the destination value */
for (b = 0; b < 4; b++)
{
UINT32 bit;
/* shift previous data up 4 bits */
tempd <<= 4;
/* lookup first bit in series */
bit = (CUSTOM_REG(REG_BLTCON0) >> (abc0 >> 12)) & 1;
abc0 <<= 4;
tempd |= bit << 3;
/* lookup second bit in series */
bit = (CUSTOM_REG(REG_BLTCON0) >> (abc1 >> 12)) & 1;
abc1 <<= 4;
tempd |= bit << 2;
/* lookup third bit in series */
bit = (CUSTOM_REG(REG_BLTCON0) >> (abc2 >> 12)) & 1;
abc2 <<= 4;
tempd |= bit << 1;
/* lookup fourth bit in series */
bit = (CUSTOM_REG(REG_BLTCON0) >> (abc3 >> 12)) & 1;
abc3 <<= 4;
tempd |= bit << 0;
}
/* accumulate the sum */
blitsum |= tempd;
/* write to the destination */
amiga_chip_ram_w(CUSTOM_REG_LONG(REG_BLTDPTH), tempd);
/* always increment along the major axis */
if (CUSTOM_REG(REG_BLTCON1) & 0x0010)
{
dx = (CUSTOM_REG(REG_BLTCON1) & 0x0004) ? -1 : 1;
dy = 0;
}
else
{
dx = 0;
dy = (CUSTOM_REG(REG_BLTCON1) & 0x0004) ? -1 : 1;
}
/* is the sign bit clear? */
if (!(CUSTOM_REG(REG_BLTCON1) & 0x0040))
{
/* add 4 * (dy-dx) */
CUSTOM_REG_LONG(REG_BLTAPTH) += CUSTOM_REG_SIGNED(REG_BLTAMOD) & ~1;
/* increment along the minor axis */
if (CUSTOM_REG(REG_BLTCON1) & 0x0010)
dy = (CUSTOM_REG(REG_BLTCON1) & 0x0008) ? -1 : 1;
else
dx = (CUSTOM_REG(REG_BLTCON1) & 0x0008) ? -1 : 1;
}
/* else add 4 * dy and don't increment along the minor axis */
else
CUSTOM_REG_LONG(REG_BLTAPTH) += CUSTOM_REG_SIGNED(REG_BLTBMOD) & ~1;
/* adjust X if necessary */
if (dx)
{
/* adjust the A shift value */
UINT32 temp = CUSTOM_REG(REG_BLTCON0) + (INT32)(dx << 12);
CUSTOM_REG(REG_BLTCON0) = temp;
/* if we went from 0xf to 0x0 or vice-versa, adjust the actual pointers */
if (temp & 0x10000)
{
CUSTOM_REG_LONG(REG_BLTCPTH) += 2 * dx;
CUSTOM_REG_LONG(REG_BLTDPTH) += 2 * dx;
}
}
/* adjust Y if necessary */
if (dy)
{
/* BLTCMOD seems to be used for both C and D pointers */
CUSTOM_REG_LONG(REG_BLTCPTH) += dy * (INT16)(CUSTOM_REG_SIGNED(REG_BLTCMOD) & ~1);
CUSTOM_REG_LONG(REG_BLTDPTH) += dy * (INT16)(CUSTOM_REG_SIGNED(REG_BLTCMOD) & ~1);
/* reset the single mask since we're on a new line */
singlemask = 0xffff;
}
/* set the new sign bit value */
CUSTOM_REG(REG_BLTCON1) = (CUSTOM_REG(REG_BLTCON1) & ~0x0040) | ((CUSTOM_REG(REG_BLTAPTL) >> 9) & 0x0040);
/* increment texture shift on every pixel */
CUSTOM_REG(REG_BLTCON1) += 0x1000;
}
return blitsum;
} | /*
The exact line drawing algorithm is not known, but based on the cryptic
setup instructions, it is clear that it is a basic Bresenham line
algorithm. A standard Bresenham algorithm looks like this:
epsilon = 0;
while (length--)
{
plot(x, y);
x++;
epsilon += dy;
if ((2 * epsilon) >= dx)
{
y++;
epsilon -= dx;
}
}
If you multiply the epsilon term by 4 and shuffle the logic a bit, the
equivalent logic is:
epsilon = 4 * dy - 2 * dx;
while (length--)
{
plot(x, y);
x++;
if (epsilon >= 0)
{
y++;
epsilon += 4 * (dy - dx);
}
else
epsilon += 4 * dy;
}
With this refactoring, you can see that BLTAPT = epsilon,
BLTAMOD = 4 * (dy - dx) and BLTBMOD = 4 * dy.
*/ | The exact line drawing algorithm is not known, but based on the cryptic
setup instructions, it is clear that it is a basic Bresenham line
algorithm. A standard Bresenham algorithm looks like this.
If you multiply the epsilon term by 4 and shuffle the logic a bit, the
equivalent logic is.
With this refactoring, you can see that BLTAPT = epsilon,
BLTAMOD = 4 * (dy - dx) and BLTBMOD = 4 * dy. | [
"The",
"exact",
"line",
"drawing",
"algorithm",
"is",
"not",
"known",
"but",
"based",
"on",
"the",
"cryptic",
"setup",
"instructions",
"it",
"is",
"clear",
"that",
"it",
"is",
"a",
"basic",
"Bresenham",
"line",
"algorithm",
".",
"A",
"standard",
"Bresenham",
"algorithm",
"looks",
"like",
"this",
".",
"If",
"you",
"multiply",
"the",
"epsilon",
"term",
"by",
"4",
"and",
"shuffle",
"the",
"logic",
"a",
"bit",
"the",
"equivalent",
"logic",
"is",
".",
"With",
"this",
"refactoring",
"you",
"can",
"see",
"that",
"BLTAPT",
"=",
"epsilon",
"BLTAMOD",
"=",
"4",
"*",
"(",
"dy",
"-",
"dx",
")",
"and",
"BLTBMOD",
"=",
"4",
"*",
"dy",
"."
] | static UINT32 blit_line(void)
{
UINT32 singlemode = (CUSTOM_REG(REG_BLTCON1) & 0x0002) ? 0x0000 : 0xffff;
UINT32 singlemask = 0xffff;
UINT32 blitsum = 0;
UINT32 height;
if (CUSTOM_REG(REG_BLTSIZH) != 0x0002)
logerror("Blitter: Blit width != 2 in line mode!\n");
if ((CUSTOM_REG(REG_BLTCON0) & 0x0a00) != 0x0a00)
logerror("Blitter: Channel selection incorrect in line mode!\n" );
height = CUSTOM_REG(REG_BLTSIZV);
while (height--)
{
UINT16 abc0, abc1, abc2, abc3;
UINT32 tempa, tempb, tempd = 0;
int b, dx, dy;
if (CUSTOM_REG(REG_BLTCON0) & 0x0200)
CUSTOM_REG(REG_BLTCDAT) = amiga_chip_ram_r(CUSTOM_REG_LONG(REG_BLTCPTH));
tempa = CUSTOM_REG(REG_BLTADAT) >> (CUSTOM_REG(REG_BLTCON0) >> 12);
tempa &= singlemask;
singlemask &= singlemode;
tempb = -((CUSTOM_REG(REG_BLTBDAT) >> (CUSTOM_REG(REG_BLTCON1) >> 12)) & 1);
abc0 = ((tempa >> 1) & 0x4444) | (tempb & 0x2222) | ((CUSTOM_REG(REG_BLTCDAT) >> 3) & 0x1111);
abc1 = ((tempa >> 0) & 0x4444) | (tempb & 0x2222) | ((CUSTOM_REG(REG_BLTCDAT) >> 2) & 0x1111);
abc2 = ((tempa << 1) & 0x4444) | (tempb & 0x2222) | ((CUSTOM_REG(REG_BLTCDAT) >> 1) & 0x1111);
abc3 = ((tempa << 2) & 0x4444) | (tempb & 0x2222) | ((CUSTOM_REG(REG_BLTCDAT) >> 0) & 0x1111);
for (b = 0; b < 4; b++)
{
UINT32 bit;
tempd <<= 4;
bit = (CUSTOM_REG(REG_BLTCON0) >> (abc0 >> 12)) & 1;
abc0 <<= 4;
tempd |= bit << 3;
bit = (CUSTOM_REG(REG_BLTCON0) >> (abc1 >> 12)) & 1;
abc1 <<= 4;
tempd |= bit << 2;
bit = (CUSTOM_REG(REG_BLTCON0) >> (abc2 >> 12)) & 1;
abc2 <<= 4;
tempd |= bit << 1;
bit = (CUSTOM_REG(REG_BLTCON0) >> (abc3 >> 12)) & 1;
abc3 <<= 4;
tempd |= bit << 0;
}
blitsum |= tempd;
amiga_chip_ram_w(CUSTOM_REG_LONG(REG_BLTDPTH), tempd);
if (CUSTOM_REG(REG_BLTCON1) & 0x0010)
{
dx = (CUSTOM_REG(REG_BLTCON1) & 0x0004) ? -1 : 1;
dy = 0;
}
else
{
dx = 0;
dy = (CUSTOM_REG(REG_BLTCON1) & 0x0004) ? -1 : 1;
}
if (!(CUSTOM_REG(REG_BLTCON1) & 0x0040))
{
CUSTOM_REG_LONG(REG_BLTAPTH) += CUSTOM_REG_SIGNED(REG_BLTAMOD) & ~1;
if (CUSTOM_REG(REG_BLTCON1) & 0x0010)
dy = (CUSTOM_REG(REG_BLTCON1) & 0x0008) ? -1 : 1;
else
dx = (CUSTOM_REG(REG_BLTCON1) & 0x0008) ? -1 : 1;
}
else
CUSTOM_REG_LONG(REG_BLTAPTH) += CUSTOM_REG_SIGNED(REG_BLTBMOD) & ~1;
if (dx)
{
UINT32 temp = CUSTOM_REG(REG_BLTCON0) + (INT32)(dx << 12);
CUSTOM_REG(REG_BLTCON0) = temp;
if (temp & 0x10000)
{
CUSTOM_REG_LONG(REG_BLTCPTH) += 2 * dx;
CUSTOM_REG_LONG(REG_BLTDPTH) += 2 * dx;
}
}
if (dy)
{
CUSTOM_REG_LONG(REG_BLTCPTH) += dy * (INT16)(CUSTOM_REG_SIGNED(REG_BLTCMOD) & ~1);
CUSTOM_REG_LONG(REG_BLTDPTH) += dy * (INT16)(CUSTOM_REG_SIGNED(REG_BLTCMOD) & ~1);
singlemask = 0xffff;
}
CUSTOM_REG(REG_BLTCON1) = (CUSTOM_REG(REG_BLTCON1) & ~0x0040) | ((CUSTOM_REG(REG_BLTAPTL) >> 9) & 0x0040);
CUSTOM_REG(REG_BLTCON1) += 0x1000;
}
return blitsum;
} | [
"static",
"UINT32",
"blit_line",
"(",
"void",
")",
"{",
"UINT32",
"singlemode",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"&",
"0x0002",
")",
"?",
"0x0000",
":",
"0xffff",
";",
"UINT32",
"singlemask",
"=",
"0xffff",
";",
"UINT32",
"blitsum",
"=",
"0",
";",
"UINT32",
"height",
";",
"if",
"(",
"CUSTOM_REG",
"(",
"REG_BLTSIZH",
")",
"!=",
"0x0002",
")",
"logerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON0",
")",
"&",
"0x0a00",
")",
"!=",
"0x0a00",
")",
"logerror",
"(",
"\"",
"\\n",
"\"",
")",
";",
"height",
"=",
"CUSTOM_REG",
"(",
"REG_BLTSIZV",
")",
";",
"while",
"(",
"height",
"--",
")",
"{",
"UINT16",
"abc0",
",",
"abc1",
",",
"abc2",
",",
"abc3",
";",
"UINT32",
"tempa",
",",
"tempb",
",",
"tempd",
"=",
"0",
";",
"int",
"b",
",",
"dx",
",",
"dy",
";",
"if",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON0",
")",
"&",
"0x0200",
")",
"CUSTOM_REG",
"(",
"REG_BLTCDAT",
")",
"=",
"amiga_chip_ram_r",
"(",
"CUSTOM_REG_LONG",
"(",
"REG_BLTCPTH",
")",
")",
";",
"tempa",
"=",
"CUSTOM_REG",
"(",
"REG_BLTADAT",
")",
">>",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON0",
")",
">>",
"12",
")",
";",
"tempa",
"&=",
"singlemask",
";",
"singlemask",
"&=",
"singlemode",
";",
"tempb",
"=",
"-",
"(",
"(",
"CUSTOM_REG",
"(",
"REG_BLTBDAT",
")",
">>",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
">>",
"12",
")",
")",
"&",
"1",
")",
";",
"abc0",
"=",
"(",
"(",
"tempa",
">>",
"1",
")",
"&",
"0x4444",
")",
"|",
"(",
"tempb",
"&",
"0x2222",
")",
"|",
"(",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCDAT",
")",
">>",
"3",
")",
"&",
"0x1111",
")",
";",
"abc1",
"=",
"(",
"(",
"tempa",
">>",
"0",
")",
"&",
"0x4444",
")",
"|",
"(",
"tempb",
"&",
"0x2222",
")",
"|",
"(",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCDAT",
")",
">>",
"2",
")",
"&",
"0x1111",
")",
";",
"abc2",
"=",
"(",
"(",
"tempa",
"<<",
"1",
")",
"&",
"0x4444",
")",
"|",
"(",
"tempb",
"&",
"0x2222",
")",
"|",
"(",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCDAT",
")",
">>",
"1",
")",
"&",
"0x1111",
")",
";",
"abc3",
"=",
"(",
"(",
"tempa",
"<<",
"2",
")",
"&",
"0x4444",
")",
"|",
"(",
"tempb",
"&",
"0x2222",
")",
"|",
"(",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCDAT",
")",
">>",
"0",
")",
"&",
"0x1111",
")",
";",
"for",
"(",
"b",
"=",
"0",
";",
"b",
"<",
"4",
";",
"b",
"++",
")",
"{",
"UINT32",
"bit",
";",
"tempd",
"<<=",
"4",
";",
"bit",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON0",
")",
">>",
"(",
"abc0",
">>",
"12",
")",
")",
"&",
"1",
";",
"abc0",
"<<=",
"4",
";",
"tempd",
"|=",
"bit",
"<<",
"3",
";",
"bit",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON0",
")",
">>",
"(",
"abc1",
">>",
"12",
")",
")",
"&",
"1",
";",
"abc1",
"<<=",
"4",
";",
"tempd",
"|=",
"bit",
"<<",
"2",
";",
"bit",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON0",
")",
">>",
"(",
"abc2",
">>",
"12",
")",
")",
"&",
"1",
";",
"abc2",
"<<=",
"4",
";",
"tempd",
"|=",
"bit",
"<<",
"1",
";",
"bit",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON0",
")",
">>",
"(",
"abc3",
">>",
"12",
")",
")",
"&",
"1",
";",
"abc3",
"<<=",
"4",
";",
"tempd",
"|=",
"bit",
"<<",
"0",
";",
"}",
"blitsum",
"|=",
"tempd",
";",
"amiga_chip_ram_w",
"(",
"CUSTOM_REG_LONG",
"(",
"REG_BLTDPTH",
")",
",",
"tempd",
")",
";",
"if",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"&",
"0x0010",
")",
"{",
"dx",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"&",
"0x0004",
")",
"?",
"-1",
":",
"1",
";",
"dy",
"=",
"0",
";",
"}",
"else",
"{",
"dx",
"=",
"0",
";",
"dy",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"&",
"0x0004",
")",
"?",
"-1",
":",
"1",
";",
"}",
"if",
"(",
"!",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"&",
"0x0040",
")",
")",
"{",
"CUSTOM_REG_LONG",
"(",
"REG_BLTAPTH",
")",
"+=",
"CUSTOM_REG_SIGNED",
"(",
"REG_BLTAMOD",
")",
"&",
"~",
"1",
";",
"if",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"&",
"0x0010",
")",
"dy",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"&",
"0x0008",
")",
"?",
"-1",
":",
"1",
";",
"else",
"dx",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"&",
"0x0008",
")",
"?",
"-1",
":",
"1",
";",
"}",
"else",
"CUSTOM_REG_LONG",
"(",
"REG_BLTAPTH",
")",
"+=",
"CUSTOM_REG_SIGNED",
"(",
"REG_BLTBMOD",
")",
"&",
"~",
"1",
";",
"if",
"(",
"dx",
")",
"{",
"UINT32",
"temp",
"=",
"CUSTOM_REG",
"(",
"REG_BLTCON0",
")",
"+",
"(",
"INT32",
")",
"(",
"dx",
"<<",
"12",
")",
";",
"CUSTOM_REG",
"(",
"REG_BLTCON0",
")",
"=",
"temp",
";",
"if",
"(",
"temp",
"&",
"0x10000",
")",
"{",
"CUSTOM_REG_LONG",
"(",
"REG_BLTCPTH",
")",
"+=",
"2",
"*",
"dx",
";",
"CUSTOM_REG_LONG",
"(",
"REG_BLTDPTH",
")",
"+=",
"2",
"*",
"dx",
";",
"}",
"}",
"if",
"(",
"dy",
")",
"{",
"CUSTOM_REG_LONG",
"(",
"REG_BLTCPTH",
")",
"+=",
"dy",
"*",
"(",
"INT16",
")",
"(",
"CUSTOM_REG_SIGNED",
"(",
"REG_BLTCMOD",
")",
"&",
"~",
"1",
")",
";",
"CUSTOM_REG_LONG",
"(",
"REG_BLTDPTH",
")",
"+=",
"dy",
"*",
"(",
"INT16",
")",
"(",
"CUSTOM_REG_SIGNED",
"(",
"REG_BLTCMOD",
")",
"&",
"~",
"1",
")",
";",
"singlemask",
"=",
"0xffff",
";",
"}",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"=",
"(",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"&",
"~",
"0x0040",
")",
"|",
"(",
"(",
"CUSTOM_REG",
"(",
"REG_BLTAPTL",
")",
">>",
"9",
")",
"&",
"0x0040",
")",
";",
"CUSTOM_REG",
"(",
"REG_BLTCON1",
")",
"+=",
"0x1000",
";",
"}",
"return",
"blitsum",
";",
"}"
] | The exact line drawing algorithm is not known, but based on the cryptic
setup instructions, it is clear that it is a basic Bresenham line
algorithm. | [
"The",
"exact",
"line",
"drawing",
"algorithm",
"is",
"not",
"known",
"but",
"based",
"on",
"the",
"cryptic",
"setup",
"instructions",
"it",
"is",
"clear",
"that",
"it",
"is",
"a",
"basic",
"Bresenham",
"line",
"algorithm",
"."
] | [
"/* see if folks are breaking the rules */",
"/* extract the length of the line */",
"/* iterate over the line height */",
"/* fetch data for C */",
"/* rotate the A data according to the shift */",
"/* apply single bit mask */",
"/* rotate the B data according to the shift and expand to 16 bits */",
"/* build up 4 16-bit words containing 4 pixels each in 0ABC bit order */",
"/* now loop over bits and compute the destination value */",
"/* shift previous data up 4 bits */",
"/* lookup first bit in series */",
"/* lookup second bit in series */",
"/* lookup third bit in series */",
"/* lookup fourth bit in series */",
"/* accumulate the sum */",
"/* write to the destination */",
"/* always increment along the major axis */",
"/* is the sign bit clear? */",
"/* add 4 * (dy-dx) */",
"/* increment along the minor axis */",
"/* else add 4 * dy and don't increment along the minor axis */",
"/* adjust X if necessary */",
"/* adjust the A shift value */",
"/* if we went from 0xf to 0x0 or vice-versa, adjust the actual pointers */",
"/* adjust Y if necessary */",
"/* BLTCMOD seems to be used for both C and D pointers */",
"/* reset the single mask since we're on a new line */",
"/* set the new sign bit value */",
"/* increment texture shift on every pixel */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | drcbex86_alloc | drcbe_state | static drcbe_state *drcbex86_alloc(drcuml_state *drcuml, drccache *cache, const device_config *device, UINT32 flags, int modes, int addrbits, int ignorebits)
{
int opnum, regnum, entry, spacenum;
drcbe_state *drcbe;
/* allocate space in the cache for our state */
drcbe = (drcbe_state *)drccache_memory_alloc(cache, sizeof(*drcbe));
if (drcbe == NULL)
return NULL;
memset(drcbe, 0, sizeof(*drcbe));
/* remember our pointers */
drcbe->device = device;
drcbe->drcuml = drcuml;
drcbe->cache = cache;
/* get address spaces */
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
drcbe->space[spacenum] = memory_find_address_space(device, spacenum);
/* allocate hash tables */
drcbe->hash = drchash_alloc(cache, modes, addrbits, ignorebits);
if (drcbe->hash == NULL)
return NULL;
/* allocate code map */
drcbe->map = drcmap_alloc(cache, 0);
if (drcbe->map == NULL)
return NULL;
/* allocate a label tracker */
drcbe->labels = drclabel_list_alloc(cache);
if (drcbe->labels == NULL)
return NULL;
/* build the opcode table (static but it doesn't hurt to regenerate it) */
for (opnum = 0; opnum < ARRAY_LENGTH(opcode_table_source); opnum++)
opcode_table[opcode_table_source[opnum].opcode] = opcode_table_source[opnum].func;
/* build the flags map (static but it doesn't hurt to regenerate it) */
for (entry = 0; entry < ARRAY_LENGTH(flags_map); entry++)
{
UINT8 flags = 0;
if (entry & 0x001) flags |= DRCUML_FLAG_C;
if (entry & 0x004) flags |= DRCUML_FLAG_U;
if (entry & 0x040) flags |= DRCUML_FLAG_Z;
if (entry & 0x080) flags |= DRCUML_FLAG_S;
if (entry & 0x800) flags |= DRCUML_FLAG_V;
flags_map[entry] = flags;
}
for (entry = 0; entry < ARRAY_LENGTH(flags_unmap); entry++)
{
UINT32 flags = 0;
if (entry & DRCUML_FLAG_C) flags |= 0x001;
if (entry & DRCUML_FLAG_U) flags |= 0x004;
if (entry & DRCUML_FLAG_Z) flags |= 0x040;
if (entry & DRCUML_FLAG_S) flags |= 0x080;
if (entry & DRCUML_FLAG_V) flags |= 0x800;
flags_unmap[entry] = flags;
}
/* compute hi pointers for each register */
for (regnum = 0; regnum < ARRAY_LENGTH(int_register_map); regnum++)
if (int_register_map[regnum] != 0)
{
drcbe->reglo[int_register_map[regnum]] = &drcbe->state.r[regnum].w.l;
drcbe->reghi[int_register_map[regnum]] = &drcbe->state.r[regnum].w.h;
}
/* create the log */
if (flags & DRCUML_OPTION_LOG_NATIVE)
drcbe->log = x86log_create_context("drcbex86.asm");
return drcbe;
} | /*-------------------------------------------------
drcbex86_alloc - allocate back-end-specific
state
-------------------------------------------------*/ | allocate back-end-specific
state | [
"allocate",
"back",
"-",
"end",
"-",
"specific",
"state"
] | static drcbe_state *drcbex86_alloc(drcuml_state *drcuml, drccache *cache, const device_config *device, UINT32 flags, int modes, int addrbits, int ignorebits)
{
int opnum, regnum, entry, spacenum;
drcbe_state *drcbe;
drcbe = (drcbe_state *)drccache_memory_alloc(cache, sizeof(*drcbe));
if (drcbe == NULL)
return NULL;
memset(drcbe, 0, sizeof(*drcbe));
drcbe->device = device;
drcbe->drcuml = drcuml;
drcbe->cache = cache;
for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
drcbe->space[spacenum] = memory_find_address_space(device, spacenum);
drcbe->hash = drchash_alloc(cache, modes, addrbits, ignorebits);
if (drcbe->hash == NULL)
return NULL;
drcbe->map = drcmap_alloc(cache, 0);
if (drcbe->map == NULL)
return NULL;
drcbe->labels = drclabel_list_alloc(cache);
if (drcbe->labels == NULL)
return NULL;
for (opnum = 0; opnum < ARRAY_LENGTH(opcode_table_source); opnum++)
opcode_table[opcode_table_source[opnum].opcode] = opcode_table_source[opnum].func;
for (entry = 0; entry < ARRAY_LENGTH(flags_map); entry++)
{
UINT8 flags = 0;
if (entry & 0x001) flags |= DRCUML_FLAG_C;
if (entry & 0x004) flags |= DRCUML_FLAG_U;
if (entry & 0x040) flags |= DRCUML_FLAG_Z;
if (entry & 0x080) flags |= DRCUML_FLAG_S;
if (entry & 0x800) flags |= DRCUML_FLAG_V;
flags_map[entry] = flags;
}
for (entry = 0; entry < ARRAY_LENGTH(flags_unmap); entry++)
{
UINT32 flags = 0;
if (entry & DRCUML_FLAG_C) flags |= 0x001;
if (entry & DRCUML_FLAG_U) flags |= 0x004;
if (entry & DRCUML_FLAG_Z) flags |= 0x040;
if (entry & DRCUML_FLAG_S) flags |= 0x080;
if (entry & DRCUML_FLAG_V) flags |= 0x800;
flags_unmap[entry] = flags;
}
for (regnum = 0; regnum < ARRAY_LENGTH(int_register_map); regnum++)
if (int_register_map[regnum] != 0)
{
drcbe->reglo[int_register_map[regnum]] = &drcbe->state.r[regnum].w.l;
drcbe->reghi[int_register_map[regnum]] = &drcbe->state.r[regnum].w.h;
}
if (flags & DRCUML_OPTION_LOG_NATIVE)
drcbe->log = x86log_create_context("drcbex86.asm");
return drcbe;
} | [
"static",
"drcbe_state",
"*",
"drcbex86_alloc",
"(",
"drcuml_state",
"*",
"drcuml",
",",
"drccache",
"*",
"cache",
",",
"const",
"device_config",
"*",
"device",
",",
"UINT32",
"flags",
",",
"int",
"modes",
",",
"int",
"addrbits",
",",
"int",
"ignorebits",
")",
"{",
"int",
"opnum",
",",
"regnum",
",",
"entry",
",",
"spacenum",
";",
"drcbe_state",
"*",
"drcbe",
";",
"drcbe",
"=",
"(",
"drcbe_state",
"*",
")",
"drccache_memory_alloc",
"(",
"cache",
",",
"sizeof",
"(",
"*",
"drcbe",
")",
")",
";",
"if",
"(",
"drcbe",
"==",
"NULL",
")",
"return",
"NULL",
";",
"memset",
"(",
"drcbe",
",",
"0",
",",
"sizeof",
"(",
"*",
"drcbe",
")",
")",
";",
"drcbe",
"->",
"device",
"=",
"device",
";",
"drcbe",
"->",
"drcuml",
"=",
"drcuml",
";",
"drcbe",
"->",
"cache",
"=",
"cache",
";",
"for",
"(",
"spacenum",
"=",
"0",
";",
"spacenum",
"<",
"ADDRESS_SPACES",
";",
"spacenum",
"++",
")",
"drcbe",
"->",
"space",
"[",
"spacenum",
"]",
"=",
"memory_find_address_space",
"(",
"device",
",",
"spacenum",
")",
";",
"drcbe",
"->",
"hash",
"=",
"drchash_alloc",
"(",
"cache",
",",
"modes",
",",
"addrbits",
",",
"ignorebits",
")",
";",
"if",
"(",
"drcbe",
"->",
"hash",
"==",
"NULL",
")",
"return",
"NULL",
";",
"drcbe",
"->",
"map",
"=",
"drcmap_alloc",
"(",
"cache",
",",
"0",
")",
";",
"if",
"(",
"drcbe",
"->",
"map",
"==",
"NULL",
")",
"return",
"NULL",
";",
"drcbe",
"->",
"labels",
"=",
"drclabel_list_alloc",
"(",
"cache",
")",
";",
"if",
"(",
"drcbe",
"->",
"labels",
"==",
"NULL",
")",
"return",
"NULL",
";",
"for",
"(",
"opnum",
"=",
"0",
";",
"opnum",
"<",
"ARRAY_LENGTH",
"(",
"opcode_table_source",
")",
";",
"opnum",
"++",
")",
"opcode_table",
"[",
"opcode_table_source",
"[",
"opnum",
"]",
".",
"opcode",
"]",
"=",
"opcode_table_source",
"[",
"opnum",
"]",
".",
"func",
";",
"for",
"(",
"entry",
"=",
"0",
";",
"entry",
"<",
"ARRAY_LENGTH",
"(",
"flags_map",
")",
";",
"entry",
"++",
")",
"{",
"UINT8",
"flags",
"=",
"0",
";",
"if",
"(",
"entry",
"&",
"0x001",
")",
"flags",
"|=",
"DRCUML_FLAG_C",
";",
"if",
"(",
"entry",
"&",
"0x004",
")",
"flags",
"|=",
"DRCUML_FLAG_U",
";",
"if",
"(",
"entry",
"&",
"0x040",
")",
"flags",
"|=",
"DRCUML_FLAG_Z",
";",
"if",
"(",
"entry",
"&",
"0x080",
")",
"flags",
"|=",
"DRCUML_FLAG_S",
";",
"if",
"(",
"entry",
"&",
"0x800",
")",
"flags",
"|=",
"DRCUML_FLAG_V",
";",
"flags_map",
"[",
"entry",
"]",
"=",
"flags",
";",
"}",
"for",
"(",
"entry",
"=",
"0",
";",
"entry",
"<",
"ARRAY_LENGTH",
"(",
"flags_unmap",
")",
";",
"entry",
"++",
")",
"{",
"UINT32",
"flags",
"=",
"0",
";",
"if",
"(",
"entry",
"&",
"DRCUML_FLAG_C",
")",
"flags",
"|=",
"0x001",
";",
"if",
"(",
"entry",
"&",
"DRCUML_FLAG_U",
")",
"flags",
"|=",
"0x004",
";",
"if",
"(",
"entry",
"&",
"DRCUML_FLAG_Z",
")",
"flags",
"|=",
"0x040",
";",
"if",
"(",
"entry",
"&",
"DRCUML_FLAG_S",
")",
"flags",
"|=",
"0x080",
";",
"if",
"(",
"entry",
"&",
"DRCUML_FLAG_V",
")",
"flags",
"|=",
"0x800",
";",
"flags_unmap",
"[",
"entry",
"]",
"=",
"flags",
";",
"}",
"for",
"(",
"regnum",
"=",
"0",
";",
"regnum",
"<",
"ARRAY_LENGTH",
"(",
"int_register_map",
")",
";",
"regnum",
"++",
")",
"if",
"(",
"int_register_map",
"[",
"regnum",
"]",
"!=",
"0",
")",
"{",
"drcbe",
"->",
"reglo",
"[",
"int_register_map",
"[",
"regnum",
"]",
"]",
"=",
"&",
"drcbe",
"->",
"state",
".",
"r",
"[",
"regnum",
"]",
".",
"w",
".",
"l",
";",
"drcbe",
"->",
"reghi",
"[",
"int_register_map",
"[",
"regnum",
"]",
"]",
"=",
"&",
"drcbe",
"->",
"state",
".",
"r",
"[",
"regnum",
"]",
".",
"w",
".",
"h",
";",
"}",
"if",
"(",
"flags",
"&",
"DRCUML_OPTION_LOG_NATIVE",
")",
"drcbe",
"->",
"log",
"=",
"x86log_create_context",
"(",
"\"",
"\"",
")",
";",
"return",
"drcbe",
";",
"}"
] | drcbex86_alloc - allocate back-end-specific
state | [
"drcbex86_alloc",
"-",
"allocate",
"back",
"-",
"end",
"-",
"specific",
"state"
] | [
"/* allocate space in the cache for our state */",
"/* remember our pointers */",
"/* get address spaces */",
"/* allocate hash tables */",
"/* allocate code map */",
"/* allocate a label tracker */",
"/* build the opcode table (static but it doesn't hurt to regenerate it) */",
"/* build the flags map (static but it doesn't hurt to regenerate it) */",
"/* compute hi pointers for each register */",
"/* create the log */"
] | [
{
"param": "drcuml",
"type": "drcuml_state"
},
{
"param": "cache",
"type": "drccache"
},
{
"param": "device",
"type": "device_config"
},
{
"param": "flags",
"type": "UINT32"
},
{
"param": "modes",
"type": "int"
},
{
"param": "addrbits",
"type": "int"
},
{
"param": "ignorebits",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcuml",
"type": "drcuml_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cache",
"type": "drccache",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "device",
"type": "device_config",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "modes",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "addrbits",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ignorebits",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | drcbex86_free | void | static void drcbex86_free(drcbe_state *drcbe)
{
/* free the log context */
if (drcbe->log != NULL)
x86log_free_context(drcbe->log);
} | /*-------------------------------------------------
drcbex86_free - free back-end specific state
-------------------------------------------------*/ | free back-end specific state | [
"free",
"back",
"-",
"end",
"specific",
"state"
] | static void drcbex86_free(drcbe_state *drcbe)
{
if (drcbe->log != NULL)
x86log_free_context(drcbe->log);
} | [
"static",
"void",
"drcbex86_free",
"(",
"drcbe_state",
"*",
"drcbe",
")",
"{",
"if",
"(",
"drcbe",
"->",
"log",
"!=",
"NULL",
")",
"x86log_free_context",
"(",
"drcbe",
"->",
"log",
")",
";",
"}"
] | drcbex86_free - free back-end specific state | [
"drcbex86_free",
"-",
"free",
"back",
"-",
"end",
"specific",
"state"
] | [
"/* free the log context */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | drcbex86_execute | int | static int drcbex86_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
{
/* call our entry point which will jump to the destination */
return (*drcbe->entry)((x86code *)drcuml_handle_codeptr(entry));
} | /*-------------------------------------------------
drcbex86_execute - execute a block of code
referenced by the given handle
-------------------------------------------------*/ | execute a block of code
referenced by the given handle | [
"execute",
"a",
"block",
"of",
"code",
"referenced",
"by",
"the",
"given",
"handle"
] | static int drcbex86_execute(drcbe_state *drcbe, drcuml_codehandle *entry)
{
return (*drcbe->entry)((x86code *)drcuml_handle_codeptr(entry));
} | [
"static",
"int",
"drcbex86_execute",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"drcuml_codehandle",
"*",
"entry",
")",
"{",
"return",
"(",
"*",
"drcbe",
"->",
"entry",
")",
"(",
"(",
"x86code",
"*",
")",
"drcuml_handle_codeptr",
"(",
"entry",
")",
")",
";",
"}"
] | drcbex86_execute - execute a block of code
referenced by the given handle | [
"drcbex86_execute",
"-",
"execute",
"a",
"block",
"of",
"code",
"referenced",
"by",
"the",
"given",
"handle"
] | [
"/* call our entry point which will jump to the destination */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "entry",
"type": "drcuml_codehandle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entry",
"type": "drcuml_codehandle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | drcbex86_get_info | void | static void drcbex86_get_info(drcbe_state *state, drcbe_info *info)
{
for (info->direct_iregs = 0; info->direct_iregs < DRCUML_REG_I_END - DRCUML_REG_I0; info->direct_iregs++)
if (int_register_map[info->direct_iregs] == 0)
break;
info->direct_fregs = 0;
} | /*-------------------------------------------------
drcbex86_get_info - return information about
the back-end implementation
-------------------------------------------------*/ | return information about
the back-end implementation | [
"return",
"information",
"about",
"the",
"back",
"-",
"end",
"implementation"
] | static void drcbex86_get_info(drcbe_state *state, drcbe_info *info)
{
for (info->direct_iregs = 0; info->direct_iregs < DRCUML_REG_I_END - DRCUML_REG_I0; info->direct_iregs++)
if (int_register_map[info->direct_iregs] == 0)
break;
info->direct_fregs = 0;
} | [
"static",
"void",
"drcbex86_get_info",
"(",
"drcbe_state",
"*",
"state",
",",
"drcbe_info",
"*",
"info",
")",
"{",
"for",
"(",
"info",
"->",
"direct_iregs",
"=",
"0",
";",
"info",
"->",
"direct_iregs",
"<",
"DRCUML_REG_I_END",
"-",
"DRCUML_REG_I0",
";",
"info",
"->",
"direct_iregs",
"++",
")",
"if",
"(",
"int_register_map",
"[",
"info",
"->",
"direct_iregs",
"]",
"==",
"0",
")",
"break",
";",
"info",
"->",
"direct_fregs",
"=",
"0",
";",
"}"
] | drcbex86_get_info - return information about
the back-end implementation | [
"drcbex86_get_info",
"-",
"return",
"information",
"about",
"the",
"back",
"-",
"end",
"implementation"
] | [] | [
{
"param": "state",
"type": "drcbe_state"
},
{
"param": "info",
"type": "drcbe_info"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "state",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "info",
"type": "drcbe_info",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | param_normalize | void | static void param_normalize(drcbe_state *drcbe, const drcuml_parameter *src, drcuml_parameter *dest, UINT32 allowed)
{
int regnum;
switch (src->type)
{
/* immediates pass through */
case DRCUML_PTYPE_IMMEDIATE:
assert(allowed & PTYPE_I);
dest->type = DRCUML_PTYPE_IMMEDIATE;
dest->value = src->value;
break;
/* memory passes through */
case DRCUML_PTYPE_MEMORY:
assert(allowed & PTYPE_M);
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = src->value;
break;
/* if a register maps to a register, keep it as a register; otherwise map it to memory */
case DRCUML_PTYPE_INT_REGISTER:
assert(allowed & PTYPE_R);
assert(allowed & PTYPE_M);
regnum = int_register_map[src->value - DRCUML_REG_I0];
if (regnum != 0)
{
dest->type = DRCUML_PTYPE_INT_REGISTER;
dest->value = regnum;
}
else
{
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)&drcbe->state.r[src->value - DRCUML_REG_I0];
}
break;
/* all floating point registers map to memory */
case DRCUML_PTYPE_FLOAT_REGISTER:
assert(allowed & PTYPE_F);
assert(allowed & PTYPE_M);
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)&drcbe->state.f[src->value - DRCUML_REG_F0];
break;
/* everything else is unexpected */
default:
fatalerror("Unexpected parameter type");
break;
}
} | /*-------------------------------------------------
param_normalize - convert a full parameter
into a reduced set
-------------------------------------------------*/ | convert a full parameter
into a reduced set | [
"convert",
"a",
"full",
"parameter",
"into",
"a",
"reduced",
"set"
] | static void param_normalize(drcbe_state *drcbe, const drcuml_parameter *src, drcuml_parameter *dest, UINT32 allowed)
{
int regnum;
switch (src->type)
{
case DRCUML_PTYPE_IMMEDIATE:
assert(allowed & PTYPE_I);
dest->type = DRCUML_PTYPE_IMMEDIATE;
dest->value = src->value;
break;
case DRCUML_PTYPE_MEMORY:
assert(allowed & PTYPE_M);
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = src->value;
break;
case DRCUML_PTYPE_INT_REGISTER:
assert(allowed & PTYPE_R);
assert(allowed & PTYPE_M);
regnum = int_register_map[src->value - DRCUML_REG_I0];
if (regnum != 0)
{
dest->type = DRCUML_PTYPE_INT_REGISTER;
dest->value = regnum;
}
else
{
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)&drcbe->state.r[src->value - DRCUML_REG_I0];
}
break;
case DRCUML_PTYPE_FLOAT_REGISTER:
assert(allowed & PTYPE_F);
assert(allowed & PTYPE_M);
dest->type = DRCUML_PTYPE_MEMORY;
dest->value = (FPTR)&drcbe->state.f[src->value - DRCUML_REG_F0];
break;
default:
fatalerror("Unexpected parameter type");
break;
}
} | [
"static",
"void",
"param_normalize",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"const",
"drcuml_parameter",
"*",
"src",
",",
"drcuml_parameter",
"*",
"dest",
",",
"UINT32",
"allowed",
")",
"{",
"int",
"regnum",
";",
"switch",
"(",
"src",
"->",
"type",
")",
"{",
"case",
"DRCUML_PTYPE_IMMEDIATE",
":",
"assert",
"(",
"allowed",
"&",
"PTYPE_I",
")",
";",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_IMMEDIATE",
";",
"dest",
"->",
"value",
"=",
"src",
"->",
"value",
";",
"break",
";",
"case",
"DRCUML_PTYPE_MEMORY",
":",
"assert",
"(",
"allowed",
"&",
"PTYPE_M",
")",
";",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_MEMORY",
";",
"dest",
"->",
"value",
"=",
"src",
"->",
"value",
";",
"break",
";",
"case",
"DRCUML_PTYPE_INT_REGISTER",
":",
"assert",
"(",
"allowed",
"&",
"PTYPE_R",
")",
";",
"assert",
"(",
"allowed",
"&",
"PTYPE_M",
")",
";",
"regnum",
"=",
"int_register_map",
"[",
"src",
"->",
"value",
"-",
"DRCUML_REG_I0",
"]",
";",
"if",
"(",
"regnum",
"!=",
"0",
")",
"{",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_INT_REGISTER",
";",
"dest",
"->",
"value",
"=",
"regnum",
";",
"}",
"else",
"{",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_MEMORY",
";",
"dest",
"->",
"value",
"=",
"(",
"FPTR",
")",
"&",
"drcbe",
"->",
"state",
".",
"r",
"[",
"src",
"->",
"value",
"-",
"DRCUML_REG_I0",
"]",
";",
"}",
"break",
";",
"case",
"DRCUML_PTYPE_FLOAT_REGISTER",
":",
"assert",
"(",
"allowed",
"&",
"PTYPE_F",
")",
";",
"assert",
"(",
"allowed",
"&",
"PTYPE_M",
")",
";",
"dest",
"->",
"type",
"=",
"DRCUML_PTYPE_MEMORY",
";",
"dest",
"->",
"value",
"=",
"(",
"FPTR",
")",
"&",
"drcbe",
"->",
"state",
".",
"f",
"[",
"src",
"->",
"value",
"-",
"DRCUML_REG_F0",
"]",
";",
"break",
";",
"default",
":",
"fatalerror",
"(",
"\"",
"\"",
")",
";",
"break",
";",
"}",
"}"
] | param_normalize - convert a full parameter
into a reduced set | [
"param_normalize",
"-",
"convert",
"a",
"full",
"parameter",
"into",
"a",
"reduced",
"set"
] | [
"/* immediates pass through */",
"/* memory passes through */",
"/* if a register maps to a register, keep it as a register; otherwise map it to memory */",
"/* all floating point registers map to memory */",
"/* everything else is unexpected */"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "src",
"type": "drcuml_parameter"
},
{
"param": "dest",
"type": "drcuml_parameter"
},
{
"param": "allowed",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "allowed",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_mov_r32_p32 | void | static void emit_mov_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (param->value == 0)
emit_xor_r32_r32(dst, reg, reg); // xor reg,reg
else
emit_mov_r32_imm(dst, reg, param->value); // mov reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_r32_m32(dst, reg, MABS(param->value)); // mov reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, reg, param->value); // mov reg,param
}
} | /*-------------------------------------------------
emit_mov_r32_p32 - move a 32-bit parameter
into a register
-------------------------------------------------*/ | move a 32-bit parameter
into a register | [
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"register"
] | static void emit_mov_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (param->value == 0)
emit_xor_r32_r32(dst, reg, reg);
else
emit_mov_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, reg, param->value);
}
} | [
"static",
"void",
"emit_mov_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"param",
"->",
"value",
"==",
"0",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reg",
",",
"reg",
")",
";",
"else",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"if",
"(",
"reg",
"!=",
"param",
"->",
"value",
")",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"}"
] | emit_mov_r32_p32 - move a 32-bit parameter
into a register | [
"emit_mov_r32_p32",
"-",
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"register"
] | [
"// xor reg,reg",
"// mov reg,param",
"// mov reg,[param]",
"// mov reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_mov_r32_p32_keepflags | void | static void emit_mov_r32_p32_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_mov_r32_imm(dst, reg, param->value); // mov reg,param
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_r32_m32(dst, reg, MABS(param->value)); // mov reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, reg, param->value); // mov reg,param
}
} | /*-------------------------------------------------
emit_mov_r32_p32_keepflags - move a 32-bit
parameter into a register without affecting
any flags
-------------------------------------------------*/ | move a 32-bit
parameter into a register without affecting
any flags | [
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"register",
"without",
"affecting",
"any",
"flags"
] | static void emit_mov_r32_p32_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_mov_r32_imm(dst, reg, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, reg, param->value);
}
} | [
"static",
"void",
"emit_mov_r32_p32_keepflags",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"if",
"(",
"reg",
"!=",
"param",
"->",
"value",
")",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"}"
] | emit_mov_r32_p32_keepflags - move a 32-bit
parameter into a register without affecting
any flags | [
"emit_mov_r32_p32_keepflags",
"-",
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"register",
"without",
"affecting",
"any",
"flags"
] | [
"// mov reg,param",
"// mov reg,[param]",
"// mov reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_mov_m32_p32 | void | static void emit_mov_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_mov_m32_imm(dst, MEMPARAMS, param->value); // mov [mem],param
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, REG_EAX, MABS(param->value)); // mov eax,[param]
emit_mov_m32_r32(dst, MEMPARAMS, REG_EAX); // mov [mem],eax
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_mov_m32_r32(dst, MEMPARAMS, param->value); // mov [mem],param
} | /*-------------------------------------------------
emit_mov_m32_p32 - move a 32-bit parameter
into a memory location
-------------------------------------------------*/ | move a 32-bit parameter
into a memory location | [
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"memory",
"location"
] | static void emit_mov_m32_p32(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_mov_m32_imm(dst, MEMPARAMS, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, REG_EAX, MABS(param->value));
emit_mov_m32_r32(dst, MEMPARAMS, REG_EAX);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_mov_m32_r32(dst, MEMPARAMS, param->value);
} | [
"static",
"void",
"emit_mov_m32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_mov_r32_m32",
"(",
"dst",
",",
"REG_EAX",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"REG_EAX",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_mov_m32_p32 - move a 32-bit parameter
into a memory location | [
"emit_mov_m32_p32",
"-",
"move",
"a",
"32",
"-",
"bit",
"parameter",
"into",
"a",
"memory",
"location"
] | [
"// mov [mem],param",
"// mov eax,[param]",
"// mov [mem],eax",
"// mov [mem],param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_mov_p32_r32 | void | static void emit_mov_p32_r32(drcbe_state *drcbe, x86code **dst, const drcuml_parameter *param, UINT8 reg)
{
assert(param->type != DRCUML_PTYPE_IMMEDIATE);
if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_m32_r32(dst, MABS(param->value), reg); // mov [param],reg
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, param->value, reg); // mov param,reg
}
} | /*-------------------------------------------------
emit_mov_p32_r32 - move a register into a
32-bit parameter
-------------------------------------------------*/ | move a register into a
32-bit parameter | [
"move",
"a",
"register",
"into",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_mov_p32_r32(drcbe_state *drcbe, x86code **dst, const drcuml_parameter *param, UINT8 reg)
{
assert(param->type != DRCUML_PTYPE_IMMEDIATE);
if (param->type == DRCUML_PTYPE_MEMORY)
emit_mov_m32_r32(dst, MABS(param->value), reg);
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reg != param->value)
emit_mov_r32_r32(dst, param->value, reg);
}
} | [
"static",
"void",
"emit_mov_p32_r32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"UINT8",
"reg",
")",
"{",
"assert",
"(",
"param",
"->",
"type",
"!=",
"DRCUML_PTYPE_IMMEDIATE",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
",",
"reg",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"if",
"(",
"reg",
"!=",
"param",
"->",
"value",
")",
"emit_mov_r32_r32",
"(",
"dst",
",",
"param",
"->",
"value",
",",
"reg",
")",
";",
"}",
"}"
] | emit_mov_p32_r32 - move a register into a
32-bit parameter | [
"emit_mov_p32_r32",
"-",
"move",
"a",
"register",
"into",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// mov [param],reg",
"// mov param,reg"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "reg",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_add_r32_p32 | void | static void emit_add_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_add_r32_imm(dst, reg, param->value); // add reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_add_r32_m32(dst, reg, MABS(param->value)); // add reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_add_r32_r32(dst, reg, param->value); // add reg,param
} | /*-------------------------------------------------
emit_add_r32_p32 - add operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | add operation to a 32-bit
register from a 32-bit parameter | [
"add",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_add_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_add_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_add_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_add_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_add_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"param",
"->",
"value",
"!=",
"0",
")",
"emit_add_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_add_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_add_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_add_r32_p32 - add operation to a 32-bit
register from a 32-bit parameter | [
"emit_add_r32_p32",
"-",
"add",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// add reg,param",
"// add reg,[param]",
"// add reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_adc_r32_p32 | void | static void emit_adc_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_adc_r32_imm(dst, reg, param->value); // adc reg,param
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_adc_r32_m32(dst, reg, MABS(param->value)); // adc reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_adc_r32_r32(dst, reg, param->value); // adc reg,param
} | /*-------------------------------------------------
emit_adc_r32_p32 - adc operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | adc operation to a 32-bit
register from a 32-bit parameter | [
"adc",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_adc_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_adc_r32_imm(dst, reg, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_adc_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_adc_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_adc_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_adc_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_adc_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_adc_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_adc_r32_p32 - adc operation to a 32-bit
register from a 32-bit parameter | [
"emit_adc_r32_p32",
"-",
"adc",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// adc reg,param",
"// adc reg,[param]",
"// adc reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_sub_r32_p32 | void | static void emit_sub_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_sub_r32_imm(dst, reg, param->value); // sub reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_sub_r32_m32(dst, reg, MABS(param->value)); // sub reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_sub_r32_r32(dst, reg, param->value); // sub reg,param
} | /*-------------------------------------------------
emit_sub_r32_p32 - sub operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | sub operation to a 32-bit
register from a 32-bit parameter | [
"sub",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_sub_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags != 0 || param->value != 0)
emit_sub_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_sub_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_sub_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_sub_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"param",
"->",
"value",
"!=",
"0",
")",
"emit_sub_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_sub_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_sub_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_sub_r32_p32 - sub operation to a 32-bit
register from a 32-bit parameter | [
"emit_sub_r32_p32",
"-",
"sub",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// sub reg,param",
"// sub reg,[param]",
"// sub reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_sbb_r32_p32 | void | static void emit_sbb_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_sbb_r32_imm(dst, reg, param->value); // sbb reg,param
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_sbb_r32_m32(dst, reg, MABS(param->value)); // sbb reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_sbb_r32_r32(dst, reg, param->value); // sbb reg,param
} | /*-------------------------------------------------
emit_sbb_r32_p32 - sbb operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | sbb operation to a 32-bit
register from a 32-bit parameter | [
"sbb",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_sbb_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_sbb_r32_imm(dst, reg, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_sbb_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_sbb_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_sbb_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_sbb_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_sbb_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_sbb_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_sbb_r32_p32 - sbb operation to a 32-bit
register from a 32-bit parameter | [
"emit_sbb_r32_p32",
"-",
"sbb",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// sbb reg,param",
"// sbb reg,[param]",
"// sbb reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_cmp_r32_p32 | void | static void emit_cmp_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_cmp_r32_imm(dst, reg, param->value); // cmp reg,param
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_cmp_r32_m32(dst, reg, MABS(param->value)); // cmp reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_cmp_r32_r32(dst, reg, param->value); // cmp reg,param
} | /*-------------------------------------------------
emit_cmp_r32_p32 - cmp operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | cmp operation to a 32-bit
register from a 32-bit parameter | [
"cmp",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_cmp_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
emit_cmp_r32_imm(dst, reg, param->value);
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_cmp_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_cmp_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_cmp_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"emit_cmp_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_cmp_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_cmp_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_cmp_r32_p32 - cmp operation to a 32-bit
register from a 32-bit parameter | [
"emit_cmp_r32_p32",
"-",
"cmp",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"// cmp reg,param",
"// cmp reg,[param]",
"// cmp reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_and_r32_p32 | void | static void emit_and_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_xor_r32_r32(dst, reg, reg); // xor reg,reg
else
emit_and_r32_imm(dst, reg, param->value); // and reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_and_r32_m32(dst, reg, MABS(param->value)); // and reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_and_r32_r32(dst, reg, param->value); // and reg,param
} | /*-------------------------------------------------
emit_and_r32_p32 - and operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | and operation to a 32-bit
register from a 32-bit parameter | [
"and",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_and_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_xor_r32_r32(dst, reg, reg);
else
emit_and_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_and_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_and_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_and_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reg",
",",
"reg",
")",
";",
"else",
"emit_and_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_and_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_and_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_and_r32_p32 - and operation to a 32-bit
register from a 32-bit parameter | [
"emit_and_r32_p32",
"-",
"and",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// xor reg,reg",
"// and reg,param",
"// and reg,[param]",
"// and reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_or_r32_p32 | void | static void emit_or_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_r32_imm(dst, reg, -1); // mov reg,-1
else
emit_or_r32_imm(dst, reg, param->value); // or reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_or_r32_m32(dst, reg, MABS(param->value)); // or reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_or_r32_r32(dst, reg, param->value); // or reg,param
} | /*-------------------------------------------------
emit_or_r32_p32 - or operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | or operation to a 32-bit
register from a 32-bit parameter | [
"or",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_or_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_r32_imm(dst, reg, -1);
else
emit_or_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_or_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_or_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_or_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reg",
",",
"-1",
")",
";",
"else",
"emit_or_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_or_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_or_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_or_r32_p32 - or operation to a 32-bit
register from a 32-bit parameter | [
"emit_or_r32_p32",
"-",
"or",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// mov reg,-1",
"// or reg,param",
"// or reg,[param]",
"// or reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_xor_r32_p32 | void | static void emit_xor_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_not_r32(dst, reg); // not reg
else
emit_xor_r32_imm(dst, reg, param->value); // xor reg,param
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_xor_r32_m32(dst, reg, MABS(param->value)); // xor reg,[param]
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_xor_r32_r32(dst, reg, param->value); // xor reg,param
} | /*-------------------------------------------------
emit_xor_r32_p32 - xor operation to a 32-bit
register from a 32-bit parameter
-------------------------------------------------*/ | xor operation to a 32-bit
register from a 32-bit parameter | [
"xor",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | static void emit_xor_r32_p32(drcbe_state *drcbe, x86code **dst, UINT8 reg, const drcuml_parameter *param, const drcuml_instruction *inst)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_not_r32(dst, reg);
else
emit_xor_r32_imm(dst, reg, param->value);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
emit_xor_r32_m32(dst, reg, MABS(param->value));
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
emit_xor_r32_r32(dst, reg, param->value);
} | [
"static",
"void",
"emit_xor_r32_p32",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reg",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
"emit_not_r32",
"(",
"dst",
",",
"reg",
")",
";",
"else",
"emit_xor_r32_imm",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"emit_xor_r32_m32",
"(",
"dst",
",",
"reg",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reg",
",",
"param",
"->",
"value",
")",
";",
"}"
] | emit_xor_r32_p32 - xor operation to a 32-bit
register from a 32-bit parameter | [
"emit_xor_r32_p32",
"-",
"xor",
"operation",
"to",
"a",
"32",
"-",
"bit",
"register",
"from",
"a",
"32",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// not reg",
"// xor reg,param",
"// xor reg,[param]",
"// xor reg,param"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reg",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reg",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_mov_r64_p64 | void | static void emit_mov_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if ((UINT32)param->value == 0)
emit_xor_r32_r32(dst, reglo, reglo); // xor reglo,reglo
else
emit_mov_r32_imm(dst, reglo, param->value); // mov reglo,param
if ((UINT32)(param->value >> 32) == 0)
emit_xor_r32_r32(dst, reghi, reghi); // xor reghi,reghi
else
emit_mov_r32_imm(dst, reghi, param->value >> 32); // mov reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, reglo, MABS(param->value)); // mov reglo,[param]
emit_mov_r32_m32(dst, reghi, MABS(param->value + 4)); // mov reghi,[param+4]
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reglo != param->value)
emit_mov_r32_r32(dst, reglo, param->value); // mov reglo,param
emit_mov_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // mov reghi,reghi[param]
}
} | /*-------------------------------------------------
emit_mov_r64_p64 - move a 64-bit parameter
into a pair of registers
-------------------------------------------------*/ | move a 64-bit parameter
into a pair of registers | [
"move",
"a",
"64",
"-",
"bit",
"parameter",
"into",
"a",
"pair",
"of",
"registers"
] | static void emit_mov_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if ((UINT32)param->value == 0)
emit_xor_r32_r32(dst, reglo, reglo);
else
emit_mov_r32_imm(dst, reglo, param->value);
if ((UINT32)(param->value >> 32) == 0)
emit_xor_r32_r32(dst, reghi, reghi);
else
emit_mov_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, reglo, MABS(param->value));
emit_mov_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reglo != param->value)
emit_mov_r32_r32(dst, reglo, param->value);
emit_mov_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
} | [
"static",
"void",
"emit_mov_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"reglo",
")",
";",
"else",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reghi",
")",
";",
"else",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"if",
"(",
"reglo",
"!=",
"param",
"->",
"value",
")",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"}"
] | emit_mov_r64_p64 - move a 64-bit parameter
into a pair of registers | [
"emit_mov_r64_p64",
"-",
"move",
"a",
"64",
"-",
"bit",
"parameter",
"into",
"a",
"pair",
"of",
"registers"
] | [
"// xor reglo,reglo",
"// mov reglo,param",
"// xor reghi,reghi",
"// mov reghi,param >> 32",
"// mov reglo,[param]",
"// mov reghi,[param+4]",
"// mov reglo,param",
"// mov reghi,reghi[param]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_mov_r64_p64_keepflags | void | static void emit_mov_r64_p64_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_mov_r32_imm(dst, reglo, param->value); // mov reglo,param
emit_mov_r32_imm(dst, reghi, param->value >> 32); // mov reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, reglo, MABS(param->value)); // mov reglo,[param]
emit_mov_r32_m32(dst, reghi, MABS(param->value + 4)); // mov reghi,[param+4]
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reglo != param->value)
emit_mov_r32_r32(dst, reglo, param->value); // mov reglo,param
emit_mov_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // mov reghi,reghi[param]
}
} | /*-------------------------------------------------
emit_mov_r64_p64_keepflags - move a 64-bit
parameter into a pair of registers without
affecting any flags
-------------------------------------------------*/ | move a 64-bit
parameter into a pair of registers without
affecting any flags | [
"move",
"a",
"64",
"-",
"bit",
"parameter",
"into",
"a",
"pair",
"of",
"registers",
"without",
"affecting",
"any",
"flags"
] | static void emit_mov_r64_p64_keepflags(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_mov_r32_imm(dst, reglo, param->value);
emit_mov_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, reglo, MABS(param->value));
emit_mov_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reglo != param->value)
emit_mov_r32_r32(dst, reglo, param->value);
emit_mov_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
} | [
"static",
"void",
"emit_mov_r64_p64_keepflags",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"if",
"(",
"reglo",
"!=",
"param",
"->",
"value",
")",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"emit_mov_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"}"
] | emit_mov_r64_p64_keepflags - move a 64-bit
parameter into a pair of registers without
affecting any flags | [
"emit_mov_r64_p64_keepflags",
"-",
"move",
"a",
"64",
"-",
"bit",
"parameter",
"into",
"a",
"pair",
"of",
"registers",
"without",
"affecting",
"any",
"flags"
] | [
"// mov reglo,param",
"// mov reghi,param >> 32",
"// mov reglo,[param]",
"// mov reghi,[param+4]",
"// mov reglo,param",
"// mov reghi,reghi[param]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_mov_m64_p64 | void | static void emit_mov_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_mov_m32_imm(dst, MEMPARAMS + 0, param->value); // mov [mem],param
emit_mov_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // mov [mem],param >> 32
}
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, REG_EAX, MABS(param->value)); // mov eax,[param]
emit_mov_m32_r32(dst, MEMPARAMS + 0, REG_EAX); // mov [mem],eax
emit_mov_r32_m32(dst, REG_EAX, MABS(param->value + 4)); // mov eax,[param+4]
emit_mov_m32_r32(dst, MEMPARAMS + 4, REG_EAX); // mov [mem+4],eax
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_mov_m32_r32(dst, MEMPARAMS + 0, param->value); // mov [mem],param
emit_mov_r32_m32(dst, REG_EAX, MABS(drcbe->reghi[param->value])); // mov eax,[param.hi]
emit_mov_m32_r32(dst, MEMPARAMS + 4, REG_EAX); // mov [mem+4],eax
}
} | /*-------------------------------------------------
emit_mov_m64_p64 - move a 64-bit parameter
into a memory location
-------------------------------------------------*/ | move a 64-bit parameter
into a memory location | [
"move",
"a",
"64",
"-",
"bit",
"parameter",
"into",
"a",
"memory",
"location"
] | static void emit_mov_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param)
{
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_mov_m32_imm(dst, MEMPARAMS + 0, param->value);
emit_mov_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); >> 32
}
else if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_r32_m32(dst, REG_EAX, MABS(param->value));
emit_mov_m32_r32(dst, MEMPARAMS + 0, REG_EAX);
emit_mov_r32_m32(dst, REG_EAX, MABS(param->value + 4));
emit_mov_m32_r32(dst, MEMPARAMS + 4, REG_EAX);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_mov_m32_r32(dst, MEMPARAMS + 0, param->value);
emit_mov_r32_m32(dst, REG_EAX, MABS(drcbe->reghi[param->value]));
emit_mov_m32_r32(dst, MEMPARAMS + 4, REG_EAX);
}
} | [
"static",
"void",
"emit_mov_m64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"0",
",",
"param",
"->",
"value",
")",
";",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_mov_r32_m32",
"(",
"dst",
",",
"REG_EAX",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"0",
",",
"REG_EAX",
")",
";",
"emit_mov_r32_m32",
"(",
"dst",
",",
"REG_EAX",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"REG_EAX",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"0",
",",
"param",
"->",
"value",
")",
";",
"emit_mov_r32_m32",
"(",
"dst",
",",
"REG_EAX",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"REG_EAX",
")",
";",
"}",
"}"
] | emit_mov_m64_p64 - move a 64-bit parameter
into a memory location | [
"emit_mov_m64_p64",
"-",
"move",
"a",
"64",
"-",
"bit",
"parameter",
"into",
"a",
"memory",
"location"
] | [
"// mov [mem],param",
"// mov [mem],param >> 32",
"// mov eax,[param]",
"// mov [mem],eax",
"// mov eax,[param+4]",
"// mov [mem+4],eax",
"// mov [mem],param",
"// mov eax,[param.hi]",
"// mov [mem+4],eax"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_mov_p64_r64 | void | static void emit_mov_p64_r64(drcbe_state *drcbe, x86code **dst, const drcuml_parameter *param, UINT8 reglo, UINT8 reghi)
{
assert(param->type != DRCUML_PTYPE_IMMEDIATE);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_m32_r32(dst, MABS(param->value), reglo); // mov [param],reglo
emit_mov_m32_r32(dst, MABS(param->value + 4), reghi); // mov [param+4],reghi
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reglo != param->value)
emit_mov_r32_r32(dst, param->value, reglo); // mov param,reglo
emit_mov_m32_r32(dst, MABS(drcbe->reghi[param->value]), reghi); // mov reghi[param],reghi
}
} | /*-------------------------------------------------
emit_mov_p64_r64 - move a pair of registers
into a 64-bit parameter
-------------------------------------------------*/ | move a pair of registers
into a 64-bit parameter | [
"move",
"a",
"pair",
"of",
"registers",
"into",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_mov_p64_r64(drcbe_state *drcbe, x86code **dst, const drcuml_parameter *param, UINT8 reglo, UINT8 reghi)
{
assert(param->type != DRCUML_PTYPE_IMMEDIATE);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_mov_m32_r32(dst, MABS(param->value), reglo);
emit_mov_m32_r32(dst, MABS(param->value + 4), reghi);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
if (reglo != param->value)
emit_mov_r32_r32(dst, param->value, reglo);
emit_mov_m32_r32(dst, MABS(drcbe->reghi[param->value]), reghi);
}
} | [
"static",
"void",
"emit_mov_p64_r64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
")",
"{",
"assert",
"(",
"param",
"->",
"type",
"!=",
"DRCUML_PTYPE_IMMEDIATE",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
",",
"reglo",
")",
";",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
",",
"reghi",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"if",
"(",
"reglo",
"!=",
"param",
"->",
"value",
")",
"emit_mov_r32_r32",
"(",
"dst",
",",
"param",
"->",
"value",
",",
"reglo",
")",
";",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
",",
"reghi",
")",
";",
"}",
"}"
] | emit_mov_p64_r64 - move a pair of registers
into a 64-bit parameter | [
"emit_mov_p64_r64",
"-",
"move",
"a",
"pair",
"of",
"registers",
"into",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// mov [param],reglo",
"// mov [param+4],reghi",
"// mov param,reglo",
"// mov reghi[param],reghi"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_add_r64_p64 | void | static void emit_add_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_add_r32_m32(dst, reglo, MABS(param->value)); // add reglo,[param]
if (saveflags) emit_pushf(dst); // pushf
emit_adc_r32_m32(dst, reghi, MABS(param->value + 4)); // adc reghi,[param]
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_add_r32_imm(dst, reglo, param->value); // add reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_adc_r32_imm(dst, reghi, param->value >> 32); // adc reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_add_r32_r32(dst, reglo, param->value); // add reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_adc_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // adc reghi,reghi[param]
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_add_r64_p64 - add operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | add operation to a 64-bit
pair of registers from a 64-bit parameter | [
"add",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_add_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_add_r32_m32(dst, reglo, MABS(param->value));
if (saveflags) emit_pushf(dst);
emit_adc_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_add_r32_imm(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_adc_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_add_r32_r32(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_adc_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_add_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_add_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_add_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"emit_add_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_add_r64_p64 - add operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_add_r64_p64",
"-",
"add",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// add reglo,[param]",
"// pushf",
"// adc reghi,[param]",
"// add reglo,param",
"// pushf",
"// adc reghi,param >> 32",
"// add reglo,param",
"// pushf",
"// adc reghi,reghi[param]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_add_m64_p64 | void | static void emit_add_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_add_m32_imm(dst, MEMPARAMS, param->value); // add [dest],param
if (saveflags) emit_pushf(dst); // pushf
emit_adc_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // adc [dest+4],param >> 32
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param); // mov edx:reglo,param
emit_add_m32_r32(dst, MEMPARAMS, reglo); // add [dest],reglo
if (saveflags) emit_pushf(dst); // pushf
emit_adc_m32_r32(dst, MEMPARAMS + 4, REG_EDX); // adc [dest+4],edx
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_add_m64_p64 - add operation to a 64-bit
memory location from a 64-bit parameter
-------------------------------------------------*/ | add operation to a 64-bit
memory location from a 64-bit parameter | [
"add",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_add_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_add_m32_imm(dst, MEMPARAMS, param->value);
if (saveflags) emit_pushf(dst);
emit_adc_m32_imm(dst, MEMPARAMS + 4, param->value >> 32);
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param);
emit_add_m32_r32(dst, MEMPARAMS, reglo);
if (saveflags) emit_pushf(dst);
emit_adc_m32_r32(dst, MEMPARAMS + 4, REG_EDX);
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_add_m64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_add_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"{",
"int",
"reglo",
"=",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"?",
"param",
"->",
"value",
":",
"REG_EAX",
";",
"emit_mov_r64_p64",
"(",
"drcbe",
",",
"dst",
",",
"reglo",
",",
"REG_EDX",
",",
"param",
")",
";",
"emit_add_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reglo",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"REG_EDX",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_add_m64_p64 - add operation to a 64-bit
memory location from a 64-bit parameter | [
"emit_add_m64_p64",
"-",
"add",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// add [dest],param",
"// pushf",
"// adc [dest+4],param >> 32",
"// mov edx:reglo,param",
"// add [dest],reglo",
"// pushf",
"// adc [dest+4],edx"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_adc_r64_p64 | void | static void emit_adc_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_adc_r32_m32(dst, reglo, MABS(param->value)); // adc reglo,[param]
if (saveflags) emit_pushf(dst); // pushf
emit_adc_r32_m32(dst, reghi, MABS(param->value + 4)); // adc reghi,[param]
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_adc_r32_imm(dst, reglo, param->value); // adc reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_adc_r32_imm(dst, reghi, param->value >> 32); // adc reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_adc_r32_r32(dst, reglo, param->value); // adc reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_adc_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // adc reghi,reghi[param]
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_adc_r64_p64 - adc operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | adc operation to a 64-bit
pair of registers from a 64-bit parameter | [
"adc",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_adc_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_adc_r32_m32(dst, reglo, MABS(param->value));
if (saveflags) emit_pushf(dst);
emit_adc_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_adc_r32_imm(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_adc_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_adc_r32_r32(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_adc_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_adc_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_adc_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_adc_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"emit_adc_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_adc_r64_p64 - adc operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_adc_r64_p64",
"-",
"adc",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// adc reglo,[param]",
"// pushf",
"// adc reghi,[param]",
"// adc reglo,param",
"// pushf",
"// adc reghi,param >> 32",
"// adc reglo,param",
"// pushf",
"// adc reghi,reghi[param]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_adc_m64_p64 | void | static void emit_adc_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_adc_m32_imm(dst, MEMPARAMS, param->value); // adc [dest],param
if (saveflags) emit_pushf(dst); // pushf
emit_adc_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // adc [dest+4],param >> 32
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64_keepflags(drcbe, dst, reglo, REG_EDX, param); // mov edx:reglo,param
emit_adc_m32_r32(dst, MEMPARAMS, reglo); // adc [dest],reglo
if (saveflags) emit_pushf(dst); // pushf
emit_adc_m32_r32(dst, MEMPARAMS + 4, REG_EDX); // adc [dest+4],edx
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_adc_m64_p64 - adc operation to a 64-bit
memory location from a 64-bit parameter
-------------------------------------------------*/ | adc operation to a 64-bit
memory location from a 64-bit parameter | [
"adc",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_adc_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_adc_m32_imm(dst, MEMPARAMS, param->value);
if (saveflags) emit_pushf(dst);
emit_adc_m32_imm(dst, MEMPARAMS + 4, param->value >> 32);
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64_keepflags(drcbe, dst, reglo, REG_EDX, param);
emit_adc_m32_r32(dst, MEMPARAMS, reglo);
if (saveflags) emit_pushf(dst);
emit_adc_m32_r32(dst, MEMPARAMS + 4, REG_EDX);
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_adc_m64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_adc_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"{",
"int",
"reglo",
"=",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"?",
"param",
"->",
"value",
":",
"REG_EAX",
";",
"emit_mov_r64_p64_keepflags",
"(",
"drcbe",
",",
"dst",
",",
"reglo",
",",
"REG_EDX",
",",
"param",
")",
";",
"emit_adc_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reglo",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_adc_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"REG_EDX",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_adc_m64_p64 - adc operation to a 64-bit
memory location from a 64-bit parameter | [
"emit_adc_m64_p64",
"-",
"adc",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// adc [dest],param",
"// pushf",
"// adc [dest+4],param >> 32",
"// mov edx:reglo,param",
"// adc [dest],reglo",
"// pushf",
"// adc [dest+4],edx"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_sub_r64_p64 | void | static void emit_sub_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_sub_r32_m32(dst, reglo, MABS(param->value)); // sub reglo,[param]
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_r32_m32(dst, reghi, MABS(param->value + 4)); // sbb reghi,[param]
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sub_r32_imm(dst, reglo, param->value); // sub reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_r32_imm(dst, reghi, param->value >> 32); // sbb reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_sub_r32_r32(dst, reglo, param->value); // sub reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // sbb reghi,reghi[param]
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_sub_r64_p64 - sub operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | sub operation to a 64-bit
pair of registers from a 64-bit parameter | [
"sub",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_sub_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_sub_r32_m32(dst, reglo, MABS(param->value));
if (saveflags) emit_pushf(dst);
emit_sbb_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sub_r32_imm(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_sbb_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_sub_r32_r32(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_sbb_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_sub_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_sub_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_sub_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"emit_sub_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_sub_r64_p64 - sub operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_sub_r64_p64",
"-",
"sub",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// sub reglo,[param]",
"// pushf",
"// sbb reghi,[param]",
"// sub reglo,param",
"// pushf",
"// sbb reghi,param >> 32",
"// sub reglo,param",
"// pushf",
"// sbb reghi,reghi[param]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_sub_m64_p64 | void | static void emit_sub_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sub_m32_imm(dst, MEMPARAMS, param->value); // sub [dest],param
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // sbb [dest+4],param >> 32
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param); // mov edx:reglo,param
emit_sub_m32_r32(dst, MEMPARAMS, reglo); // sub [dest],reglo
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_m32_r32(dst, MEMPARAMS + 4, REG_EDX); // sbb [dest+4],edx
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_sub_m64_p64 - sub operation to a 64-bit
memory location from a 64-bit parameter
-------------------------------------------------*/ | sub operation to a 64-bit
memory location from a 64-bit parameter | [
"sub",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_sub_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sub_m32_imm(dst, MEMPARAMS, param->value);
if (saveflags) emit_pushf(dst);
emit_sbb_m32_imm(dst, MEMPARAMS + 4, param->value >> 32);
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param);
emit_sub_m32_r32(dst, MEMPARAMS, reglo);
if (saveflags) emit_pushf(dst);
emit_sbb_m32_r32(dst, MEMPARAMS + 4, REG_EDX);
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_sub_m64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_sub_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"{",
"int",
"reglo",
"=",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"?",
"param",
"->",
"value",
":",
"REG_EAX",
";",
"emit_mov_r64_p64",
"(",
"drcbe",
",",
"dst",
",",
"reglo",
",",
"REG_EDX",
",",
"param",
")",
";",
"emit_sub_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reglo",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"REG_EDX",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_sub_m64_p64 - sub operation to a 64-bit
memory location from a 64-bit parameter | [
"emit_sub_m64_p64",
"-",
"sub",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// sub [dest],param",
"// pushf",
"// sbb [dest+4],param >> 32",
"// mov edx:reglo,param",
"// sub [dest],reglo",
"// pushf",
"// sbb [dest+4],edx"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_sbb_r64_p64 | void | static void emit_sbb_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_sbb_r32_m32(dst, reglo, MABS(param->value)); // sbb reglo,[param]
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_r32_m32(dst, reghi, MABS(param->value + 4)); // sbb reghi,[param]
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sbb_r32_imm(dst, reglo, param->value); // sbb reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_r32_imm(dst, reghi, param->value >> 32); // sbb reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_sbb_r32_r32(dst, reglo, param->value); // sbb reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // sbb reghi,reghi[param]
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_sbb_r64_p64 - sbb operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | sbb operation to a 64-bit
pair of registers from a 64-bit parameter | [
"sbb",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_sbb_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_sbb_r32_m32(dst, reglo, MABS(param->value));
if (saveflags) emit_pushf(dst);
emit_sbb_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sbb_r32_imm(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_sbb_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_sbb_r32_r32(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_sbb_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_sbb_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_sbb_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_sbb_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"emit_sbb_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_sbb_r64_p64 - sbb operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_sbb_r64_p64",
"-",
"sbb",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// sbb reglo,[param]",
"// pushf",
"// sbb reghi,[param]",
"// sbb reglo,param",
"// pushf",
"// sbb reghi,param >> 32",
"// sbb reglo,param",
"// pushf",
"// sbb reghi,reghi[param]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_sbb_m64_p64 | void | static void emit_sbb_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sbb_m32_imm(dst, MEMPARAMS, param->value); // sbb [dest],param
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // sbb [dest+4],param >> 32
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64_keepflags(drcbe, dst, reglo, REG_EDX, param); // mov edx:reglo,param
emit_sbb_m32_r32(dst, MEMPARAMS, reglo); // sbb [dest],reglo
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_m32_r32(dst, MEMPARAMS + 4, REG_EDX); // sbb [dest+4],edx
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_sbb_m64_p64 - sbb operation to a 64-bit
memory location from a 64-bit parameter
-------------------------------------------------*/ | sbb operation to a 64-bit
memory location from a 64-bit parameter | [
"sbb",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_sbb_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sbb_m32_imm(dst, MEMPARAMS, param->value);
if (saveflags) emit_pushf(dst);
emit_sbb_m32_imm(dst, MEMPARAMS + 4, param->value >> 32);
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64_keepflags(drcbe, dst, reglo, REG_EDX, param);
emit_sbb_m32_r32(dst, MEMPARAMS, reglo);
if (saveflags) emit_pushf(dst);
emit_sbb_m32_r32(dst, MEMPARAMS + 4, REG_EDX);
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_sbb_m64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_sbb_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"{",
"int",
"reglo",
"=",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"?",
"param",
"->",
"value",
":",
"REG_EAX",
";",
"emit_mov_r64_p64_keepflags",
"(",
"drcbe",
",",
"dst",
",",
"reglo",
",",
"REG_EDX",
",",
"param",
")",
";",
"emit_sbb_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reglo",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"REG_EDX",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_sbb_m64_p64 - sbb operation to a 64-bit
memory location from a 64-bit parameter | [
"emit_sbb_m64_p64",
"-",
"sbb",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// sbb [dest],param",
"// pushf",
"// sbb [dest+4],param >> 32",
"// mov edx:reglo,param",
"// sbb [dest],reglo",
"// pushf",
"// sbb [dest+4],edx"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_cmp_r64_p64 | void | static void emit_cmp_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = (inst->flags != DRCUML_FLAG_Z && (inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_sub_r32_m32(dst, reglo, MABS(param->value)); // sub reglo,[param]
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_r32_m32(dst, reghi, MABS(param->value + 4)); // sbb reghi,[param]
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sub_r32_imm(dst, reglo, param->value); // sub reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_r32_imm(dst, reghi, param->value >> 32); // sbb reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_sub_r32_r32(dst, reglo, param->value); // sub reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_sbb_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // sbb reghi,reghi[param]
}
if (inst->flags == DRCUML_FLAG_Z)
emit_or_r32_r32(dst, reghi, reglo); // or reghi,reglo
else if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_cmp_r64_p64 - sub operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | sub operation to a 64-bit
pair of registers from a 64-bit parameter | [
"sub",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_cmp_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = (inst->flags != DRCUML_FLAG_Z && (inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_sub_r32_m32(dst, reglo, MABS(param->value));
if (saveflags) emit_pushf(dst);
emit_sbb_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
emit_sub_r32_imm(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_sbb_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_sub_r32_r32(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_sbb_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
if (inst->flags == DRCUML_FLAG_Z)
emit_or_r32_r32(dst, reghi, reglo);
else if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_cmp_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"inst",
"->",
"flags",
"!=",
"DRCUML_FLAG_Z",
"&&",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_sub_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"emit_sub_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"emit_sub_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sbb_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"if",
"(",
"inst",
"->",
"flags",
"==",
"DRCUML_FLAG_Z",
")",
"emit_or_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reglo",
")",
";",
"else",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_cmp_r64_p64 - sub operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_cmp_r64_p64",
"-",
"sub",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// sub reglo,[param]",
"// pushf",
"// sbb reghi,[param]",
"// sub reglo,param",
"// pushf",
"// sbb reghi,param >> 32",
"// sub reglo,param",
"// pushf",
"// sbb reghi,reghi[param]",
"// or reghi,reglo"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_and_r64_p64 | void | static void emit_and_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_and_r32_m32(dst, reglo, MABS(param->value)); // and reglo,[param]
if (saveflags) emit_pushf(dst); // pushf
emit_and_r32_m32(dst, reghi, MABS(param->value + 4)); // and reghi,[param]
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_xor_r32_r32(dst, reglo, reglo); // xor reglo,reglo
else
emit_and_r32_imm(dst, reglo, param->value); // and reglo,param
if (saveflags) emit_pushf(dst); // pushf
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
/* skip */;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
emit_xor_r32_r32(dst, reghi, reghi); // xor reghi,reghi
else
emit_and_r32_imm(dst, reghi, param->value >> 32); // and reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_and_r32_r32(dst, reglo, param->value); // and reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_and_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // and reghi,reghi[param]
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_and_r64_p64 - and operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | and operation to a 64-bit
pair of registers from a 64-bit parameter | [
"and",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_and_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_and_r32_m32(dst, reglo, MABS(param->value));
if (saveflags) emit_pushf(dst);
emit_and_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_xor_r32_r32(dst, reglo, reglo);
else
emit_and_r32_imm(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
emit_xor_r32_r32(dst, reghi, reghi);
else
emit_and_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_and_r32_r32(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_and_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_and_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_and_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_and_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"reglo",
")",
";",
"else",
"emit_and_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0xffffffff",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0",
")",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reghi",
")",
";",
"else",
"emit_and_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"emit_and_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_and_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_and_r64_p64 - and operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_and_r64_p64",
"-",
"and",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// and reglo,[param]",
"// pushf",
"// and reghi,[param]",
"/* skip */",
"// xor reglo,reglo",
"// and reglo,param",
"// pushf",
"/* skip */",
"// xor reghi,reghi",
"// and reghi,param >> 32",
"// and reglo,param",
"// pushf",
"// and reghi,reghi[param]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_and_m64_p64 | void | static void emit_and_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_mov_m32_imm(dst, MEMPARAMS, 0); // mov [dest],0
else
emit_and_m32_imm(dst, MEMPARAMS, param->value); // and [dest],param
if (saveflags) emit_pushf(dst); // pushf
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
/* skip */;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
emit_mov_m32_imm(dst, MEMPARAMS + 4, 0); // mov [dest+4],0
else
emit_and_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // and [dest+4],param >> 32
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param); // mov edx:reglo,param
emit_and_m32_r32(dst, MEMPARAMS, reglo); // and [dest],reglo
if (saveflags) emit_pushf(dst); // pushf
emit_and_m32_r32(dst, MEMPARAMS + 4, REG_EDX); // and [dest+4],edx
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_and_m64_p64 - and operation to a 64-bit
memory location from a 64-bit parameter
-------------------------------------------------*/ | and operation to a 64-bit
memory location from a 64-bit parameter | [
"and",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_and_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
;
else if (inst->flags == 0 && (UINT32)param->value == 0)
emit_mov_m32_imm(dst, MEMPARAMS, 0);
else
emit_and_m32_imm(dst, MEMPARAMS, param->value);
if (saveflags) emit_pushf(dst);
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
emit_mov_m32_imm(dst, MEMPARAMS + 4, 0);
else
emit_and_m32_imm(dst, MEMPARAMS + 4, param->value >> 32);
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param);
emit_and_m32_r32(dst, MEMPARAMS, reglo);
if (saveflags) emit_pushf(dst);
emit_and_m32_r32(dst, MEMPARAMS + 4, REG_EDX);
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_and_m64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"0",
")",
";",
"else",
"emit_and_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0xffffffff",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0",
")",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"0",
")",
";",
"else",
"emit_and_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"{",
"int",
"reglo",
"=",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"?",
"param",
"->",
"value",
":",
"REG_EAX",
";",
"emit_mov_r64_p64",
"(",
"drcbe",
",",
"dst",
",",
"reglo",
",",
"REG_EDX",
",",
"param",
")",
";",
"emit_and_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reglo",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_and_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"REG_EDX",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_and_m64_p64 - and operation to a 64-bit
memory location from a 64-bit parameter | [
"emit_and_m64_p64",
"-",
"and",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// mov [dest],0",
"// and [dest],param",
"// pushf",
"/* skip */",
"// mov [dest+4],0",
"// and [dest+4],param >> 32",
"// mov edx:reglo,param",
"// and [dest],reglo",
"// pushf",
"// and [dest+4],edx"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_or_r64_p64 | void | static void emit_or_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_or_r32_m32(dst, reglo, MABS(param->value)); // or reglo,[param]
if (saveflags) emit_pushf(dst); // pushf
emit_or_r32_m32(dst, reghi, MABS(param->value + 4)); // or reghi,[param]
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_r32_imm(dst, reglo, -1); // mov reglo,-1
else
emit_or_r32_imm(dst, reglo, param->value); // or reglo,param
if (saveflags) emit_pushf(dst); // pushf
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
emit_mov_r32_imm(dst, reghi, -1); // mov reghi,-1
else
emit_or_r32_imm(dst, reghi, param->value >> 32); // or reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_or_r32_r32(dst, reglo, param->value); // or reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_or_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // or reghi,reghi[param]
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_or_r64_p64 - or operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | or operation to a 64-bit
pair of registers from a 64-bit parameter | [
"or",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_or_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_or_r32_m32(dst, reglo, MABS(param->value));
if (saveflags) emit_pushf(dst);
emit_or_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_r32_imm(dst, reglo, -1);
else
emit_or_r32_imm(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
emit_mov_r32_imm(dst, reghi, -1);
else
emit_or_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_or_r32_r32(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_or_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_or_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_or_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_or_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"-1",
")",
";",
"else",
"emit_or_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0xffffffff",
")",
"emit_mov_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"-1",
")",
";",
"else",
"emit_or_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"emit_or_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_or_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_or_r64_p64 - or operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_or_r64_p64",
"-",
"or",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// or reglo,[param]",
"// pushf",
"// or reghi,[param]",
"/* skip */",
"// mov reglo,-1",
"// or reglo,param",
"// pushf",
"/* skip */",
"// mov reghi,-1",
"// or reghi,param >> 32",
"// or reglo,param",
"// pushf",
"// or reghi,reghi[param]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_or_m64_p64 | void | static void emit_or_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_m32_imm(dst, MEMPARAMS, -1); // mov [dest],-1
else
emit_or_m32_imm(dst, MEMPARAMS, param->value); // or [dest],param
if (saveflags) emit_pushf(dst); // pushf
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
emit_mov_m32_imm(dst, MEMPARAMS + 4, -1); // mov [dest+4],-1
else
emit_or_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // or [dest+4],param >> 32
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param); // mov edx:reglo,param
emit_or_m32_r32(dst, MEMPARAMS, reglo); // or [dest],reglo
if (saveflags) emit_pushf(dst); // pushf
emit_or_m32_r32(dst, MEMPARAMS + 4, REG_EDX); // or [dest+4],edx
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_or_m64_p64 - or operation to a 64-bit
memory location from a 64-bit parameter
-------------------------------------------------*/ | or operation to a 64-bit
memory location from a 64-bit parameter | [
"or",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_or_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_mov_m32_imm(dst, MEMPARAMS, -1);
else
emit_or_m32_imm(dst, MEMPARAMS, param->value);
if (saveflags) emit_pushf(dst);
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
emit_mov_m32_imm(dst, MEMPARAMS + 4, -1);
else
emit_or_m32_imm(dst, MEMPARAMS + 4, param->value >> 32);
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param);
emit_or_m32_r32(dst, MEMPARAMS, reglo);
if (saveflags) emit_pushf(dst);
emit_or_m32_r32(dst, MEMPARAMS + 4, REG_EDX);
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_or_m64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"-1",
")",
";",
"else",
"emit_or_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0xffffffff",
")",
"emit_mov_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"-1",
")",
";",
"else",
"emit_or_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"{",
"int",
"reglo",
"=",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"?",
"param",
"->",
"value",
":",
"REG_EAX",
";",
"emit_mov_r64_p64",
"(",
"drcbe",
",",
"dst",
",",
"reglo",
",",
"REG_EDX",
",",
"param",
")",
";",
"emit_or_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reglo",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_or_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"REG_EDX",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_or_m64_p64 - or operation to a 64-bit
memory location from a 64-bit parameter | [
"emit_or_m64_p64",
"-",
"or",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// mov [dest],-1",
"// or [dest],param",
"// pushf",
"/* skip */",
"// mov [dest+4],-1",
"// or [dest+4],param >> 32",
"// mov edx:reglo,param",
"// or [dest],reglo",
"// pushf",
"// or [dest+4],edx"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_xor_r64_p64 | void | static void emit_xor_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_xor_r32_m32(dst, reglo, MABS(param->value)); // xor reglo,[param]
if (saveflags) emit_pushf(dst); // pushf
emit_xor_r32_m32(dst, reghi, MABS(param->value + 4)); // xor reghi,[param]
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_not_r32(dst, reglo); // not reglo
else
emit_xor_r32_imm(dst, reglo, param->value); // xor reglo,param
if (saveflags) emit_pushf(dst); // pushf
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
emit_not_r32(dst, reghi); // not reghi
else
emit_xor_r32_imm(dst, reghi, param->value >> 32); // xor reghi,param >> 32
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_xor_r32_r32(dst, reglo, param->value); // xor reglo,param
if (saveflags) emit_pushf(dst); // pushf
emit_xor_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value])); // xor reghi,reghi[param]
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_xor_r64_p64 - xor operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | xor operation to a 64-bit
pair of registers from a 64-bit parameter | [
"xor",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_xor_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_MEMORY)
{
emit_xor_r32_m32(dst, reglo, MABS(param->value));
if (saveflags) emit_pushf(dst);
emit_xor_r32_m32(dst, reghi, MABS(param->value + 4));
}
else if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_not_r32(dst, reglo);
else
emit_xor_r32_imm(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
emit_not_r32(dst, reghi);
else
emit_xor_r32_imm(dst, reghi, param->value >> 32);
}
else if (param->type == DRCUML_PTYPE_INT_REGISTER)
{
emit_xor_r32_r32(dst, reglo, param->value);
if (saveflags) emit_pushf(dst);
emit_xor_r32_m32(dst, reghi, MABS(drcbe->reghi[param->value]));
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_xor_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
"{",
"emit_xor_r32_m32",
"(",
"dst",
",",
"reglo",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_xor_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"param",
"->",
"value",
"+",
"4",
")",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
"emit_not_r32",
"(",
"dst",
",",
"reglo",
")",
";",
"else",
"emit_xor_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0xffffffff",
")",
"emit_not_r32",
"(",
"dst",
",",
"reghi",
")",
";",
"else",
"emit_xor_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"{",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_xor_r32_m32",
"(",
"dst",
",",
"reghi",
",",
"MABS",
"(",
"drcbe",
"->",
"reghi",
"[",
"param",
"->",
"value",
"]",
")",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_xor_r64_p64 - xor operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_xor_r64_p64",
"-",
"xor",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// xor reglo,[param]",
"// pushf",
"// xor reghi,[param]",
"/* skip */",
"// not reglo",
"// xor reglo,param",
"// pushf",
"/* skip */",
"// not reghi",
"// xor reghi,param >> 32",
"// xor reglo,param",
"// pushf",
"// xor reghi,reghi[param]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_xor_m64_p64 | void | static void emit_xor_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_not_m32(dst, MEMPARAMS); // not [dest]
else
emit_xor_m32_imm(dst, MEMPARAMS, param->value); // xor [dest],param
if (saveflags) emit_pushf(dst); // pushf
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
/* skip */;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
emit_not_m32(dst, MEMPARAMS + 4); // not [dest+4]
else
emit_xor_m32_imm(dst, MEMPARAMS + 4, param->value >> 32); // xor [dest+4],param >> 32
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param); // mov edx:reglo,param
emit_xor_m32_r32(dst, MEMPARAMS, reglo); // xor [dest],reglo
if (saveflags) emit_pushf(dst); // pushf
emit_xor_m32_r32(dst, MEMPARAMS + 4, REG_EDX); // xor [dest+4],edx
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_xor_m64_p64 - xor operation to a 64-bit
memory location from a 64-bit parameter
-------------------------------------------------*/ | xor operation to a 64-bit
memory location from a 64-bit parameter | [
"xor",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_xor_m64_p64(drcbe_state *drcbe, x86code **dst, DECLARE_MEMPARAMS, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
if (inst->flags == 0 && (UINT32)param->value == 0)
;
else if (inst->flags == 0 && (UINT32)param->value == 0xffffffff)
emit_not_m32(dst, MEMPARAMS);
else
emit_xor_m32_imm(dst, MEMPARAMS, param->value);
if (saveflags) emit_pushf(dst);
if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0)
;
else if (inst->flags == 0 && (UINT32)(param->value >> 32) == 0xffffffff)
emit_not_m32(dst, MEMPARAMS + 4);
else
emit_xor_m32_imm(dst, MEMPARAMS + 4, param->value >> 32);
}
else
{
int reglo = (param->type == DRCUML_PTYPE_INT_REGISTER) ? param->value : REG_EAX;
emit_mov_r64_p64(drcbe, dst, reglo, REG_EDX, param);
emit_xor_m32_r32(dst, MEMPARAMS, reglo);
if (saveflags) emit_pushf(dst);
emit_xor_m32_r32(dst, MEMPARAMS + 4, REG_EDX);
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_xor_m64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"DECLARE_MEMPARAMS",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"param",
"->",
"value",
"==",
"0xffffffff",
")",
"emit_not_m32",
"(",
"dst",
",",
"MEMPARAMS",
")",
";",
"else",
"emit_xor_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
",",
"param",
"->",
"value",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0",
")",
";",
"else",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"(",
"UINT32",
")",
"(",
"param",
"->",
"value",
">>",
"32",
")",
"==",
"0xffffffff",
")",
"emit_not_m32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
")",
";",
"else",
"emit_xor_m32_imm",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"param",
"->",
"value",
">>",
"32",
")",
";",
"}",
"else",
"{",
"int",
"reglo",
"=",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_INT_REGISTER",
")",
"?",
"param",
"->",
"value",
":",
"REG_EAX",
";",
"emit_mov_r64_p64",
"(",
"drcbe",
",",
"dst",
",",
"reglo",
",",
"REG_EDX",
",",
"param",
")",
";",
"emit_xor_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
",",
"reglo",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_xor_m32_r32",
"(",
"dst",
",",
"MEMPARAMS",
"+",
"4",
",",
"REG_EDX",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_xor_m64_p64 - xor operation to a 64-bit
memory location from a 64-bit parameter | [
"emit_xor_m64_p64",
"-",
"xor",
"operation",
"to",
"a",
"64",
"-",
"bit",
"memory",
"location",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// not [dest]",
"// xor [dest],param",
"// pushf",
"/* skip */",
"// not [dest+4]",
"// xor [dest+4],param >> 32",
"// mov edx:reglo,param",
"// xor [dest],reglo",
"// pushf",
"// xor [dest+4],edx"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_shl_r64_p64 | void | static void emit_shl_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = (inst->flags != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
/* skip */;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_shld_r32_r32_imm(dst, reghi, reglo, 31); // shld reghi,reglo,31
emit_shl_r32_imm(dst, reglo, 31); // shl reglo,31
count -= 31;
}
else
{
emit_mov_r32_r32(dst, reghi, reglo); // mov reghi,reglo
emit_xor_r32_r32(dst, reglo, reglo); // xor reglo,reglo
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_shld_r32_r32_imm(dst, reghi, reglo, count); // shld reghi,reglo,count
if (saveflags) emit_pushf(dst); // pushf
emit_shl_r32_imm(dst, reglo, count); // shl reglo,count
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_shld_r32_r32_imm(dst, reghi, reglo, 31); // shld reghi,reglo,31
emit_shl_r32_imm(dst, reglo, 31); // shl reglo,31
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip2); // jz skip2
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_shld_r32_r32_imm(dst, reghi, reglo, 31); // shld reghi,reglo,31
emit_shl_r32_imm(dst, reglo, 31); // shl reglo,31
resolve_link(dst, &skip2); // skip2:
}
else
{
emit_mov_r32_r32(dst, reghi, reglo); // mov reghi,reglo
emit_xor_r32_r32(dst, reglo, reglo); // xor reglo,reglo
}
resolve_link(dst, &skip1); // skip1:
emit_shld_r32_r32_cl(dst, reghi, reglo); // shld reghi,reglo,cl
if (saveflags) emit_pushf(dst); // pushf
emit_shl_r32_cl(dst, reglo); // shl reglo,cl
}
if (saveflags)
emit_combine_z_shl_flags(dst);
} | /*-------------------------------------------------
emit_shl_r64_p64 - shl operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | shl operation to a 64-bit
pair of registers from a 64-bit parameter | [
"shl",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_shl_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = (inst->flags != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_shld_r32_r32_imm(dst, reghi, reglo, 31);
emit_shl_r32_imm(dst, reglo, 31);
count -= 31;
}
else
{
emit_mov_r32_r32(dst, reghi, reglo);
emit_xor_r32_r32(dst, reglo, reglo);
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_shld_r32_r32_imm(dst, reghi, reglo, count);
if (saveflags) emit_pushf(dst);
emit_shl_r32_imm(dst, reglo, count);
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_r32_p32(drcbe, dst, REG_ECX, param);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip1);
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_shld_r32_r32_imm(dst, reghi, reglo, 31);
emit_shl_r32_imm(dst, reglo, 31);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip2);
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_shld_r32_r32_imm(dst, reghi, reglo, 31);
emit_shl_r32_imm(dst, reglo, 31);
resolve_link(dst, &skip2);
}
else
{
emit_mov_r32_r32(dst, reghi, reglo);
emit_xor_r32_r32(dst, reglo, reglo);
}
resolve_link(dst, &skip1);
emit_shld_r32_r32_cl(dst, reghi, reglo);
if (saveflags) emit_pushf(dst);
emit_shl_r32_cl(dst, reglo);
}
if (saveflags)
emit_combine_z_shl_flags(dst);
} | [
"static",
"void",
"emit_shl_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"int",
"count",
"=",
"param",
"->",
"value",
"&",
"63",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"count",
"==",
"0",
")",
";",
"else",
"{",
"while",
"(",
"count",
">=",
"32",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"reglo",
",",
"31",
")",
";",
"emit_shl_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"31",
")",
";",
"count",
"-=",
"31",
";",
"}",
"else",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reglo",
")",
";",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"reglo",
")",
";",
"count",
"-=",
"32",
";",
"}",
"}",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"count",
">",
"0",
")",
"{",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"reglo",
",",
"count",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_shl_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"count",
")",
";",
"}",
"}",
"}",
"else",
"{",
"emit_link",
"skip1",
",",
"skip2",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"REG_ECX",
",",
"param",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip1",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"reglo",
",",
"31",
")",
";",
"emit_shl_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"31",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip2",
")",
";",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"reglo",
",",
"31",
")",
";",
"emit_shl_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"31",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skip2",
")",
";",
"}",
"else",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reglo",
")",
";",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"reglo",
")",
";",
"}",
"resolve_link",
"(",
"dst",
",",
"&",
"skip1",
")",
";",
"emit_shld_r32_r32_cl",
"(",
"dst",
",",
"reghi",
",",
"reglo",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_shl_r32_cl",
"(",
"dst",
",",
"reglo",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_shl_flags",
"(",
"dst",
")",
";",
"}"
] | emit_shl_r64_p64 - shl operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_shl_r64_p64",
"-",
"shl",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// shld reghi,reglo,31",
"// shl reglo,31",
"// mov reghi,reglo",
"// xor reglo,reglo",
"// shld reghi,reglo,count",
"// pushf",
"// shl reglo,count",
"// mov ecx,param",
"// test ecx,0x20",
"// jz skip1",
"// sub ecx,31",
"// shld reghi,reglo,31",
"// shl reglo,31",
"// test ecx,0x20",
"// jz skip2",
"// sub ecx,31",
"// shld reghi,reglo,31",
"// shl reglo,31",
"// skip2:",
"// mov reghi,reglo",
"// xor reglo,reglo",
"// skip1:",
"// shld reghi,reglo,cl",
"// pushf",
"// shl reglo,cl"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_shr_r64_p64 | void | static void emit_shr_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
/* skip */;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31
emit_shr_r32_imm(dst, reghi, 31); // shr reghi,31
count -= 31;
}
else
{
emit_mov_r32_r32(dst, reglo, reghi); // mov reglo,reghi
emit_xor_r32_r32(dst, reghi, reghi); // xor reghi,reghi
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_shrd_r32_r32_imm(dst, reglo, reghi, count); // shrd reglo,reghi,count
if (saveflags) emit_pushf(dst); // pushf
emit_shr_r32_imm(dst, reghi, count); // shr reghi,count
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31
emit_shr_r32_imm(dst, reghi, 31); // shr reghi,31
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip2); // jz skip2
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31
emit_shr_r32_imm(dst, reghi, 31); // shr reghi,31
resolve_link(dst, &skip2); // skip2:
}
else
{
emit_mov_r32_r32(dst, reglo, reghi); // mov reglo,reghi
emit_xor_r32_r32(dst, reghi, reghi); // xor reghi,reghi
}
resolve_link(dst, &skip1); // skip1:
emit_shrd_r32_r32_cl(dst, reglo, reghi); // shrd reglo,reghi,cl
if (saveflags) emit_pushf(dst); // pushf
emit_shr_r32_cl(dst, reghi); // shr reghi,cl
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_shr_r64_p64 - shr operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | shr operation to a 64-bit
pair of registers from a 64-bit parameter | [
"shr",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_shr_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31);
emit_shr_r32_imm(dst, reghi, 31);
count -= 31;
}
else
{
emit_mov_r32_r32(dst, reglo, reghi);
emit_xor_r32_r32(dst, reghi, reghi);
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_shrd_r32_r32_imm(dst, reglo, reghi, count);
if (saveflags) emit_pushf(dst);
emit_shr_r32_imm(dst, reghi, count);
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_r32_p32(drcbe, dst, REG_ECX, param);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip1);
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31);
emit_shr_r32_imm(dst, reghi, 31);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip2);
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31);
emit_shr_r32_imm(dst, reghi, 31);
resolve_link(dst, &skip2);
}
else
{
emit_mov_r32_r32(dst, reglo, reghi);
emit_xor_r32_r32(dst, reghi, reghi);
}
resolve_link(dst, &skip1);
emit_shrd_r32_r32_cl(dst, reglo, reghi);
if (saveflags) emit_pushf(dst);
emit_shr_r32_cl(dst, reghi);
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_shr_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"int",
"count",
"=",
"param",
"->",
"value",
"&",
"63",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"count",
"==",
"0",
")",
";",
"else",
"{",
"while",
"(",
"count",
">=",
"32",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_shr_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"31",
")",
";",
"count",
"-=",
"31",
";",
"}",
"else",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"reghi",
")",
";",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reghi",
")",
";",
"count",
"-=",
"32",
";",
"}",
"}",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"count",
">",
"0",
")",
"{",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"count",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_shr_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"count",
")",
";",
"}",
"}",
"}",
"else",
"{",
"emit_link",
"skip1",
",",
"skip2",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"REG_ECX",
",",
"param",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip1",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_shr_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"31",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip2",
")",
";",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_shr_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"31",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skip2",
")",
";",
"}",
"else",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"reghi",
")",
";",
"emit_xor_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reghi",
")",
";",
"}",
"resolve_link",
"(",
"dst",
",",
"&",
"skip1",
")",
";",
"emit_shrd_r32_r32_cl",
"(",
"dst",
",",
"reglo",
",",
"reghi",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_shr_r32_cl",
"(",
"dst",
",",
"reghi",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_shr_r64_p64 - shr operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_shr_r64_p64",
"-",
"shr",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// shrd reglo,reghi,31",
"// shr reghi,31",
"// mov reglo,reghi",
"// xor reghi,reghi",
"// shrd reglo,reghi,count",
"// pushf",
"// shr reghi,count",
"// mov ecx,param",
"// test ecx,0x20",
"// jz skip1",
"// sub ecx,31",
"// shrd reglo,reghi,31",
"// shr reghi,31",
"// test ecx,0x20",
"// jz skip2",
"// sub ecx,31",
"// shrd reglo,reghi,31",
"// shr reghi,31",
"// skip2:",
"// mov reglo,reghi",
"// xor reghi,reghi",
"// skip1:",
"// shrd reglo,reghi,cl",
"// pushf",
"// shr reghi,cl"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_sar_r64_p64 | void | static void emit_sar_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
/* skip */;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31
emit_sar_r32_imm(dst, reghi, 31); // sar reghi,31
count -= 31;
}
else
{
emit_mov_r32_r32(dst, reglo, reghi); // mov reglo,reghi
emit_sar_r32_imm(dst, reghi, 31); // sar reghi,31
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_shrd_r32_r32_imm(dst, reglo, reghi, count); // shrd reglo,reghi,count
if (saveflags) emit_pushf(dst); // pushf
emit_sar_r32_imm(dst, reghi, count); // sar reghi,count
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31
emit_sar_r32_imm(dst, reghi, 31); // sar reghi,31
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip2); // jz skip
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31
emit_sar_r32_imm(dst, reghi, 31); // sar reghi,31
resolve_link(dst, &skip2); // skip2:
}
else
{
emit_mov_r32_r32(dst, reglo, reghi); // mov reglo,reghi
emit_sar_r32_imm(dst, reghi, 31); // sar reghi,31
}
resolve_link(dst, &skip1); // skip1:
emit_shrd_r32_r32_cl(dst, reglo, reghi); // shrd reglo,reghi,cl
if (saveflags) emit_pushf(dst); // pushf
emit_sar_r32_cl(dst, reghi); // sar reghi,cl
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_sar_r64_p64 - sar operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | sar operation to a 64-bit
pair of registers from a 64-bit parameter | [
"sar",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_sar_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31);
emit_sar_r32_imm(dst, reghi, 31);
count -= 31;
}
else
{
emit_mov_r32_r32(dst, reglo, reghi);
emit_sar_r32_imm(dst, reghi, 31);
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_shrd_r32_r32_imm(dst, reglo, reghi, count);
if (saveflags) emit_pushf(dst);
emit_sar_r32_imm(dst, reghi, count);
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_r32_p32(drcbe, dst, REG_ECX, param);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip1);
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31);
emit_sar_r32_imm(dst, reghi, 31);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip2);
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31);
emit_sar_r32_imm(dst, reghi, 31);
resolve_link(dst, &skip2);
}
else
{
emit_mov_r32_r32(dst, reglo, reghi);
emit_sar_r32_imm(dst, reghi, 31);
}
resolve_link(dst, &skip1);
emit_shrd_r32_r32_cl(dst, reglo, reghi);
if (saveflags) emit_pushf(dst);
emit_sar_r32_cl(dst, reghi);
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_sar_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"int",
"count",
"=",
"param",
"->",
"value",
"&",
"63",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"count",
"==",
"0",
")",
";",
"else",
"{",
"while",
"(",
"count",
">=",
"32",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_sar_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"31",
")",
";",
"count",
"-=",
"31",
";",
"}",
"else",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"reghi",
")",
";",
"emit_sar_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"31",
")",
";",
"count",
"-=",
"32",
";",
"}",
"}",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"count",
">",
"0",
")",
"{",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"count",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sar_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"count",
")",
";",
"}",
"}",
"}",
"else",
"{",
"emit_link",
"skip1",
",",
"skip2",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"REG_ECX",
",",
"param",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip1",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_sar_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"31",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip2",
")",
";",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_sar_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"31",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skip2",
")",
";",
"}",
"else",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"reglo",
",",
"reghi",
")",
";",
"emit_sar_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"31",
")",
";",
"}",
"resolve_link",
"(",
"dst",
",",
"&",
"skip1",
")",
";",
"emit_shrd_r32_r32_cl",
"(",
"dst",
",",
"reglo",
",",
"reghi",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_sar_r32_cl",
"(",
"dst",
",",
"reghi",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_sar_r64_p64 - sar operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_sar_r64_p64",
"-",
"sar",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// shrd reglo,reghi,31",
"// sar reghi,31",
"// mov reglo,reghi",
"// sar reghi,31",
"// shrd reglo,reghi,count",
"// pushf",
"// sar reghi,count",
"// mov ecx,param",
"// test ecx,0x20",
"// jz skip1",
"// sub ecx,31",
"// shrd reglo,reghi,31",
"// sar reghi,31",
"// test ecx,0x20",
"// jz skip",
"// sub ecx,31",
"// shrd reglo,reghi,31",
"// sar reghi,31",
"// skip2:",
"// mov reglo,reghi",
"// sar reghi,31",
"// skip1:",
"// shrd reglo,reghi,cl",
"// pushf",
"// sar reghi,cl"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_rol_r64_p64 | void | static void emit_rol_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
/* skip */;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_mov_r32_r32(dst, REG_ECX, reglo); // mov ecx,reglo
emit_shld_r32_r32_imm(dst, reglo, reghi, 31); // shld reglo,reghi,31
emit_shld_r32_r32_imm(dst, reghi, REG_ECX, 31); // shld reghi,ecx,31
count -= 31;
}
else
{
emit_xchg_r32_r32(dst, reghi, reglo); // xchg reghi,reglo
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_mov_r32_r32(dst, REG_ECX, reglo); // mov ecx,reglo
emit_shld_r32_r32_imm(dst, reglo, reghi, count); // shld reglo,reghi,count
if (saveflags) emit_pushf(dst); // pushf
emit_shld_r32_r32_imm(dst, reghi, REG_ECX, count); // shld reghi,ecx,count
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_m32_r32(dst, MBD(REG_ESP, -8), REG_EBX); // mov [esp-8],ebx
emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_mov_r32_r32(dst, REG_EBX, reglo); // mov ebx,reglo
emit_shld_r32_r32_imm(dst, reglo, reghi, 31); // shld reglo,reghi,31
emit_shld_r32_r32_imm(dst, reghi, REG_EBX, 31); // shld reghi,ebx,31
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip2); // jz skip2
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_mov_r32_r32(dst, REG_EBX, reglo); // mov ebx,reglo
emit_shld_r32_r32_imm(dst, reglo, reghi, 31); // shld reglo,reghi,31
emit_shld_r32_r32_imm(dst, reghi, REG_EBX, 31); // shld reghi,ebx,31
resolve_link(dst, &skip2); // skip2:
}
else
emit_xchg_r32_r32(dst, reghi, reglo); // xchg reghi,reglo
resolve_link(dst, &skip1); // skip1:
emit_mov_r32_r32(dst, REG_EBX, reglo); // mov ebx,reglo
emit_shld_r32_r32_cl(dst, reglo, reghi); // shld reglo,reghi,cl
if (saveflags) emit_pushf(dst); // pushf
emit_shld_r32_r32_cl(dst, reghi, REG_EBX); // shld reghi,ebx,cl
emit_mov_r32_m32(dst, REG_EBX, MBD(REG_ESP, saveflags ? -4 : -8)); // mov ebx,[esp-8]
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_rol_r64_p64 - rol operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | rol operation to a 64-bit
pair of registers from a 64-bit parameter | [
"rol",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_rol_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_mov_r32_r32(dst, REG_ECX, reglo);
emit_shld_r32_r32_imm(dst, reglo, reghi, 31);
emit_shld_r32_r32_imm(dst, reghi, REG_ECX, 31);
count -= 31;
}
else
{
emit_xchg_r32_r32(dst, reghi, reglo);
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_mov_r32_r32(dst, REG_ECX, reglo);
emit_shld_r32_r32_imm(dst, reglo, reghi, count);
if (saveflags) emit_pushf(dst);
emit_shld_r32_r32_imm(dst, reghi, REG_ECX, count);
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_m32_r32(dst, MBD(REG_ESP, -8), REG_EBX);
emit_mov_r32_p32(drcbe, dst, REG_ECX, param);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip1);
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_mov_r32_r32(dst, REG_EBX, reglo);
emit_shld_r32_r32_imm(dst, reglo, reghi, 31);
emit_shld_r32_r32_imm(dst, reghi, REG_EBX, 31);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip2);
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_mov_r32_r32(dst, REG_EBX, reglo);
emit_shld_r32_r32_imm(dst, reglo, reghi, 31);
emit_shld_r32_r32_imm(dst, reghi, REG_EBX, 31);
resolve_link(dst, &skip2);
}
else
emit_xchg_r32_r32(dst, reghi, reglo);
resolve_link(dst, &skip1);
emit_mov_r32_r32(dst, REG_EBX, reglo);
emit_shld_r32_r32_cl(dst, reglo, reghi);
if (saveflags) emit_pushf(dst);
emit_shld_r32_r32_cl(dst, reghi, REG_EBX);
emit_mov_r32_m32(dst, REG_EBX, MBD(REG_ESP, saveflags ? -4 : -8));
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_rol_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"int",
"count",
"=",
"param",
"->",
"value",
"&",
"63",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"count",
"==",
"0",
")",
";",
"else",
"{",
"while",
"(",
"count",
">=",
"32",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_ECX",
",",
"reglo",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"REG_ECX",
",",
"31",
")",
";",
"count",
"-=",
"31",
";",
"}",
"else",
"{",
"emit_xchg_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reglo",
")",
";",
"count",
"-=",
"32",
";",
"}",
"}",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"count",
">",
"0",
")",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_ECX",
",",
"reglo",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"count",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"REG_ECX",
",",
"count",
")",
";",
"}",
"}",
"}",
"else",
"{",
"emit_link",
"skip1",
",",
"skip2",
";",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MBD",
"(",
"REG_ESP",
",",
"-8",
")",
",",
"REG_EBX",
")",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"REG_ECX",
",",
"param",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip1",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_EBX",
",",
"reglo",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"REG_EBX",
",",
"31",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip2",
")",
";",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_EBX",
",",
"reglo",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_shld_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"REG_EBX",
",",
"31",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skip2",
")",
";",
"}",
"else",
"emit_xchg_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reglo",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skip1",
")",
";",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_EBX",
",",
"reglo",
")",
";",
"emit_shld_r32_r32_cl",
"(",
"dst",
",",
"reglo",
",",
"reghi",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_shld_r32_r32_cl",
"(",
"dst",
",",
"reghi",
",",
"REG_EBX",
")",
";",
"emit_mov_r32_m32",
"(",
"dst",
",",
"REG_EBX",
",",
"MBD",
"(",
"REG_ESP",
",",
"saveflags",
"?",
"-4",
":",
"-8",
")",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_rol_r64_p64 - rol operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_rol_r64_p64",
"-",
"rol",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// mov ecx,reglo",
"// shld reglo,reghi,31",
"// shld reghi,ecx,31",
"// xchg reghi,reglo",
"// mov ecx,reglo",
"// shld reglo,reghi,count",
"// pushf",
"// shld reghi,ecx,count",
"// mov [esp-8],ebx",
"// mov ecx,param",
"// test ecx,0x20",
"// jz skip1",
"// sub ecx,31",
"// mov ebx,reglo",
"// shld reglo,reghi,31",
"// shld reghi,ebx,31",
"// test ecx,0x20",
"// jz skip2",
"// sub ecx,31",
"// mov ebx,reglo",
"// shld reglo,reghi,31",
"// shld reghi,ebx,31",
"// skip2:",
"// xchg reghi,reglo",
"// skip1:",
"// mov ebx,reglo",
"// shld reglo,reghi,cl",
"// pushf",
"// shld reghi,ebx,cl",
"// mov ebx,[esp-8]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_ror_r64_p64 | void | static void emit_ror_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
/* skip */;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_mov_r32_r32(dst, REG_ECX, reglo); // mov ecx,reglo
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31
emit_shrd_r32_r32_imm(dst, reghi, REG_ECX, 31); // shrd reghi,ecx,31
count -= 31;
}
else
{
emit_xchg_r32_r32(dst, reghi, reglo); // xchg reghi,reglo
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_mov_r32_r32(dst, REG_ECX, reglo); // mov ecx,reglo
emit_shrd_r32_r32_imm(dst, reglo, reghi, count); // shrd reglo,reghi,count
if (saveflags) emit_pushf(dst); // pushf
emit_shrd_r32_r32_imm(dst, reghi, REG_ECX, count); // shrd reghi,ecx,count
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_m32_r32(dst, MBD(REG_ESP, -8), REG_EBX); // mov [esp-8],ebx
emit_mov_r32_p32(drcbe, dst, REG_ECX, param); // mov ecx,param
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip1); // jz skip1
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_mov_r32_r32(dst, REG_EBX, reglo); // mov ebx,reglo
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31
emit_shrd_r32_r32_imm(dst, reghi, REG_EBX, 31); // shrd reghi,ebx,31
emit_test_r32_imm(dst, REG_ECX, 0x20); // test ecx,0x20
emit_jcc_short_link(dst, COND_Z, &skip2); // jz skip2
emit_sub_r32_imm(dst, REG_ECX, 31); // sub ecx,31
emit_mov_r32_r32(dst, REG_EBX, reglo); // mov ebx,reglo
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31); // shrd reglo,reghi,31
emit_shrd_r32_r32_imm(dst, reghi, REG_EBX, 31); // shrd reghi,ebx,31
resolve_link(dst, &skip2); // skip2:
}
else
emit_xchg_r32_r32(dst, reghi, reglo); // xchg reghi,reglo
resolve_link(dst, &skip1); // skip1:
emit_mov_r32_r32(dst, REG_EBX, reglo); // mov ebx,reglo
emit_shrd_r32_r32_cl(dst, reglo, reghi); // shrd reglo,reghi,cl
if (saveflags) emit_pushf(dst); // pushf
emit_shrd_r32_r32_cl(dst, reghi, REG_EBX); // shrd reghi,ebx,cl
emit_mov_r32_m32(dst, REG_EBX, MBD(REG_ESP, saveflags ? -4 : -8)); // mov ebx,[esp-8]
}
if (saveflags)
emit_combine_z_flags(dst);
} | /*-------------------------------------------------
emit_ror_r64_p64 - ror operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | ror operation to a 64-bit
pair of registers from a 64-bit parameter | [
"ror",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_ror_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
if (param->type == DRCUML_PTYPE_IMMEDIATE)
{
int count = param->value & 63;
if (inst->flags == 0 && count == 0)
;
else
{
while (count >= 32)
{
if (inst->flags != 0)
{
emit_mov_r32_r32(dst, REG_ECX, reglo);
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31);
emit_shrd_r32_r32_imm(dst, reghi, REG_ECX, 31);
count -= 31;
}
else
{
emit_xchg_r32_r32(dst, reghi, reglo);
count -= 32;
}
}
if (inst->flags != 0 || count > 0)
{
emit_mov_r32_r32(dst, REG_ECX, reglo);
emit_shrd_r32_r32_imm(dst, reglo, reghi, count);
if (saveflags) emit_pushf(dst);
emit_shrd_r32_r32_imm(dst, reghi, REG_ECX, count);
}
}
}
else
{
emit_link skip1, skip2;
emit_mov_m32_r32(dst, MBD(REG_ESP, -8), REG_EBX);
emit_mov_r32_p32(drcbe, dst, REG_ECX, param);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip1);
if (inst->flags != 0)
{
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_mov_r32_r32(dst, REG_EBX, reglo);
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31);
emit_shrd_r32_r32_imm(dst, reghi, REG_EBX, 31);
emit_test_r32_imm(dst, REG_ECX, 0x20);
emit_jcc_short_link(dst, COND_Z, &skip2);
emit_sub_r32_imm(dst, REG_ECX, 31);
emit_mov_r32_r32(dst, REG_EBX, reglo);
emit_shrd_r32_r32_imm(dst, reglo, reghi, 31);
emit_shrd_r32_r32_imm(dst, reghi, REG_EBX, 31);
resolve_link(dst, &skip2);
}
else
emit_xchg_r32_r32(dst, reghi, reglo);
resolve_link(dst, &skip1);
emit_mov_r32_r32(dst, REG_EBX, reglo);
emit_shrd_r32_r32_cl(dst, reglo, reghi);
if (saveflags) emit_pushf(dst);
emit_shrd_r32_r32_cl(dst, reghi, REG_EBX);
emit_mov_r32_m32(dst, REG_EBX, MBD(REG_ESP, saveflags ? -4 : -8));
}
if (saveflags)
emit_combine_z_flags(dst);
} | [
"static",
"void",
"emit_ror_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"if",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_IMMEDIATE",
")",
"{",
"int",
"count",
"=",
"param",
"->",
"value",
"&",
"63",
";",
"if",
"(",
"inst",
"->",
"flags",
"==",
"0",
"&&",
"count",
"==",
"0",
")",
";",
"else",
"{",
"while",
"(",
"count",
">=",
"32",
")",
"{",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_ECX",
",",
"reglo",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"REG_ECX",
",",
"31",
")",
";",
"count",
"-=",
"31",
";",
"}",
"else",
"{",
"emit_xchg_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reglo",
")",
";",
"count",
"-=",
"32",
";",
"}",
"}",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
"||",
"count",
">",
"0",
")",
"{",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_ECX",
",",
"reglo",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"count",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"REG_ECX",
",",
"count",
")",
";",
"}",
"}",
"}",
"else",
"{",
"emit_link",
"skip1",
",",
"skip2",
";",
"emit_mov_m32_r32",
"(",
"dst",
",",
"MBD",
"(",
"REG_ESP",
",",
"-8",
")",
",",
"REG_EBX",
")",
";",
"emit_mov_r32_p32",
"(",
"drcbe",
",",
"dst",
",",
"REG_ECX",
",",
"param",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip1",
")",
";",
"if",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
"{",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_EBX",
",",
"reglo",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"REG_EBX",
",",
"31",
")",
";",
"emit_test_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"0x20",
")",
";",
"emit_jcc_short_link",
"(",
"dst",
",",
"COND_Z",
",",
"&",
"skip2",
")",
";",
"emit_sub_r32_imm",
"(",
"dst",
",",
"REG_ECX",
",",
"31",
")",
";",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_EBX",
",",
"reglo",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"reghi",
",",
"31",
")",
";",
"emit_shrd_r32_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"REG_EBX",
",",
"31",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skip2",
")",
";",
"}",
"else",
"emit_xchg_r32_r32",
"(",
"dst",
",",
"reghi",
",",
"reglo",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skip1",
")",
";",
"emit_mov_r32_r32",
"(",
"dst",
",",
"REG_EBX",
",",
"reglo",
")",
";",
"emit_shrd_r32_r32_cl",
"(",
"dst",
",",
"reglo",
",",
"reghi",
")",
";",
"if",
"(",
"saveflags",
")",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_shrd_r32_r32_cl",
"(",
"dst",
",",
"reghi",
",",
"REG_EBX",
")",
";",
"emit_mov_r32_m32",
"(",
"dst",
",",
"REG_EBX",
",",
"MBD",
"(",
"REG_ESP",
",",
"saveflags",
"?",
"-4",
":",
"-8",
")",
")",
";",
"}",
"if",
"(",
"saveflags",
")",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}"
] | emit_ror_r64_p64 - ror operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_ror_r64_p64",
"-",
"ror",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"/* skip */",
"// mov ecx,reglo",
"// shrd reglo,reghi,31",
"// shrd reghi,ecx,31",
"// xchg reghi,reglo",
"// mov ecx,reglo",
"// shrd reglo,reghi,count",
"// pushf",
"// shrd reghi,ecx,count",
"// mov [esp-8],ebx",
"// mov ecx,param",
"// test ecx,0x20",
"// jz skip1",
"// sub ecx,31",
"// mov ebx,reglo",
"// shrd reglo,reghi,31",
"// shrd reghi,ebx,31",
"// test ecx,0x20",
"// jz skip2",
"// sub ecx,31",
"// mov ebx,reglo",
"// shrd reglo,reghi,31",
"// shrd reghi,ebx,31",
"// skip2:",
"// xchg reghi,reglo",
"// skip1:",
"// mov ebx,reglo",
"// shrd reglo,reghi,cl",
"// pushf",
"// shrd reghi,ebx,cl",
"// mov ebx,[esp-8]"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_rcl_r64_p64 | void | static void emit_rcl_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
emit_link skipall, skiploop;
x86code *loop;
emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); // mov ecx,param
if (!saveflags)
{
loop = *dst; // loop:
emit_jecxz_link(dst, &skipall); // jecxz skipall
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1)); // lea ecx,[ecx-1]
emit_rcl_r32_imm(dst, reglo, 1); // rcl reglo,1
emit_rcl_r32_imm(dst, reghi, 1); // rcl reghi,1
emit_jmp(dst, loop); // jmp loop
resolve_link(dst, &skipall); // skipall:
}
else
{
emit_jecxz_link(dst, &skipall); // jecxz skipall
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1)); // lea ecx,[ecx-1]
loop = *dst; // loop:
emit_jecxz_link(dst, &skiploop); // jecxz skiploop
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1)); // lea ecx,[ecx-1]
emit_rcl_r32_imm(dst, reglo, 1); // rcl reglo,1
emit_rcl_r32_imm(dst, reghi, 1); // rcl reghi,1
emit_jmp(dst, loop); // jmp loop
resolve_link(dst, &skiploop); // skiploop:
emit_rcl_r32_imm(dst, reglo, 1); // rcl reglo,1
emit_pushf(dst); // pushf
emit_rcl_r32_imm(dst, reghi, 1); // rcl reghi,1
resolve_link(dst, &skipall); // skipall:
emit_combine_z_flags(dst);
}
} | /*-------------------------------------------------
emit_rcl_r64_p64 - rcl operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | rcl operation to a 64-bit
pair of registers from a 64-bit parameter | [
"rcl",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_rcl_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = ((inst->flags & DRCUML_FLAG_Z) != 0);
emit_link skipall, skiploop;
x86code *loop;
emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param);
if (!saveflags)
{
loop = *dst;
emit_jecxz_link(dst, &skipall);
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1));
emit_rcl_r32_imm(dst, reglo, 1);
emit_rcl_r32_imm(dst, reghi, 1);
emit_jmp(dst, loop);
resolve_link(dst, &skipall);
}
else
{
emit_jecxz_link(dst, &skipall);
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1));
loop = *dst;
emit_jecxz_link(dst, &skiploop);
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1));
emit_rcl_r32_imm(dst, reglo, 1);
emit_rcl_r32_imm(dst, reghi, 1);
emit_jmp(dst, loop);
resolve_link(dst, &skiploop);
emit_rcl_r32_imm(dst, reglo, 1);
emit_pushf(dst);
emit_rcl_r32_imm(dst, reghi, 1);
resolve_link(dst, &skipall);
emit_combine_z_flags(dst);
}
} | [
"static",
"void",
"emit_rcl_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"(",
"inst",
"->",
"flags",
"&",
"DRCUML_FLAG_Z",
")",
"!=",
"0",
")",
";",
"emit_link",
"skipall",
",",
"skiploop",
";",
"x86code",
"*",
"loop",
";",
"emit_mov_r32_p32_keepflags",
"(",
"drcbe",
",",
"dst",
",",
"REG_ECX",
",",
"param",
")",
";",
"if",
"(",
"!",
"saveflags",
")",
"{",
"loop",
"=",
"*",
"dst",
";",
"emit_jecxz_link",
"(",
"dst",
",",
"&",
"skipall",
")",
";",
"emit_lea_r32_m32",
"(",
"dst",
",",
"REG_ECX",
",",
"MBD",
"(",
"REG_ECX",
",",
"-1",
")",
")",
";",
"emit_rcl_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"1",
")",
";",
"emit_rcl_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"1",
")",
";",
"emit_jmp",
"(",
"dst",
",",
"loop",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skipall",
")",
";",
"}",
"else",
"{",
"emit_jecxz_link",
"(",
"dst",
",",
"&",
"skipall",
")",
";",
"emit_lea_r32_m32",
"(",
"dst",
",",
"REG_ECX",
",",
"MBD",
"(",
"REG_ECX",
",",
"-1",
")",
")",
";",
"loop",
"=",
"*",
"dst",
";",
"emit_jecxz_link",
"(",
"dst",
",",
"&",
"skiploop",
")",
";",
"emit_lea_r32_m32",
"(",
"dst",
",",
"REG_ECX",
",",
"MBD",
"(",
"REG_ECX",
",",
"-1",
")",
")",
";",
"emit_rcl_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"1",
")",
";",
"emit_rcl_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"1",
")",
";",
"emit_jmp",
"(",
"dst",
",",
"loop",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skiploop",
")",
";",
"emit_rcl_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"1",
")",
";",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_rcl_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"1",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skipall",
")",
";",
"emit_combine_z_flags",
"(",
"dst",
")",
";",
"}",
"}"
] | emit_rcl_r64_p64 - rcl operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_rcl_r64_p64",
"-",
"rcl",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// mov ecx,param",
"// loop:",
"// jecxz skipall",
"// lea ecx,[ecx-1]",
"// rcl reglo,1",
"// rcl reghi,1",
"// jmp loop",
"// skipall:",
"// jecxz skipall",
"// lea ecx,[ecx-1]",
"// loop:",
"// jecxz skiploop",
"// lea ecx,[ecx-1]",
"// rcl reglo,1",
"// rcl reghi,1",
"// jmp loop",
"// skiploop:",
"// rcl reglo,1",
"// pushf",
"// rcl reghi,1",
"// skipall:"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_rcr_r64_p64 | void | static void emit_rcr_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = (inst->flags != 0);
emit_link skipall, skiploop;
x86code *loop;
emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param); // mov ecx,param
if (!saveflags)
{
loop = *dst; // loop:
emit_jecxz_link(dst, &skipall); // jecxz skipall
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1)); // lea ecx,[ecx-1]
emit_rcr_r32_imm(dst, reghi, 1); // rcr reghi,1
emit_rcr_r32_imm(dst, reglo, 1); // rcr reglo,1
emit_jmp(dst, loop); // jmp loop
resolve_link(dst, &skipall); // skipall:
}
else
{
emit_jecxz_link(dst, &skipall); // jecxz skipall
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1)); // lea ecx,[ecx-1]
loop = *dst; // loop:
emit_jecxz_link(dst, &skiploop); // jecxz skiploop
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1)); // lea ecx,[ecx-1]
emit_rcr_r32_imm(dst, reghi, 1); // rcr reghi,1
emit_rcr_r32_imm(dst, reglo, 1); // rcr reglo,1
emit_jmp(dst, loop); // jmp loop
resolve_link(dst, &skiploop); // skiploop:
emit_rcr_r32_imm(dst, reghi, 1); // rcr reghi,1
emit_pushf(dst); // pushf
emit_rcr_r32_imm(dst, reglo, 1); // rcr reglo,1
resolve_link(dst, &skipall); // skipall:
emit_combine_z_shl_flags(dst);
}
} | /*-------------------------------------------------
emit_rcr_r64_p64 - rcr operation to a 64-bit
pair of registers from a 64-bit parameter
-------------------------------------------------*/ | rcr operation to a 64-bit
pair of registers from a 64-bit parameter | [
"rcr",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | static void emit_rcr_r64_p64(drcbe_state *drcbe, x86code **dst, UINT8 reglo, UINT8 reghi, const drcuml_parameter *param, const drcuml_instruction *inst)
{
int saveflags = (inst->flags != 0);
emit_link skipall, skiploop;
x86code *loop;
emit_mov_r32_p32_keepflags(drcbe, dst, REG_ECX, param);
if (!saveflags)
{
loop = *dst;
emit_jecxz_link(dst, &skipall);
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1));
emit_rcr_r32_imm(dst, reghi, 1);
emit_rcr_r32_imm(dst, reglo, 1);
emit_jmp(dst, loop);
resolve_link(dst, &skipall);
}
else
{
emit_jecxz_link(dst, &skipall);
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1));
loop = *dst;
emit_jecxz_link(dst, &skiploop);
emit_lea_r32_m32(dst, REG_ECX, MBD(REG_ECX, -1));
emit_rcr_r32_imm(dst, reghi, 1);
emit_rcr_r32_imm(dst, reglo, 1);
emit_jmp(dst, loop);
resolve_link(dst, &skiploop);
emit_rcr_r32_imm(dst, reghi, 1);
emit_pushf(dst);
emit_rcr_r32_imm(dst, reglo, 1);
resolve_link(dst, &skipall);
emit_combine_z_shl_flags(dst);
}
} | [
"static",
"void",
"emit_rcr_r64_p64",
"(",
"drcbe_state",
"*",
"drcbe",
",",
"x86code",
"*",
"*",
"dst",
",",
"UINT8",
"reglo",
",",
"UINT8",
"reghi",
",",
"const",
"drcuml_parameter",
"*",
"param",
",",
"const",
"drcuml_instruction",
"*",
"inst",
")",
"{",
"int",
"saveflags",
"=",
"(",
"inst",
"->",
"flags",
"!=",
"0",
")",
";",
"emit_link",
"skipall",
",",
"skiploop",
";",
"x86code",
"*",
"loop",
";",
"emit_mov_r32_p32_keepflags",
"(",
"drcbe",
",",
"dst",
",",
"REG_ECX",
",",
"param",
")",
";",
"if",
"(",
"!",
"saveflags",
")",
"{",
"loop",
"=",
"*",
"dst",
";",
"emit_jecxz_link",
"(",
"dst",
",",
"&",
"skipall",
")",
";",
"emit_lea_r32_m32",
"(",
"dst",
",",
"REG_ECX",
",",
"MBD",
"(",
"REG_ECX",
",",
"-1",
")",
")",
";",
"emit_rcr_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"1",
")",
";",
"emit_rcr_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"1",
")",
";",
"emit_jmp",
"(",
"dst",
",",
"loop",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skipall",
")",
";",
"}",
"else",
"{",
"emit_jecxz_link",
"(",
"dst",
",",
"&",
"skipall",
")",
";",
"emit_lea_r32_m32",
"(",
"dst",
",",
"REG_ECX",
",",
"MBD",
"(",
"REG_ECX",
",",
"-1",
")",
")",
";",
"loop",
"=",
"*",
"dst",
";",
"emit_jecxz_link",
"(",
"dst",
",",
"&",
"skiploop",
")",
";",
"emit_lea_r32_m32",
"(",
"dst",
",",
"REG_ECX",
",",
"MBD",
"(",
"REG_ECX",
",",
"-1",
")",
")",
";",
"emit_rcr_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"1",
")",
";",
"emit_rcr_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"1",
")",
";",
"emit_jmp",
"(",
"dst",
",",
"loop",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skiploop",
")",
";",
"emit_rcr_r32_imm",
"(",
"dst",
",",
"reghi",
",",
"1",
")",
";",
"emit_pushf",
"(",
"dst",
")",
";",
"emit_rcr_r32_imm",
"(",
"dst",
",",
"reglo",
",",
"1",
")",
";",
"resolve_link",
"(",
"dst",
",",
"&",
"skipall",
")",
";",
"emit_combine_z_shl_flags",
"(",
"dst",
")",
";",
"}",
"}"
] | emit_rcr_r64_p64 - rcr operation to a 64-bit
pair of registers from a 64-bit parameter | [
"emit_rcr_r64_p64",
"-",
"rcr",
"operation",
"to",
"a",
"64",
"-",
"bit",
"pair",
"of",
"registers",
"from",
"a",
"64",
"-",
"bit",
"parameter"
] | [
"// mov ecx,param",
"// loop:",
"// jecxz skipall",
"// lea ecx,[ecx-1]",
"// rcr reghi,1",
"// rcr reglo,1",
"// jmp loop",
"// skipall:",
"// jecxz skipall",
"// lea ecx,[ecx-1]",
"// loop:",
"// jecxz skiploop",
"// lea ecx,[ecx-1]",
"// rcr reghi,1",
"// rcr reglo,1",
"// jmp loop",
"// skiploop:",
"// rcr reghi,1",
"// pushf",
"// rcr reglo,1",
"// skipall:"
] | [
{
"param": "drcbe",
"type": "drcbe_state"
},
{
"param": "dst",
"type": "x86code"
},
{
"param": "reglo",
"type": "UINT8"
},
{
"param": "reghi",
"type": "UINT8"
},
{
"param": "param",
"type": "drcuml_parameter"
},
{
"param": "inst",
"type": "drcuml_instruction"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "drcbe",
"type": "drcbe_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reglo",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reghi",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inst",
"type": "drcuml_instruction",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_fld_p | void | static void emit_fld_p(x86code **dst, int size, const drcuml_parameter *param)
{
assert(param->type == DRCUML_PTYPE_MEMORY);
assert(size == 4 || size == 8);
if (size == 4)
emit_fld_m32(dst, MABS(param->value));
else if (size == 8)
emit_fld_m64(dst, MABS(param->value));
} | /*-------------------------------------------------
emit_fld_p - load a floating point parameter
onto the stack
-------------------------------------------------*/ | load a floating point parameter
onto the stack | [
"load",
"a",
"floating",
"point",
"parameter",
"onto",
"the",
"stack"
] | static void emit_fld_p(x86code **dst, int size, const drcuml_parameter *param)
{
assert(param->type == DRCUML_PTYPE_MEMORY);
assert(size == 4 || size == 8);
if (size == 4)
emit_fld_m32(dst, MABS(param->value));
else if (size == 8)
emit_fld_m64(dst, MABS(param->value));
} | [
"static",
"void",
"emit_fld_p",
"(",
"x86code",
"*",
"*",
"dst",
",",
"int",
"size",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"assert",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
";",
"assert",
"(",
"size",
"==",
"4",
"||",
"size",
"==",
"8",
")",
";",
"if",
"(",
"size",
"==",
"4",
")",
"emit_fld_m32",
"(",
"dst",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"size",
"==",
"8",
")",
"emit_fld_m64",
"(",
"dst",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"}"
] | emit_fld_p - load a floating point parameter
onto the stack | [
"emit_fld_p",
"-",
"load",
"a",
"floating",
"point",
"parameter",
"onto",
"the",
"stack"
] | [] | [
{
"param": "dst",
"type": "x86code"
},
{
"param": "size",
"type": "int"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | emit_fstp_p | void | static void emit_fstp_p(x86code **dst, int size, const drcuml_parameter *param)
{
assert(param->type == DRCUML_PTYPE_MEMORY);
assert(size == 4 || size == 8);
if (size == 4)
emit_fstp_m32(dst, MABS(param->value));
else if (size == 8)
emit_fstp_m64(dst, MABS(param->value));
} | /*-------------------------------------------------
emit_fstp_p - store a floating point parameter
from the stack and pop it
-------------------------------------------------*/ | store a floating point parameter
from the stack and pop it | [
"store",
"a",
"floating",
"point",
"parameter",
"from",
"the",
"stack",
"and",
"pop",
"it"
] | static void emit_fstp_p(x86code **dst, int size, const drcuml_parameter *param)
{
assert(param->type == DRCUML_PTYPE_MEMORY);
assert(size == 4 || size == 8);
if (size == 4)
emit_fstp_m32(dst, MABS(param->value));
else if (size == 8)
emit_fstp_m64(dst, MABS(param->value));
} | [
"static",
"void",
"emit_fstp_p",
"(",
"x86code",
"*",
"*",
"dst",
",",
"int",
"size",
",",
"const",
"drcuml_parameter",
"*",
"param",
")",
"{",
"assert",
"(",
"param",
"->",
"type",
"==",
"DRCUML_PTYPE_MEMORY",
")",
";",
"assert",
"(",
"size",
"==",
"4",
"||",
"size",
"==",
"8",
")",
";",
"if",
"(",
"size",
"==",
"4",
")",
"emit_fstp_m32",
"(",
"dst",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"else",
"if",
"(",
"size",
"==",
"8",
")",
"emit_fstp_m64",
"(",
"dst",
",",
"MABS",
"(",
"param",
"->",
"value",
")",
")",
";",
"}"
] | emit_fstp_p - store a floating point parameter
from the stack and pop it | [
"emit_fstp_p",
"-",
"store",
"a",
"floating",
"point",
"parameter",
"from",
"the",
"stack",
"and",
"pop",
"it"
] | [] | [
{
"param": "dst",
"type": "x86code"
},
{
"param": "size",
"type": "int"
},
{
"param": "param",
"type": "drcuml_parameter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dst",
"type": "x86code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "size",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "param",
"type": "drcuml_parameter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | fixup_exception | void | static void fixup_exception(drccodeptr *codeptr, void *param1, void *param2, void *param3)
{
drcuml_parameter handp, exp;
drcbe_state *drcbe = (drcbe_state *)param1;
drccodeptr src = (drccodeptr)param2;
const drcuml_instruction *inst = (const drcuml_instruction *)param3;
drccodeptr dst = *codeptr;
drccodeptr *targetptr;
/* normalize parameters */
param_normalize_2(drcbe, inst, &handp, PTYPE_M, &exp, PTYPE_MRI);
/* look up the handle target */
targetptr = drcuml_handle_codeptr_addr((drcuml_codehandle *)(FPTR)handp.value);
/* first fixup the jump to get us here */
((UINT32 *)src)[-1] = dst - src;
/* then store the exception parameter */
emit_mov_m32_p32(drcbe, &dst, MABS(&drcbe->state.exp), &exp); // mov [exp],exp
/* push the original return address on the stack */
emit_push_imm(&dst, (FPTR)src); // push <return>
if (*targetptr != NULL)
emit_jmp(&dst, *targetptr); // jmp *targetptr
else
emit_jmp_m32(&dst, MABS(targetptr)); // jmp [targetptr]
*codeptr = dst;
} | /*-------------------------------------------------
fixup_exception - callback to perform cleanup
and jump to an exception handler
-------------------------------------------------*/ | callback to perform cleanup
and jump to an exception handler | [
"callback",
"to",
"perform",
"cleanup",
"and",
"jump",
"to",
"an",
"exception",
"handler"
] | static void fixup_exception(drccodeptr *codeptr, void *param1, void *param2, void *param3)
{
drcuml_parameter handp, exp;
drcbe_state *drcbe = (drcbe_state *)param1;
drccodeptr src = (drccodeptr)param2;
const drcuml_instruction *inst = (const drcuml_instruction *)param3;
drccodeptr dst = *codeptr;
drccodeptr *targetptr;
param_normalize_2(drcbe, inst, &handp, PTYPE_M, &exp, PTYPE_MRI);
targetptr = drcuml_handle_codeptr_addr((drcuml_codehandle *)(FPTR)handp.value);
((UINT32 *)src)[-1] = dst - src;
emit_mov_m32_p32(drcbe, &dst, MABS(&drcbe->state.exp), &exp);
emit_push_imm(&dst, (FPTR)src);
if (*targetptr != NULL)
emit_jmp(&dst, *targetptr);
else
emit_jmp_m32(&dst, MABS(targetptr));
*codeptr = dst;
} | [
"static",
"void",
"fixup_exception",
"(",
"drccodeptr",
"*",
"codeptr",
",",
"void",
"*",
"param1",
",",
"void",
"*",
"param2",
",",
"void",
"*",
"param3",
")",
"{",
"drcuml_parameter",
"handp",
",",
"exp",
";",
"drcbe_state",
"*",
"drcbe",
"=",
"(",
"drcbe_state",
"*",
")",
"param1",
";",
"drccodeptr",
"src",
"=",
"(",
"drccodeptr",
")",
"param2",
";",
"const",
"drcuml_instruction",
"*",
"inst",
"=",
"(",
"const",
"drcuml_instruction",
"*",
")",
"param3",
";",
"drccodeptr",
"dst",
"=",
"*",
"codeptr",
";",
"drccodeptr",
"*",
"targetptr",
";",
"param_normalize_2",
"(",
"drcbe",
",",
"inst",
",",
"&",
"handp",
",",
"PTYPE_M",
",",
"&",
"exp",
",",
"PTYPE_MRI",
")",
";",
"targetptr",
"=",
"drcuml_handle_codeptr_addr",
"(",
"(",
"drcuml_codehandle",
"*",
")",
"(",
"FPTR",
")",
"handp",
".",
"value",
")",
";",
"(",
"(",
"UINT32",
"*",
")",
"src",
")",
"[",
"-1",
"]",
"=",
"dst",
"-",
"src",
";",
"emit_mov_m32_p32",
"(",
"drcbe",
",",
"&",
"dst",
",",
"MABS",
"(",
"&",
"drcbe",
"->",
"state",
".",
"exp",
")",
",",
"&",
"exp",
")",
";",
"emit_push_imm",
"(",
"&",
"dst",
",",
"(",
"FPTR",
")",
"src",
")",
";",
"if",
"(",
"*",
"targetptr",
"!=",
"NULL",
")",
"emit_jmp",
"(",
"&",
"dst",
",",
"*",
"targetptr",
")",
";",
"else",
"emit_jmp_m32",
"(",
"&",
"dst",
",",
"MABS",
"(",
"targetptr",
")",
")",
";",
"*",
"codeptr",
"=",
"dst",
";",
"}"
] | fixup_exception - callback to perform cleanup
and jump to an exception handler | [
"fixup_exception",
"-",
"callback",
"to",
"perform",
"cleanup",
"and",
"jump",
"to",
"an",
"exception",
"handler"
] | [
"/* normalize parameters */",
"/* look up the handle target */",
"/* first fixup the jump to get us here */",
"/* then store the exception parameter */",
"// mov [exp],exp",
"/* push the original return address on the stack */",
"// push <return>",
"// jmp *targetptr",
"// jmp [targetptr]"
] | [
{
"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": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | ddivu | int | static int ddivu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2)
{
/* do nothing if src2 == 0 */
if (src2 == 0)
return DRCUML_FLAG_V;
/* shortcut if no remainder */
*dstlo = src1 / src2;
if (dstlo != dsthi)
*dsthi = src1 % src2;
return ((*dstlo == 0) << 2) | ((*dstlo >> 60) & DRCUML_FLAG_S);
} | /*-------------------------------------------------
ddivu - perform a double-wide unsigned divide
-------------------------------------------------*/ | perform a double-wide unsigned divide | [
"perform",
"a",
"double",
"-",
"wide",
"unsigned",
"divide"
] | static int ddivu(UINT64 *dstlo, UINT64 *dsthi, UINT64 src1, UINT64 src2)
{
if (src2 == 0)
return DRCUML_FLAG_V;
*dstlo = src1 / src2;
if (dstlo != dsthi)
*dsthi = src1 % src2;
return ((*dstlo == 0) << 2) | ((*dstlo >> 60) & DRCUML_FLAG_S);
} | [
"static",
"int",
"ddivu",
"(",
"UINT64",
"*",
"dstlo",
",",
"UINT64",
"*",
"dsthi",
",",
"UINT64",
"src1",
",",
"UINT64",
"src2",
")",
"{",
"if",
"(",
"src2",
"==",
"0",
")",
"return",
"DRCUML_FLAG_V",
";",
"*",
"dstlo",
"=",
"src1",
"/",
"src2",
";",
"if",
"(",
"dstlo",
"!=",
"dsthi",
")",
"*",
"dsthi",
"=",
"src1",
"%",
"src2",
";",
"return",
"(",
"(",
"*",
"dstlo",
"==",
"0",
")",
"<<",
"2",
")",
"|",
"(",
"(",
"*",
"dstlo",
">>",
"60",
")",
"&",
"DRCUML_FLAG_S",
")",
";",
"}"
] | ddivu - perform a double-wide unsigned divide | [
"ddivu",
"-",
"perform",
"a",
"double",
"-",
"wide",
"unsigned",
"divide"
] | [
"/* do nothing if src2 == 0 */",
"/* shortcut if no remainder */"
] | [
{
"param": "dstlo",
"type": "UINT64"
},
{
"param": "dsthi",
"type": "UINT64"
},
{
"param": "src1",
"type": "UINT64"
},
{
"param": "src2",
"type": "UINT64"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dstlo",
"type": "UINT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dsthi",
"type": "UINT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src1",
"type": "UINT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src2",
"type": "UINT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8848f8329a81c792d6a17c65da9f787c81fd3d2 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/drcbex86.c | [
"Unlicense"
] | C | ddivs | int | static int ddivs(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2)
{
/* do nothing if src2 == 0 */
if (src2 == 0)
return DRCUML_FLAG_V;
/* shortcut if no remainder */
*dstlo = src1 / src2;
if (dstlo != dsthi)
*dsthi = src1 % src2;
return ((*dstlo == 0) << 2) | ((*dstlo >> 60) & DRCUML_FLAG_S);
} | /*-------------------------------------------------
ddivs - perform a double-wide signed divide
-------------------------------------------------*/ | perform a double-wide signed divide | [
"perform",
"a",
"double",
"-",
"wide",
"signed",
"divide"
] | static int ddivs(UINT64 *dstlo, UINT64 *dsthi, INT64 src1, INT64 src2)
{
if (src2 == 0)
return DRCUML_FLAG_V;
*dstlo = src1 / src2;
if (dstlo != dsthi)
*dsthi = src1 % src2;
return ((*dstlo == 0) << 2) | ((*dstlo >> 60) & DRCUML_FLAG_S);
} | [
"static",
"int",
"ddivs",
"(",
"UINT64",
"*",
"dstlo",
",",
"UINT64",
"*",
"dsthi",
",",
"INT64",
"src1",
",",
"INT64",
"src2",
")",
"{",
"if",
"(",
"src2",
"==",
"0",
")",
"return",
"DRCUML_FLAG_V",
";",
"*",
"dstlo",
"=",
"src1",
"/",
"src2",
";",
"if",
"(",
"dstlo",
"!=",
"dsthi",
")",
"*",
"dsthi",
"=",
"src1",
"%",
"src2",
";",
"return",
"(",
"(",
"*",
"dstlo",
"==",
"0",
")",
"<<",
"2",
")",
"|",
"(",
"(",
"*",
"dstlo",
">>",
"60",
")",
"&",
"DRCUML_FLAG_S",
")",
";",
"}"
] | ddivs - perform a double-wide signed divide | [
"ddivs",
"-",
"perform",
"a",
"double",
"-",
"wide",
"signed",
"divide"
] | [
"/* do nothing if src2 == 0 */",
"/* shortcut if no remainder */"
] | [
{
"param": "dstlo",
"type": "UINT64"
},
{
"param": "dsthi",
"type": "UINT64"
},
{
"param": "src1",
"type": "INT64"
},
{
"param": "src2",
"type": "INT64"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dstlo",
"type": "UINT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dsthi",
"type": "UINT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src1",
"type": "INT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src2",
"type": "INT64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
eab1675c7dd2024010838060efd22628b94d1137 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/kaneko16.c | [
"Unlicense"
] | C | kaneko16_draw_sprites_custom | void | static void kaneko16_draw_sprites_custom(bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx,
UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
int priority)
{
pen_t pen_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
bitmap_t *priority_bitmap = gfx->machine->priority_bitmap;
int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16;
int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16;
if (sprite_screen_width && sprite_screen_height)
{
/* compute sprite increment per screen pixel */
int dx = (gfx->width<<16)/sprite_screen_width;
int dy = (gfx->height<<16)/sprite_screen_height;
int ex = sx+sprite_screen_width;
int ey = sy+sprite_screen_height;
int x_index_base;
int y_index;
if( flipx )
{
x_index_base = (sprite_screen_width-1)*dx;
dx = -dx;
}
else
{
x_index_base = 0;
}
if( flipy )
{
y_index = (sprite_screen_height-1)*dy;
dy = -dy;
}
else
{
y_index = 0;
}
if( clip )
{
if( sx < clip->min_x)
{ /* clip left */
int pixels = clip->min_x-sx;
sx += pixels;
x_index_base += pixels*dx;
}
if( sy < clip->min_y )
{ /* clip top */
int pixels = clip->min_y-sy;
sy += pixels;
y_index += pixels*dy;
}
/* NS 980211 - fixed incorrect clipping */
if( ex > clip->max_x+1 )
{ /* clip right */
int pixels = ex-clip->max_x-1;
ex -= pixels;
}
if( ey > clip->max_y+1 )
{ /* clip bottom */
int pixels = ey-clip->max_y-1;
ey -= pixels;
}
}
if( ex>sx )
{ /* skip if inner loop doesn't draw anything */
int y;
for( y=sy; y<ey; y++ )
{
const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0);
UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0);
int x, x_index = x_index_base;
for( x=sx; x<ex; x++ )
{
int c = source[x_index>>16];
if( c != 0 )
{
if (pri[x] < priority)
dest[x] = pen_base + c;
pri[x] = 0xff; // mark it "already drawn"
}
x_index += dx;
}
y_index += dy;
}
}
}
} | // custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities | custom function to draw a single sprite. needed to keep correct sprites - sprites and sprites - tilemaps priorities | [
"custom",
"function",
"to",
"draw",
"a",
"single",
"sprite",
".",
"needed",
"to",
"keep",
"correct",
"sprites",
"-",
"sprites",
"and",
"sprites",
"-",
"tilemaps",
"priorities"
] | static void kaneko16_draw_sprites_custom(bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx,
UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,
int priority)
{
pen_t pen_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements);
bitmap_t *priority_bitmap = gfx->machine->priority_bitmap;
int sprite_screen_height = ((1<<16)*gfx->height+0x8000)>>16;
int sprite_screen_width = ((1<<16)*gfx->width+0x8000)>>16;
if (sprite_screen_width && sprite_screen_height)
{
int dx = (gfx->width<<16)/sprite_screen_width;
int dy = (gfx->height<<16)/sprite_screen_height;
int ex = sx+sprite_screen_width;
int ey = sy+sprite_screen_height;
int x_index_base;
int y_index;
if( flipx )
{
x_index_base = (sprite_screen_width-1)*dx;
dx = -dx;
}
else
{
x_index_base = 0;
}
if( flipy )
{
y_index = (sprite_screen_height-1)*dy;
dy = -dy;
}
else
{
y_index = 0;
}
if( clip )
{
if( sx < clip->min_x)
{
int pixels = clip->min_x-sx;
sx += pixels;
x_index_base += pixels*dx;
}
if( sy < clip->min_y )
{
int pixels = clip->min_y-sy;
sy += pixels;
y_index += pixels*dy;
}
if( ex > clip->max_x+1 )
{
int pixels = ex-clip->max_x-1;
ex -= pixels;
}
if( ey > clip->max_y+1 )
{
int pixels = ey-clip->max_y-1;
ey -= pixels;
}
}
if( ex>sx )
{
int y;
for( y=sy; y<ey; y++ )
{
const UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0);
UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0);
int x, x_index = x_index_base;
for( x=sx; x<ex; x++ )
{
int c = source[x_index>>16];
if( c != 0 )
{
if (pri[x] < priority)
dest[x] = pen_base + c;
pri[x] = 0xff;
}
x_index += dx;
}
y_index += dy;
}
}
}
} | [
"static",
"void",
"kaneko16_draw_sprites_custom",
"(",
"bitmap_t",
"*",
"dest_bmp",
",",
"const",
"rectangle",
"*",
"clip",
",",
"const",
"gfx_element",
"*",
"gfx",
",",
"UINT32",
"code",
",",
"UINT32",
"color",
",",
"int",
"flipx",
",",
"int",
"flipy",
",",
"int",
"sx",
",",
"int",
"sy",
",",
"int",
"priority",
")",
"{",
"pen_t",
"pen_base",
"=",
"gfx",
"->",
"color_base",
"+",
"gfx",
"->",
"color_granularity",
"*",
"(",
"color",
"%",
"gfx",
"->",
"total_colors",
")",
";",
"const",
"UINT8",
"*",
"source_base",
"=",
"gfx_element_get_data",
"(",
"gfx",
",",
"code",
"%",
"gfx",
"->",
"total_elements",
")",
";",
"bitmap_t",
"*",
"priority_bitmap",
"=",
"gfx",
"->",
"machine",
"->",
"priority_bitmap",
";",
"int",
"sprite_screen_height",
"=",
"(",
"(",
"1",
"<<",
"16",
")",
"*",
"gfx",
"->",
"height",
"+",
"0x8000",
")",
">>",
"16",
";",
"int",
"sprite_screen_width",
"=",
"(",
"(",
"1",
"<<",
"16",
")",
"*",
"gfx",
"->",
"width",
"+",
"0x8000",
")",
">>",
"16",
";",
"if",
"(",
"sprite_screen_width",
"&&",
"sprite_screen_height",
")",
"{",
"int",
"dx",
"=",
"(",
"gfx",
"->",
"width",
"<<",
"16",
")",
"/",
"sprite_screen_width",
";",
"int",
"dy",
"=",
"(",
"gfx",
"->",
"height",
"<<",
"16",
")",
"/",
"sprite_screen_height",
";",
"int",
"ex",
"=",
"sx",
"+",
"sprite_screen_width",
";",
"int",
"ey",
"=",
"sy",
"+",
"sprite_screen_height",
";",
"int",
"x_index_base",
";",
"int",
"y_index",
";",
"if",
"(",
"flipx",
")",
"{",
"x_index_base",
"=",
"(",
"sprite_screen_width",
"-",
"1",
")",
"*",
"dx",
";",
"dx",
"=",
"-",
"dx",
";",
"}",
"else",
"{",
"x_index_base",
"=",
"0",
";",
"}",
"if",
"(",
"flipy",
")",
"{",
"y_index",
"=",
"(",
"sprite_screen_height",
"-",
"1",
")",
"*",
"dy",
";",
"dy",
"=",
"-",
"dy",
";",
"}",
"else",
"{",
"y_index",
"=",
"0",
";",
"}",
"if",
"(",
"clip",
")",
"{",
"if",
"(",
"sx",
"<",
"clip",
"->",
"min_x",
")",
"{",
"int",
"pixels",
"=",
"clip",
"->",
"min_x",
"-",
"sx",
";",
"sx",
"+=",
"pixels",
";",
"x_index_base",
"+=",
"pixels",
"*",
"dx",
";",
"}",
"if",
"(",
"sy",
"<",
"clip",
"->",
"min_y",
")",
"{",
"int",
"pixels",
"=",
"clip",
"->",
"min_y",
"-",
"sy",
";",
"sy",
"+=",
"pixels",
";",
"y_index",
"+=",
"pixels",
"*",
"dy",
";",
"}",
"if",
"(",
"ex",
">",
"clip",
"->",
"max_x",
"+",
"1",
")",
"{",
"int",
"pixels",
"=",
"ex",
"-",
"clip",
"->",
"max_x",
"-",
"1",
";",
"ex",
"-=",
"pixels",
";",
"}",
"if",
"(",
"ey",
">",
"clip",
"->",
"max_y",
"+",
"1",
")",
"{",
"int",
"pixels",
"=",
"ey",
"-",
"clip",
"->",
"max_y",
"-",
"1",
";",
"ey",
"-=",
"pixels",
";",
"}",
"}",
"if",
"(",
"ex",
">",
"sx",
")",
"{",
"int",
"y",
";",
"for",
"(",
"y",
"=",
"sy",
";",
"y",
"<",
"ey",
";",
"y",
"++",
")",
"{",
"const",
"UINT8",
"*",
"source",
"=",
"source_base",
"+",
"(",
"y_index",
">>",
"16",
")",
"*",
"gfx",
"->",
"line_modulo",
";",
"UINT16",
"*",
"dest",
"=",
"BITMAP_ADDR16",
"(",
"dest_bmp",
",",
"y",
",",
"0",
")",
";",
"UINT8",
"*",
"pri",
"=",
"BITMAP_ADDR8",
"(",
"priority_bitmap",
",",
"y",
",",
"0",
")",
";",
"int",
"x",
",",
"x_index",
"=",
"x_index_base",
";",
"for",
"(",
"x",
"=",
"sx",
";",
"x",
"<",
"ex",
";",
"x",
"++",
")",
"{",
"int",
"c",
"=",
"source",
"[",
"x_index",
">>",
"16",
"]",
";",
"if",
"(",
"c",
"!=",
"0",
")",
"{",
"if",
"(",
"pri",
"[",
"x",
"]",
"<",
"priority",
")",
"dest",
"[",
"x",
"]",
"=",
"pen_base",
"+",
"c",
";",
"pri",
"[",
"x",
"]",
"=",
"0xff",
";",
"}",
"x_index",
"+=",
"dx",
";",
"}",
"y_index",
"+=",
"dy",
";",
"}",
"}",
"}",
"}"
] | custom function to draw a single sprite. | [
"custom",
"function",
"to",
"draw",
"a",
"single",
"sprite",
"."
] | [
"/* compute sprite increment per screen pixel */",
"/* clip left */",
"/* clip top */",
"/* NS 980211 - fixed incorrect clipping */",
"/* clip right */",
"/* clip bottom */",
"/* skip if inner loop doesn't draw anything */",
"// mark it \"already drawn\""
] | [
{
"param": "dest_bmp",
"type": "bitmap_t"
},
{
"param": "clip",
"type": "rectangle"
},
{
"param": "gfx",
"type": "gfx_element"
},
{
"param": "code",
"type": "UINT32"
},
{
"param": "color",
"type": "UINT32"
},
{
"param": "flipx",
"type": "int"
},
{
"param": "flipy",
"type": "int"
},
{
"param": "sx",
"type": "int"
},
{
"param": "sy",
"type": "int"
},
{
"param": "priority",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest_bmp",
"type": "bitmap_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clip",
"type": "rectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gfx",
"type": "gfx_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "color",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flipy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sy",
"type": "int",
"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": []
} |
eab1675c7dd2024010838060efd22628b94d1137 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/kaneko16.c | [
"Unlicense"
] | C | kaneko16_draw_sprites | void | void kaneko16_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
/* Sprites *must* be parsed from the first in RAM to the last,
because of the multisprite feature. But they *must* be drawn
from the last in RAM (frontmost) to the first in order to
cope with priorities using pdrawgfx.
Hence we parse them from first to last and put the result
in a temp buffer, then draw the buffer's contents from last
to first. */
int max = (video_screen_get_width(machine->primary_screen) > 0x100) ? (0x200<<6) : (0x100<<6);
int i = 0;
struct tempsprite *s = spritelist.first_sprite;
/* These values are latched from the last sprite. */
int x = 0;
int y = 0;
int code = 0;
int color = 0;
int priority = 0;
int xoffs = 0;
int yoffs = 0;
int flipx = 0;
int flipy = 0;
while (1)
{
int flags;
switch( kaneko16_sprite_type )
{
case 0:
case 1:
case 2: flags = kaneko16_parse_sprite_type012(machine, i,s); break;
default: flags = -1;
}
if (flags == -1) // End of Sprites
break;
if (flags & USE_LATCHED_CODE)
s->code = ++code; // Use the latched code + 1 ..
else
code = s->code; // .. or latch this value
if (flags & USE_LATCHED_COLOR)
{
s->color = color;
s->priority = priority;
s->xoffs = xoffs;
s->yoffs = yoffs;
if (kaneko16_sprite_fliptype==0)
{
s->flipx = flipx;
s->flipy = flipy;
}
}
else
{
color = s->color;
priority = s->priority;
xoffs = s->xoffs;
yoffs = s->yoffs;
if (kaneko16_sprite_fliptype==0)
{
flipx = s->flipx;
flipy = s->flipy;
}
}
// brap boys explicitly doesn't want the flip to be latched, maybe there is a different bit to enable that behavior?
if (kaneko16_sprite_fliptype==1)
{
flipx = s->flipx;
flipy = s->flipy;
}
if (flags & USE_LATCHED_XY)
{
s->x += x;
s->y += y;
}
// Always latch the latest result
x = s->x;
y = s->y;
/* We can now buffer this sprite */
s->x = s->xoffs + s->x;
s->y = s->yoffs + s->y;
s->x += kaneko16_sprite_xoffs;
s->y += kaneko16_sprite_yoffs;
if (kaneko16_sprite_flipx) { s->x = max - s->x - (16<<6); s->flipx = !s->flipx; }
if (kaneko16_sprite_flipy) { s->y = max - s->y - (16<<6); s->flipy = !s->flipy; }
s->x = ( (s->x & 0x7fc0) - (s->x & 0x8000) ) / 0x40;
s->y = ( (s->y & 0x7fc0) - (s->y & 0x8000) ) / 0x40;
i++;
s++;
}
/* Let's finally draw the sprites we buffered, in reverse order
(for pdrawgfx) */
for (s--; s >= spritelist.first_sprite; s--)
{
int curr_pri = s->priority;
UINT32 primask = kaneko16_priority.sprite[curr_pri];
kaneko16_draw_sprites_custom(
bitmap,cliprect,machine->gfx[0],
s->code,
s->color,
s->flipx, s->flipy,
s->x, s->y,
primask );
}
} | /* Build a list of sprites to display & draw them */ | Build a list of sprites to display & draw them | [
"Build",
"a",
"list",
"of",
"sprites",
"to",
"display",
"&",
"draw",
"them"
] | void kaneko16_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
int max = (video_screen_get_width(machine->primary_screen) > 0x100) ? (0x200<<6) : (0x100<<6);
int i = 0;
struct tempsprite *s = spritelist.first_sprite;
int x = 0;
int y = 0;
int code = 0;
int color = 0;
int priority = 0;
int xoffs = 0;
int yoffs = 0;
int flipx = 0;
int flipy = 0;
while (1)
{
int flags;
switch( kaneko16_sprite_type )
{
case 0:
case 1:
case 2: flags = kaneko16_parse_sprite_type012(machine, i,s); break;
default: flags = -1;
}
if (flags == -1)
break;
if (flags & USE_LATCHED_CODE)
s->code = ++code;
else
code = s->code;
if (flags & USE_LATCHED_COLOR)
{
s->color = color;
s->priority = priority;
s->xoffs = xoffs;
s->yoffs = yoffs;
if (kaneko16_sprite_fliptype==0)
{
s->flipx = flipx;
s->flipy = flipy;
}
}
else
{
color = s->color;
priority = s->priority;
xoffs = s->xoffs;
yoffs = s->yoffs;
if (kaneko16_sprite_fliptype==0)
{
flipx = s->flipx;
flipy = s->flipy;
}
}
if (kaneko16_sprite_fliptype==1)
{
flipx = s->flipx;
flipy = s->flipy;
}
if (flags & USE_LATCHED_XY)
{
s->x += x;
s->y += y;
}
x = s->x;
y = s->y;
s->x = s->xoffs + s->x;
s->y = s->yoffs + s->y;
s->x += kaneko16_sprite_xoffs;
s->y += kaneko16_sprite_yoffs;
if (kaneko16_sprite_flipx) { s->x = max - s->x - (16<<6); s->flipx = !s->flipx; }
if (kaneko16_sprite_flipy) { s->y = max - s->y - (16<<6); s->flipy = !s->flipy; }
s->x = ( (s->x & 0x7fc0) - (s->x & 0x8000) ) / 0x40;
s->y = ( (s->y & 0x7fc0) - (s->y & 0x8000) ) / 0x40;
i++;
s++;
}
for (s--; s >= spritelist.first_sprite; s--)
{
int curr_pri = s->priority;
UINT32 primask = kaneko16_priority.sprite[curr_pri];
kaneko16_draw_sprites_custom(
bitmap,cliprect,machine->gfx[0],
s->code,
s->color,
s->flipx, s->flipy,
s->x, s->y,
primask );
}
} | [
"void",
"kaneko16_draw_sprites",
"(",
"running_machine",
"*",
"machine",
",",
"bitmap_t",
"*",
"bitmap",
",",
"const",
"rectangle",
"*",
"cliprect",
")",
"{",
"int",
"max",
"=",
"(",
"video_screen_get_width",
"(",
"machine",
"->",
"primary_screen",
")",
">",
"0x100",
")",
"?",
"(",
"0x200",
"<<",
"6",
")",
":",
"(",
"0x100",
"<<",
"6",
")",
";",
"int",
"i",
"=",
"0",
";",
"struct",
"tempsprite",
"*",
"s",
"=",
"spritelist",
".",
"first_sprite",
";",
"int",
"x",
"=",
"0",
";",
"int",
"y",
"=",
"0",
";",
"int",
"code",
"=",
"0",
";",
"int",
"color",
"=",
"0",
";",
"int",
"priority",
"=",
"0",
";",
"int",
"xoffs",
"=",
"0",
";",
"int",
"yoffs",
"=",
"0",
";",
"int",
"flipx",
"=",
"0",
";",
"int",
"flipy",
"=",
"0",
";",
"while",
"(",
"1",
")",
"{",
"int",
"flags",
";",
"switch",
"(",
"kaneko16_sprite_type",
")",
"{",
"case",
"0",
":",
"case",
"1",
":",
"case",
"2",
":",
"flags",
"=",
"kaneko16_parse_sprite_type012",
"(",
"machine",
",",
"i",
",",
"s",
")",
";",
"break",
";",
"default",
":",
"flags",
"=",
"-1",
";",
"}",
"if",
"(",
"flags",
"==",
"-1",
")",
"break",
";",
"if",
"(",
"flags",
"&",
"USE_LATCHED_CODE",
")",
"s",
"->",
"code",
"=",
"++",
"code",
";",
"else",
"code",
"=",
"s",
"->",
"code",
";",
"if",
"(",
"flags",
"&",
"USE_LATCHED_COLOR",
")",
"{",
"s",
"->",
"color",
"=",
"color",
";",
"s",
"->",
"priority",
"=",
"priority",
";",
"s",
"->",
"xoffs",
"=",
"xoffs",
";",
"s",
"->",
"yoffs",
"=",
"yoffs",
";",
"if",
"(",
"kaneko16_sprite_fliptype",
"==",
"0",
")",
"{",
"s",
"->",
"flipx",
"=",
"flipx",
";",
"s",
"->",
"flipy",
"=",
"flipy",
";",
"}",
"}",
"else",
"{",
"color",
"=",
"s",
"->",
"color",
";",
"priority",
"=",
"s",
"->",
"priority",
";",
"xoffs",
"=",
"s",
"->",
"xoffs",
";",
"yoffs",
"=",
"s",
"->",
"yoffs",
";",
"if",
"(",
"kaneko16_sprite_fliptype",
"==",
"0",
")",
"{",
"flipx",
"=",
"s",
"->",
"flipx",
";",
"flipy",
"=",
"s",
"->",
"flipy",
";",
"}",
"}",
"if",
"(",
"kaneko16_sprite_fliptype",
"==",
"1",
")",
"{",
"flipx",
"=",
"s",
"->",
"flipx",
";",
"flipy",
"=",
"s",
"->",
"flipy",
";",
"}",
"if",
"(",
"flags",
"&",
"USE_LATCHED_XY",
")",
"{",
"s",
"->",
"x",
"+=",
"x",
";",
"s",
"->",
"y",
"+=",
"y",
";",
"}",
"x",
"=",
"s",
"->",
"x",
";",
"y",
"=",
"s",
"->",
"y",
";",
"s",
"->",
"x",
"=",
"s",
"->",
"xoffs",
"+",
"s",
"->",
"x",
";",
"s",
"->",
"y",
"=",
"s",
"->",
"yoffs",
"+",
"s",
"->",
"y",
";",
"s",
"->",
"x",
"+=",
"kaneko16_sprite_xoffs",
";",
"s",
"->",
"y",
"+=",
"kaneko16_sprite_yoffs",
";",
"if",
"(",
"kaneko16_sprite_flipx",
")",
"{",
"s",
"->",
"x",
"=",
"max",
"-",
"s",
"->",
"x",
"-",
"(",
"16",
"<<",
"6",
")",
";",
"s",
"->",
"flipx",
"=",
"!",
"s",
"->",
"flipx",
";",
"}",
"if",
"(",
"kaneko16_sprite_flipy",
")",
"{",
"s",
"->",
"y",
"=",
"max",
"-",
"s",
"->",
"y",
"-",
"(",
"16",
"<<",
"6",
")",
";",
"s",
"->",
"flipy",
"=",
"!",
"s",
"->",
"flipy",
";",
"}",
"s",
"->",
"x",
"=",
"(",
"(",
"s",
"->",
"x",
"&",
"0x7fc0",
")",
"-",
"(",
"s",
"->",
"x",
"&",
"0x8000",
")",
")",
"/",
"0x40",
";",
"s",
"->",
"y",
"=",
"(",
"(",
"s",
"->",
"y",
"&",
"0x7fc0",
")",
"-",
"(",
"s",
"->",
"y",
"&",
"0x8000",
")",
")",
"/",
"0x40",
";",
"i",
"++",
";",
"s",
"++",
";",
"}",
"for",
"(",
"s",
"--",
";",
"s",
">=",
"spritelist",
".",
"first_sprite",
";",
"s",
"--",
")",
"{",
"int",
"curr_pri",
"=",
"s",
"->",
"priority",
";",
"UINT32",
"primask",
"=",
"kaneko16_priority",
".",
"sprite",
"[",
"curr_pri",
"]",
";",
"kaneko16_draw_sprites_custom",
"(",
"bitmap",
",",
"cliprect",
",",
"machine",
"->",
"gfx",
"[",
"0",
"]",
",",
"s",
"->",
"code",
",",
"s",
"->",
"color",
",",
"s",
"->",
"flipx",
",",
"s",
"->",
"flipy",
",",
"s",
"->",
"x",
",",
"s",
"->",
"y",
",",
"primask",
")",
";",
"}",
"}"
] | Build a list of sprites to display & draw them | [
"Build",
"a",
"list",
"of",
"sprites",
"to",
"display",
"&",
"draw",
"them"
] | [
"/* Sprites *must* be parsed from the first in RAM to the last,\n because of the multisprite feature. But they *must* be drawn\n from the last in RAM (frontmost) to the first in order to\n cope with priorities using pdrawgfx.\n\n Hence we parse them from first to last and put the result\n in a temp buffer, then draw the buffer's contents from last\n to first. */",
"/* These values are latched from the last sprite. */",
"// End of Sprites",
"// Use the latched code + 1 ..",
"// .. or latch this value",
"// brap boys explicitly doesn't want the flip to be latched, maybe there is a different bit to enable that behavior?",
"// Always latch the latest result",
"/* We can now buffer this sprite */",
"/* Let's finally draw the sprites we buffered, in reverse order\n (for pdrawgfx) */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"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": "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": []
} |
59ea1ecc3a6553143217fa49bfb7db3449932b94 | lofunz/mieme | Reloaded/trunk/src/emu/uiimage.c | [
"Unlicense"
] | C | extra_text_draw_box | void | static void extra_text_draw_box(float origx1, float origx2, float origy, float yspan, const char *text, int direction)
{
float text_width, text_height;
float width, maxwidth;
float x1, y1, x2, y2, temp;
/* get the size of the text */
ui_draw_text_full( render_container_get_ui(),text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &text_width, &text_height);
width = text_width + (2 * UI_BOX_LR_BORDER);
maxwidth = MAX(width, origx2 - origx1);
/* compute our bounds */
x1 = 0.5f - 0.5f * maxwidth;
x2 = x1 + maxwidth;
y1 = origy + (yspan * direction);
y2 = origy + (UI_BOX_TB_BORDER * direction);
if (y1 > y2)
{
temp = y1;
y1 = y2;
y2 = temp;
}
/* draw a box */
ui_draw_outlined_box(render_container_get_ui(),x1, y1, x2, y2, UI_BACKGROUND_COLOR);
/* take off the borders */
x1 += UI_BOX_LR_BORDER;
x2 -= UI_BOX_LR_BORDER;
y1 += UI_BOX_TB_BORDER;
y2 -= UI_BOX_TB_BORDER;
/* draw the text within it */
ui_draw_text_full(render_container_get_ui(),text, x1, y1, text_width, JUSTIFY_LEFT, WRAP_WORD,
DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
} | /*-------------------------------------------------
extra_text_draw_box - generically adds header
or footer text
-------------------------------------------------*/ | generically adds header
or footer text | [
"generically",
"adds",
"header",
"or",
"footer",
"text"
] | static void extra_text_draw_box(float origx1, float origx2, float origy, float yspan, const char *text, int direction)
{
float text_width, text_height;
float width, maxwidth;
float x1, y1, x2, y2, temp;
ui_draw_text_full( render_container_get_ui(),text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &text_width, &text_height);
width = text_width + (2 * UI_BOX_LR_BORDER);
maxwidth = MAX(width, origx2 - origx1);
x1 = 0.5f - 0.5f * maxwidth;
x2 = x1 + maxwidth;
y1 = origy + (yspan * direction);
y2 = origy + (UI_BOX_TB_BORDER * direction);
if (y1 > y2)
{
temp = y1;
y1 = y2;
y2 = temp;
}
ui_draw_outlined_box(render_container_get_ui(),x1, y1, x2, y2, UI_BACKGROUND_COLOR);
x1 += UI_BOX_LR_BORDER;
x2 -= UI_BOX_LR_BORDER;
y1 += UI_BOX_TB_BORDER;
y2 -= UI_BOX_TB_BORDER;
ui_draw_text_full(render_container_get_ui(),text, x1, y1, text_width, JUSTIFY_LEFT, WRAP_WORD,
DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
} | [
"static",
"void",
"extra_text_draw_box",
"(",
"float",
"origx1",
",",
"float",
"origx2",
",",
"float",
"origy",
",",
"float",
"yspan",
",",
"const",
"char",
"*",
"text",
",",
"int",
"direction",
")",
"{",
"float",
"text_width",
",",
"text_height",
";",
"float",
"width",
",",
"maxwidth",
";",
"float",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"temp",
";",
"ui_draw_text_full",
"(",
"render_container_get_ui",
"(",
")",
",",
"text",
",",
"0.0f",
",",
"0.0f",
",",
"1.0f",
",",
"JUSTIFY_LEFT",
",",
"WRAP_WORD",
",",
"DRAW_NONE",
",",
"ARGB_WHITE",
",",
"ARGB_BLACK",
",",
"&",
"text_width",
",",
"&",
"text_height",
")",
";",
"width",
"=",
"text_width",
"+",
"(",
"2",
"*",
"UI_BOX_LR_BORDER",
")",
";",
"maxwidth",
"=",
"MAX",
"(",
"width",
",",
"origx2",
"-",
"origx1",
")",
";",
"x1",
"=",
"0.5f",
"-",
"0.5f",
"*",
"maxwidth",
";",
"x2",
"=",
"x1",
"+",
"maxwidth",
";",
"y1",
"=",
"origy",
"+",
"(",
"yspan",
"*",
"direction",
")",
";",
"y2",
"=",
"origy",
"+",
"(",
"UI_BOX_TB_BORDER",
"*",
"direction",
")",
";",
"if",
"(",
"y1",
">",
"y2",
")",
"{",
"temp",
"=",
"y1",
";",
"y1",
"=",
"y2",
";",
"y2",
"=",
"temp",
";",
"}",
"ui_draw_outlined_box",
"(",
"render_container_get_ui",
"(",
")",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"UI_BACKGROUND_COLOR",
")",
";",
"x1",
"+=",
"UI_BOX_LR_BORDER",
";",
"x2",
"-=",
"UI_BOX_LR_BORDER",
";",
"y1",
"+=",
"UI_BOX_TB_BORDER",
";",
"y2",
"-=",
"UI_BOX_TB_BORDER",
";",
"ui_draw_text_full",
"(",
"render_container_get_ui",
"(",
")",
",",
"text",
",",
"x1",
",",
"y1",
",",
"text_width",
",",
"JUSTIFY_LEFT",
",",
"WRAP_WORD",
",",
"DRAW_NORMAL",
",",
"ARGB_WHITE",
",",
"ARGB_BLACK",
",",
"NULL",
",",
"NULL",
")",
";",
"}"
] | extra_text_draw_box - generically adds header
or footer text | [
"extra_text_draw_box",
"-",
"generically",
"adds",
"header",
"or",
"footer",
"text"
] | [
"/* get the size of the text */",
"/* compute our bounds */",
"/* draw a box */",
"/* take off the borders */",
"/* draw the text within it */"
] | [
{
"param": "origx1",
"type": "float"
},
{
"param": "origx2",
"type": "float"
},
{
"param": "origy",
"type": "float"
},
{
"param": "yspan",
"type": "float"
},
{
"param": "text",
"type": "char"
},
{
"param": "direction",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "origx1",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origx2",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origy",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "yspan",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "direction",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
59ea1ecc3a6553143217fa49bfb7db3449932b94 | lofunz/mieme | Reloaded/trunk/src/emu/uiimage.c | [
"Unlicense"
] | C | extra_text_render | void | static void extra_text_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom,
float origx1, float origy1, float origx2, float origy2,
const char *header, const char *footer)
{
header = ((header != NULL) && (header[0] != '\0')) ? header : NULL;
footer = ((footer != NULL) && (footer[0] != '\0')) ? footer : NULL;
if (header != NULL)
extra_text_draw_box(origx1, origx2, origy1, top, header, -1);
if (footer != NULL)
extra_text_draw_box(origx1, origx2, origy2, bottom, footer, +1);
} | /*-------------------------------------------------
extra_text_render - generically adds header
and footer text
-------------------------------------------------*/ | generically adds header
and footer text | [
"generically",
"adds",
"header",
"and",
"footer",
"text"
] | static void extra_text_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom,
float origx1, float origy1, float origx2, float origy2,
const char *header, const char *footer)
{
header = ((header != NULL) && (header[0] != '\0')) ? header : NULL;
footer = ((footer != NULL) && (footer[0] != '\0')) ? footer : NULL;
if (header != NULL)
extra_text_draw_box(origx1, origx2, origy1, top, header, -1);
if (footer != NULL)
extra_text_draw_box(origx1, origx2, origy2, bottom, footer, +1);
} | [
"static",
"void",
"extra_text_render",
"(",
"running_machine",
"*",
"machine",
",",
"ui_menu",
"*",
"menu",
",",
"void",
"*",
"state",
",",
"void",
"*",
"selectedref",
",",
"float",
"top",
",",
"float",
"bottom",
",",
"float",
"origx1",
",",
"float",
"origy1",
",",
"float",
"origx2",
",",
"float",
"origy2",
",",
"const",
"char",
"*",
"header",
",",
"const",
"char",
"*",
"footer",
")",
"{",
"header",
"=",
"(",
"(",
"header",
"!=",
"NULL",
")",
"&&",
"(",
"header",
"[",
"0",
"]",
"!=",
"'",
"\\0",
"'",
")",
")",
"?",
"header",
":",
"NULL",
";",
"footer",
"=",
"(",
"(",
"footer",
"!=",
"NULL",
")",
"&&",
"(",
"footer",
"[",
"0",
"]",
"!=",
"'",
"\\0",
"'",
")",
")",
"?",
"footer",
":",
"NULL",
";",
"if",
"(",
"header",
"!=",
"NULL",
")",
"extra_text_draw_box",
"(",
"origx1",
",",
"origx2",
",",
"origy1",
",",
"top",
",",
"header",
",",
"-1",
")",
";",
"if",
"(",
"footer",
"!=",
"NULL",
")",
"extra_text_draw_box",
"(",
"origx1",
",",
"origx2",
",",
"origy2",
",",
"bottom",
",",
"footer",
",",
"+1",
")",
";",
"}"
] | extra_text_render - generically adds header
and footer text | [
"extra_text_render",
"-",
"generically",
"adds",
"header",
"and",
"footer",
"text"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "menu",
"type": "ui_menu"
},
{
"param": "state",
"type": "void"
},
{
"param": "selectedref",
"type": "void"
},
{
"param": "top",
"type": "float"
},
{
"param": "bottom",
"type": "float"
},
{
"param": "origx1",
"type": "float"
},
{
"param": "origy1",
"type": "float"
},
{
"param": "origx2",
"type": "float"
},
{
"param": "origy2",
"type": "float"
},
{
"param": "header",
"type": "char"
},
{
"param": "footer",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "menu",
"type": "ui_menu",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "selectedref",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "top",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bottom",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origx1",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origy1",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origx2",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "origy2",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "header",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "footer",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
59ea1ecc3a6553143217fa49bfb7db3449932b94 | lofunz/mieme | Reloaded/trunk/src/emu/uiimage.c | [
"Unlicense"
] | C | menu_confirm_save_as_populate | void | static void menu_confirm_save_as_populate(running_machine *machine, ui_menu *menu, void *state)
{
ui_menu_item_append(menu, "File Already Exists - Overide?", NULL, MENU_FLAG_DISABLE, NULL);
ui_menu_item_append(menu, MENU_SEPARATOR_ITEM, NULL, MENU_FLAG_DISABLE, NULL);
ui_menu_item_append(menu, "No", NULL, 0, ITEMREF_NO);
ui_menu_item_append(menu, "Yes", NULL, 0, ITEMREF_YES);
} | /*-------------------------------------------------
menu_confirm_save_as_populate - populates the
confirm save as menu
-------------------------------------------------*/ | populates the
confirm save as menu | [
"populates",
"the",
"confirm",
"save",
"as",
"menu"
] | static void menu_confirm_save_as_populate(running_machine *machine, ui_menu *menu, void *state)
{
ui_menu_item_append(menu, "File Already Exists - Overide?", NULL, MENU_FLAG_DISABLE, NULL);
ui_menu_item_append(menu, MENU_SEPARATOR_ITEM, NULL, MENU_FLAG_DISABLE, NULL);
ui_menu_item_append(menu, "No", NULL, 0, ITEMREF_NO);
ui_menu_item_append(menu, "Yes", NULL, 0, ITEMREF_YES);
} | [
"static",
"void",
"menu_confirm_save_as_populate",
"(",
"running_machine",
"*",
"machine",
",",
"ui_menu",
"*",
"menu",
",",
"void",
"*",
"state",
")",
"{",
"ui_menu_item_append",
"(",
"menu",
",",
"\"",
"\"",
",",
"NULL",
",",
"MENU_FLAG_DISABLE",
",",
"NULL",
")",
";",
"ui_menu_item_append",
"(",
"menu",
",",
"MENU_SEPARATOR_ITEM",
",",
"NULL",
",",
"MENU_FLAG_DISABLE",
",",
"NULL",
")",
";",
"ui_menu_item_append",
"(",
"menu",
",",
"\"",
"\"",
",",
"NULL",
",",
"0",
",",
"ITEMREF_NO",
")",
";",
"ui_menu_item_append",
"(",
"menu",
",",
"\"",
"\"",
",",
"NULL",
",",
"0",
",",
"ITEMREF_YES",
")",
";",
"}"
] | menu_confirm_save_as_populate - populates the
confirm save as menu | [
"menu_confirm_save_as_populate",
"-",
"populates",
"the",
"confirm",
"save",
"as",
"menu"
] | [] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "menu",
"type": "ui_menu"
},
{
"param": "state",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "menu",
"type": "ui_menu",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
59ea1ecc3a6553143217fa49bfb7db3449932b94 | lofunz/mieme | Reloaded/trunk/src/emu/uiimage.c | [
"Unlicense"
] | C | menu_file_selector_populate | file_error | static file_error menu_file_selector_populate(running_machine *machine, ui_menu *menu, file_selector_menu_state *menustate)
{
zippath_directory *directory = NULL;
file_error err = FILERR_NONE;
const osd_directory_entry *dirent;
const file_selector_entry *entry;
const file_selector_entry *selected_entry = NULL;
int i;
const char *volume_name;
device_image_interface *device = menustate->manager_menustate->selected_device;
const char *path = astring_c(menustate->manager_menustate->current_directory);
/* open the directory */
err = zippath_opendir(path, &directory);
if (err != FILERR_NONE)
goto done;
/* clear out the menu entries */
menustate->entrylist = NULL;
/* add the "[empty slot]" entry */
append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_EMPTY, NULL, NULL);
if (device->image_config().is_creatable() && !zippath_is_zip(directory))
{
/* add the "[create]" entry */
append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_CREATE, NULL, NULL);
}
/* add the "[software list]" entry */
append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, NULL, NULL);
/* add the drives */
i = 0;
while((volume_name = osd_get_volume_name(i))!=NULL)
{
append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_DRIVE,
volume_name, volume_name);
i++;
}
/* build the menu for each item */
while((dirent = zippath_readdir(directory)) != NULL)
{
/* append a dirent entry */
entry = append_dirent_file_selector_entry(menu, menustate, dirent);
if (entry != NULL)
{
/* set the selected item to be the first non-parent directory or file */
if ((selected_entry == NULL) && strcmp(dirent->name, ".."))
selected_entry = entry;
/* do we have to select this file? */
if (!mame_stricmp(astring_c(menustate->manager_menustate->current_file), dirent->name))
selected_entry = entry;
}
}
/* append all of the menu entries */
for (entry = menustate->entrylist; entry != NULL; entry = entry->next)
append_file_selector_entry_menu_item(menu, entry);
/* set the selection (if we have one) */
if (selected_entry != NULL)
ui_menu_set_selection(menu, (void *) selected_entry);
/* set up custom render proc */
ui_menu_set_custom_render(menu, file_selector_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0);
done:
if (directory != NULL)
zippath_closedir(directory);
return err;
} | /*-------------------------------------------------
menu_file_selector_populate - creates and
allocates all menu items for a directory
-------------------------------------------------*/ | creates and
allocates all menu items for a directory | [
"creates",
"and",
"allocates",
"all",
"menu",
"items",
"for",
"a",
"directory"
] | static file_error menu_file_selector_populate(running_machine *machine, ui_menu *menu, file_selector_menu_state *menustate)
{
zippath_directory *directory = NULL;
file_error err = FILERR_NONE;
const osd_directory_entry *dirent;
const file_selector_entry *entry;
const file_selector_entry *selected_entry = NULL;
int i;
const char *volume_name;
device_image_interface *device = menustate->manager_menustate->selected_device;
const char *path = astring_c(menustate->manager_menustate->current_directory);
err = zippath_opendir(path, &directory);
if (err != FILERR_NONE)
goto done;
menustate->entrylist = NULL;
append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_EMPTY, NULL, NULL);
if (device->image_config().is_creatable() && !zippath_is_zip(directory))
{
append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_CREATE, NULL, NULL);
}
append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, NULL, NULL);
i = 0;
while((volume_name = osd_get_volume_name(i))!=NULL)
{
append_file_selector_entry(menu, menustate, SELECTOR_ENTRY_TYPE_DRIVE,
volume_name, volume_name);
i++;
}
while((dirent = zippath_readdir(directory)) != NULL)
{
entry = append_dirent_file_selector_entry(menu, menustate, dirent);
if (entry != NULL)
{
if ((selected_entry == NULL) && strcmp(dirent->name, ".."))
selected_entry = entry;
if (!mame_stricmp(astring_c(menustate->manager_menustate->current_file), dirent->name))
selected_entry = entry;
}
}
for (entry = menustate->entrylist; entry != NULL; entry = entry->next)
append_file_selector_entry_menu_item(menu, entry);
if (selected_entry != NULL)
ui_menu_set_selection(menu, (void *) selected_entry);
ui_menu_set_custom_render(menu, file_selector_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0);
done:
if (directory != NULL)
zippath_closedir(directory);
return err;
} | [
"static",
"file_error",
"menu_file_selector_populate",
"(",
"running_machine",
"*",
"machine",
",",
"ui_menu",
"*",
"menu",
",",
"file_selector_menu_state",
"*",
"menustate",
")",
"{",
"zippath_directory",
"*",
"directory",
"=",
"NULL",
";",
"file_error",
"err",
"=",
"FILERR_NONE",
";",
"const",
"osd_directory_entry",
"*",
"dirent",
";",
"const",
"file_selector_entry",
"*",
"entry",
";",
"const",
"file_selector_entry",
"*",
"selected_entry",
"=",
"NULL",
";",
"int",
"i",
";",
"const",
"char",
"*",
"volume_name",
";",
"device_image_interface",
"*",
"device",
"=",
"menustate",
"->",
"manager_menustate",
"->",
"selected_device",
";",
"const",
"char",
"*",
"path",
"=",
"astring_c",
"(",
"menustate",
"->",
"manager_menustate",
"->",
"current_directory",
")",
";",
"err",
"=",
"zippath_opendir",
"(",
"path",
",",
"&",
"directory",
")",
";",
"if",
"(",
"err",
"!=",
"FILERR_NONE",
")",
"goto",
"done",
";",
"menustate",
"->",
"entrylist",
"=",
"NULL",
";",
"append_file_selector_entry",
"(",
"menu",
",",
"menustate",
",",
"SELECTOR_ENTRY_TYPE_EMPTY",
",",
"NULL",
",",
"NULL",
")",
";",
"if",
"(",
"device",
"->",
"image_config",
"(",
")",
".",
"is_creatable",
"(",
")",
"&&",
"!",
"zippath_is_zip",
"(",
"directory",
")",
")",
"{",
"append_file_selector_entry",
"(",
"menu",
",",
"menustate",
",",
"SELECTOR_ENTRY_TYPE_CREATE",
",",
"NULL",
",",
"NULL",
")",
";",
"}",
"append_file_selector_entry",
"(",
"menu",
",",
"menustate",
",",
"SELECTOR_ENTRY_TYPE_SOFTWARE_LIST",
",",
"NULL",
",",
"NULL",
")",
";",
"i",
"=",
"0",
";",
"while",
"(",
"(",
"volume_name",
"=",
"osd_get_volume_name",
"(",
"i",
")",
")",
"!=",
"NULL",
")",
"{",
"append_file_selector_entry",
"(",
"menu",
",",
"menustate",
",",
"SELECTOR_ENTRY_TYPE_DRIVE",
",",
"volume_name",
",",
"volume_name",
")",
";",
"i",
"++",
";",
"}",
"while",
"(",
"(",
"dirent",
"=",
"zippath_readdir",
"(",
"directory",
")",
")",
"!=",
"NULL",
")",
"{",
"entry",
"=",
"append_dirent_file_selector_entry",
"(",
"menu",
",",
"menustate",
",",
"dirent",
")",
";",
"if",
"(",
"entry",
"!=",
"NULL",
")",
"{",
"if",
"(",
"(",
"selected_entry",
"==",
"NULL",
")",
"&&",
"strcmp",
"(",
"dirent",
"->",
"name",
",",
"\"",
"\"",
")",
")",
"selected_entry",
"=",
"entry",
";",
"if",
"(",
"!",
"mame_stricmp",
"(",
"astring_c",
"(",
"menustate",
"->",
"manager_menustate",
"->",
"current_file",
")",
",",
"dirent",
"->",
"name",
")",
")",
"selected_entry",
"=",
"entry",
";",
"}",
"}",
"for",
"(",
"entry",
"=",
"menustate",
"->",
"entrylist",
";",
"entry",
"!=",
"NULL",
";",
"entry",
"=",
"entry",
"->",
"next",
")",
"append_file_selector_entry_menu_item",
"(",
"menu",
",",
"entry",
")",
";",
"if",
"(",
"selected_entry",
"!=",
"NULL",
")",
"ui_menu_set_selection",
"(",
"menu",
",",
"(",
"void",
"*",
")",
"selected_entry",
")",
";",
"ui_menu_set_custom_render",
"(",
"menu",
",",
"file_selector_render_extra",
",",
"ui_get_line_height",
"(",
")",
"+",
"3.0f",
"*",
"UI_BOX_TB_BORDER",
",",
"0",
")",
";",
"done",
":",
"if",
"(",
"directory",
"!=",
"NULL",
")",
"zippath_closedir",
"(",
"directory",
")",
";",
"return",
"err",
";",
"}"
] | menu_file_selector_populate - creates and
allocates all menu items for a directory | [
"menu_file_selector_populate",
"-",
"creates",
"and",
"allocates",
"all",
"menu",
"items",
"for",
"a",
"directory"
] | [
"/* open the directory */",
"/* clear out the menu entries */",
"/* add the \"[empty slot]\" entry */",
"/* add the \"[create]\" entry */",
"/* add the \"[software list]\" entry */",
"/* add the drives */",
"/* build the menu for each item */",
"/* append a dirent entry */",
"/* set the selected item to be the first non-parent directory or file */",
"/* do we have to select this file? */",
"/* append all of the menu entries */",
"/* set the selection (if we have one) */",
"/* set up custom render proc */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "menu",
"type": "ui_menu"
},
{
"param": "menustate",
"type": "file_selector_menu_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "menu",
"type": "ui_menu",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "menustate",
"type": "file_selector_menu_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
59ea1ecc3a6553143217fa49bfb7db3449932b94 | lofunz/mieme | Reloaded/trunk/src/emu/uiimage.c | [
"Unlicense"
] | C | menu_file_manager_populate | void | static void menu_file_manager_populate(running_machine *machine, ui_menu *menu, void *state)
{
char buffer[2048];
device_image_interface *image = NULL;
const char *entry_basename;
/* cycle through all devices for this system */
for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{
/* get the image type/id */
snprintf(buffer, ARRAY_LENGTH(buffer),
"%s",
image->image_config().devconfig().name());
/* get the base name */
entry_basename = image->basename();
/* record the menu item */
ui_menu_item_append(menu, buffer, (entry_basename != NULL) ? entry_basename : "---", 0, (void *) image);
}
/* set up custom render proc */
ui_menu_set_custom_render(menu, file_manager_render_extra, 0, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER);
} | /*-------------------------------------------------
menu_file_manager_populate - populates the main
file manager menu
-------------------------------------------------*/ | populates the main
file manager menu | [
"populates",
"the",
"main",
"file",
"manager",
"menu"
] | static void menu_file_manager_populate(running_machine *machine, ui_menu *menu, void *state)
{
char buffer[2048];
device_image_interface *image = NULL;
const char *entry_basename;
for (bool gotone = machine->m_devicelist.first(image); gotone; gotone = image->next(image))
{
snprintf(buffer, ARRAY_LENGTH(buffer),
"%s",
image->image_config().devconfig().name());
entry_basename = image->basename();
ui_menu_item_append(menu, buffer, (entry_basename != NULL) ? entry_basename : "---", 0, (void *) image);
}
ui_menu_set_custom_render(menu, file_manager_render_extra, 0, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER);
} | [
"static",
"void",
"menu_file_manager_populate",
"(",
"running_machine",
"*",
"machine",
",",
"ui_menu",
"*",
"menu",
",",
"void",
"*",
"state",
")",
"{",
"char",
"buffer",
"[",
"2048",
"]",
";",
"device_image_interface",
"*",
"image",
"=",
"NULL",
";",
"const",
"char",
"*",
"entry_basename",
";",
"for",
"(",
"bool",
"gotone",
"=",
"machine",
"->",
"m_devicelist",
".",
"first",
"(",
"image",
")",
";",
"gotone",
";",
"gotone",
"=",
"image",
"->",
"next",
"(",
"image",
")",
")",
"{",
"snprintf",
"(",
"buffer",
",",
"ARRAY_LENGTH",
"(",
"buffer",
")",
",",
"\"",
"\"",
",",
"image",
"->",
"image_config",
"(",
")",
".",
"devconfig",
"(",
")",
".",
"name",
"(",
")",
")",
";",
"entry_basename",
"=",
"image",
"->",
"basename",
"(",
")",
";",
"ui_menu_item_append",
"(",
"menu",
",",
"buffer",
",",
"(",
"entry_basename",
"!=",
"NULL",
")",
"?",
"entry_basename",
":",
"\"",
"\"",
",",
"0",
",",
"(",
"void",
"*",
")",
"image",
")",
";",
"}",
"ui_menu_set_custom_render",
"(",
"menu",
",",
"file_manager_render_extra",
",",
"0",
",",
"ui_get_line_height",
"(",
")",
"+",
"3.0f",
"*",
"UI_BOX_TB_BORDER",
")",
";",
"}"
] | menu_file_manager_populate - populates the main
file manager menu | [
"menu_file_manager_populate",
"-",
"populates",
"the",
"main",
"file",
"manager",
"menu"
] | [
"/* cycle through all devices for this system */",
"/* get the image type/id */",
"/* get the base name */",
"/* record the menu item */",
"/* set up custom render proc */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "menu",
"type": "ui_menu"
},
{
"param": "state",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "menu",
"type": "ui_menu",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
59ea1ecc3a6553143217fa49bfb7db3449932b94 | lofunz/mieme | Reloaded/trunk/src/emu/uiimage.c | [
"Unlicense"
] | C | ui_image_menu_image_info | void | void ui_image_menu_image_info(running_machine *machine, ui_menu *menu, void *parameter, void *state)
{
/* if the menu isn't built, populate now */
if (!ui_menu_populated(menu))
{
astring *tempstring = image_info_astring(machine, astring_alloc());
ui_menu_item_append(menu, astring_c(tempstring), NULL, MENU_FLAG_MULTILINE, NULL);
astring_free(tempstring);
}
/* process the menu */
ui_menu_process(machine, menu, 0);
} | /*-------------------------------------------------
ui_image_menu_image_info - menu that shows info
on all loaded images
-------------------------------------------------*/ | menu that shows info
on all loaded images | [
"menu",
"that",
"shows",
"info",
"on",
"all",
"loaded",
"images"
] | void ui_image_menu_image_info(running_machine *machine, ui_menu *menu, void *parameter, void *state)
{
if (!ui_menu_populated(menu))
{
astring *tempstring = image_info_astring(machine, astring_alloc());
ui_menu_item_append(menu, astring_c(tempstring), NULL, MENU_FLAG_MULTILINE, NULL);
astring_free(tempstring);
}
ui_menu_process(machine, menu, 0);
} | [
"void",
"ui_image_menu_image_info",
"(",
"running_machine",
"*",
"machine",
",",
"ui_menu",
"*",
"menu",
",",
"void",
"*",
"parameter",
",",
"void",
"*",
"state",
")",
"{",
"if",
"(",
"!",
"ui_menu_populated",
"(",
"menu",
")",
")",
"{",
"astring",
"*",
"tempstring",
"=",
"image_info_astring",
"(",
"machine",
",",
"astring_alloc",
"(",
")",
")",
";",
"ui_menu_item_append",
"(",
"menu",
",",
"astring_c",
"(",
"tempstring",
")",
",",
"NULL",
",",
"MENU_FLAG_MULTILINE",
",",
"NULL",
")",
";",
"astring_free",
"(",
"tempstring",
")",
";",
"}",
"ui_menu_process",
"(",
"machine",
",",
"menu",
",",
"0",
")",
";",
"}"
] | ui_image_menu_image_info - menu that shows info
on all loaded images | [
"ui_image_menu_image_info",
"-",
"menu",
"that",
"shows",
"info",
"on",
"all",
"loaded",
"images"
] | [
"/* if the menu isn't built, populate now */",
"/* process the menu */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "menu",
"type": "ui_menu"
},
{
"param": "parameter",
"type": "void"
},
{
"param": "state",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "menu",
"type": "ui_menu",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parameter",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
add4cdb8fdda59983f795ba9e27848c1ba55122b | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/drivers/ssv.c | [
"Unlicense"
] | C | init_ssv | void | static void init_ssv(void)
{
int i;
for (i = 0; i < 16; i++)
ssv_tile_code[i] = ( (i & 8) ? (1 << 16) : 0 ) +
( (i & 4) ? (2 << 16) : 0 ) +
( (i & 2) ? (4 << 16) : 0 ) +
( (i & 1) ? (8 << 16) : 0 ) ;
ssv_enable_video(1);
ssv_special = 0;
interrupt_ultrax = 0;
} | /***************************************************************************
Some games (e.g. hypreac2) oddly map the high bits of the tile code
to the gfx roms: arranging the roms accordingly would waste tens of
megabytes. So we use a look-up table.
We also need to set up game specific offsets for sprites and layers
(at least until the CRT controlled will be emulated).
***************************************************************************/ | Some games oddly map the high bits of the tile code
to the gfx roms: arranging the roms accordingly would waste tens of
megabytes. So we use a look-up table.
We also need to set up game specific offsets for sprites and layers
(at least until the CRT controlled will be emulated). | [
"Some",
"games",
"oddly",
"map",
"the",
"high",
"bits",
"of",
"the",
"tile",
"code",
"to",
"the",
"gfx",
"roms",
":",
"arranging",
"the",
"roms",
"accordingly",
"would",
"waste",
"tens",
"of",
"megabytes",
".",
"So",
"we",
"use",
"a",
"look",
"-",
"up",
"table",
".",
"We",
"also",
"need",
"to",
"set",
"up",
"game",
"specific",
"offsets",
"for",
"sprites",
"and",
"layers",
"(",
"at",
"least",
"until",
"the",
"CRT",
"controlled",
"will",
"be",
"emulated",
")",
"."
] | static void init_ssv(void)
{
int i;
for (i = 0; i < 16; i++)
ssv_tile_code[i] = ( (i & 8) ? (1 << 16) : 0 ) +
( (i & 4) ? (2 << 16) : 0 ) +
( (i & 2) ? (4 << 16) : 0 ) +
( (i & 1) ? (8 << 16) : 0 ) ;
ssv_enable_video(1);
ssv_special = 0;
interrupt_ultrax = 0;
} | [
"static",
"void",
"init_ssv",
"(",
"void",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"16",
";",
"i",
"++",
")",
"ssv_tile_code",
"[",
"i",
"]",
"=",
"(",
"(",
"i",
"&",
"8",
")",
"?",
"(",
"1",
"<<",
"16",
")",
":",
"0",
")",
"+",
"(",
"(",
"i",
"&",
"4",
")",
"?",
"(",
"2",
"<<",
"16",
")",
":",
"0",
")",
"+",
"(",
"(",
"i",
"&",
"2",
")",
"?",
"(",
"4",
"<<",
"16",
")",
":",
"0",
")",
"+",
"(",
"(",
"i",
"&",
"1",
")",
"?",
"(",
"8",
"<<",
"16",
")",
":",
"0",
")",
";",
"ssv_enable_video",
"(",
"1",
")",
";",
"ssv_special",
"=",
"0",
";",
"interrupt_ultrax",
"=",
"0",
";",
"}"
] | Some games (e.g. | [
"Some",
"games",
"(",
"e",
".",
"g",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
addc860f4fa5c38fdae6ae6aa97822575178734b | lofunz/mieme | Reloaded/trunk/src/emu/cpu/pic16c5x/pic16c5x.c | [
"Unlicense"
] | C | pic16c5x_reset_regs | void | static void pic16c5x_reset_regs(pic16c5x_state *cpustate)
{
cpustate->PC = cpustate->reset_vector;
cpustate->CONFIG = cpustate->temp_config;
cpustate->TRISA = 0xff;
cpustate->TRISB = 0xff;
cpustate->TRISC = 0xff;
cpustate->OPTION = (T0CS_FLAG | T0SE_FLAG | PSA_FLAG | PS_REG);
cpustate->PCL = 0xff;
cpustate->FSR |= (UINT8)(~cpustate->picRAMmask);
cpustate->PORTA &= 0x0f;
cpustate->prescaler = 0;
cpustate->delay_timer = 0;
cpustate->old_T0 = 0;
cpustate->inst_cycles = 0;
} | /****************************************************************************
* Reset registers to their initial values
****************************************************************************/ | Reset registers to their initial values | [
"Reset",
"registers",
"to",
"their",
"initial",
"values"
] | static void pic16c5x_reset_regs(pic16c5x_state *cpustate)
{
cpustate->PC = cpustate->reset_vector;
cpustate->CONFIG = cpustate->temp_config;
cpustate->TRISA = 0xff;
cpustate->TRISB = 0xff;
cpustate->TRISC = 0xff;
cpustate->OPTION = (T0CS_FLAG | T0SE_FLAG | PSA_FLAG | PS_REG);
cpustate->PCL = 0xff;
cpustate->FSR |= (UINT8)(~cpustate->picRAMmask);
cpustate->PORTA &= 0x0f;
cpustate->prescaler = 0;
cpustate->delay_timer = 0;
cpustate->old_T0 = 0;
cpustate->inst_cycles = 0;
} | [
"static",
"void",
"pic16c5x_reset_regs",
"(",
"pic16c5x_state",
"*",
"cpustate",
")",
"{",
"cpustate",
"->",
"PC",
"=",
"cpustate",
"->",
"reset_vector",
";",
"cpustate",
"->",
"CONFIG",
"=",
"cpustate",
"->",
"temp_config",
";",
"cpustate",
"->",
"TRISA",
"=",
"0xff",
";",
"cpustate",
"->",
"TRISB",
"=",
"0xff",
";",
"cpustate",
"->",
"TRISC",
"=",
"0xff",
";",
"cpustate",
"->",
"OPTION",
"=",
"(",
"T0CS_FLAG",
"|",
"T0SE_FLAG",
"|",
"PSA_FLAG",
"|",
"PS_REG",
")",
";",
"cpustate",
"->",
"PCL",
"=",
"0xff",
";",
"cpustate",
"->",
"FSR",
"|=",
"(",
"UINT8",
")",
"(",
"~",
"cpustate",
"->",
"picRAMmask",
")",
";",
"cpustate",
"->",
"PORTA",
"&=",
"0x0f",
";",
"cpustate",
"->",
"prescaler",
"=",
"0",
";",
"cpustate",
"->",
"delay_timer",
"=",
"0",
";",
"cpustate",
"->",
"old_T0",
"=",
"0",
";",
"cpustate",
"->",
"inst_cycles",
"=",
"0",
";",
"}"
] | Reset registers to their initial values | [
"Reset",
"registers",
"to",
"their",
"initial",
"values"
] | [] | [
{
"param": "cpustate",
"type": "pic16c5x_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "pic16c5x_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9db9f8bd6ea1c64cfead522ff29f69e3afdc68cb | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/audio/mcr.c | [
"Unlicense"
] | C | ssio_compute_ay8910_modulation | void | static void ssio_compute_ay8910_modulation(running_machine *machine)
{
UINT8 *prom = memory_region(machine, "proms");
int volval;
/* loop over all possible values of the duty cycle */
for (volval = 0; volval < 16; volval++)
{
int remaining_clocks = volval;
int clock, cur = 0, prev = 1;
/* loop over all the clocks until we run out; look up in the PROM */
/* to find out when the next clock should fire */
for (clock = 0; clock < 160 && remaining_clocks; clock++)
{
cur = prom[clock / 8] & (0x80 >> (clock % 8));
/* check for a high -> low transition */
if (cur == 0 && prev != 0)
remaining_clocks--;
prev = cur;
}
/* treat the duty cycle as a volume */
ssio_ayvolume_lookup[15-volval] = clock * 100 / 160;
}
} | /*
AY-8910 modulation:
Starts with a 16MHz oscillator
/2 via 7474 flip-flip @ F11
This signal clocks the binary counter @ E11 which
cascades into the decade counter @ D11. This combo
effectively counts from 0-159 and then wraps. The
value from these counters is input to an 82S123 PROM,
which appears to be standard on all games.
One bit at a time from this PROM is clocked at a time
and the resulting inverted signal becomes a clock for
the down counters at F3, F4, F5, F8, F9, and F10. The
value in these down counters are reloaded after the 160
counts from the binary/decade counter combination.
When these down counters are loaded, the TC signal is
clear, which mutes the voice. When the down counters
cross through 0, the TC signal goes high and the 4016
multiplexers allow the AY-8910 voice to go through.
Thus, writing a 0 to the counters will enable the
voice for the longest period of time, while writing
a 15 enables it for the shortest period of time.
This creates an effective duty cycle for the voice.
Given that the down counters are reset 50000 times per
second (SSIO_CLOCK/2/160), which is above the typical
frequency of sound output. So we simply apply a volume
adjustment to each voice according to the duty cycle.
*/ | AY-8910 modulation:
Starts with a 16MHz oscillator
2 via 7474 flip-flip @ F11
This signal clocks the binary counter @ E11 which
cascades into the decade counter @ D11. This combo
effectively counts from 0-159 and then wraps. The
value from these counters is input to an 82S123 PROM,
which appears to be standard on all games.
One bit at a time from this PROM is clocked at a time
and the resulting inverted signal becomes a clock for
the down counters at F3, F4, F5, F8, F9, and F10. The
value in these down counters are reloaded after the 160
counts from the binary/decade counter combination.
When these down counters are loaded, the TC signal is
clear, which mutes the voice. When the down counters
cross through 0, the TC signal goes high and the 4016
multiplexers allow the AY-8910 voice to go through.
Thus, writing a 0 to the counters will enable the
voice for the longest period of time, while writing
a 15 enables it for the shortest period of time.
This creates an effective duty cycle for the voice.
Given that the down counters are reset 50000 times per
second (SSIO_CLOCK/2/160), which is above the typical
frequency of sound output. So we simply apply a volume
adjustment to each voice according to the duty cycle. | [
"AY",
"-",
"8910",
"modulation",
":",
"Starts",
"with",
"a",
"16MHz",
"oscillator",
"2",
"via",
"7474",
"flip",
"-",
"flip",
"@",
"F11",
"This",
"signal",
"clocks",
"the",
"binary",
"counter",
"@",
"E11",
"which",
"cascades",
"into",
"the",
"decade",
"counter",
"@",
"D11",
".",
"This",
"combo",
"effectively",
"counts",
"from",
"0",
"-",
"159",
"and",
"then",
"wraps",
".",
"The",
"value",
"from",
"these",
"counters",
"is",
"input",
"to",
"an",
"82S123",
"PROM",
"which",
"appears",
"to",
"be",
"standard",
"on",
"all",
"games",
".",
"One",
"bit",
"at",
"a",
"time",
"from",
"this",
"PROM",
"is",
"clocked",
"at",
"a",
"time",
"and",
"the",
"resulting",
"inverted",
"signal",
"becomes",
"a",
"clock",
"for",
"the",
"down",
"counters",
"at",
"F3",
"F4",
"F5",
"F8",
"F9",
"and",
"F10",
".",
"The",
"value",
"in",
"these",
"down",
"counters",
"are",
"reloaded",
"after",
"the",
"160",
"counts",
"from",
"the",
"binary",
"/",
"decade",
"counter",
"combination",
".",
"When",
"these",
"down",
"counters",
"are",
"loaded",
"the",
"TC",
"signal",
"is",
"clear",
"which",
"mutes",
"the",
"voice",
".",
"When",
"the",
"down",
"counters",
"cross",
"through",
"0",
"the",
"TC",
"signal",
"goes",
"high",
"and",
"the",
"4016",
"multiplexers",
"allow",
"the",
"AY",
"-",
"8910",
"voice",
"to",
"go",
"through",
".",
"Thus",
"writing",
"a",
"0",
"to",
"the",
"counters",
"will",
"enable",
"the",
"voice",
"for",
"the",
"longest",
"period",
"of",
"time",
"while",
"writing",
"a",
"15",
"enables",
"it",
"for",
"the",
"shortest",
"period",
"of",
"time",
".",
"This",
"creates",
"an",
"effective",
"duty",
"cycle",
"for",
"the",
"voice",
".",
"Given",
"that",
"the",
"down",
"counters",
"are",
"reset",
"50000",
"times",
"per",
"second",
"(",
"SSIO_CLOCK",
"/",
"2",
"/",
"160",
")",
"which",
"is",
"above",
"the",
"typical",
"frequency",
"of",
"sound",
"output",
".",
"So",
"we",
"simply",
"apply",
"a",
"volume",
"adjustment",
"to",
"each",
"voice",
"according",
"to",
"the",
"duty",
"cycle",
"."
] | static void ssio_compute_ay8910_modulation(running_machine *machine)
{
UINT8 *prom = memory_region(machine, "proms");
int volval;
for (volval = 0; volval < 16; volval++)
{
int remaining_clocks = volval;
int clock, cur = 0, prev = 1;
for (clock = 0; clock < 160 && remaining_clocks; clock++)
{
cur = prom[clock / 8] & (0x80 >> (clock % 8));
if (cur == 0 && prev != 0)
remaining_clocks--;
prev = cur;
}
ssio_ayvolume_lookup[15-volval] = clock * 100 / 160;
}
} | [
"static",
"void",
"ssio_compute_ay8910_modulation",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"UINT8",
"*",
"prom",
"=",
"memory_region",
"(",
"machine",
",",
"\"",
"\"",
")",
";",
"int",
"volval",
";",
"for",
"(",
"volval",
"=",
"0",
";",
"volval",
"<",
"16",
";",
"volval",
"++",
")",
"{",
"int",
"remaining_clocks",
"=",
"volval",
";",
"int",
"clock",
",",
"cur",
"=",
"0",
",",
"prev",
"=",
"1",
";",
"for",
"(",
"clock",
"=",
"0",
";",
"clock",
"<",
"160",
"&&",
"remaining_clocks",
";",
"clock",
"++",
")",
"{",
"cur",
"=",
"prom",
"[",
"clock",
"/",
"8",
"]",
"&",
"(",
"0x80",
">>",
"(",
"clock",
"%",
"8",
")",
")",
";",
"if",
"(",
"cur",
"==",
"0",
"&&",
"prev",
"!=",
"0",
")",
"remaining_clocks",
"--",
";",
"prev",
"=",
"cur",
";",
"}",
"ssio_ayvolume_lookup",
"[",
"15",
"-",
"volval",
"]",
"=",
"clock",
"*",
"100",
"/",
"160",
";",
"}",
"}"
] | AY-8910 modulation:
Starts with a 16MHz oscillator
2 via 7474 flip-flip @ F11 | [
"AY",
"-",
"8910",
"modulation",
":",
"Starts",
"with",
"a",
"16MHz",
"oscillator",
"2",
"via",
"7474",
"flip",
"-",
"flip",
"@",
"F11"
] | [
"/* loop over all possible values of the duty cycle */",
"/* loop over all the clocks until we run out; look up in the PROM */",
"/* to find out when the next clock should fire */",
"/* check for a high -> low transition */",
"/* treat the duty cycle as a volume */"
] | [
{
"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": []
} |
60c80e2683b9ef09dc200b1e12763707600d6ddd | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/audio/wiping.c | [
"Unlicense"
] | C | make_mixer_table | void | static void make_mixer_table(running_machine *machine, int voices, int gain)
{
int count = voices * 128;
int i;
/* allocate memory */
mixer_table = auto_alloc_array(machine, INT16, 256 * voices);
/* find the middle of the table */
mixer_lookup = mixer_table + (128 * voices);
/* fill in the table - 16 bit case */
for (i = 0; i < count; i++)
{
int val = i * gain * 16 / voices;
if (val > 32767) val = 32767;
mixer_lookup[ i] = val;
mixer_lookup[-i] = -val;
}
} | /* build a table to divide by the number of voices; gain is specified as gain*16 */ | build a table to divide by the number of voices; gain is specified as gain*16 | [
"build",
"a",
"table",
"to",
"divide",
"by",
"the",
"number",
"of",
"voices",
";",
"gain",
"is",
"specified",
"as",
"gain",
"*",
"16"
] | static void make_mixer_table(running_machine *machine, int voices, int gain)
{
int count = voices * 128;
int i;
mixer_table = auto_alloc_array(machine, INT16, 256 * voices);
mixer_lookup = mixer_table + (128 * voices);
for (i = 0; i < count; i++)
{
int val = i * gain * 16 / voices;
if (val > 32767) val = 32767;
mixer_lookup[ i] = val;
mixer_lookup[-i] = -val;
}
} | [
"static",
"void",
"make_mixer_table",
"(",
"running_machine",
"*",
"machine",
",",
"int",
"voices",
",",
"int",
"gain",
")",
"{",
"int",
"count",
"=",
"voices",
"*",
"128",
";",
"int",
"i",
";",
"mixer_table",
"=",
"auto_alloc_array",
"(",
"machine",
",",
"INT16",
",",
"256",
"*",
"voices",
")",
";",
"mixer_lookup",
"=",
"mixer_table",
"+",
"(",
"128",
"*",
"voices",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"int",
"val",
"=",
"i",
"*",
"gain",
"*",
"16",
"/",
"voices",
";",
"if",
"(",
"val",
">",
"32767",
")",
"val",
"=",
"32767",
";",
"mixer_lookup",
"[",
"i",
"]",
"=",
"val",
";",
"mixer_lookup",
"[",
"-",
"i",
"]",
"=",
"-",
"val",
";",
"}",
"}"
] | build a table to divide by the number of voices; gain is specified as gain*16 | [
"build",
"a",
"table",
"to",
"divide",
"by",
"the",
"number",
"of",
"voices",
";",
"gain",
"is",
"specified",
"as",
"gain",
"*",
"16"
] | [
"/* allocate memory */",
"/* find the middle of the table */",
"/* fill in the table - 16 bit case */"
] | [
{
"param": "machine",
"type": "running_machine"
},
{
"param": "voices",
"type": "int"
},
{
"param": "gain",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "machine",
"type": "running_machine",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "voices",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gain",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27d9103cc1be63a6addee84bdb28f5ed66b09dc0 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/dsp56k/dsp56pcu.c | [
"Unlicense"
] | C | dsp56k_set_irq_source | void | void dsp56k_set_irq_source(UINT8 irq_num, UINT16 iv, const char* source)
{
dsp56k_interrupt_sources[irq_num].irq_vector = iv;
strcpy(dsp56k_interrupt_sources[irq_num].irq_source, source);
} | /* Utility function to construct IRQ table */ | Utility function to construct IRQ table | [
"Utility",
"function",
"to",
"construct",
"IRQ",
"table"
] | void dsp56k_set_irq_source(UINT8 irq_num, UINT16 iv, const char* source)
{
dsp56k_interrupt_sources[irq_num].irq_vector = iv;
strcpy(dsp56k_interrupt_sources[irq_num].irq_source, source);
} | [
"void",
"dsp56k_set_irq_source",
"(",
"UINT8",
"irq_num",
",",
"UINT16",
"iv",
",",
"const",
"char",
"*",
"source",
")",
"{",
"dsp56k_interrupt_sources",
"[",
"irq_num",
"]",
".",
"irq_vector",
"=",
"iv",
";",
"strcpy",
"(",
"dsp56k_interrupt_sources",
"[",
"irq_num",
"]",
".",
"irq_source",
",",
"source",
")",
";",
"}"
] | Utility function to construct IRQ table | [
"Utility",
"function",
"to",
"construct",
"IRQ",
"table"
] | [] | [
{
"param": "irq_num",
"type": "UINT8"
},
{
"param": "iv",
"type": "UINT16"
},
{
"param": "source",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "irq_num",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iv",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "source",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27d9103cc1be63a6addee84bdb28f5ed66b09dc0 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/dsp56k/dsp56pcu.c | [
"Unlicense"
] | C | dsp56k_irq_table_init | void | void dsp56k_irq_table_init(void)
{
/* 1-14 + 1-18 */
/* TODO: Cull host command stuff appropriately */
/* array index . vector . token */
dsp56k_set_irq_source(0, 0x0000, "Hardware RESET");
dsp56k_set_irq_source(1, 0x0002, "Illegal Instruction");
dsp56k_set_irq_source(2, 0x0004, "Stack Error");
dsp56k_set_irq_source(3, 0x0006, "Reserved");
dsp56k_set_irq_source(4, 0x0008, "SWI");
dsp56k_set_irq_source(5, 0x000a, "IRQA");
dsp56k_set_irq_source(6, 0x000c, "IRQB");
dsp56k_set_irq_source(7, 0x000e, "Reserved");
dsp56k_set_irq_source(8, 0x0010, "SSI0 Receive Data with Exception");
dsp56k_set_irq_source(9, 0x0012, "SSI0 Receive Data");
dsp56k_set_irq_source(10, 0x0014, "SSI0 Transmit Data with Exception");
dsp56k_set_irq_source(11, 0x0016, "SSI0 Transmit Data");
dsp56k_set_irq_source(12, 0x0018, "SSI1 Receive Data with Exception");
dsp56k_set_irq_source(13, 0x001a, "SSI1 Receive Data");
dsp56k_set_irq_source(14, 0x001c, "SSI1 Transmit Data with Exception");
dsp56k_set_irq_source(15, 0x001e, "SSI1 Transmit Data");
dsp56k_set_irq_source(16, 0x0020, "Timer Overflow");
dsp56k_set_irq_source(17, 0x0022, "Timer Compare");
dsp56k_set_irq_source(18, 0x0024, "Host DMA Receive Data");
dsp56k_set_irq_source(19, 0x0026, "Host DMA Transmit Data");
dsp56k_set_irq_source(20, 0x0028, "Host Receive Data");
dsp56k_set_irq_source(21, 0x002a, "Host Transmit Data");
dsp56k_set_irq_source(22, 0x002c, "Host Command"); /* Default vector for the host command */
dsp56k_set_irq_source(23, 0x002e, "Codec Receive/Transmit");
dsp56k_set_irq_source(24, 0x0030, "Host Command 1");
dsp56k_set_irq_source(25, 0x0032, "Host Command 2");
dsp56k_set_irq_source(26, 0x0034, "Host Command 3");
dsp56k_set_irq_source(27, 0x0036, "Host Command 4");
dsp56k_set_irq_source(28, 0x0038, "Host Command 5");
dsp56k_set_irq_source(29, 0x003a, "Host Command 6");
dsp56k_set_irq_source(30, 0x003c, "Host Command 7");
dsp56k_set_irq_source(31, 0x003e, "Host Command 8");
} | /* Construct a table containing pertient IRQ information */ | Construct a table containing pertient IRQ information | [
"Construct",
"a",
"table",
"containing",
"pertient",
"IRQ",
"information"
] | void dsp56k_irq_table_init(void)
{
dsp56k_set_irq_source(0, 0x0000, "Hardware RESET");
dsp56k_set_irq_source(1, 0x0002, "Illegal Instruction");
dsp56k_set_irq_source(2, 0x0004, "Stack Error");
dsp56k_set_irq_source(3, 0x0006, "Reserved");
dsp56k_set_irq_source(4, 0x0008, "SWI");
dsp56k_set_irq_source(5, 0x000a, "IRQA");
dsp56k_set_irq_source(6, 0x000c, "IRQB");
dsp56k_set_irq_source(7, 0x000e, "Reserved");
dsp56k_set_irq_source(8, 0x0010, "SSI0 Receive Data with Exception");
dsp56k_set_irq_source(9, 0x0012, "SSI0 Receive Data");
dsp56k_set_irq_source(10, 0x0014, "SSI0 Transmit Data with Exception");
dsp56k_set_irq_source(11, 0x0016, "SSI0 Transmit Data");
dsp56k_set_irq_source(12, 0x0018, "SSI1 Receive Data with Exception");
dsp56k_set_irq_source(13, 0x001a, "SSI1 Receive Data");
dsp56k_set_irq_source(14, 0x001c, "SSI1 Transmit Data with Exception");
dsp56k_set_irq_source(15, 0x001e, "SSI1 Transmit Data");
dsp56k_set_irq_source(16, 0x0020, "Timer Overflow");
dsp56k_set_irq_source(17, 0x0022, "Timer Compare");
dsp56k_set_irq_source(18, 0x0024, "Host DMA Receive Data");
dsp56k_set_irq_source(19, 0x0026, "Host DMA Transmit Data");
dsp56k_set_irq_source(20, 0x0028, "Host Receive Data");
dsp56k_set_irq_source(21, 0x002a, "Host Transmit Data");
dsp56k_set_irq_source(22, 0x002c, "Host Command");
dsp56k_set_irq_source(23, 0x002e, "Codec Receive/Transmit");
dsp56k_set_irq_source(24, 0x0030, "Host Command 1");
dsp56k_set_irq_source(25, 0x0032, "Host Command 2");
dsp56k_set_irq_source(26, 0x0034, "Host Command 3");
dsp56k_set_irq_source(27, 0x0036, "Host Command 4");
dsp56k_set_irq_source(28, 0x0038, "Host Command 5");
dsp56k_set_irq_source(29, 0x003a, "Host Command 6");
dsp56k_set_irq_source(30, 0x003c, "Host Command 7");
dsp56k_set_irq_source(31, 0x003e, "Host Command 8");
} | [
"void",
"dsp56k_irq_table_init",
"(",
"void",
")",
"{",
"dsp56k_set_irq_source",
"(",
"0",
",",
"0x0000",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"1",
",",
"0x0002",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"2",
",",
"0x0004",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"3",
",",
"0x0006",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"4",
",",
"0x0008",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"5",
",",
"0x000a",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"6",
",",
"0x000c",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"7",
",",
"0x000e",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"8",
",",
"0x0010",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"9",
",",
"0x0012",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"10",
",",
"0x0014",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"11",
",",
"0x0016",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"12",
",",
"0x0018",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"13",
",",
"0x001a",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"14",
",",
"0x001c",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"15",
",",
"0x001e",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"16",
",",
"0x0020",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"17",
",",
"0x0022",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"18",
",",
"0x0024",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"19",
",",
"0x0026",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"20",
",",
"0x0028",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"21",
",",
"0x002a",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"22",
",",
"0x002c",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"23",
",",
"0x002e",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"24",
",",
"0x0030",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"25",
",",
"0x0032",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"26",
",",
"0x0034",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"27",
",",
"0x0036",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"28",
",",
"0x0038",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"29",
",",
"0x003a",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"30",
",",
"0x003c",
",",
"\"",
"\"",
")",
";",
"dsp56k_set_irq_source",
"(",
"31",
",",
"0x003e",
",",
"\"",
"\"",
")",
";",
"}"
] | Construct a table containing pertient IRQ information | [
"Construct",
"a",
"table",
"containing",
"pertient",
"IRQ",
"information"
] | [
"/* 1-14 + 1-18 */",
"/* TODO: Cull host command stuff appropriately */",
"/* array index . vector . token */",
"/* Default vector for the host command */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
27d9103cc1be63a6addee84bdb28f5ed66b09dc0 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/dsp56k/dsp56pcu.c | [
"Unlicense"
] | C | dsp56k_clear_pending_interrupts | void | void dsp56k_clear_pending_interrupts(dsp56k_core* cpustate)
{
int i;
for (i = 0; i < 32; i++)
{
cpustate->PCU.pending_interrupts[i] = -1;
}
} | /* Clear all entries from the pending table */ | Clear all entries from the pending table | [
"Clear",
"all",
"entries",
"from",
"the",
"pending",
"table"
] | void dsp56k_clear_pending_interrupts(dsp56k_core* cpustate)
{
int i;
for (i = 0; i < 32; i++)
{
cpustate->PCU.pending_interrupts[i] = -1;
}
} | [
"void",
"dsp56k_clear_pending_interrupts",
"(",
"dsp56k_core",
"*",
"cpustate",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"32",
";",
"i",
"++",
")",
"{",
"cpustate",
"->",
"PCU",
".",
"pending_interrupts",
"[",
"i",
"]",
"=",
"-1",
";",
"}",
"}"
] | Clear all entries from the pending table | [
"Clear",
"all",
"entries",
"from",
"the",
"pending",
"table"
] | [] | [
{
"param": "cpustate",
"type": "dsp56k_core"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "dsp56k_core",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27d9103cc1be63a6addee84bdb28f5ed66b09dc0 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/dsp56k/dsp56pcu.c | [
"Unlicense"
] | C | dsp56k_sort_pending_interrupts | void | void dsp56k_sort_pending_interrupts(dsp56k_core* cpustate, int num)
{
int i, j;
/* We're going to be sorting the priorities */
int priority_list[32];
for (i = 0; i < num; i++)
{
priority_list[i] = dsp56k_get_irq_priority(cpustate, cpustate->PCU.pending_interrupts[i]);
}
/* Bubble sort should be good enough for us */
for (i = 0; i < num; i++)
{
for(j = 0; j < num-1; j++)
{
if (priority_list[j] > priority_list[j+1])
{
int holder;
/* Swap priorities */
holder = priority_list[j+1];
priority_list[j+1] = priority_list[j];
priority_list[j] = holder;
/* Swap irq indices. */
holder = cpustate->PCU.pending_interrupts[j+1];
cpustate->PCU.pending_interrupts[j+1] = cpustate->PCU.pending_interrupts[j];
cpustate->PCU.pending_interrupts[j] = holder;
}
}
}
/* TODO: 1-17 Now sort each of the priority levels within their categories. */
} | /* Sort the pending irqs by priority */ | Sort the pending irqs by priority | [
"Sort",
"the",
"pending",
"irqs",
"by",
"priority"
] | void dsp56k_sort_pending_interrupts(dsp56k_core* cpustate, int num)
{
int i, j;
int priority_list[32];
for (i = 0; i < num; i++)
{
priority_list[i] = dsp56k_get_irq_priority(cpustate, cpustate->PCU.pending_interrupts[i]);
}
for (i = 0; i < num; i++)
{
for(j = 0; j < num-1; j++)
{
if (priority_list[j] > priority_list[j+1])
{
int holder;
holder = priority_list[j+1];
priority_list[j+1] = priority_list[j];
priority_list[j] = holder;
holder = cpustate->PCU.pending_interrupts[j+1];
cpustate->PCU.pending_interrupts[j+1] = cpustate->PCU.pending_interrupts[j];
cpustate->PCU.pending_interrupts[j] = holder;
}
}
}
} | [
"void",
"dsp56k_sort_pending_interrupts",
"(",
"dsp56k_core",
"*",
"cpustate",
",",
"int",
"num",
")",
"{",
"int",
"i",
",",
"j",
";",
"int",
"priority_list",
"[",
"32",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"num",
";",
"i",
"++",
")",
"{",
"priority_list",
"[",
"i",
"]",
"=",
"dsp56k_get_irq_priority",
"(",
"cpustate",
",",
"cpustate",
"->",
"PCU",
".",
"pending_interrupts",
"[",
"i",
"]",
")",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"num",
";",
"i",
"++",
")",
"{",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"num",
"-",
"1",
";",
"j",
"++",
")",
"{",
"if",
"(",
"priority_list",
"[",
"j",
"]",
">",
"priority_list",
"[",
"j",
"+",
"1",
"]",
")",
"{",
"int",
"holder",
";",
"holder",
"=",
"priority_list",
"[",
"j",
"+",
"1",
"]",
";",
"priority_list",
"[",
"j",
"+",
"1",
"]",
"=",
"priority_list",
"[",
"j",
"]",
";",
"priority_list",
"[",
"j",
"]",
"=",
"holder",
";",
"holder",
"=",
"cpustate",
"->",
"PCU",
".",
"pending_interrupts",
"[",
"j",
"+",
"1",
"]",
";",
"cpustate",
"->",
"PCU",
".",
"pending_interrupts",
"[",
"j",
"+",
"1",
"]",
"=",
"cpustate",
"->",
"PCU",
".",
"pending_interrupts",
"[",
"j",
"]",
";",
"cpustate",
"->",
"PCU",
".",
"pending_interrupts",
"[",
"j",
"]",
"=",
"holder",
";",
"}",
"}",
"}",
"}"
] | Sort the pending irqs by priority | [
"Sort",
"the",
"pending",
"irqs",
"by",
"priority"
] | [
"/* We're going to be sorting the priorities */",
"/* Bubble sort should be good enough for us */",
"/* Swap priorities */",
"/* Swap irq indices. */",
"/* TODO: 1-17 Now sort each of the priority levels within their categories. */"
] | [
{
"param": "cpustate",
"type": "dsp56k_core"
},
{
"param": "num",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "dsp56k_core",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27d9103cc1be63a6addee84bdb28f5ed66b09dc0 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/dsp56k/dsp56pcu.c | [
"Unlicense"
] | C | dsp56k_get_irq_priority | INT8 | INT8 dsp56k_get_irq_priority(dsp56k_core* cpustate, int index)
{
/* 1-12 */
switch (index)
{
/* Non-maskable */
case 0: return 3; /* Hardware RESET */
case 1: return 3; /* Illegal Instruction */
case 2: return 3; /* Stack Error */
case 3: return 3; /* Reserved */
case 4: return 3; /* SWI */
/* Poll the IPR for these guys. */
case 5: return irqa_ipl(cpustate); /* IRQA */
case 6: return irqb_ipl(cpustate); /* IRQB */
case 7: return -1; /* Reserved */
case 8: return ssi0_ipl(cpustate); /* SSI0 Receive Data with Exception */
case 9: return ssi0_ipl(cpustate); /* SSI0 Receive Data */
case 10: return ssi0_ipl(cpustate); /* SSI0 Transmit Data with Exception */
case 11: return ssi0_ipl(cpustate); /* SSI0 Transmit Data */
case 12: return ssi1_ipl(cpustate); /* SSI1 Receive Data with Exception */
case 13: return ssi1_ipl(cpustate); /* SSI1 Receive Data */
case 14: return ssi1_ipl(cpustate); /* SSI1 Transmit Data with Exception */
case 15: return ssi1_ipl(cpustate); /* SSI1 Transmit Data */
case 16: return tm_ipl(cpustate); /* Timer Overflow */
case 17: return tm_ipl(cpustate); /* Timer Compare */
case 18: return host_ipl(cpustate); /* Host DMA Receive Data */
case 19: return host_ipl(cpustate); /* Host DMA Transmit Data */
case 20: return host_ipl(cpustate); /* Host Receive Data */
case 21: return host_ipl(cpustate); /* Host Transmit Data */
case 22: return host_ipl(cpustate); /* Host Command 0 (Default) */
case 23: return codec_ipl(cpustate); /* Codec Receive/Transmit */
case 24: return host_ipl(cpustate); /* Host Command 1 // TODO: Are all host ipl's the same? */
case 25: return host_ipl(cpustate); /* Host Command 2 */
case 26: return host_ipl(cpustate); /* Host Command 3 */
case 27: return host_ipl(cpustate); /* Host Command 4 */
case 28: return host_ipl(cpustate); /* Host Command 5 */
case 29: return host_ipl(cpustate); /* Host Command 6 */
case 30: return host_ipl(cpustate); /* Host Command 7 */
case 31: return host_ipl(cpustate); /* Host Command 8 */
default: break;
}
return -1;
} | /* Given an index into the irq table, return the interrupt's current priority */ | Given an index into the irq table, return the interrupt's current priority | [
"Given",
"an",
"index",
"into",
"the",
"irq",
"table",
"return",
"the",
"interrupt",
"'",
"s",
"current",
"priority"
] | INT8 dsp56k_get_irq_priority(dsp56k_core* cpustate, int index)
{
switch (index)
{
case 0: return 3;
case 1: return 3;
case 2: return 3;
case 3: return 3;
case 4: return 3;
case 5: return irqa_ipl(cpustate);
case 6: return irqb_ipl(cpustate);
case 7: return -1;
case 8: return ssi0_ipl(cpustate);
case 9: return ssi0_ipl(cpustate);
case 10: return ssi0_ipl(cpustate);
case 11: return ssi0_ipl(cpustate);
case 12: return ssi1_ipl(cpustate);
case 13: return ssi1_ipl(cpustate);
case 14: return ssi1_ipl(cpustate);
case 15: return ssi1_ipl(cpustate);
case 16: return tm_ipl(cpustate);
case 17: return tm_ipl(cpustate);
case 18: return host_ipl(cpustate);
case 19: return host_ipl(cpustate);
case 20: return host_ipl(cpustate);
case 21: return host_ipl(cpustate);
case 22: return host_ipl(cpustate);
case 23: return codec_ipl(cpustate);
case 24: return host_ipl(cpustate);
case 25: return host_ipl(cpustate);
case 26: return host_ipl(cpustate);
case 27: return host_ipl(cpustate);
case 28: return host_ipl(cpustate);
case 29: return host_ipl(cpustate);
case 30: return host_ipl(cpustate);
case 31: return host_ipl(cpustate);
default: break;
}
return -1;
} | [
"INT8",
"dsp56k_get_irq_priority",
"(",
"dsp56k_core",
"*",
"cpustate",
",",
"int",
"index",
")",
"{",
"switch",
"(",
"index",
")",
"{",
"case",
"0",
":",
"return",
"3",
";",
"case",
"1",
":",
"return",
"3",
";",
"case",
"2",
":",
"return",
"3",
";",
"case",
"3",
":",
"return",
"3",
";",
"case",
"4",
":",
"return",
"3",
";",
"case",
"5",
":",
"return",
"irqa_ipl",
"(",
"cpustate",
")",
";",
"case",
"6",
":",
"return",
"irqb_ipl",
"(",
"cpustate",
")",
";",
"case",
"7",
":",
"return",
"-1",
";",
"case",
"8",
":",
"return",
"ssi0_ipl",
"(",
"cpustate",
")",
";",
"case",
"9",
":",
"return",
"ssi0_ipl",
"(",
"cpustate",
")",
";",
"case",
"10",
":",
"return",
"ssi0_ipl",
"(",
"cpustate",
")",
";",
"case",
"11",
":",
"return",
"ssi0_ipl",
"(",
"cpustate",
")",
";",
"case",
"12",
":",
"return",
"ssi1_ipl",
"(",
"cpustate",
")",
";",
"case",
"13",
":",
"return",
"ssi1_ipl",
"(",
"cpustate",
")",
";",
"case",
"14",
":",
"return",
"ssi1_ipl",
"(",
"cpustate",
")",
";",
"case",
"15",
":",
"return",
"ssi1_ipl",
"(",
"cpustate",
")",
";",
"case",
"16",
":",
"return",
"tm_ipl",
"(",
"cpustate",
")",
";",
"case",
"17",
":",
"return",
"tm_ipl",
"(",
"cpustate",
")",
";",
"case",
"18",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"19",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"20",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"21",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"22",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"23",
":",
"return",
"codec_ipl",
"(",
"cpustate",
")",
";",
"case",
"24",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"25",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"26",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"27",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"28",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"29",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"30",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"case",
"31",
":",
"return",
"host_ipl",
"(",
"cpustate",
")",
";",
"default",
":",
"break",
";",
"}",
"return",
"-1",
";",
"}"
] | Given an index into the irq table, return the interrupt's current priority | [
"Given",
"an",
"index",
"into",
"the",
"irq",
"table",
"return",
"the",
"interrupt",
"'",
"s",
"current",
"priority"
] | [
"/* 1-12 */",
"/* Non-maskable */",
"/* Hardware RESET */",
"/* Illegal Instruction */",
"/* Stack Error */",
"/* Reserved */",
"/* SWI */",
"/* Poll the IPR for these guys. */",
"/* IRQA */",
"/* IRQB */",
"/* Reserved */",
"/* SSI0 Receive Data with Exception */",
"/* SSI0 Receive Data */",
"/* SSI0 Transmit Data with Exception */",
"/* SSI0 Transmit Data */",
"/* SSI1 Receive Data with Exception */",
"/* SSI1 Receive Data */",
"/* SSI1 Transmit Data with Exception */",
"/* SSI1 Transmit Data */",
"/* Timer Overflow */",
"/* Timer Compare */",
"/* Host DMA Receive Data */",
"/* Host DMA Transmit Data */",
"/* Host Receive Data */",
"/* Host Transmit Data */",
"/* Host Command 0 (Default) */",
"/* Codec Receive/Transmit */",
"/* Host Command 1 // TODO: Are all host ipl's the same? */",
"/* Host Command 2 */",
"/* Host Command 3 */",
"/* Host Command 4 */",
"/* Host Command 5 */",
"/* Host Command 6 */",
"/* Host Command 7 */",
"/* Host Command 8 */"
] | [
{
"param": "cpustate",
"type": "dsp56k_core"
},
{
"param": "index",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cpustate",
"type": "dsp56k_core",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27d9103cc1be63a6addee84bdb28f5ed66b09dc0 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/dsp56k/dsp56pcu.c | [
"Unlicense"
] | C | dsp56k_get_irq_index_by_tag | int | int dsp56k_get_irq_index_by_tag(const char* tag)
{
int i;
for (i = 0; i < 32; i++)
{
if (strcmp(tag, dsp56k_interrupt_sources[i].irq_source) == 0)
{
return i;
}
}
fatalerror("DSP56K ERROR : IRQ TAG specified incorrectly (get_vector_by_tag) : %s.\n", tag);
return -1;
} | /* Given an IRQ name, return its index in the irq table */ | Given an IRQ name, return its index in the irq table | [
"Given",
"an",
"IRQ",
"name",
"return",
"its",
"index",
"in",
"the",
"irq",
"table"
] | int dsp56k_get_irq_index_by_tag(const char* tag)
{
int i;
for (i = 0; i < 32; i++)
{
if (strcmp(tag, dsp56k_interrupt_sources[i].irq_source) == 0)
{
return i;
}
}
fatalerror("DSP56K ERROR : IRQ TAG specified incorrectly (get_vector_by_tag) : %s.\n", tag);
return -1;
} | [
"int",
"dsp56k_get_irq_index_by_tag",
"(",
"const",
"char",
"*",
"tag",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"32",
";",
"i",
"++",
")",
"{",
"if",
"(",
"strcmp",
"(",
"tag",
",",
"dsp56k_interrupt_sources",
"[",
"i",
"]",
".",
"irq_source",
")",
"==",
"0",
")",
"{",
"return",
"i",
";",
"}",
"}",
"fatalerror",
"(",
"\"",
"\\n",
"\"",
",",
"tag",
")",
";",
"return",
"-1",
";",
"}"
] | Given an IRQ name, return its index in the irq table | [
"Given",
"an",
"IRQ",
"name",
"return",
"its",
"index",
"in",
"the",
"irq",
"table"
] | [] | [
{
"param": "tag",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tag",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d128b87fa3da59de0bba44c5f71214f8ebdc1f32 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/m68000/m68kcpu.h | [
"Unlicense"
] | C | m68ki_stack_frame_1010 | void | void m68ki_stack_frame_1010(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc)
{
/* INTERNAL REGISTER */
m68ki_push_16(m68k, 0);
/* INTERNAL REGISTER */
m68ki_push_16(m68k, 0);
/* DATA OUTPUT BUFFER (2 words) */
m68ki_push_32(m68k, 0);
/* INTERNAL REGISTER */
m68ki_push_16(m68k, 0);
/* INTERNAL REGISTER */
m68ki_push_16(m68k, 0);
/* DATA CYCLE FAULT ADDRESS (2 words) */
m68ki_push_32(m68k, 0);
/* INSTRUCTION PIPE STAGE B */
m68ki_push_16(m68k, 0);
/* INSTRUCTION PIPE STAGE C */
m68ki_push_16(m68k, 0);
/* SPECIAL STATUS REGISTER */
m68ki_push_16(m68k, 0);
/* INTERNAL REGISTER */
m68ki_push_16(m68k, 0);
/* 1010, VECTOR OFFSET */
m68ki_push_16(m68k, 0xa000 | (vector<<2));
/* PROGRAM COUNTER */
m68ki_push_32(m68k, pc);
/* STATUS REGISTER */
m68ki_push_16(m68k, sr);
} | /* Format A stack frame (short bus fault).
* This is used only by 68020 for bus fault and address error
* if the error happens at an instruction boundary.
* PC stacked is address of next instruction.
*/ | Format A stack frame (short bus fault).
This is used only by 68020 for bus fault and address error
if the error happens at an instruction boundary.
PC stacked is address of next instruction. | [
"Format",
"A",
"stack",
"frame",
"(",
"short",
"bus",
"fault",
")",
".",
"This",
"is",
"used",
"only",
"by",
"68020",
"for",
"bus",
"fault",
"and",
"address",
"error",
"if",
"the",
"error",
"happens",
"at",
"an",
"instruction",
"boundary",
".",
"PC",
"stacked",
"is",
"address",
"of",
"next",
"instruction",
"."
] | void m68ki_stack_frame_1010(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc)
{
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0xa000 | (vector<<2));
m68ki_push_32(m68k, pc);
m68ki_push_16(m68k, sr);
} | [
"void",
"m68ki_stack_frame_1010",
"(",
"m68ki_cpu_core",
"*",
"m68k",
",",
"UINT32",
"sr",
",",
"UINT32",
"vector",
",",
"UINT32",
"pc",
")",
"{",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0xa000",
"|",
"(",
"vector",
"<<",
"2",
")",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"pc",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"sr",
")",
";",
"}"
] | Format A stack frame (short bus fault). | [
"Format",
"A",
"stack",
"frame",
"(",
"short",
"bus",
"fault",
")",
"."
] | [
"/* INTERNAL REGISTER */",
"/* INTERNAL REGISTER */",
"/* DATA OUTPUT BUFFER (2 words) */",
"/* INTERNAL REGISTER */",
"/* INTERNAL REGISTER */",
"/* DATA CYCLE FAULT ADDRESS (2 words) */",
"/* INSTRUCTION PIPE STAGE B */",
"/* INSTRUCTION PIPE STAGE C */",
"/* SPECIAL STATUS REGISTER */",
"/* INTERNAL REGISTER */",
"/* 1010, VECTOR OFFSET */",
"/* PROGRAM COUNTER */",
"/* STATUS REGISTER */"
] | [
{
"param": "m68k",
"type": "m68ki_cpu_core"
},
{
"param": "sr",
"type": "UINT32"
},
{
"param": "vector",
"type": "UINT32"
},
{
"param": "pc",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "m68k",
"type": "m68ki_cpu_core",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sr",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vector",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pc",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d128b87fa3da59de0bba44c5f71214f8ebdc1f32 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/m68000/m68kcpu.h | [
"Unlicense"
] | C | m68ki_stack_frame_1011 | void | void m68ki_stack_frame_1011(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc)
{
/* INTERNAL REGISTERS (18 words) */
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
/* VERSION# (4 bits), INTERNAL INFORMATION */
m68ki_push_16(m68k, 0);
/* INTERNAL REGISTERS (3 words) */
m68ki_push_32(m68k, 0);
m68ki_push_16(m68k, 0);
/* DATA INTPUT BUFFER (2 words) */
m68ki_push_32(m68k, 0);
/* INTERNAL REGISTERS (2 words) */
m68ki_push_32(m68k, 0);
/* STAGE B ADDRESS (2 words) */
m68ki_push_32(m68k, 0);
/* INTERNAL REGISTER (4 words) */
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
/* DATA OUTPUT BUFFER (2 words) */
m68ki_push_32(m68k, 0);
/* INTERNAL REGISTER */
m68ki_push_16(m68k, 0);
/* INTERNAL REGISTER */
m68ki_push_16(m68k, 0);
/* DATA CYCLE FAULT ADDRESS (2 words) */
m68ki_push_32(m68k, 0);
/* INSTRUCTION PIPE STAGE B */
m68ki_push_16(m68k, 0);
/* INSTRUCTION PIPE STAGE C */
m68ki_push_16(m68k, 0);
/* SPECIAL STATUS REGISTER */
m68ki_push_16(m68k, 0);
/* INTERNAL REGISTER */
m68ki_push_16(m68k, 0);
/* 1011, VECTOR OFFSET */
m68ki_push_16(m68k, 0xb000 | (vector<<2));
/* PROGRAM COUNTER */
m68ki_push_32(m68k, pc);
/* STATUS REGISTER */
m68ki_push_16(m68k, sr);
} | /* Format B stack frame (long bus fault).
* This is used only by 68020 for bus fault and address error
* if the error happens during instruction execution.
* PC stacked is address of instruction in progress.
*/ | Format B stack frame (long bus fault).
This is used only by 68020 for bus fault and address error
if the error happens during instruction execution.
PC stacked is address of instruction in progress. | [
"Format",
"B",
"stack",
"frame",
"(",
"long",
"bus",
"fault",
")",
".",
"This",
"is",
"used",
"only",
"by",
"68020",
"for",
"bus",
"fault",
"and",
"address",
"error",
"if",
"the",
"error",
"happens",
"during",
"instruction",
"execution",
".",
"PC",
"stacked",
"is",
"address",
"of",
"instruction",
"in",
"progress",
"."
] | void m68ki_stack_frame_1011(m68ki_cpu_core *m68k, UINT32 sr, UINT32 vector, UINT32 pc)
{
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_32(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0);
m68ki_push_16(m68k, 0xb000 | (vector<<2));
m68ki_push_32(m68k, pc);
m68ki_push_16(m68k, sr);
} | [
"void",
"m68ki_stack_frame_1011",
"(",
"m68ki_cpu_core",
"*",
"m68k",
",",
"UINT32",
"sr",
",",
"UINT32",
"vector",
",",
"UINT32",
"pc",
")",
"{",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"0xb000",
"|",
"(",
"vector",
"<<",
"2",
")",
")",
";",
"m68ki_push_32",
"(",
"m68k",
",",
"pc",
")",
";",
"m68ki_push_16",
"(",
"m68k",
",",
"sr",
")",
";",
"}"
] | Format B stack frame (long bus fault). | [
"Format",
"B",
"stack",
"frame",
"(",
"long",
"bus",
"fault",
")",
"."
] | [
"/* INTERNAL REGISTERS (18 words) */",
"/* VERSION# (4 bits), INTERNAL INFORMATION */",
"/* INTERNAL REGISTERS (3 words) */",
"/* DATA INTPUT BUFFER (2 words) */",
"/* INTERNAL REGISTERS (2 words) */",
"/* STAGE B ADDRESS (2 words) */",
"/* INTERNAL REGISTER (4 words) */",
"/* DATA OUTPUT BUFFER (2 words) */",
"/* INTERNAL REGISTER */",
"/* INTERNAL REGISTER */",
"/* DATA CYCLE FAULT ADDRESS (2 words) */",
"/* INSTRUCTION PIPE STAGE B */",
"/* INSTRUCTION PIPE STAGE C */",
"/* SPECIAL STATUS REGISTER */",
"/* INTERNAL REGISTER */",
"/* 1011, VECTOR OFFSET */",
"/* PROGRAM COUNTER */",
"/* STATUS REGISTER */"
] | [
{
"param": "m68k",
"type": "m68ki_cpu_core"
},
{
"param": "sr",
"type": "UINT32"
},
{
"param": "vector",
"type": "UINT32"
},
{
"param": "pc",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "m68k",
"type": "m68ki_cpu_core",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sr",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vector",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pc",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d128b87fa3da59de0bba44c5f71214f8ebdc1f32 | lofunz/mieme | Reloaded/trunk/src/emu/cpu/m68000/m68kcpu.h | [
"Unlicense"
] | C | m68ki_exception_interrupt | void | void m68ki_exception_interrupt(m68ki_cpu_core *m68k, UINT32 int_level)
{
UINT32 vector;
UINT32 sr;
UINT32 new_pc;
if(CPU_TYPE_IS_000(m68k->cpu_type))
{
m68k->instr_mode = INSTRUCTION_NO;
}
/* Turn off the stopped state */
m68k->stopped &= ~STOP_LEVEL_STOP;
/* If we are halted, don't do anything */
if(m68k->stopped)
return;
/* Acknowledge the interrupt */
vector = (*m68k->int_ack_callback)(m68k->device, int_level);
/* Get the interrupt vector */
if(vector == M68K_INT_ACK_AUTOVECTOR)
/* Use the autovectors. This is the most commonly used implementation */
vector = EXCEPTION_INTERRUPT_AUTOVECTOR+int_level;
else if(vector == M68K_INT_ACK_SPURIOUS)
/* Called if no devices respond to the interrupt acknowledge */
vector = EXCEPTION_SPURIOUS_INTERRUPT;
else if(vector > 255)
return;
/* Start exception processing */
sr = m68ki_init_exception(m68k);
/* Set the interrupt mask to the level of the one being serviced */
m68k->int_mask = int_level<<8;
/* Get the new PC */
new_pc = m68ki_read_data_32(m68k, (vector<<2) + m68k->vbr);
/* If vector is uninitialized, call the uninitialized interrupt vector */
if(new_pc == 0)
new_pc = m68ki_read_data_32(m68k, (EXCEPTION_UNINITIALIZED_INTERRUPT<<2) + m68k->vbr);
/* Generate a stack frame */
m68ki_stack_frame_0000(m68k, REG_PC, sr, vector);
if(m68k->m_flag && CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
{
/* Create throwaway frame */
m68ki_set_sm_flag(m68k, m68k->s_flag); /* clear M */
sr |= 0x2000; /* Same as SR in master stack frame except S is forced high */
m68ki_stack_frame_0001(m68k, REG_PC, sr, vector);
}
m68ki_jump(m68k, new_pc);
/* Defer cycle counting until later */
m68k->remaining_cycles -= m68k->cyc_exception[vector];
} | /* Service an interrupt request and start exception processing */ | Service an interrupt request and start exception processing | [
"Service",
"an",
"interrupt",
"request",
"and",
"start",
"exception",
"processing"
] | void m68ki_exception_interrupt(m68ki_cpu_core *m68k, UINT32 int_level)
{
UINT32 vector;
UINT32 sr;
UINT32 new_pc;
if(CPU_TYPE_IS_000(m68k->cpu_type))
{
m68k->instr_mode = INSTRUCTION_NO;
}
m68k->stopped &= ~STOP_LEVEL_STOP;
if(m68k->stopped)
return;
vector = (*m68k->int_ack_callback)(m68k->device, int_level);
if(vector == M68K_INT_ACK_AUTOVECTOR)
vector = EXCEPTION_INTERRUPT_AUTOVECTOR+int_level;
else if(vector == M68K_INT_ACK_SPURIOUS)
vector = EXCEPTION_SPURIOUS_INTERRUPT;
else if(vector > 255)
return;
sr = m68ki_init_exception(m68k);
m68k->int_mask = int_level<<8;
new_pc = m68ki_read_data_32(m68k, (vector<<2) + m68k->vbr);
if(new_pc == 0)
new_pc = m68ki_read_data_32(m68k, (EXCEPTION_UNINITIALIZED_INTERRUPT<<2) + m68k->vbr);
m68ki_stack_frame_0000(m68k, REG_PC, sr, vector);
if(m68k->m_flag && CPU_TYPE_IS_EC020_PLUS(m68k->cpu_type))
{
m68ki_set_sm_flag(m68k, m68k->s_flag);
sr |= 0x2000;
m68ki_stack_frame_0001(m68k, REG_PC, sr, vector);
}
m68ki_jump(m68k, new_pc);
m68k->remaining_cycles -= m68k->cyc_exception[vector];
} | [
"void",
"m68ki_exception_interrupt",
"(",
"m68ki_cpu_core",
"*",
"m68k",
",",
"UINT32",
"int_level",
")",
"{",
"UINT32",
"vector",
";",
"UINT32",
"sr",
";",
"UINT32",
"new_pc",
";",
"if",
"(",
"CPU_TYPE_IS_000",
"(",
"m68k",
"->",
"cpu_type",
")",
")",
"{",
"m68k",
"->",
"instr_mode",
"=",
"INSTRUCTION_NO",
";",
"}",
"m68k",
"->",
"stopped",
"&=",
"~",
"STOP_LEVEL_STOP",
";",
"if",
"(",
"m68k",
"->",
"stopped",
")",
"return",
";",
"vector",
"=",
"(",
"*",
"m68k",
"->",
"int_ack_callback",
")",
"(",
"m68k",
"->",
"device",
",",
"int_level",
")",
";",
"if",
"(",
"vector",
"==",
"M68K_INT_ACK_AUTOVECTOR",
")",
"vector",
"=",
"EXCEPTION_INTERRUPT_AUTOVECTOR",
"+",
"int_level",
";",
"else",
"if",
"(",
"vector",
"==",
"M68K_INT_ACK_SPURIOUS",
")",
"vector",
"=",
"EXCEPTION_SPURIOUS_INTERRUPT",
";",
"else",
"if",
"(",
"vector",
">",
"255",
")",
"return",
";",
"sr",
"=",
"m68ki_init_exception",
"(",
"m68k",
")",
";",
"m68k",
"->",
"int_mask",
"=",
"int_level",
"<<",
"8",
";",
"new_pc",
"=",
"m68ki_read_data_32",
"(",
"m68k",
",",
"(",
"vector",
"<<",
"2",
")",
"+",
"m68k",
"->",
"vbr",
")",
";",
"if",
"(",
"new_pc",
"==",
"0",
")",
"new_pc",
"=",
"m68ki_read_data_32",
"(",
"m68k",
",",
"(",
"EXCEPTION_UNINITIALIZED_INTERRUPT",
"<<",
"2",
")",
"+",
"m68k",
"->",
"vbr",
")",
";",
"m68ki_stack_frame_0000",
"(",
"m68k",
",",
"REG_PC",
",",
"sr",
",",
"vector",
")",
";",
"if",
"(",
"m68k",
"->",
"m_flag",
"&&",
"CPU_TYPE_IS_EC020_PLUS",
"(",
"m68k",
"->",
"cpu_type",
")",
")",
"{",
"m68ki_set_sm_flag",
"(",
"m68k",
",",
"m68k",
"->",
"s_flag",
")",
";",
"sr",
"|=",
"0x2000",
";",
"m68ki_stack_frame_0001",
"(",
"m68k",
",",
"REG_PC",
",",
"sr",
",",
"vector",
")",
";",
"}",
"m68ki_jump",
"(",
"m68k",
",",
"new_pc",
")",
";",
"m68k",
"->",
"remaining_cycles",
"-=",
"m68k",
"->",
"cyc_exception",
"[",
"vector",
"]",
";",
"}"
] | Service an interrupt request and start exception processing | [
"Service",
"an",
"interrupt",
"request",
"and",
"start",
"exception",
"processing"
] | [
"/* Turn off the stopped state */",
"/* If we are halted, don't do anything */",
"/* Acknowledge the interrupt */",
"/* Get the interrupt vector */",
"/* Use the autovectors. This is the most commonly used implementation */",
"/* Called if no devices respond to the interrupt acknowledge */",
"/* Start exception processing */",
"/* Set the interrupt mask to the level of the one being serviced */",
"/* Get the new PC */",
"/* If vector is uninitialized, call the uninitialized interrupt vector */",
"/* Generate a stack frame */",
"/* Create throwaway frame */",
"/* clear M */",
"/* Same as SR in master stack frame except S is forced high */",
"/* Defer cycle counting until later */"
] | [
{
"param": "m68k",
"type": "m68ki_cpu_core"
},
{
"param": "int_level",
"type": "UINT32"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "m68k",
"type": "m68ki_cpu_core",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "int_level",
"type": "UINT32",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_create | core_options | core_options *options_create(void (*fail)(const char *message))
{
/* allocate memory for the option block */
core_options *opts = (core_options *)malloc(sizeof(*opts));
if (opts == NULL)
goto error;
/* and set up the structure */
memset(opts, 0, sizeof(*opts));
opts->datalist_nextptr = &opts->datalist;
return opts;
error:
return NULL;
} | /*-------------------------------------------------
options_create - creates a new instance of
core options
-------------------------------------------------*/ | creates a new instance of
core options | [
"creates",
"a",
"new",
"instance",
"of",
"core",
"options"
] | core_options *options_create(void (*fail)(const char *message))
{
core_options *opts = (core_options *)malloc(sizeof(*opts));
if (opts == NULL)
goto error;
memset(opts, 0, sizeof(*opts));
opts->datalist_nextptr = &opts->datalist;
return opts;
error:
return NULL;
} | [
"core_options",
"*",
"options_create",
"(",
"void",
"(",
"*",
"fail",
")",
"(",
"const",
"char",
"*",
"message",
")",
")",
"{",
"core_options",
"*",
"opts",
"=",
"(",
"core_options",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"opts",
")",
")",
";",
"if",
"(",
"opts",
"==",
"NULL",
")",
"goto",
"error",
";",
"memset",
"(",
"opts",
",",
"0",
",",
"sizeof",
"(",
"*",
"opts",
")",
")",
";",
"opts",
"->",
"datalist_nextptr",
"=",
"&",
"opts",
"->",
"datalist",
";",
"return",
"opts",
";",
"error",
":",
"return",
"NULL",
";",
"}"
] | options_create - creates a new instance of
core options | [
"options_create",
"-",
"creates",
"a",
"new",
"instance",
"of",
"core",
"options"
] | [
"/* allocate memory for the option block */",
"/* and set up the structure */"
] | [
{
"param": "fail",
"type": "void"
},
{
"param": "message",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fail",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "message",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_revert | void | void options_revert(core_options *opts, int priority)
{
options_data *data;
/* iterate over options and revert to defaults if below the given priority */
for (data = opts->datalist; data != NULL; data = data->next)
if (data->priority <= priority)
{
astring_cpy(data->data, data->defdata);
data->priority = OPTION_PRIORITY_DEFAULT;
}
} | /*-------------------------------------------------
options_revert - revert options at or below
a certain priority back to their defaults
-------------------------------------------------*/ | revert options at or below
a certain priority back to their defaults | [
"revert",
"options",
"at",
"or",
"below",
"a",
"certain",
"priority",
"back",
"to",
"their",
"defaults"
] | void options_revert(core_options *opts, int priority)
{
options_data *data;
for (data = opts->datalist; data != NULL; data = data->next)
if (data->priority <= priority)
{
astring_cpy(data->data, data->defdata);
data->priority = OPTION_PRIORITY_DEFAULT;
}
} | [
"void",
"options_revert",
"(",
"core_options",
"*",
"opts",
",",
"int",
"priority",
")",
"{",
"options_data",
"*",
"data",
";",
"for",
"(",
"data",
"=",
"opts",
"->",
"datalist",
";",
"data",
"!=",
"NULL",
";",
"data",
"=",
"data",
"->",
"next",
")",
"if",
"(",
"data",
"->",
"priority",
"<=",
"priority",
")",
"{",
"astring_cpy",
"(",
"data",
"->",
"data",
",",
"data",
"->",
"defdata",
")",
";",
"data",
"->",
"priority",
"=",
"OPTION_PRIORITY_DEFAULT",
";",
"}",
"}"
] | options_revert - revert options at or below
a certain priority back to their defaults | [
"options_revert",
"-",
"revert",
"options",
"at",
"or",
"below",
"a",
"certain",
"priority",
"back",
"to",
"their",
"defaults"
] | [
"/* iterate over options and revert to defaults if below the given priority */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "priority",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"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": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_copy | int | int options_copy(core_options *dest_opts, core_options *src_opts)
{
options_data *data;
/* iterate over options in the destination */
for (data = dest_opts->datalist; data != NULL; data = data->next)
if (!(data->flags & OPTION_HEADER))
{
options_data *srcdata = find_entry_data(src_opts, astring_c(data->links[0].name), FALSE);
/* if the option exists in the source, set it in the destination */
if (srcdata != NULL)
options_set_string(dest_opts, astring_c(srcdata->links[0].name), astring_c(srcdata->data), srcdata->priority);
}
return TRUE;
} | /*-------------------------------------------------
options_copy - copy options from one core_options
to another
-------------------------------------------------*/ | copy options from one core_options
to another | [
"copy",
"options",
"from",
"one",
"core_options",
"to",
"another"
] | int options_copy(core_options *dest_opts, core_options *src_opts)
{
options_data *data;
for (data = dest_opts->datalist; data != NULL; data = data->next)
if (!(data->flags & OPTION_HEADER))
{
options_data *srcdata = find_entry_data(src_opts, astring_c(data->links[0].name), FALSE);
if (srcdata != NULL)
options_set_string(dest_opts, astring_c(srcdata->links[0].name), astring_c(srcdata->data), srcdata->priority);
}
return TRUE;
} | [
"int",
"options_copy",
"(",
"core_options",
"*",
"dest_opts",
",",
"core_options",
"*",
"src_opts",
")",
"{",
"options_data",
"*",
"data",
";",
"for",
"(",
"data",
"=",
"dest_opts",
"->",
"datalist",
";",
"data",
"!=",
"NULL",
";",
"data",
"=",
"data",
"->",
"next",
")",
"if",
"(",
"!",
"(",
"data",
"->",
"flags",
"&",
"OPTION_HEADER",
")",
")",
"{",
"options_data",
"*",
"srcdata",
"=",
"find_entry_data",
"(",
"src_opts",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"FALSE",
")",
";",
"if",
"(",
"srcdata",
"!=",
"NULL",
")",
"options_set_string",
"(",
"dest_opts",
",",
"astring_c",
"(",
"srcdata",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"astring_c",
"(",
"srcdata",
"->",
"data",
")",
",",
"srcdata",
"->",
"priority",
")",
";",
"}",
"return",
"TRUE",
";",
"}"
] | options_copy - copy options from one core_options
to another | [
"options_copy",
"-",
"copy",
"options",
"from",
"one",
"core_options",
"to",
"another"
] | [
"/* iterate over options in the destination */",
"/* if the option exists in the source, set it in the destination */"
] | [
{
"param": "dest_opts",
"type": "core_options"
},
{
"param": "src_opts",
"type": "core_options"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dest_opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src_opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_add_entries | int | int options_add_entries(core_options *opts, const options_entry *entrylist)
{
/* loop over entries until we hit a NULL name */
for ( ; entrylist->name != NULL || (entrylist->flags & OPTION_HEADER); entrylist++)
{
options_data *match = NULL;
int i;
/* allocate a new item */
options_data *data = (options_data *)malloc(sizeof(*data));
if (data == NULL)
return FALSE;
memset(data, 0, sizeof(*data));
/* parse the option name */
if (entrylist->name != NULL)
parse_option_name(opts, entrylist->name, data);
/* do we match an existing entry? */
for (i = 0; i < ARRAY_LENGTH(data->links) && match == NULL; i++)
if (data->links[i].name != NULL)
match = find_entry_data(opts, astring_c(data->links[i].name), FALSE);
/* if so, throw away this entry and replace the data */
if (match != NULL)
{
/* free what we've allocated so far */
for (i = 0; i < ARRAY_LENGTH(data->links); i++)
if (data->links[i].name != NULL)
astring_free(data->links[i].name);
free(data);
/* use the matching entry as our data */
data = match;
}
/* otherwise, finish making the new entry */
else
{
/* allocate strings */
data->data = astring_alloc();
data->defdata = astring_alloc();
/* copy the flags, and set the value equal to the default */
data->flags = entrylist->flags;
data->description = entrylist->description;
/* add us to the end of the sequential list */
*opts->datalist_nextptr = data;
opts->datalist_nextptr = &data->next;
/* add each name to the appropriate hash table with a link back to us */
for (i = 0; i < ARRAY_LENGTH(data->links); i++)
if (data->links[i].name != NULL)
{
int hash_entry = hash_value(opts, astring_c(data->links[i].name));
/* set up link */
data->links[i].data = data;
data->links[i].next = opts->hashtable[hash_entry];
opts->hashtable[hash_entry] = &data->links[i];
}
}
/* copy in the data and default data values */
if (entrylist->defvalue != NULL)
{
astring_cpyc(data->data, entrylist->defvalue);
astring_cpyc(data->defdata, entrylist->defvalue);
}
data->priority = OPTION_PRIORITY_DEFAULT;
}
return TRUE;
} | /*-------------------------------------------------
options_add_entries - add entries to the
current options sets
-------------------------------------------------*/ | add entries to the
current options sets | [
"add",
"entries",
"to",
"the",
"current",
"options",
"sets"
] | int options_add_entries(core_options *opts, const options_entry *entrylist)
{
for ( ; entrylist->name != NULL || (entrylist->flags & OPTION_HEADER); entrylist++)
{
options_data *match = NULL;
int i;
options_data *data = (options_data *)malloc(sizeof(*data));
if (data == NULL)
return FALSE;
memset(data, 0, sizeof(*data));
if (entrylist->name != NULL)
parse_option_name(opts, entrylist->name, data);
for (i = 0; i < ARRAY_LENGTH(data->links) && match == NULL; i++)
if (data->links[i].name != NULL)
match = find_entry_data(opts, astring_c(data->links[i].name), FALSE);
if (match != NULL)
{
for (i = 0; i < ARRAY_LENGTH(data->links); i++)
if (data->links[i].name != NULL)
astring_free(data->links[i].name);
free(data);
data = match;
}
else
{
data->data = astring_alloc();
data->defdata = astring_alloc();
data->flags = entrylist->flags;
data->description = entrylist->description;
*opts->datalist_nextptr = data;
opts->datalist_nextptr = &data->next;
for (i = 0; i < ARRAY_LENGTH(data->links); i++)
if (data->links[i].name != NULL)
{
int hash_entry = hash_value(opts, astring_c(data->links[i].name));
data->links[i].data = data;
data->links[i].next = opts->hashtable[hash_entry];
opts->hashtable[hash_entry] = &data->links[i];
}
}
if (entrylist->defvalue != NULL)
{
astring_cpyc(data->data, entrylist->defvalue);
astring_cpyc(data->defdata, entrylist->defvalue);
}
data->priority = OPTION_PRIORITY_DEFAULT;
}
return TRUE;
} | [
"int",
"options_add_entries",
"(",
"core_options",
"*",
"opts",
",",
"const",
"options_entry",
"*",
"entrylist",
")",
"{",
"for",
"(",
";",
"entrylist",
"->",
"name",
"!=",
"NULL",
"||",
"(",
"entrylist",
"->",
"flags",
"&",
"OPTION_HEADER",
")",
";",
"entrylist",
"++",
")",
"{",
"options_data",
"*",
"match",
"=",
"NULL",
";",
"int",
"i",
";",
"options_data",
"*",
"data",
"=",
"(",
"options_data",
"*",
")",
"malloc",
"(",
"sizeof",
"(",
"*",
"data",
")",
")",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"return",
"FALSE",
";",
"memset",
"(",
"data",
",",
"0",
",",
"sizeof",
"(",
"*",
"data",
")",
")",
";",
"if",
"(",
"entrylist",
"->",
"name",
"!=",
"NULL",
")",
"parse_option_name",
"(",
"opts",
",",
"entrylist",
"->",
"name",
",",
"data",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"ARRAY_LENGTH",
"(",
"data",
"->",
"links",
")",
"&&",
"match",
"==",
"NULL",
";",
"i",
"++",
")",
"if",
"(",
"data",
"->",
"links",
"[",
"i",
"]",
".",
"name",
"!=",
"NULL",
")",
"match",
"=",
"find_entry_data",
"(",
"opts",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"i",
"]",
".",
"name",
")",
",",
"FALSE",
")",
";",
"if",
"(",
"match",
"!=",
"NULL",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"ARRAY_LENGTH",
"(",
"data",
"->",
"links",
")",
";",
"i",
"++",
")",
"if",
"(",
"data",
"->",
"links",
"[",
"i",
"]",
".",
"name",
"!=",
"NULL",
")",
"astring_free",
"(",
"data",
"->",
"links",
"[",
"i",
"]",
".",
"name",
")",
";",
"free",
"(",
"data",
")",
";",
"data",
"=",
"match",
";",
"}",
"else",
"{",
"data",
"->",
"data",
"=",
"astring_alloc",
"(",
")",
";",
"data",
"->",
"defdata",
"=",
"astring_alloc",
"(",
")",
";",
"data",
"->",
"flags",
"=",
"entrylist",
"->",
"flags",
";",
"data",
"->",
"description",
"=",
"entrylist",
"->",
"description",
";",
"*",
"opts",
"->",
"datalist_nextptr",
"=",
"data",
";",
"opts",
"->",
"datalist_nextptr",
"=",
"&",
"data",
"->",
"next",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"ARRAY_LENGTH",
"(",
"data",
"->",
"links",
")",
";",
"i",
"++",
")",
"if",
"(",
"data",
"->",
"links",
"[",
"i",
"]",
".",
"name",
"!=",
"NULL",
")",
"{",
"int",
"hash_entry",
"=",
"hash_value",
"(",
"opts",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"i",
"]",
".",
"name",
")",
")",
";",
"data",
"->",
"links",
"[",
"i",
"]",
".",
"data",
"=",
"data",
";",
"data",
"->",
"links",
"[",
"i",
"]",
".",
"next",
"=",
"opts",
"->",
"hashtable",
"[",
"hash_entry",
"]",
";",
"opts",
"->",
"hashtable",
"[",
"hash_entry",
"]",
"=",
"&",
"data",
"->",
"links",
"[",
"i",
"]",
";",
"}",
"}",
"if",
"(",
"entrylist",
"->",
"defvalue",
"!=",
"NULL",
")",
"{",
"astring_cpyc",
"(",
"data",
"->",
"data",
",",
"entrylist",
"->",
"defvalue",
")",
";",
"astring_cpyc",
"(",
"data",
"->",
"defdata",
",",
"entrylist",
"->",
"defvalue",
")",
";",
"}",
"data",
"->",
"priority",
"=",
"OPTION_PRIORITY_DEFAULT",
";",
"}",
"return",
"TRUE",
";",
"}"
] | options_add_entries - add entries to the
current options sets | [
"options_add_entries",
"-",
"add",
"entries",
"to",
"the",
"current",
"options",
"sets"
] | [
"/* loop over entries until we hit a NULL name */",
"/* allocate a new item */",
"/* parse the option name */",
"/* do we match an existing entry? */",
"/* if so, throw away this entry and replace the data */",
"/* free what we've allocated so far */",
"/* use the matching entry as our data */",
"/* otherwise, finish making the new entry */",
"/* allocate strings */",
"/* copy the flags, and set the value equal to the default */",
"/* add us to the end of the sequential list */",
"/* add each name to the appropriate hash table with a link back to us */",
"/* set up link */",
"/* copy in the data and default data values */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "entrylist",
"type": "options_entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entrylist",
"type": "options_entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_set_option_default_value | int | int options_set_option_default_value(core_options *opts, const char *name, const char *defvalue)
{
options_data *data = find_entry_data(opts, name, TRUE);
/* if we don't have an entry for this, fail */
if (data == NULL)
return FALSE;
/* update the data and default data; note that we assume that data == defdata */
astring_cpyc(data->data, defvalue);
astring_cpyc(data->defdata, defvalue);
data->priority = OPTION_PRIORITY_DEFAULT;
return TRUE;
} | /*-------------------------------------------------
options_set_option_default_value - change the
default value of an option
-------------------------------------------------*/ | change the
default value of an option | [
"change",
"the",
"default",
"value",
"of",
"an",
"option"
] | int options_set_option_default_value(core_options *opts, const char *name, const char *defvalue)
{
options_data *data = find_entry_data(opts, name, TRUE);
if (data == NULL)
return FALSE;
astring_cpyc(data->data, defvalue);
astring_cpyc(data->defdata, defvalue);
data->priority = OPTION_PRIORITY_DEFAULT;
return TRUE;
} | [
"int",
"options_set_option_default_value",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
",",
"const",
"char",
"*",
"defvalue",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"TRUE",
")",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"return",
"FALSE",
";",
"astring_cpyc",
"(",
"data",
"->",
"data",
",",
"defvalue",
")",
";",
"astring_cpyc",
"(",
"data",
"->",
"defdata",
",",
"defvalue",
")",
";",
"data",
"->",
"priority",
"=",
"OPTION_PRIORITY_DEFAULT",
";",
"return",
"TRUE",
";",
"}"
] | options_set_option_default_value - change the
default value of an option | [
"options_set_option_default_value",
"-",
"change",
"the",
"default",
"value",
"of",
"an",
"option"
] | [
"/* if we don't have an entry for this, fail */",
"/* update the data and default data; note that we assume that data == defdata */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
},
{
"param": "defvalue",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "defvalue",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_set_option_callback | int | int options_set_option_callback(core_options *opts, const char *name, void (*callback)(core_options *opts, const char *arg))
{
options_data *data = find_entry_data(opts, name, TRUE);
/* if we don't find an entry, fail */
if (data == NULL)
return FALSE;
/* set the callback */
data->callback = callback;
return TRUE;
} | /*-------------------------------------------------
options_set_option_callback - specifies a
callback to be invoked when parsing options
-------------------------------------------------*/ | specifies a
callback to be invoked when parsing options | [
"specifies",
"a",
"callback",
"to",
"be",
"invoked",
"when",
"parsing",
"options"
] | int options_set_option_callback(core_options *opts, const char *name, void (*callback)(core_options *opts, const char *arg))
{
options_data *data = find_entry_data(opts, name, TRUE);
if (data == NULL)
return FALSE;
data->callback = callback;
return TRUE;
} | [
"int",
"options_set_option_callback",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
",",
"void",
"(",
"*",
"callback",
")",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"arg",
")",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"TRUE",
")",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"return",
"FALSE",
";",
"data",
"->",
"callback",
"=",
"callback",
";",
"return",
"TRUE",
";",
"}"
] | options_set_option_callback - specifies a
callback to be invoked when parsing options | [
"options_set_option_callback",
"-",
"specifies",
"a",
"callback",
"to",
"be",
"invoked",
"when",
"parsing",
"options"
] | [
"/* if we don't find an entry, fail */",
"/* set the callback */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
},
{
"param": "callback",
"type": "void"
},
{
"param": "arg",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "callback",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_parse_command_line | int | int options_parse_command_line(core_options *opts, int argc, char **argv, int priority)
{
int unadorned_index = 0;
int arg;
/* loop over commands, looking for options */
for (arg = 1; arg < argc; arg++)
{
const char *optionname, *newdata;
options_data *data;
int is_unadorned;
/* determine the entry name to search for */
is_unadorned = (argv[arg][0] != '-');
if (!is_unadorned)
optionname = &argv[arg][1];
else
optionname = OPTION_UNADORNED(unadorned_index);
/* find our entry */
data = find_entry_data(opts, optionname, TRUE);
if (data == NULL)
{
message(opts, OPTMSG_ERROR, "Error: unknown option: %s\n", argv[arg]);
return 1;
}
/* if unadorned, we have to bump the count (unless if the option repeats) */
if (is_unadorned && !(data->flags & OPTION_REPEATS))
unadorned_index++;
/* get the data for this argument, special casing booleans */
if ((data->flags & (OPTION_BOOLEAN | OPTION_COMMAND)) != 0)
newdata = (strncmp(&argv[arg][1], "no", 2) == 0) ? "0" : "1";
else if (argv[arg][0] != '-')
newdata = argv[arg];
else if (arg + 1 < argc)
newdata = argv[++arg];
else
{
message(opts, OPTMSG_ERROR, "Error: option %s expected a parameter\n", argv[arg]);
return 1;
}
/* if the option is deprecated or internal, don't process further */
if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL)) != 0)
continue;
/* invoke callback, if present */
if (data->callback != NULL)
(*data->callback)(opts, newdata);
/* allocate a new copy of data for this */
update_data(opts, data, newdata, priority);
}
return 0;
} | /*-------------------------------------------------
options_parse_command_line - parse a series
of command line arguments
-------------------------------------------------*/ | parse a series
of command line arguments | [
"parse",
"a",
"series",
"of",
"command",
"line",
"arguments"
] | int options_parse_command_line(core_options *opts, int argc, char **argv, int priority)
{
int unadorned_index = 0;
int arg;
for (arg = 1; arg < argc; arg++)
{
const char *optionname, *newdata;
options_data *data;
int is_unadorned;
is_unadorned = (argv[arg][0] != '-');
if (!is_unadorned)
optionname = &argv[arg][1];
else
optionname = OPTION_UNADORNED(unadorned_index);
data = find_entry_data(opts, optionname, TRUE);
if (data == NULL)
{
message(opts, OPTMSG_ERROR, "Error: unknown option: %s\n", argv[arg]);
return 1;
}
if (is_unadorned && !(data->flags & OPTION_REPEATS))
unadorned_index++;
if ((data->flags & (OPTION_BOOLEAN | OPTION_COMMAND)) != 0)
newdata = (strncmp(&argv[arg][1], "no", 2) == 0) ? "0" : "1";
else if (argv[arg][0] != '-')
newdata = argv[arg];
else if (arg + 1 < argc)
newdata = argv[++arg];
else
{
message(opts, OPTMSG_ERROR, "Error: option %s expected a parameter\n", argv[arg]);
return 1;
}
if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL)) != 0)
continue;
if (data->callback != NULL)
(*data->callback)(opts, newdata);
update_data(opts, data, newdata, priority);
}
return 0;
} | [
"int",
"options_parse_command_line",
"(",
"core_options",
"*",
"opts",
",",
"int",
"argc",
",",
"char",
"*",
"*",
"argv",
",",
"int",
"priority",
")",
"{",
"int",
"unadorned_index",
"=",
"0",
";",
"int",
"arg",
";",
"for",
"(",
"arg",
"=",
"1",
";",
"arg",
"<",
"argc",
";",
"arg",
"++",
")",
"{",
"const",
"char",
"*",
"optionname",
",",
"*",
"newdata",
";",
"options_data",
"*",
"data",
";",
"int",
"is_unadorned",
";",
"is_unadorned",
"=",
"(",
"argv",
"[",
"arg",
"]",
"[",
"0",
"]",
"!=",
"'",
"'",
")",
";",
"if",
"(",
"!",
"is_unadorned",
")",
"optionname",
"=",
"&",
"argv",
"[",
"arg",
"]",
"[",
"1",
"]",
";",
"else",
"optionname",
"=",
"OPTION_UNADORNED",
"(",
"unadorned_index",
")",
";",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"optionname",
",",
"TRUE",
")",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"argv",
"[",
"arg",
"]",
")",
";",
"return",
"1",
";",
"}",
"if",
"(",
"is_unadorned",
"&&",
"!",
"(",
"data",
"->",
"flags",
"&",
"OPTION_REPEATS",
")",
")",
"unadorned_index",
"++",
";",
"if",
"(",
"(",
"data",
"->",
"flags",
"&",
"(",
"OPTION_BOOLEAN",
"|",
"OPTION_COMMAND",
")",
")",
"!=",
"0",
")",
"newdata",
"=",
"(",
"strncmp",
"(",
"&",
"argv",
"[",
"arg",
"]",
"[",
"1",
"]",
",",
"\"",
"\"",
",",
"2",
")",
"==",
"0",
")",
"?",
"\"",
"\"",
":",
"\"",
"\"",
";",
"else",
"if",
"(",
"argv",
"[",
"arg",
"]",
"[",
"0",
"]",
"!=",
"'",
"'",
")",
"newdata",
"=",
"argv",
"[",
"arg",
"]",
";",
"else",
"if",
"(",
"arg",
"+",
"1",
"<",
"argc",
")",
"newdata",
"=",
"argv",
"[",
"++",
"arg",
"]",
";",
"else",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"argv",
"[",
"arg",
"]",
")",
";",
"return",
"1",
";",
"}",
"if",
"(",
"(",
"data",
"->",
"flags",
"&",
"(",
"OPTION_DEPRECATED",
"|",
"OPTION_INTERNAL",
")",
")",
"!=",
"0",
")",
"continue",
";",
"if",
"(",
"data",
"->",
"callback",
"!=",
"NULL",
")",
"(",
"*",
"data",
"->",
"callback",
")",
"(",
"opts",
",",
"newdata",
")",
";",
"update_data",
"(",
"opts",
",",
"data",
",",
"newdata",
",",
"priority",
")",
";",
"}",
"return",
"0",
";",
"}"
] | options_parse_command_line - parse a series
of command line arguments | [
"options_parse_command_line",
"-",
"parse",
"a",
"series",
"of",
"command",
"line",
"arguments"
] | [
"/* loop over commands, looking for options */",
"/* determine the entry name to search for */",
"/* find our entry */",
"/* if unadorned, we have to bump the count (unless if the option repeats) */",
"/* get the data for this argument, special casing booleans */",
"/* if the option is deprecated or internal, don't process further */",
"/* invoke callback, if present */",
"/* allocate a new copy of data for this */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
},
{
"param": "priority",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"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": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_parse_ini_file | int | int options_parse_ini_file(core_options *opts, core_file *inifile, int priority)
{
char buffer[4096];
/* loop over data */
while (core_fgets(buffer, ARRAY_LENGTH(buffer), inifile) != NULL)
{
char *optionname, *optiondata, *temp;
options_data *data;
int inquotes = FALSE;
/* find the name */
for (optionname = buffer; *optionname != 0; optionname++)
if (!isspace((UINT8)*optionname))
break;
/* skip comments */
if (*optionname == 0 || *optionname == '#')
continue;
/* scan forward to find the first space */
for (temp = optionname; *temp != 0; temp++)
if (isspace((UINT8)*temp))
break;
/* if we hit the end early, print a warning and continue */
if (*temp == 0)
{
message(opts, OPTMSG_WARNING, "Warning: invalid line in INI: %s", buffer);
continue;
}
/* NULL-terminate */
*temp++ = 0;
optiondata = temp;
/* scan the data, stopping when we hit a comment */
for (temp = optiondata; *temp != 0; temp++)
{
if (*temp == '"')
inquotes = !inquotes;
if (*temp == '#' && !inquotes)
break;
}
*temp = 0;
/* find our entry */
data = find_entry_data(opts, optionname, FALSE);
if (data == NULL)
{
message(opts, OPTMSG_WARNING, "Warning: unknown option in INI: %s\n", optionname);
continue;
}
if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL)) != 0)
continue;
/* allocate a new copy of data for this */
update_data(opts, data, optiondata, priority);
}
return 0;
} | /*-------------------------------------------------
options_parse_ini_file - parse a series
of entries in an INI file
-------------------------------------------------*/ | parse a series
of entries in an INI file | [
"parse",
"a",
"series",
"of",
"entries",
"in",
"an",
"INI",
"file"
] | int options_parse_ini_file(core_options *opts, core_file *inifile, int priority)
{
char buffer[4096];
while (core_fgets(buffer, ARRAY_LENGTH(buffer), inifile) != NULL)
{
char *optionname, *optiondata, *temp;
options_data *data;
int inquotes = FALSE;
for (optionname = buffer; *optionname != 0; optionname++)
if (!isspace((UINT8)*optionname))
break;
if (*optionname == 0 || *optionname == '#')
continue;
for (temp = optionname; *temp != 0; temp++)
if (isspace((UINT8)*temp))
break;
if (*temp == 0)
{
message(opts, OPTMSG_WARNING, "Warning: invalid line in INI: %s", buffer);
continue;
}
*temp++ = 0;
optiondata = temp;
for (temp = optiondata; *temp != 0; temp++)
{
if (*temp == '"')
inquotes = !inquotes;
if (*temp == '#' && !inquotes)
break;
}
*temp = 0;
data = find_entry_data(opts, optionname, FALSE);
if (data == NULL)
{
message(opts, OPTMSG_WARNING, "Warning: unknown option in INI: %s\n", optionname);
continue;
}
if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL)) != 0)
continue;
update_data(opts, data, optiondata, priority);
}
return 0;
} | [
"int",
"options_parse_ini_file",
"(",
"core_options",
"*",
"opts",
",",
"core_file",
"*",
"inifile",
",",
"int",
"priority",
")",
"{",
"char",
"buffer",
"[",
"4096",
"]",
";",
"while",
"(",
"core_fgets",
"(",
"buffer",
",",
"ARRAY_LENGTH",
"(",
"buffer",
")",
",",
"inifile",
")",
"!=",
"NULL",
")",
"{",
"char",
"*",
"optionname",
",",
"*",
"optiondata",
",",
"*",
"temp",
";",
"options_data",
"*",
"data",
";",
"int",
"inquotes",
"=",
"FALSE",
";",
"for",
"(",
"optionname",
"=",
"buffer",
";",
"*",
"optionname",
"!=",
"0",
";",
"optionname",
"++",
")",
"if",
"(",
"!",
"isspace",
"(",
"(",
"UINT8",
")",
"*",
"optionname",
")",
")",
"break",
";",
"if",
"(",
"*",
"optionname",
"==",
"0",
"||",
"*",
"optionname",
"==",
"'",
"'",
")",
"continue",
";",
"for",
"(",
"temp",
"=",
"optionname",
";",
"*",
"temp",
"!=",
"0",
";",
"temp",
"++",
")",
"if",
"(",
"isspace",
"(",
"(",
"UINT8",
")",
"*",
"temp",
")",
")",
"break",
";",
"if",
"(",
"*",
"temp",
"==",
"0",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_WARNING",
",",
"\"",
"\"",
",",
"buffer",
")",
";",
"continue",
";",
"}",
"*",
"temp",
"++",
"=",
"0",
";",
"optiondata",
"=",
"temp",
";",
"for",
"(",
"temp",
"=",
"optiondata",
";",
"*",
"temp",
"!=",
"0",
";",
"temp",
"++",
")",
"{",
"if",
"(",
"*",
"temp",
"==",
"'",
"'",
")",
"inquotes",
"=",
"!",
"inquotes",
";",
"if",
"(",
"*",
"temp",
"==",
"'",
"'",
"&&",
"!",
"inquotes",
")",
"break",
";",
"}",
"*",
"temp",
"=",
"0",
";",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"optionname",
",",
"FALSE",
")",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_WARNING",
",",
"\"",
"\\n",
"\"",
",",
"optionname",
")",
";",
"continue",
";",
"}",
"if",
"(",
"(",
"data",
"->",
"flags",
"&",
"(",
"OPTION_DEPRECATED",
"|",
"OPTION_INTERNAL",
")",
")",
"!=",
"0",
")",
"continue",
";",
"update_data",
"(",
"opts",
",",
"data",
",",
"optiondata",
",",
"priority",
")",
";",
"}",
"return",
"0",
";",
"}"
] | options_parse_ini_file - parse a series
of entries in an INI file | [
"options_parse_ini_file",
"-",
"parse",
"a",
"series",
"of",
"entries",
"in",
"an",
"INI",
"file"
] | [
"/* loop over data */",
"/* find the name */",
"/* skip comments */",
"/* scan forward to find the first space */",
"/* if we hit the end early, print a warning and continue */",
"/* NULL-terminate */",
"/* scan the data, stopping when we hit a comment */",
"/* find our entry */",
"/* allocate a new copy of data for this */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "inifile",
"type": "core_file"
},
{
"param": "priority",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inifile",
"type": "core_file",
"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": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_output_diff_ini_file | void | void options_output_diff_ini_file(core_options *opts, core_options *baseopts, core_file *inifile)
{
options_data *data;
const char *last_header = NULL;
const char *name;
const char *value;
options_data *basedata;
/* loop over all items */
for (data = opts->datalist; data != NULL; data = data->next)
{
/* header: record description */
if ((data->flags & OPTION_HEADER) != 0)
last_header = data->description;
/* otherwise, output entries for all non-deprecated and non-command items (if not in baseopts) */
else if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL | OPTION_COMMAND)) == 0)
{
/* get name and data of this value */
name = astring_c(data->links[0].name);
value = astring_c(data->data);
/* look up counterpart in baseopts, if baseopts is specified */
basedata = (baseopts != NULL) ? find_entry_data(baseopts, name, FALSE) : NULL;
/* is our data different, or not in baseopts? */
if ((basedata == NULL) || (strcmp(value, astring_c(basedata->data)) != 0))
{
/* output header, if we have one */
if (last_header != NULL)
{
core_fprintf(inifile, "\n#\n# %s\n#\n", last_header);
last_header = NULL;
}
/* and finally output the data */
if (strchr(value, ' ') != NULL)
core_fprintf(inifile, "%-25s \"%s\"\n", name, value);
else
core_fprintf(inifile, "%-25s %s\n", name, value);
}
}
}
} | /*-------------------------------------------------
options_output_diff_ini_file - output the diff
of the current state from a base state to an
INI file
-------------------------------------------------*/ | output the diff
of the current state from a base state to an
INI file | [
"output",
"the",
"diff",
"of",
"the",
"current",
"state",
"from",
"a",
"base",
"state",
"to",
"an",
"INI",
"file"
] | void options_output_diff_ini_file(core_options *opts, core_options *baseopts, core_file *inifile)
{
options_data *data;
const char *last_header = NULL;
const char *name;
const char *value;
options_data *basedata;
for (data = opts->datalist; data != NULL; data = data->next)
{
if ((data->flags & OPTION_HEADER) != 0)
last_header = data->description;
else if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL | OPTION_COMMAND)) == 0)
{
name = astring_c(data->links[0].name);
value = astring_c(data->data);
basedata = (baseopts != NULL) ? find_entry_data(baseopts, name, FALSE) : NULL;
if ((basedata == NULL) || (strcmp(value, astring_c(basedata->data)) != 0))
{
if (last_header != NULL)
{
core_fprintf(inifile, "\n#\n# %s\n#\n", last_header);
last_header = NULL;
}
if (strchr(value, ' ') != NULL)
core_fprintf(inifile, "%-25s \"%s\"\n", name, value);
else
core_fprintf(inifile, "%-25s %s\n", name, value);
}
}
}
} | [
"void",
"options_output_diff_ini_file",
"(",
"core_options",
"*",
"opts",
",",
"core_options",
"*",
"baseopts",
",",
"core_file",
"*",
"inifile",
")",
"{",
"options_data",
"*",
"data",
";",
"const",
"char",
"*",
"last_header",
"=",
"NULL",
";",
"const",
"char",
"*",
"name",
";",
"const",
"char",
"*",
"value",
";",
"options_data",
"*",
"basedata",
";",
"for",
"(",
"data",
"=",
"opts",
"->",
"datalist",
";",
"data",
"!=",
"NULL",
";",
"data",
"=",
"data",
"->",
"next",
")",
"{",
"if",
"(",
"(",
"data",
"->",
"flags",
"&",
"OPTION_HEADER",
")",
"!=",
"0",
")",
"last_header",
"=",
"data",
"->",
"description",
";",
"else",
"if",
"(",
"(",
"data",
"->",
"flags",
"&",
"(",
"OPTION_DEPRECATED",
"|",
"OPTION_INTERNAL",
"|",
"OPTION_COMMAND",
")",
")",
"==",
"0",
")",
"{",
"name",
"=",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
";",
"value",
"=",
"astring_c",
"(",
"data",
"->",
"data",
")",
";",
"basedata",
"=",
"(",
"baseopts",
"!=",
"NULL",
")",
"?",
"find_entry_data",
"(",
"baseopts",
",",
"name",
",",
"FALSE",
")",
":",
"NULL",
";",
"if",
"(",
"(",
"basedata",
"==",
"NULL",
")",
"||",
"(",
"strcmp",
"(",
"value",
",",
"astring_c",
"(",
"basedata",
"->",
"data",
")",
")",
"!=",
"0",
")",
")",
"{",
"if",
"(",
"last_header",
"!=",
"NULL",
")",
"{",
"core_fprintf",
"(",
"inifile",
",",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
",",
"last_header",
")",
";",
"last_header",
"=",
"NULL",
";",
"}",
"if",
"(",
"strchr",
"(",
"value",
",",
"'",
"'",
")",
"!=",
"NULL",
")",
"core_fprintf",
"(",
"inifile",
",",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"name",
",",
"value",
")",
";",
"else",
"core_fprintf",
"(",
"inifile",
",",
"\"",
"\\n",
"\"",
",",
"name",
",",
"value",
")",
";",
"}",
"}",
"}",
"}"
] | options_output_diff_ini_file - output the diff
of the current state from a base state to an
INI file | [
"options_output_diff_ini_file",
"-",
"output",
"the",
"diff",
"of",
"the",
"current",
"state",
"from",
"a",
"base",
"state",
"to",
"an",
"INI",
"file"
] | [
"/* loop over all items */",
"/* header: record description */",
"/* otherwise, output entries for all non-deprecated and non-command items (if not in baseopts) */",
"/* get name and data of this value */",
"/* look up counterpart in baseopts, if baseopts is specified */",
"/* is our data different, or not in baseopts? */",
"/* output header, if we have one */",
"/* and finally output the data */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "baseopts",
"type": "core_options"
},
{
"param": "inifile",
"type": "core_file"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "baseopts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inifile",
"type": "core_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_output_ini_stdfile | void | void options_output_ini_stdfile(core_options *opts, FILE *inifile)
{
options_data *data;
/* loop over all items */
for (data = opts->datalist; data != NULL; data = data->next)
{
/* header: just print */
if ((data->flags & OPTION_HEADER) != 0)
fprintf(inifile, "\n#\n# %s\n#\n", data->description);
/* otherwise, output entries for all non-deprecated and non-command items */
else if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL | OPTION_COMMAND)) == 0)
{
if (astring_chr(data->data, 0, ' ') != -1)
fprintf(inifile, "%-25s \"%s\"\n", astring_c(data->links[0].name), astring_c(data->data));
else
fprintf(inifile, "%-25s %s\n", astring_c(data->links[0].name), astring_c(data->data));
}
}
} | /*-------------------------------------------------
options_output_ini_file - output the current
state to an INI file
-------------------------------------------------*/ | output the current
state to an INI file | [
"output",
"the",
"current",
"state",
"to",
"an",
"INI",
"file"
] | void options_output_ini_stdfile(core_options *opts, FILE *inifile)
{
options_data *data;
for (data = opts->datalist; data != NULL; data = data->next)
{
if ((data->flags & OPTION_HEADER) != 0)
fprintf(inifile, "\n#\n# %s\n#\n", data->description);
else if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL | OPTION_COMMAND)) == 0)
{
if (astring_chr(data->data, 0, ' ') != -1)
fprintf(inifile, "%-25s \"%s\"\n", astring_c(data->links[0].name), astring_c(data->data));
else
fprintf(inifile, "%-25s %s\n", astring_c(data->links[0].name), astring_c(data->data));
}
}
} | [
"void",
"options_output_ini_stdfile",
"(",
"core_options",
"*",
"opts",
",",
"FILE",
"*",
"inifile",
")",
"{",
"options_data",
"*",
"data",
";",
"for",
"(",
"data",
"=",
"opts",
"->",
"datalist",
";",
"data",
"!=",
"NULL",
";",
"data",
"=",
"data",
"->",
"next",
")",
"{",
"if",
"(",
"(",
"data",
"->",
"flags",
"&",
"OPTION_HEADER",
")",
"!=",
"0",
")",
"fprintf",
"(",
"inifile",
",",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
",",
"data",
"->",
"description",
")",
";",
"else",
"if",
"(",
"(",
"data",
"->",
"flags",
"&",
"(",
"OPTION_DEPRECATED",
"|",
"OPTION_INTERNAL",
"|",
"OPTION_COMMAND",
")",
")",
"==",
"0",
")",
"{",
"if",
"(",
"astring_chr",
"(",
"data",
"->",
"data",
",",
"0",
",",
"'",
"'",
")",
"!=",
"-1",
")",
"fprintf",
"(",
"inifile",
",",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"astring_c",
"(",
"data",
"->",
"data",
")",
")",
";",
"else",
"fprintf",
"(",
"inifile",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"astring_c",
"(",
"data",
"->",
"data",
")",
")",
";",
"}",
"}",
"}"
] | options_output_ini_file - output the current
state to an INI file | [
"options_output_ini_file",
"-",
"output",
"the",
"current",
"state",
"to",
"an",
"INI",
"file"
] | [
"/* loop over all items */",
"/* header: just print */",
"/* otherwise, output entries for all non-deprecated and non-command items */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "inifile",
"type": "FILE"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inifile",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_output_help | void | void options_output_help(core_options *opts, void (*output)(const char *))
{
options_data *data;
/* loop over all items */
for (data = opts->datalist; data != NULL; data = data->next)
{
/* header: just print */
if ((data->flags & OPTION_HEADER) != 0)
output_printf(output, "\n#\n# %s\n#\n", data->description);
/* otherwise, output entries for all non-deprecated items */
else if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL)) == 0 && data->description != NULL)
output_printf(output, "-%-20s%s\n", astring_c(data->links[0].name), data->description);
}
} | /*-------------------------------------------------
options_output_help - output option help to
a file
-------------------------------------------------*/ | output option help to
a file | [
"output",
"option",
"help",
"to",
"a",
"file"
] | void options_output_help(core_options *opts, void (*output)(const char *))
{
options_data *data;
for (data = opts->datalist; data != NULL; data = data->next)
{
if ((data->flags & OPTION_HEADER) != 0)
output_printf(output, "\n#\n# %s\n#\n", data->description);
else if ((data->flags & (OPTION_DEPRECATED | OPTION_INTERNAL)) == 0 && data->description != NULL)
output_printf(output, "-%-20s%s\n", astring_c(data->links[0].name), data->description);
}
} | [
"void",
"options_output_help",
"(",
"core_options",
"*",
"opts",
",",
"void",
"(",
"*",
"output",
")",
"(",
"const",
"char",
"*",
")",
")",
"{",
"options_data",
"*",
"data",
";",
"for",
"(",
"data",
"=",
"opts",
"->",
"datalist",
";",
"data",
"!=",
"NULL",
";",
"data",
"=",
"data",
"->",
"next",
")",
"{",
"if",
"(",
"(",
"data",
"->",
"flags",
"&",
"OPTION_HEADER",
")",
"!=",
"0",
")",
"output_printf",
"(",
"output",
",",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
",",
"data",
"->",
"description",
")",
";",
"else",
"if",
"(",
"(",
"data",
"->",
"flags",
"&",
"(",
"OPTION_DEPRECATED",
"|",
"OPTION_INTERNAL",
")",
")",
"==",
"0",
"&&",
"data",
"->",
"description",
"!=",
"NULL",
")",
"output_printf",
"(",
"output",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"data",
"->",
"description",
")",
";",
"}",
"}"
] | options_output_help - output option help to
a file | [
"options_output_help",
"-",
"output",
"option",
"help",
"to",
"a",
"file"
] | [
"/* loop over all items */",
"/* header: just print */",
"/* otherwise, output entries for all non-deprecated items */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "output",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_get_string | char | const char *options_get_string(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
const char *value = "";
/* error if not found */
if (data == NULL)
message(opts, OPTMSG_ERROR, "Unexpected option %s queried\n", name);
/* copy if non-NULL */
else
value = astring_c(data->data);
return value;
} | /*-------------------------------------------------
options_get_string - return data formatted
as a string
-------------------------------------------------*/ | return data formatted
as a string | [
"return",
"data",
"formatted",
"as",
"a",
"string"
] | const char *options_get_string(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
const char *value = "";
if (data == NULL)
message(opts, OPTMSG_ERROR, "Unexpected option %s queried\n", name);
else
value = astring_c(data->data);
return value;
} | [
"const",
"char",
"*",
"options_get_string",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"FALSE",
")",
";",
"const",
"char",
"*",
"value",
"=",
"\"",
"\"",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"name",
")",
";",
"else",
"value",
"=",
"astring_c",
"(",
"data",
"->",
"data",
")",
";",
"return",
"value",
";",
"}"
] | options_get_string - return data formatted
as a string | [
"options_get_string",
"-",
"return",
"data",
"formatted",
"as",
"a",
"string"
] | [
"/* error if not found */",
"/* copy if non-NULL */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_get_bool | int | int options_get_bool(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
int value = FALSE;
/* error if not found */
if (data == NULL)
message(opts, OPTMSG_ERROR, "Unexpected boolean option %s queried\n", name);
/* also error if we don't have a valid boolean value */
else if (sscanf(astring_c(data->data), "%d", &value) != 1 || value < 0 || value > 1)
{
options_set_string(opts, name, astring_c(data->defdata), 0);
sscanf(astring_c(data->data), "%d", &value);
if (!data->error_reported)
{
message(opts, OPTMSG_ERROR, "Illegal boolean value for %s; reverting to %d\n", astring_c(data->links[0].name), value);
data->error_reported = TRUE;
}
}
return value;
} | /*-------------------------------------------------
options_get_bool - return data formatted as
a boolean
-------------------------------------------------*/ | return data formatted as
a boolean | [
"return",
"data",
"formatted",
"as",
"a",
"boolean"
] | int options_get_bool(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
int value = FALSE;
if (data == NULL)
message(opts, OPTMSG_ERROR, "Unexpected boolean option %s queried\n", name);
else if (sscanf(astring_c(data->data), "%d", &value) != 1 || value < 0 || value > 1)
{
options_set_string(opts, name, astring_c(data->defdata), 0);
sscanf(astring_c(data->data), "%d", &value);
if (!data->error_reported)
{
message(opts, OPTMSG_ERROR, "Illegal boolean value for %s; reverting to %d\n", astring_c(data->links[0].name), value);
data->error_reported = TRUE;
}
}
return value;
} | [
"int",
"options_get_bool",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"FALSE",
")",
";",
"int",
"value",
"=",
"FALSE",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"name",
")",
";",
"else",
"if",
"(",
"sscanf",
"(",
"astring_c",
"(",
"data",
"->",
"data",
")",
",",
"\"",
"\"",
",",
"&",
"value",
")",
"!=",
"1",
"||",
"value",
"<",
"0",
"||",
"value",
">",
"1",
")",
"{",
"options_set_string",
"(",
"opts",
",",
"name",
",",
"astring_c",
"(",
"data",
"->",
"defdata",
")",
",",
"0",
")",
";",
"sscanf",
"(",
"astring_c",
"(",
"data",
"->",
"data",
")",
",",
"\"",
"\"",
",",
"&",
"value",
")",
";",
"if",
"(",
"!",
"data",
"->",
"error_reported",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"value",
")",
";",
"data",
"->",
"error_reported",
"=",
"TRUE",
";",
"}",
"}",
"return",
"value",
";",
"}"
] | options_get_bool - return data formatted as
a boolean | [
"options_get_bool",
"-",
"return",
"data",
"formatted",
"as",
"a",
"boolean"
] | [
"/* error if not found */",
"/* also error if we don't have a valid boolean value */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_get_int | int | int options_get_int(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
int value = 0;
/* error if not found */
if (data == NULL)
message(opts, OPTMSG_ERROR, "Unexpected integer option %s queried\n", name);
/* also error if we don't have a valid integer value */
else if (sscanf(astring_c(data->data), "%d", &value) != 1)
{
options_set_string(opts, name, astring_c(data->defdata), 0);
sscanf(astring_c(data->data), "%d", &value);
if (!data->error_reported)
{
message(opts, OPTMSG_ERROR, "Illegal integer value for %s; reverting to %d\n", astring_c(data->links[0].name), value);
data->error_reported = TRUE;
}
}
return value;
} | /*-------------------------------------------------
options_get_int - return data formatted as
an integer
-------------------------------------------------*/ | return data formatted as
an integer | [
"return",
"data",
"formatted",
"as",
"an",
"integer"
] | int options_get_int(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
int value = 0;
if (data == NULL)
message(opts, OPTMSG_ERROR, "Unexpected integer option %s queried\n", name);
else if (sscanf(astring_c(data->data), "%d", &value) != 1)
{
options_set_string(opts, name, astring_c(data->defdata), 0);
sscanf(astring_c(data->data), "%d", &value);
if (!data->error_reported)
{
message(opts, OPTMSG_ERROR, "Illegal integer value for %s; reverting to %d\n", astring_c(data->links[0].name), value);
data->error_reported = TRUE;
}
}
return value;
} | [
"int",
"options_get_int",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"FALSE",
")",
";",
"int",
"value",
"=",
"0",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"name",
")",
";",
"else",
"if",
"(",
"sscanf",
"(",
"astring_c",
"(",
"data",
"->",
"data",
")",
",",
"\"",
"\"",
",",
"&",
"value",
")",
"!=",
"1",
")",
"{",
"options_set_string",
"(",
"opts",
",",
"name",
",",
"astring_c",
"(",
"data",
"->",
"defdata",
")",
",",
"0",
")",
";",
"sscanf",
"(",
"astring_c",
"(",
"data",
"->",
"data",
")",
",",
"\"",
"\"",
",",
"&",
"value",
")",
";",
"if",
"(",
"!",
"data",
"->",
"error_reported",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"value",
")",
";",
"data",
"->",
"error_reported",
"=",
"TRUE",
";",
"}",
"}",
"return",
"value",
";",
"}"
] | options_get_int - return data formatted as
an integer | [
"options_get_int",
"-",
"return",
"data",
"formatted",
"as",
"an",
"integer"
] | [
"/* error if not found */",
"/* also error if we don't have a valid integer value */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_get_float | float | float options_get_float(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
float value = 0;
/* error if not found */
if (data == NULL)
message(opts, OPTMSG_ERROR, "Unexpected float option %s queried\n", name);
/* also error if we don't have a valid floating point value */
else if (sscanf(astring_c(data->data), "%f", &value) != 1)
{
options_set_string(opts, name, astring_c(data->defdata), 0);
sscanf(astring_c(data->data), "%f", &value);
if (!data->error_reported)
{
message(opts, OPTMSG_ERROR, "Illegal float value for %s; reverting to %f\n", astring_c(data->links[0].name), (double)value);
data->error_reported = TRUE;
}
}
return value;
} | /*-------------------------------------------------
options_get_float - return data formatted as
a float
-------------------------------------------------*/ | return data formatted as
a float | [
"return",
"data",
"formatted",
"as",
"a",
"float"
] | float options_get_float(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
float value = 0;
if (data == NULL)
message(opts, OPTMSG_ERROR, "Unexpected float option %s queried\n", name);
else if (sscanf(astring_c(data->data), "%f", &value) != 1)
{
options_set_string(opts, name, astring_c(data->defdata), 0);
sscanf(astring_c(data->data), "%f", &value);
if (!data->error_reported)
{
message(opts, OPTMSG_ERROR, "Illegal float value for %s; reverting to %f\n", astring_c(data->links[0].name), (double)value);
data->error_reported = TRUE;
}
}
return value;
} | [
"float",
"options_get_float",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"FALSE",
")",
";",
"float",
"value",
"=",
"0",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"name",
")",
";",
"else",
"if",
"(",
"sscanf",
"(",
"astring_c",
"(",
"data",
"->",
"data",
")",
",",
"\"",
"\"",
",",
"&",
"value",
")",
"!=",
"1",
")",
"{",
"options_set_string",
"(",
"opts",
",",
"name",
",",
"astring_c",
"(",
"data",
"->",
"defdata",
")",
",",
"0",
")",
";",
"sscanf",
"(",
"astring_c",
"(",
"data",
"->",
"data",
")",
",",
"\"",
"\"",
",",
"&",
"value",
")",
";",
"if",
"(",
"!",
"data",
"->",
"error_reported",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"(",
"double",
")",
"value",
")",
";",
"data",
"->",
"error_reported",
"=",
"TRUE",
";",
"}",
"}",
"return",
"value",
";",
"}"
] | options_get_float - return data formatted as
a float | [
"options_get_float",
"-",
"return",
"data",
"formatted",
"as",
"a",
"float"
] | [
"/* error if not found */",
"/* also error if we don't have a valid floating point value */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_get_seqid | UINT32 | UINT32 options_get_seqid(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
return (data == NULL) ? 0 : data->seqid;
} | /*-------------------------------------------------
options_get_seqid - return the seqid for an
entry
-------------------------------------------------*/ | return the seqid for an
entry | [
"return",
"the",
"seqid",
"for",
"an",
"entry"
] | UINT32 options_get_seqid(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
return (data == NULL) ? 0 : data->seqid;
} | [
"UINT32",
"options_get_seqid",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"FALSE",
")",
";",
"return",
"(",
"data",
"==",
"NULL",
")",
"?",
"0",
":",
"data",
"->",
"seqid",
";",
"}"
] | options_get_seqid - return the seqid for an
entry | [
"options_get_seqid",
"-",
"return",
"the",
"seqid",
"for",
"an",
"entry"
] | [] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_enumerator_next | char | const char *options_enumerator_next(options_enumerator *enumerator)
{
astring *option_name = NULL;
/* be sure to skip over false options */
while (option_name == NULL && enumerator->current != NULL)
{
/* retrieve the current option name and advance the enumerator */
option_name = enumerator->current->links[0].name;
enumerator->current = enumerator->current->next;
}
return (option_name != NULL) ? astring_c(option_name) : NULL;
} | /*-------------------------------------------------
options_enumerator_next - returns the current
option and advances the enumerator
-------------------------------------------------*/ | returns the current
option and advances the enumerator | [
"returns",
"the",
"current",
"option",
"and",
"advances",
"the",
"enumerator"
] | const char *options_enumerator_next(options_enumerator *enumerator)
{
astring *option_name = NULL;
while (option_name == NULL && enumerator->current != NULL)
{
option_name = enumerator->current->links[0].name;
enumerator->current = enumerator->current->next;
}
return (option_name != NULL) ? astring_c(option_name) : NULL;
} | [
"const",
"char",
"*",
"options_enumerator_next",
"(",
"options_enumerator",
"*",
"enumerator",
")",
"{",
"astring",
"*",
"option_name",
"=",
"NULL",
";",
"while",
"(",
"option_name",
"==",
"NULL",
"&&",
"enumerator",
"->",
"current",
"!=",
"NULL",
")",
"{",
"option_name",
"=",
"enumerator",
"->",
"current",
"->",
"links",
"[",
"0",
"]",
".",
"name",
";",
"enumerator",
"->",
"current",
"=",
"enumerator",
"->",
"current",
"->",
"next",
";",
"}",
"return",
"(",
"option_name",
"!=",
"NULL",
")",
"?",
"astring_c",
"(",
"option_name",
")",
":",
"NULL",
";",
"}"
] | options_enumerator_next - returns the current
option and advances the enumerator | [
"options_enumerator_next",
"-",
"returns",
"the",
"current",
"option",
"and",
"advances",
"the",
"enumerator"
] | [
"/* be sure to skip over false options */",
"/* retrieve the current option name and advance the enumerator */"
] | [
{
"param": "enumerator",
"type": "options_enumerator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "enumerator",
"type": "options_enumerator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_get_range_type | options_range_type | options_range_type options_get_range_type(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
return data->range_type;
} | /*-------------------------------------------------
options_get_range_type - determine the type
of range for a particular option
-------------------------------------------------*/ | determine the type
of range for a particular option | [
"determine",
"the",
"type",
"of",
"range",
"for",
"a",
"particular",
"option"
] | options_range_type options_get_range_type(core_options *opts, const char *name)
{
options_data *data = find_entry_data(opts, name, FALSE);
return data->range_type;
} | [
"options_range_type",
"options_get_range_type",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"FALSE",
")",
";",
"return",
"data",
"->",
"range_type",
";",
"}"
] | options_get_range_type - determine the type
of range for a particular option | [
"options_get_range_type",
"-",
"determine",
"the",
"type",
"of",
"range",
"for",
"a",
"particular",
"option"
] | [] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_get_range_int | void | void options_get_range_int(core_options *opts, const char *name, int *minval, int *maxval)
{
options_data *data = find_entry_data(opts, name, FALSE);
*minval = data->range_minimum.i;
*maxval = data->range_maximum.i;
} | /*-------------------------------------------------
options_get_range_int - retrieve the range of
an integer option
-------------------------------------------------*/ | retrieve the range of
an integer option | [
"retrieve",
"the",
"range",
"of",
"an",
"integer",
"option"
] | void options_get_range_int(core_options *opts, const char *name, int *minval, int *maxval)
{
options_data *data = find_entry_data(opts, name, FALSE);
*minval = data->range_minimum.i;
*maxval = data->range_maximum.i;
} | [
"void",
"options_get_range_int",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
",",
"int",
"*",
"minval",
",",
"int",
"*",
"maxval",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"FALSE",
")",
";",
"*",
"minval",
"=",
"data",
"->",
"range_minimum",
".",
"i",
";",
"*",
"maxval",
"=",
"data",
"->",
"range_maximum",
".",
"i",
";",
"}"
] | options_get_range_int - retrieve the range of
an integer option | [
"options_get_range_int",
"-",
"retrieve",
"the",
"range",
"of",
"an",
"integer",
"option"
] | [] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
},
{
"param": "minval",
"type": "int"
},
{
"param": "maxval",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "minval",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "maxval",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | options_get_range_float | void | void options_get_range_float(core_options *opts, const char *name, float *minval, float *maxval)
{
options_data *data = find_entry_data(opts, name, FALSE);
*minval = data->range_minimum.f;
*maxval = data->range_maximum.f;
} | /*-------------------------------------------------
options_get_range_float - retrieve the range of
a float option
-------------------------------------------------*/ | retrieve the range of
a float option | [
"retrieve",
"the",
"range",
"of",
"a",
"float",
"option"
] | void options_get_range_float(core_options *opts, const char *name, float *minval, float *maxval)
{
options_data *data = find_entry_data(opts, name, FALSE);
*minval = data->range_minimum.f;
*maxval = data->range_maximum.f;
} | [
"void",
"options_get_range_float",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"name",
",",
"float",
"*",
"minval",
",",
"float",
"*",
"maxval",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"name",
",",
"FALSE",
")",
";",
"*",
"minval",
"=",
"data",
"->",
"range_minimum",
".",
"f",
";",
"*",
"maxval",
"=",
"data",
"->",
"range_maximum",
".",
"f",
";",
"}"
] | options_get_range_float - retrieve the range of
a float option | [
"options_get_range_float",
"-",
"retrieve",
"the",
"range",
"of",
"a",
"float",
"option"
] | [] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "name",
"type": "char"
},
{
"param": "minval",
"type": "float"
},
{
"param": "maxval",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "minval",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "maxval",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | find_entry_data | options_data | static options_data *find_entry_data(core_options *opts, const char *string, int is_command_line)
{
int hash_entry = hash_value(opts, string);
options_hash_entry *link;
/* scan all entries */
for (link = opts->hashtable[hash_entry]; link != NULL; link = link->next)
if (!(link->data->flags & OPTION_HEADER) && link->name != NULL && astring_cmpc(link->name, string) == 0)
return link->data;
/* haven't found it? if we are prefixed with "no", then try to search for that */
if (is_command_line && string[0] == 'n' && string[1] == 'o')
{
options_data *data = find_entry_data(opts, &string[2], FALSE);
if (data != NULL && (data->flags & OPTION_BOOLEAN))
return data;
}
/* didn't find it at all */
return NULL;
} | /*-------------------------------------------------
find_entry_data - locate an entry whose name
matches the given string
-------------------------------------------------*/ | locate an entry whose name
matches the given string | [
"locate",
"an",
"entry",
"whose",
"name",
"matches",
"the",
"given",
"string"
] | static options_data *find_entry_data(core_options *opts, const char *string, int is_command_line)
{
int hash_entry = hash_value(opts, string);
options_hash_entry *link;
for (link = opts->hashtable[hash_entry]; link != NULL; link = link->next)
if (!(link->data->flags & OPTION_HEADER) && link->name != NULL && astring_cmpc(link->name, string) == 0)
return link->data;
if (is_command_line && string[0] == 'n' && string[1] == 'o')
{
options_data *data = find_entry_data(opts, &string[2], FALSE);
if (data != NULL && (data->flags & OPTION_BOOLEAN))
return data;
}
return NULL;
} | [
"static",
"options_data",
"*",
"find_entry_data",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"string",
",",
"int",
"is_command_line",
")",
"{",
"int",
"hash_entry",
"=",
"hash_value",
"(",
"opts",
",",
"string",
")",
";",
"options_hash_entry",
"*",
"link",
";",
"for",
"(",
"link",
"=",
"opts",
"->",
"hashtable",
"[",
"hash_entry",
"]",
";",
"link",
"!=",
"NULL",
";",
"link",
"=",
"link",
"->",
"next",
")",
"if",
"(",
"!",
"(",
"link",
"->",
"data",
"->",
"flags",
"&",
"OPTION_HEADER",
")",
"&&",
"link",
"->",
"name",
"!=",
"NULL",
"&&",
"astring_cmpc",
"(",
"link",
"->",
"name",
",",
"string",
")",
"==",
"0",
")",
"return",
"link",
"->",
"data",
";",
"if",
"(",
"is_command_line",
"&&",
"string",
"[",
"0",
"]",
"==",
"'",
"'",
"&&",
"string",
"[",
"1",
"]",
"==",
"'",
"'",
")",
"{",
"options_data",
"*",
"data",
"=",
"find_entry_data",
"(",
"opts",
",",
"&",
"string",
"[",
"2",
"]",
",",
"FALSE",
")",
";",
"if",
"(",
"data",
"!=",
"NULL",
"&&",
"(",
"data",
"->",
"flags",
"&",
"OPTION_BOOLEAN",
")",
")",
"return",
"data",
";",
"}",
"return",
"NULL",
";",
"}"
] | find_entry_data - locate an entry whose name
matches the given string | [
"find_entry_data",
"-",
"locate",
"an",
"entry",
"whose",
"name",
"matches",
"the",
"given",
"string"
] | [
"/* scan all entries */",
"/* haven't found it? if we are prefixed with \"no\", then try to search for that */",
"/* didn't find it at all */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "string",
"type": "char"
},
{
"param": "is_command_line",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "is_command_line",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | update_data | void | static void update_data(core_options *opts, options_data *data, const char *newdata, int priority)
{
const char *dataend = newdata + strlen(newdata) - 1;
const char *datastart = newdata;
float f;
int i;
/* strip off leading/trailing spaces */
while (isspace((UINT8)*datastart) && datastart <= dataend)
datastart++;
while (isspace((UINT8)*dataend) && datastart <= dataend)
dataend--;
/* strip off quotes */
if (datastart != dataend && *datastart == '"' && *dataend == '"')
datastart++, dataend--;
/* check against range */
switch (data->range_type)
{
case OPTION_RANGE_NONE:
/* do nothing */
break;
case OPTION_RANGE_INT:
/* check against integer range */
i = 0;
if (sscanf(datastart, "%d", &i) != 1)
{
message(opts, OPTMSG_ERROR, "Illegal integer value for %s; keeping value of %s\n", astring_c(data->links[0].name), astring_c(data->data));
data->error_reported = TRUE;
return;
}
if (i < data->range_minimum.i || i > data->range_maximum.i)
{
message(opts, OPTMSG_ERROR, "Invalid %s value (must be between %i and %i); keeping value of %s\n",
astring_c(data->links[0].name), data->range_minimum.i, data->range_maximum.i, astring_c(data->data));
data->error_reported = TRUE;
return;
}
break;
case OPTION_RANGE_FLOAT:
/* check against float range */
f = 0;
if (sscanf(datastart, "%f", &f) != 1)
{
message(opts, OPTMSG_ERROR, "Illegal float value for %s; keeping value of %s\n", astring_c(data->links[0].name), astring_c(data->data));
data->error_reported = TRUE;
return;
}
if (f < data->range_minimum.f || f > data->range_maximum.f)
{
message(opts, OPTMSG_ERROR, "Invalid %s value (must be between %f and %f); keeping value of %s\n",
astring_c(data->links[0].name), data->range_minimum.f, data->range_maximum.f, astring_c(data->data));
data->error_reported = TRUE;
return;
}
break;
}
/* ignore if we don't have priority */
if (priority < data->priority)
return;
/* allocate a copy of the data */
astring_cpych(data->data, datastart, dataend + 1 - datastart);
data->priority = priority;
/* bump the seqid and clear the error reporting */
data->seqid++;
data->error_reported = FALSE;
} | /*-------------------------------------------------
update_data - update the data value for a
given entry
-------------------------------------------------*/ | update the data value for a
given entry | [
"update",
"the",
"data",
"value",
"for",
"a",
"given",
"entry"
] | static void update_data(core_options *opts, options_data *data, const char *newdata, int priority)
{
const char *dataend = newdata + strlen(newdata) - 1;
const char *datastart = newdata;
float f;
int i;
while (isspace((UINT8)*datastart) && datastart <= dataend)
datastart++;
while (isspace((UINT8)*dataend) && datastart <= dataend)
dataend--;
if (datastart != dataend && *datastart == '"' && *dataend == '"')
datastart++, dataend--;
switch (data->range_type)
{
case OPTION_RANGE_NONE:
break;
case OPTION_RANGE_INT:
i = 0;
if (sscanf(datastart, "%d", &i) != 1)
{
message(opts, OPTMSG_ERROR, "Illegal integer value for %s; keeping value of %s\n", astring_c(data->links[0].name), astring_c(data->data));
data->error_reported = TRUE;
return;
}
if (i < data->range_minimum.i || i > data->range_maximum.i)
{
message(opts, OPTMSG_ERROR, "Invalid %s value (must be between %i and %i); keeping value of %s\n",
astring_c(data->links[0].name), data->range_minimum.i, data->range_maximum.i, astring_c(data->data));
data->error_reported = TRUE;
return;
}
break;
case OPTION_RANGE_FLOAT:
f = 0;
if (sscanf(datastart, "%f", &f) != 1)
{
message(opts, OPTMSG_ERROR, "Illegal float value for %s; keeping value of %s\n", astring_c(data->links[0].name), astring_c(data->data));
data->error_reported = TRUE;
return;
}
if (f < data->range_minimum.f || f > data->range_maximum.f)
{
message(opts, OPTMSG_ERROR, "Invalid %s value (must be between %f and %f); keeping value of %s\n",
astring_c(data->links[0].name), data->range_minimum.f, data->range_maximum.f, astring_c(data->data));
data->error_reported = TRUE;
return;
}
break;
}
if (priority < data->priority)
return;
astring_cpych(data->data, datastart, dataend + 1 - datastart);
data->priority = priority;
data->seqid++;
data->error_reported = FALSE;
} | [
"static",
"void",
"update_data",
"(",
"core_options",
"*",
"opts",
",",
"options_data",
"*",
"data",
",",
"const",
"char",
"*",
"newdata",
",",
"int",
"priority",
")",
"{",
"const",
"char",
"*",
"dataend",
"=",
"newdata",
"+",
"strlen",
"(",
"newdata",
")",
"-",
"1",
";",
"const",
"char",
"*",
"datastart",
"=",
"newdata",
";",
"float",
"f",
";",
"int",
"i",
";",
"while",
"(",
"isspace",
"(",
"(",
"UINT8",
")",
"*",
"datastart",
")",
"&&",
"datastart",
"<=",
"dataend",
")",
"datastart",
"++",
";",
"while",
"(",
"isspace",
"(",
"(",
"UINT8",
")",
"*",
"dataend",
")",
"&&",
"datastart",
"<=",
"dataend",
")",
"dataend",
"--",
";",
"if",
"(",
"datastart",
"!=",
"dataend",
"&&",
"*",
"datastart",
"==",
"'",
"'",
"&&",
"*",
"dataend",
"==",
"'",
"'",
")",
"datastart",
"++",
",",
"dataend",
"--",
";",
"switch",
"(",
"data",
"->",
"range_type",
")",
"{",
"case",
"OPTION_RANGE_NONE",
":",
"break",
";",
"case",
"OPTION_RANGE_INT",
":",
"i",
"=",
"0",
";",
"if",
"(",
"sscanf",
"(",
"datastart",
",",
"\"",
"\"",
",",
"&",
"i",
")",
"!=",
"1",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"astring_c",
"(",
"data",
"->",
"data",
")",
")",
";",
"data",
"->",
"error_reported",
"=",
"TRUE",
";",
"return",
";",
"}",
"if",
"(",
"i",
"<",
"data",
"->",
"range_minimum",
".",
"i",
"||",
"i",
">",
"data",
"->",
"range_maximum",
".",
"i",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"data",
"->",
"range_minimum",
".",
"i",
",",
"data",
"->",
"range_maximum",
".",
"i",
",",
"astring_c",
"(",
"data",
"->",
"data",
")",
")",
";",
"data",
"->",
"error_reported",
"=",
"TRUE",
";",
"return",
";",
"}",
"break",
";",
"case",
"OPTION_RANGE_FLOAT",
":",
"f",
"=",
"0",
";",
"if",
"(",
"sscanf",
"(",
"datastart",
",",
"\"",
"\"",
",",
"&",
"f",
")",
"!=",
"1",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"astring_c",
"(",
"data",
"->",
"data",
")",
")",
";",
"data",
"->",
"error_reported",
"=",
"TRUE",
";",
"return",
";",
"}",
"if",
"(",
"f",
"<",
"data",
"->",
"range_minimum",
".",
"f",
"||",
"f",
">",
"data",
"->",
"range_maximum",
".",
"f",
")",
"{",
"message",
"(",
"opts",
",",
"OPTMSG_ERROR",
",",
"\"",
"\\n",
"\"",
",",
"astring_c",
"(",
"data",
"->",
"links",
"[",
"0",
"]",
".",
"name",
")",
",",
"data",
"->",
"range_minimum",
".",
"f",
",",
"data",
"->",
"range_maximum",
".",
"f",
",",
"astring_c",
"(",
"data",
"->",
"data",
")",
")",
";",
"data",
"->",
"error_reported",
"=",
"TRUE",
";",
"return",
";",
"}",
"break",
";",
"}",
"if",
"(",
"priority",
"<",
"data",
"->",
"priority",
")",
"return",
";",
"astring_cpych",
"(",
"data",
"->",
"data",
",",
"datastart",
",",
"dataend",
"+",
"1",
"-",
"datastart",
")",
";",
"data",
"->",
"priority",
"=",
"priority",
";",
"data",
"->",
"seqid",
"++",
";",
"data",
"->",
"error_reported",
"=",
"FALSE",
";",
"}"
] | update_data - update the data value for a
given entry | [
"update_data",
"-",
"update",
"the",
"data",
"value",
"for",
"a",
"given",
"entry"
] | [
"/* strip off leading/trailing spaces */",
"/* strip off quotes */",
"/* check against range */",
"/* do nothing */",
"/* check against integer range */",
"/* check against float range */",
"/* ignore if we don't have priority */",
"/* allocate a copy of the data */",
"/* bump the seqid and clear the error reporting */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "data",
"type": "options_data"
},
{
"param": "newdata",
"type": "char"
},
{
"param": "priority",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "options_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "newdata",
"type": "char",
"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": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | parse_option_name | int | static int parse_option_name(core_options *opts, const char *srcstring, options_data *data)
{
const char *start;
const char *end = NULL;
int curentry;
/* start with the original string and loop over entries */
start = srcstring;
for (curentry = 0; curentry < ARRAY_LENGTH(data->links); curentry++)
{
/* find the end of this entry and copy the string */
for (end = start; *end != 0 && *end != ';' && *end != '('; end++)
;
data->links[curentry].name = astring_dupch(start, end - start);
/* if we hit the end of the source, stop */
if (*end != ';')
break;
start = end + 1;
}
/* have we found a range? */
if (end != NULL && *end == '(')
{
if (sscanf(end, "(%d-%d)", &data->range_minimum.i, &data->range_maximum.i) == 2)
data->range_type = OPTION_RANGE_INT;
else if (sscanf(end, "(%f-%f)", &data->range_minimum.f, &data->range_maximum.f) == 2)
data->range_type = OPTION_RANGE_FLOAT;
}
return curentry;
} | /*-------------------------------------------------
parse_option_name - read data from an option_entry
name into an option_data structure
-------------------------------------------------*/ | read data from an option_entry
name into an option_data structure | [
"read",
"data",
"from",
"an",
"option_entry",
"name",
"into",
"an",
"option_data",
"structure"
] | static int parse_option_name(core_options *opts, const char *srcstring, options_data *data)
{
const char *start;
const char *end = NULL;
int curentry;
start = srcstring;
for (curentry = 0; curentry < ARRAY_LENGTH(data->links); curentry++)
{
for (end = start; *end != 0 && *end != ';' && *end != '('; end++)
;
data->links[curentry].name = astring_dupch(start, end - start);
if (*end != ';')
break;
start = end + 1;
}
if (end != NULL && *end == '(')
{
if (sscanf(end, "(%d-%d)", &data->range_minimum.i, &data->range_maximum.i) == 2)
data->range_type = OPTION_RANGE_INT;
else if (sscanf(end, "(%f-%f)", &data->range_minimum.f, &data->range_maximum.f) == 2)
data->range_type = OPTION_RANGE_FLOAT;
}
return curentry;
} | [
"static",
"int",
"parse_option_name",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"srcstring",
",",
"options_data",
"*",
"data",
")",
"{",
"const",
"char",
"*",
"start",
";",
"const",
"char",
"*",
"end",
"=",
"NULL",
";",
"int",
"curentry",
";",
"start",
"=",
"srcstring",
";",
"for",
"(",
"curentry",
"=",
"0",
";",
"curentry",
"<",
"ARRAY_LENGTH",
"(",
"data",
"->",
"links",
")",
";",
"curentry",
"++",
")",
"{",
"for",
"(",
"end",
"=",
"start",
";",
"*",
"end",
"!=",
"0",
"&&",
"*",
"end",
"!=",
"'",
"'",
"&&",
"*",
"end",
"!=",
"'",
"'",
";",
"end",
"++",
")",
";",
"data",
"->",
"links",
"[",
"curentry",
"]",
".",
"name",
"=",
"astring_dupch",
"(",
"start",
",",
"end",
"-",
"start",
")",
";",
"if",
"(",
"*",
"end",
"!=",
"'",
"'",
")",
"break",
";",
"start",
"=",
"end",
"+",
"1",
";",
"}",
"if",
"(",
"end",
"!=",
"NULL",
"&&",
"*",
"end",
"==",
"'",
"'",
")",
"{",
"if",
"(",
"sscanf",
"(",
"end",
",",
"\"",
"\"",
",",
"&",
"data",
"->",
"range_minimum",
".",
"i",
",",
"&",
"data",
"->",
"range_maximum",
".",
"i",
")",
"==",
"2",
")",
"data",
"->",
"range_type",
"=",
"OPTION_RANGE_INT",
";",
"else",
"if",
"(",
"sscanf",
"(",
"end",
",",
"\"",
"\"",
",",
"&",
"data",
"->",
"range_minimum",
".",
"f",
",",
"&",
"data",
"->",
"range_maximum",
".",
"f",
")",
"==",
"2",
")",
"data",
"->",
"range_type",
"=",
"OPTION_RANGE_FLOAT",
";",
"}",
"return",
"curentry",
";",
"}"
] | parse_option_name - read data from an option_entry
name into an option_data structure | [
"parse_option_name",
"-",
"read",
"data",
"from",
"an",
"option_entry",
"name",
"into",
"an",
"option_data",
"structure"
] | [
"/* start with the original string and loop over entries */",
"/* find the end of this entry and copy the string */",
"/* if we hit the end of the source, stop */",
"/* have we found a range? */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "srcstring",
"type": "char"
},
{
"param": "data",
"type": "options_data"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "srcstring",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "options_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | message | void | static void message(core_options *opts, options_message msgtype, const char *format, ...)
{
char buf[1024];
va_list argptr;
/* output a message if there is a non-NULL handler for it */
if (opts->output[msgtype] != NULL)
{
va_start(argptr, format);
vsprintf(buf, format, argptr);
va_end(argptr);
(*opts->output[msgtype])(buf);
}
} | /*-------------------------------------------------
message - outputs a message to a listener
-------------------------------------------------*/ | outputs a message to a listener | [
"outputs",
"a",
"message",
"to",
"a",
"listener"
] | static void message(core_options *opts, options_message msgtype, const char *format, ...)
{
char buf[1024];
va_list argptr;
if (opts->output[msgtype] != NULL)
{
va_start(argptr, format);
vsprintf(buf, format, argptr);
va_end(argptr);
(*opts->output[msgtype])(buf);
}
} | [
"static",
"void",
"message",
"(",
"core_options",
"*",
"opts",
",",
"options_message",
"msgtype",
",",
"const",
"char",
"*",
"format",
",",
"...",
")",
"{",
"char",
"buf",
"[",
"1024",
"]",
";",
"va_list",
"argptr",
";",
"if",
"(",
"opts",
"->",
"output",
"[",
"msgtype",
"]",
"!=",
"NULL",
")",
"{",
"va_start",
"(",
"argptr",
",",
"format",
")",
";",
"vsprintf",
"(",
"buf",
",",
"format",
",",
"argptr",
")",
";",
"va_end",
"(",
"argptr",
")",
";",
"(",
"*",
"opts",
"->",
"output",
"[",
"msgtype",
"]",
")",
"(",
"buf",
")",
";",
"}",
"}"
] | message - outputs a message to a listener | [
"message",
"-",
"outputs",
"a",
"message",
"to",
"a",
"listener"
] | [
"/* output a message if there is a non-NULL handler for it */"
] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "msgtype",
"type": "options_message"
},
{
"param": "format",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "msgtype",
"type": "options_message",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "format",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | hash_value | UINT32 | static UINT32 hash_value(core_options *opts, const char *str)
{
UINT32 hash = 5381;
int c;
while ((c = *str++) != 0)
hash = ((hash << 5) + hash) + c;
return hash % ARRAY_LENGTH(opts->hashtable);
} | /*-------------------------------------------------
hash_value - computes the hash value for a string
-------------------------------------------------*/ | computes the hash value for a string | [
"computes",
"the",
"hash",
"value",
"for",
"a",
"string"
] | static UINT32 hash_value(core_options *opts, const char *str)
{
UINT32 hash = 5381;
int c;
while ((c = *str++) != 0)
hash = ((hash << 5) + hash) + c;
return hash % ARRAY_LENGTH(opts->hashtable);
} | [
"static",
"UINT32",
"hash_value",
"(",
"core_options",
"*",
"opts",
",",
"const",
"char",
"*",
"str",
")",
"{",
"UINT32",
"hash",
"=",
"5381",
";",
"int",
"c",
";",
"while",
"(",
"(",
"c",
"=",
"*",
"str",
"++",
")",
"!=",
"0",
")",
"hash",
"=",
"(",
"(",
"hash",
"<<",
"5",
")",
"+",
"hash",
")",
"+",
"c",
";",
"return",
"hash",
"%",
"ARRAY_LENGTH",
"(",
"opts",
"->",
"hashtable",
")",
";",
"}"
] | hash_value - computes the hash value for a string | [
"hash_value",
"-",
"computes",
"the",
"hash",
"value",
"for",
"a",
"string"
] | [] | [
{
"param": "opts",
"type": "core_options"
},
{
"param": "str",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "opts",
"type": "core_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "str",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27cc6fff2a1ef94be5e577c9a756b63c2554f36f | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/lib/util/options.c | [
"Unlicense"
] | C | output_printf | void | static void output_printf(void (*output)(const char *s), const char *format, ...)
{
char buf[1024];
va_list argptr;
va_start(argptr, format);
vsprintf(buf, format, argptr);
va_end(argptr);
output(buf);
} | /*-------------------------------------------------
output_printf - outputs an arbitrary message
to a callback
-------------------------------------------------*/ | outputs an arbitrary message
to a callback | [
"outputs",
"an",
"arbitrary",
"message",
"to",
"a",
"callback"
] | static void output_printf(void (*output)(const char *s), const char *format, ...)
{
char buf[1024];
va_list argptr;
va_start(argptr, format);
vsprintf(buf, format, argptr);
va_end(argptr);
output(buf);
} | [
"static",
"void",
"output_printf",
"(",
"void",
"(",
"*",
"output",
")",
"(",
"const",
"char",
"*",
"s",
")",
",",
"const",
"char",
"*",
"format",
",",
"...",
")",
"{",
"char",
"buf",
"[",
"1024",
"]",
";",
"va_list",
"argptr",
";",
"va_start",
"(",
"argptr",
",",
"format",
")",
";",
"vsprintf",
"(",
"buf",
",",
"format",
",",
"argptr",
")",
";",
"va_end",
"(",
"argptr",
")",
";",
"output",
"(",
"buf",
")",
";",
"}"
] | output_printf - outputs an arbitrary message
to a callback | [
"output_printf",
"-",
"outputs",
"an",
"arbitrary",
"message",
"to",
"a",
"callback"
] | [] | [
{
"param": "output",
"type": "void"
},
{
"param": "s",
"type": "char"
},
{
"param": "format",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "s",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "format",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6300c0893571c6f2b8dd9ea1f33b00245dd12b00 | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/drivers/sandscrp.c | [
"Unlicense"
] | C | update_irq_state | void | static void update_irq_state(running_machine *machine)
{
if (vblank_irq || sprite_irq || unknown_irq)
cputag_set_input_line(machine, "maincpu", 1, ASSERT_LINE);
else
cputag_set_input_line(machine, "maincpu", 1, CLEAR_LINE);
} | /* Update the IRQ state based on all possible causes */ | Update the IRQ state based on all possible causes | [
"Update",
"the",
"IRQ",
"state",
"based",
"on",
"all",
"possible",
"causes"
] | static void update_irq_state(running_machine *machine)
{
if (vblank_irq || sprite_irq || unknown_irq)
cputag_set_input_line(machine, "maincpu", 1, ASSERT_LINE);
else
cputag_set_input_line(machine, "maincpu", 1, CLEAR_LINE);
} | [
"static",
"void",
"update_irq_state",
"(",
"running_machine",
"*",
"machine",
")",
"{",
"if",
"(",
"vblank_irq",
"||",
"sprite_irq",
"||",
"unknown_irq",
")",
"cputag_set_input_line",
"(",
"machine",
",",
"\"",
"\"",
",",
"1",
",",
"ASSERT_LINE",
")",
";",
"else",
"cputag_set_input_line",
"(",
"machine",
",",
"\"",
"\"",
",",
"1",
",",
"CLEAR_LINE",
")",
";",
"}"
] | Update the IRQ state based on all possible causes | [
"Update",
"the",
"IRQ",
"state",
"based",
"on",
"all",
"possible",
"causes"
] | [] | [
{
"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": []
} |
4ccaf5acc2026c9c1b255678380bf80773edc96c | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/machine/slikshot.c | [
"Unlicense"
] | C | inters_to_vels | void | static void inters_to_vels(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 beams,
UINT8 *xres, UINT8 *vxres, UINT8 *vyres)
{
UINT32 _27d8, _27c2;
UINT32 vx, vy, _283a, _283e;
UINT8 vxsgn;
UINT16 xoffs = 0x0016;
UINT8 xscale = 0xe6;
UINT16 x;
/* compute Vy */
vy = inter1 ? (0x31c28 / inter1) : 0;
/* compute Vx */
_283a = inter2 ? (0x30f2e / inter2) : 0;
_27d8 = ((UINT64)vy * 0xfbd3) >> 16;
_27c2 = _283a - _27d8;
vxsgn = 0;
if ((INT32)_27c2 < 0)
{
vxsgn = 1;
_27c2 = _27d8 - _283a;
}
vx = ((UINT64)_27c2 * 0x58f8c) >> 16;
/* compute X */
_27d8 = ((UINT64)(inter3 << 16) * _283a) >> 16;
_283e = ((UINT64)_27d8 * 0x4a574b) >> 16;
/* adjust X based on the low bit of the beams */
if (beams & 1)
x = 0x7a + (_283e >> 16) - xoffs;
else
x = 0x7a - (_283e >> 16) - xoffs;
/* apply a constant X scale */
if (xscale)
x = ((xscale * (x & 0xff)) >> 8) & 0xff;
/* clamp if out of range */
if ((vx & 0xffff) >= 0x80)
x = 0;
/* put the sign back in Vx */
vx &= 0xff;
if (!vxsgn)
vx = -vx;
/* clamp VY */
if ((vy & 0xffff) > 0x7f)
vy = 0x7f;
else
vy &= 0xff;
/* copy the results */
*xres = x;
*vxres = vx;
*vyres = vy;
} | /*************************************
*
* inters_to_vels
*
* converts the three intermediate
* values to the final velocity and
* X position values
*
*************************************/ | inters_to_vels
converts the three intermediate
values to the final velocity and
X position values | [
"inters_to_vels",
"converts",
"the",
"three",
"intermediate",
"values",
"to",
"the",
"final",
"velocity",
"and",
"X",
"position",
"values"
] | static void inters_to_vels(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 beams,
UINT8 *xres, UINT8 *vxres, UINT8 *vyres)
{
UINT32 _27d8, _27c2;
UINT32 vx, vy, _283a, _283e;
UINT8 vxsgn;
UINT16 xoffs = 0x0016;
UINT8 xscale = 0xe6;
UINT16 x;
vy = inter1 ? (0x31c28 / inter1) : 0;
_283a = inter2 ? (0x30f2e / inter2) : 0;
_27d8 = ((UINT64)vy * 0xfbd3) >> 16;
_27c2 = _283a - _27d8;
vxsgn = 0;
if ((INT32)_27c2 < 0)
{
vxsgn = 1;
_27c2 = _27d8 - _283a;
}
vx = ((UINT64)_27c2 * 0x58f8c) >> 16;
_27d8 = ((UINT64)(inter3 << 16) * _283a) >> 16;
_283e = ((UINT64)_27d8 * 0x4a574b) >> 16;
if (beams & 1)
x = 0x7a + (_283e >> 16) - xoffs;
else
x = 0x7a - (_283e >> 16) - xoffs;
if (xscale)
x = ((xscale * (x & 0xff)) >> 8) & 0xff;
if ((vx & 0xffff) >= 0x80)
x = 0;
vx &= 0xff;
if (!vxsgn)
vx = -vx;
if ((vy & 0xffff) > 0x7f)
vy = 0x7f;
else
vy &= 0xff;
*xres = x;
*vxres = vx;
*vyres = vy;
} | [
"static",
"void",
"inters_to_vels",
"(",
"UINT16",
"inter1",
",",
"UINT16",
"inter2",
",",
"UINT16",
"inter3",
",",
"UINT8",
"beams",
",",
"UINT8",
"*",
"xres",
",",
"UINT8",
"*",
"vxres",
",",
"UINT8",
"*",
"vyres",
")",
"{",
"UINT32",
"_27d8",
",",
"_27c2",
";",
"UINT32",
"vx",
",",
"vy",
",",
"_283a",
",",
"_283e",
";",
"UINT8",
"vxsgn",
";",
"UINT16",
"xoffs",
"=",
"0x0016",
";",
"UINT8",
"xscale",
"=",
"0xe6",
";",
"UINT16",
"x",
";",
"vy",
"=",
"inter1",
"?",
"(",
"0x31c28",
"/",
"inter1",
")",
":",
"0",
";",
"_283a",
"=",
"inter2",
"?",
"(",
"0x30f2e",
"/",
"inter2",
")",
":",
"0",
";",
"_27d8",
"=",
"(",
"(",
"UINT64",
")",
"vy",
"*",
"0xfbd3",
")",
">>",
"16",
";",
"_27c2",
"=",
"_283a",
"-",
"_27d8",
";",
"vxsgn",
"=",
"0",
";",
"if",
"(",
"(",
"INT32",
")",
"_27c2",
"<",
"0",
")",
"{",
"vxsgn",
"=",
"1",
";",
"_27c2",
"=",
"_27d8",
"-",
"_283a",
";",
"}",
"vx",
"=",
"(",
"(",
"UINT64",
")",
"_27c2",
"*",
"0x58f8c",
")",
">>",
"16",
";",
"_27d8",
"=",
"(",
"(",
"UINT64",
")",
"(",
"inter3",
"<<",
"16",
")",
"*",
"_283a",
")",
">>",
"16",
";",
"_283e",
"=",
"(",
"(",
"UINT64",
")",
"_27d8",
"*",
"0x4a574b",
")",
">>",
"16",
";",
"if",
"(",
"beams",
"&",
"1",
")",
"x",
"=",
"0x7a",
"+",
"(",
"_283e",
">>",
"16",
")",
"-",
"xoffs",
";",
"else",
"x",
"=",
"0x7a",
"-",
"(",
"_283e",
">>",
"16",
")",
"-",
"xoffs",
";",
"if",
"(",
"xscale",
")",
"x",
"=",
"(",
"(",
"xscale",
"*",
"(",
"x",
"&",
"0xff",
")",
")",
">>",
"8",
")",
"&",
"0xff",
";",
"if",
"(",
"(",
"vx",
"&",
"0xffff",
")",
">=",
"0x80",
")",
"x",
"=",
"0",
";",
"vx",
"&=",
"0xff",
";",
"if",
"(",
"!",
"vxsgn",
")",
"vx",
"=",
"-",
"vx",
";",
"if",
"(",
"(",
"vy",
"&",
"0xffff",
")",
">",
"0x7f",
")",
"vy",
"=",
"0x7f",
";",
"else",
"vy",
"&=",
"0xff",
";",
"*",
"xres",
"=",
"x",
";",
"*",
"vxres",
"=",
"vx",
";",
"*",
"vyres",
"=",
"vy",
";",
"}"
] | inters_to_vels
converts the three intermediate
values to the final velocity and
X position values | [
"inters_to_vels",
"converts",
"the",
"three",
"intermediate",
"values",
"to",
"the",
"final",
"velocity",
"and",
"X",
"position",
"values"
] | [
"/* compute Vy */",
"/* compute Vx */",
"/* compute X */",
"/* adjust X based on the low bit of the beams */",
"/* apply a constant X scale */",
"/* clamp if out of range */",
"/* put the sign back in Vx */",
"/* clamp VY */",
"/* copy the results */"
] | [
{
"param": "inter1",
"type": "UINT16"
},
{
"param": "inter2",
"type": "UINT16"
},
{
"param": "inter3",
"type": "UINT16"
},
{
"param": "beams",
"type": "UINT8"
},
{
"param": "xres",
"type": "UINT8"
},
{
"param": "vxres",
"type": "UINT8"
},
{
"param": "vyres",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inter1",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inter2",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inter3",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beams",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xres",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vxres",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vyres",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4ccaf5acc2026c9c1b255678380bf80773edc96c | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/machine/slikshot.c | [
"Unlicense"
] | C | vels_to_inters | void | static void vels_to_inters(UINT8 x, UINT8 vx, UINT8 vy,
UINT16 *inter1, UINT16 *inter2, UINT16 *inter3, UINT8 *beams)
{
UINT32 _27d8;
UINT16 xoffs = 0x0016;
UINT8 xscale = 0xe6;
UINT8 x1, vx1, vy1;
UINT8 x2, vx2, vy2;
UINT8 diff1, diff2;
UINT16 inter2a;
/* inter1 comes from Vy */
*inter1 = vy ? 0x31c28 / vy : 0;
/* inter2 can be derived from Vx and Vy */
_27d8 = ((UINT64)vy * 0xfbd3) >> 16;
*inter2 = 0x30f2e / (_27d8 + ((abs((INT8)vx) << 16) / 0x58f8c));
inter2a = 0x30f2e / (_27d8 - ((abs((INT8)vx) << 16) / 0x58f8c));
/* compute it back both ways and pick the closer */
inters_to_vels(*inter1, *inter2, 0, 0, &x1, &vx1, &vy1);
inters_to_vels(*inter1, inter2a, 0, 0, &x2, &vx2, &vy2);
diff1 = (vx > vx1) ? (vx - vx1) : (vx1 - vx);
diff2 = (vx > vx2) ? (vx - vx2) : (vx2 - vx);
if (diff2 < diff1)
*inter2 = inter2a;
/* inter3: (beams & 1 == 1), inter3a: (beams & 1) == 0 */
if (((x << 8) / xscale) + xoffs >= 0x7a)
{
*beams = 1;
*inter3 = (((((((UINT64)(((x << 8) / xscale) + xoffs - 0x7a)) << 16) << 16) / 0x4a574b) << 16) / (0x30f2e / *inter2)) >> 16;
}
else
{
*beams = 0;
*inter3 = (((((((UINT64)(((x << 8) / xscale) + xoffs - 0x7a) * -1) << 16) << 16) / 0x4a574b) << 16) / (0x30f2e / *inter2)) >> 16;
}
} | /*************************************
*
* vels_to_inters
*
* converts from the final velocity
* and X position values back to
* three intermediate values that
* will produce the desired result
*
*************************************/ | vels_to_inters
converts from the final velocity
and X position values back to
three intermediate values that
will produce the desired result | [
"vels_to_inters",
"converts",
"from",
"the",
"final",
"velocity",
"and",
"X",
"position",
"values",
"back",
"to",
"three",
"intermediate",
"values",
"that",
"will",
"produce",
"the",
"desired",
"result"
] | static void vels_to_inters(UINT8 x, UINT8 vx, UINT8 vy,
UINT16 *inter1, UINT16 *inter2, UINT16 *inter3, UINT8 *beams)
{
UINT32 _27d8;
UINT16 xoffs = 0x0016;
UINT8 xscale = 0xe6;
UINT8 x1, vx1, vy1;
UINT8 x2, vx2, vy2;
UINT8 diff1, diff2;
UINT16 inter2a;
*inter1 = vy ? 0x31c28 / vy : 0;
_27d8 = ((UINT64)vy * 0xfbd3) >> 16;
*inter2 = 0x30f2e / (_27d8 + ((abs((INT8)vx) << 16) / 0x58f8c));
inter2a = 0x30f2e / (_27d8 - ((abs((INT8)vx) << 16) / 0x58f8c));
inters_to_vels(*inter1, *inter2, 0, 0, &x1, &vx1, &vy1);
inters_to_vels(*inter1, inter2a, 0, 0, &x2, &vx2, &vy2);
diff1 = (vx > vx1) ? (vx - vx1) : (vx1 - vx);
diff2 = (vx > vx2) ? (vx - vx2) : (vx2 - vx);
if (diff2 < diff1)
*inter2 = inter2a;
if (((x << 8) / xscale) + xoffs >= 0x7a)
{
*beams = 1;
*inter3 = (((((((UINT64)(((x << 8) / xscale) + xoffs - 0x7a)) << 16) << 16) / 0x4a574b) << 16) / (0x30f2e / *inter2)) >> 16;
}
else
{
*beams = 0;
*inter3 = (((((((UINT64)(((x << 8) / xscale) + xoffs - 0x7a) * -1) << 16) << 16) / 0x4a574b) << 16) / (0x30f2e / *inter2)) >> 16;
}
} | [
"static",
"void",
"vels_to_inters",
"(",
"UINT8",
"x",
",",
"UINT8",
"vx",
",",
"UINT8",
"vy",
",",
"UINT16",
"*",
"inter1",
",",
"UINT16",
"*",
"inter2",
",",
"UINT16",
"*",
"inter3",
",",
"UINT8",
"*",
"beams",
")",
"{",
"UINT32",
"_27d8",
";",
"UINT16",
"xoffs",
"=",
"0x0016",
";",
"UINT8",
"xscale",
"=",
"0xe6",
";",
"UINT8",
"x1",
",",
"vx1",
",",
"vy1",
";",
"UINT8",
"x2",
",",
"vx2",
",",
"vy2",
";",
"UINT8",
"diff1",
",",
"diff2",
";",
"UINT16",
"inter2a",
";",
"*",
"inter1",
"=",
"vy",
"?",
"0x31c28",
"/",
"vy",
":",
"0",
";",
"_27d8",
"=",
"(",
"(",
"UINT64",
")",
"vy",
"*",
"0xfbd3",
")",
">>",
"16",
";",
"*",
"inter2",
"=",
"0x30f2e",
"/",
"(",
"_27d8",
"+",
"(",
"(",
"abs",
"(",
"(",
"INT8",
")",
"vx",
")",
"<<",
"16",
")",
"/",
"0x58f8c",
")",
")",
";",
"inter2a",
"=",
"0x30f2e",
"/",
"(",
"_27d8",
"-",
"(",
"(",
"abs",
"(",
"(",
"INT8",
")",
"vx",
")",
"<<",
"16",
")",
"/",
"0x58f8c",
")",
")",
";",
"inters_to_vels",
"(",
"*",
"inter1",
",",
"*",
"inter2",
",",
"0",
",",
"0",
",",
"&",
"x1",
",",
"&",
"vx1",
",",
"&",
"vy1",
")",
";",
"inters_to_vels",
"(",
"*",
"inter1",
",",
"inter2a",
",",
"0",
",",
"0",
",",
"&",
"x2",
",",
"&",
"vx2",
",",
"&",
"vy2",
")",
";",
"diff1",
"=",
"(",
"vx",
">",
"vx1",
")",
"?",
"(",
"vx",
"-",
"vx1",
")",
":",
"(",
"vx1",
"-",
"vx",
")",
";",
"diff2",
"=",
"(",
"vx",
">",
"vx2",
")",
"?",
"(",
"vx",
"-",
"vx2",
")",
":",
"(",
"vx2",
"-",
"vx",
")",
";",
"if",
"(",
"diff2",
"<",
"diff1",
")",
"*",
"inter2",
"=",
"inter2a",
";",
"if",
"(",
"(",
"(",
"x",
"<<",
"8",
")",
"/",
"xscale",
")",
"+",
"xoffs",
">=",
"0x7a",
")",
"{",
"*",
"beams",
"=",
"1",
";",
"*",
"inter3",
"=",
"(",
"(",
"(",
"(",
"(",
"(",
"(",
"UINT64",
")",
"(",
"(",
"(",
"x",
"<<",
"8",
")",
"/",
"xscale",
")",
"+",
"xoffs",
"-",
"0x7a",
")",
")",
"<<",
"16",
")",
"<<",
"16",
")",
"/",
"0x4a574b",
")",
"<<",
"16",
")",
"/",
"(",
"0x30f2e",
"/",
"*",
"inter2",
")",
")",
">>",
"16",
";",
"}",
"else",
"{",
"*",
"beams",
"=",
"0",
";",
"*",
"inter3",
"=",
"(",
"(",
"(",
"(",
"(",
"(",
"(",
"UINT64",
")",
"(",
"(",
"(",
"x",
"<<",
"8",
")",
"/",
"xscale",
")",
"+",
"xoffs",
"-",
"0x7a",
")",
"*",
"-1",
")",
"<<",
"16",
")",
"<<",
"16",
")",
"/",
"0x4a574b",
")",
"<<",
"16",
")",
"/",
"(",
"0x30f2e",
"/",
"*",
"inter2",
")",
")",
">>",
"16",
";",
"}",
"}"
] | vels_to_inters
converts from the final velocity
and X position values back to
three intermediate values that
will produce the desired result | [
"vels_to_inters",
"converts",
"from",
"the",
"final",
"velocity",
"and",
"X",
"position",
"values",
"back",
"to",
"three",
"intermediate",
"values",
"that",
"will",
"produce",
"the",
"desired",
"result"
] | [
"/* inter1 comes from Vy */",
"/* inter2 can be derived from Vx and Vy */",
"/* compute it back both ways and pick the closer */",
"/* inter3: (beams & 1 == 1), inter3a: (beams & 1) == 0 */"
] | [
{
"param": "x",
"type": "UINT8"
},
{
"param": "vx",
"type": "UINT8"
},
{
"param": "vy",
"type": "UINT8"
},
{
"param": "inter1",
"type": "UINT16"
},
{
"param": "inter2",
"type": "UINT16"
},
{
"param": "inter3",
"type": "UINT16"
},
{
"param": "beams",
"type": "UINT8"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vx",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vy",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inter1",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inter2",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inter3",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beams",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4ccaf5acc2026c9c1b255678380bf80773edc96c | lofunz/mieme | Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/machine/slikshot.c | [
"Unlicense"
] | C | inters_to_words | void | static void inters_to_words(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 *beams,
UINT16 *word1, UINT16 *word2, UINT16 *word3)
{
UINT16 word2mod;
/* intermediate value 3 is always equal to the third word */
*word3 = inter3;
/* on input, it is expected that the low bit of beams has already been determined */
if (*beams & 1)
{
/* make sure we can do it */
if (inter3 <= inter1)
{
/* always go back via case 3 */
*beams |= 2;
/* compute an appropriate value for the scaled version of word 2 */
word2mod = inter1 - inter3;
/* compute the other values from that */
*word1 = inter2 - word2mod;
*word2 = ((UINT64)word2mod << 16) / 0x16553;
}
else
logerror("inters_to_words: unable to convert %04x %04x %04x %02x\n",
(UINT32)inter1, (UINT32)inter2, (UINT32)inter3, (UINT32)*beams);
}
/* handle the case where low bit of beams is 0 */
else
{
/* make sure we can do it */
if (inter3 <= inter2)
{
/* always go back via case 0 */
/* compute an appropriate value for the scaled version of word 2 */
word2mod = inter2 - inter3;
/* compute the other values from that */
*word1 = inter1 - word2mod;
*word2 = ((UINT64)word2mod << 16) / 0x16553;
}
else
logerror("inters_to_words: unable to convert %04x %04x %04x %02x\n",
(UINT32)inter1, (UINT32)inter2, (UINT32)inter3, (UINT32)*beams);
}
} | /*************************************
*
* inters_to_words
*
* converts the intermediate values
* used in the final calculations
* back to the three words + byte
* data from the Z80
*
*************************************/ | inters_to_words
converts the intermediate values
used in the final calculations
back to the three words + byte
data from the Z80 | [
"inters_to_words",
"converts",
"the",
"intermediate",
"values",
"used",
"in",
"the",
"final",
"calculations",
"back",
"to",
"the",
"three",
"words",
"+",
"byte",
"data",
"from",
"the",
"Z80"
] | static void inters_to_words(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 *beams,
UINT16 *word1, UINT16 *word2, UINT16 *word3)
{
UINT16 word2mod;
*word3 = inter3;
if (*beams & 1)
{
if (inter3 <= inter1)
{
*beams |= 2;
word2mod = inter1 - inter3;
*word1 = inter2 - word2mod;
*word2 = ((UINT64)word2mod << 16) / 0x16553;
}
else
logerror("inters_to_words: unable to convert %04x %04x %04x %02x\n",
(UINT32)inter1, (UINT32)inter2, (UINT32)inter3, (UINT32)*beams);
}
else
{
if (inter3 <= inter2)
{
word2mod = inter2 - inter3;
*word1 = inter1 - word2mod;
*word2 = ((UINT64)word2mod << 16) / 0x16553;
}
else
logerror("inters_to_words: unable to convert %04x %04x %04x %02x\n",
(UINT32)inter1, (UINT32)inter2, (UINT32)inter3, (UINT32)*beams);
}
} | [
"static",
"void",
"inters_to_words",
"(",
"UINT16",
"inter1",
",",
"UINT16",
"inter2",
",",
"UINT16",
"inter3",
",",
"UINT8",
"*",
"beams",
",",
"UINT16",
"*",
"word1",
",",
"UINT16",
"*",
"word2",
",",
"UINT16",
"*",
"word3",
")",
"{",
"UINT16",
"word2mod",
";",
"*",
"word3",
"=",
"inter3",
";",
"if",
"(",
"*",
"beams",
"&",
"1",
")",
"{",
"if",
"(",
"inter3",
"<=",
"inter1",
")",
"{",
"*",
"beams",
"|=",
"2",
";",
"word2mod",
"=",
"inter1",
"-",
"inter3",
";",
"*",
"word1",
"=",
"inter2",
"-",
"word2mod",
";",
"*",
"word2",
"=",
"(",
"(",
"UINT64",
")",
"word2mod",
"<<",
"16",
")",
"/",
"0x16553",
";",
"}",
"else",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"(",
"UINT32",
")",
"inter1",
",",
"(",
"UINT32",
")",
"inter2",
",",
"(",
"UINT32",
")",
"inter3",
",",
"(",
"UINT32",
")",
"*",
"beams",
")",
";",
"}",
"else",
"{",
"if",
"(",
"inter3",
"<=",
"inter2",
")",
"{",
"word2mod",
"=",
"inter2",
"-",
"inter3",
";",
"*",
"word1",
"=",
"inter1",
"-",
"word2mod",
";",
"*",
"word2",
"=",
"(",
"(",
"UINT64",
")",
"word2mod",
"<<",
"16",
")",
"/",
"0x16553",
";",
"}",
"else",
"logerror",
"(",
"\"",
"\\n",
"\"",
",",
"(",
"UINT32",
")",
"inter1",
",",
"(",
"UINT32",
")",
"inter2",
",",
"(",
"UINT32",
")",
"inter3",
",",
"(",
"UINT32",
")",
"*",
"beams",
")",
";",
"}",
"}"
] | inters_to_words
converts the intermediate values
used in the final calculations
back to the three words + byte
data from the Z80 | [
"inters_to_words",
"converts",
"the",
"intermediate",
"values",
"used",
"in",
"the",
"final",
"calculations",
"back",
"to",
"the",
"three",
"words",
"+",
"byte",
"data",
"from",
"the",
"Z80"
] | [
"/* intermediate value 3 is always equal to the third word */",
"/* on input, it is expected that the low bit of beams has already been determined */",
"/* make sure we can do it */",
"/* always go back via case 3 */",
"/* compute an appropriate value for the scaled version of word 2 */",
"/* compute the other values from that */",
"/* handle the case where low bit of beams is 0 */",
"/* make sure we can do it */",
"/* always go back via case 0 */",
"/* compute an appropriate value for the scaled version of word 2 */",
"/* compute the other values from that */"
] | [
{
"param": "inter1",
"type": "UINT16"
},
{
"param": "inter2",
"type": "UINT16"
},
{
"param": "inter3",
"type": "UINT16"
},
{
"param": "beams",
"type": "UINT8"
},
{
"param": "word1",
"type": "UINT16"
},
{
"param": "word2",
"type": "UINT16"
},
{
"param": "word3",
"type": "UINT16"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inter1",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inter2",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inter3",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beams",
"type": "UINT8",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "word1",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "word2",
"type": "UINT16",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "word3",
"type": "UINT16",
"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.