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
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_recompute
int
static int disasm_view_recompute(debug_view *view, offs_t pc, int startline, int lines) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; const address_space *space = dasmdata->space; int minbytes, maxbytes, maxbytes_clamped; int changed = FALSE; int line; /* determine how many characters we need for an address and set the divider */ dasmdata->divider1 = 1 + space->logaddrchars + 1; /* assume a fixed number of characters for the disassembly */ dasmdata->divider2 = dasmdata->divider1 + 1 + dasmdata->dasm_width + 1; /* determine how many bytes we might need to display */ minbytes = cpu_get_min_opcode_bytes(space->cpu); maxbytes = cpu_get_max_opcode_bytes(space->cpu); /* ensure that the PC is aligned to the minimum opcode size */ pc &= ~memory_byte_to_address_end(space, minbytes - 1); /* set the width of the third column according to display mode */ if (dasmdata->right_column == DASM_RIGHTCOL_RAW || dasmdata->right_column == DASM_RIGHTCOL_ENCRYPTED) { maxbytes_clamped = MIN(maxbytes, DASM_MAX_BYTES); view->total.x = dasmdata->divider2 + 1 + 2 * maxbytes_clamped + (maxbytes_clamped / minbytes - 1) + 1; } else if (dasmdata->right_column == DASM_RIGHTCOL_COMMENTS) view->total.x = dasmdata->divider2 + 1 + 50; /* DEBUG_COMMENT_MAX_LINE_LENGTH */ else view->total.x = dasmdata->divider2 + 1; /* reallocate memory if we don't have enough */ if (dasmdata->allocated.x < view->total.x || dasmdata->allocated.y < view->total.y) { /* update our values */ dasmdata->allocated.x = view->total.x; dasmdata->allocated.y = view->total.y; /* allocate address array */ if (dasmdata->byteaddress != NULL) free(dasmdata->byteaddress); dasmdata->byteaddress = alloc_array_or_die(offs_t, dasmdata->allocated.y); /* allocate disassembly buffer */ if (dasmdata->dasm != NULL) free(dasmdata->dasm); dasmdata->dasm = alloc_array_or_die(char, dasmdata->allocated.x * dasmdata->allocated.y); } /* iterate over lines */ for (line = 0; line < lines; line++) { int instr = startline + line; char *destbuf = &dasmdata->dasm[instr * dasmdata->allocated.x]; char buffer[100], oldbuf[100]; offs_t pcbyte, physpcbyte; int numbytes = 0; /* convert PC to a byte offset */ pcbyte = memory_address_to_byte(space, pc) & space->logbytemask; /* save a copy of the previous line as a backup if we're only doing one line */ if (lines == 1) strncpy(oldbuf, destbuf, MIN(sizeof(oldbuf), dasmdata->allocated.x)); /* convert back and set the address of this instruction */ dasmdata->byteaddress[instr] = pcbyte; sprintf(&destbuf[0], " %s ", core_i64_hex_format(memory_byte_to_address(space, pcbyte), space->logaddrchars)); /* make sure we can translate the address, and then disassemble the result */ physpcbyte = pcbyte; if (debug_cpu_translate(space, TRANSLATE_FETCH_DEBUG, &physpcbyte)) { UINT8 opbuf[64], argbuf[64]; /* fetch the bytes up to the maximum */ for (numbytes = 0; numbytes < maxbytes; numbytes++) { opbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, FALSE); argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, TRUE); } /* disassemble the result */ pc += numbytes = debug_cpu_disassemble(space->cpu, buffer, pc & space->logaddrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK; } else strcpy(buffer, "<unmapped>"); /* append the disassembly to the buffer */ sprintf(&destbuf[dasmdata->divider1 + 1], "%-*s ", dasmdata->dasm_width, buffer); /* output the right column */ if (dasmdata->right_column == DASM_RIGHTCOL_RAW || dasmdata->right_column == DASM_RIGHTCOL_ENCRYPTED) { /* get the bytes */ numbytes = memory_address_to_byte(space, numbytes) & space->logbytemask; disasm_view_generate_bytes(space, pcbyte, numbytes, minbytes, &destbuf[dasmdata->divider2], dasmdata->allocated.x - dasmdata->divider2, dasmdata->right_column == DASM_RIGHTCOL_ENCRYPTED); } else if (dasmdata->right_column == DASM_RIGHTCOL_COMMENTS) { offs_t comment_address = memory_byte_to_address(space, dasmdata->byteaddress[instr]); const char *text; /* get and add the comment, if present */ text = debug_comment_get_text(space->cpu, comment_address, debug_comment_get_opcode_crc32(space->cpu, comment_address)); if (text != NULL) sprintf(&destbuf[dasmdata->divider2], "// %.*s", dasmdata->allocated.x - dasmdata->divider2 - 1, text); } /* see if the line changed at all */ if (lines == 1 && strncmp(oldbuf, destbuf, MIN(sizeof(oldbuf), dasmdata->allocated.x)) != 0) changed = TRUE; } /* update opcode base information */ dasmdata->last_direct_decrypted = space->direct.decrypted; dasmdata->last_direct_raw = space->direct.raw; dasmdata->last_change_count = debug_comment_all_change_count(space->machine); /* now longer need to recompute */ view->recompute = FALSE; return changed; }
/*------------------------------------------------- disasm_view_recompute - recompute selected info for the disassembly view -------------------------------------------------*/
recompute selected info for the disassembly view
[ "recompute", "selected", "info", "for", "the", "disassembly", "view" ]
static int disasm_view_recompute(debug_view *view, offs_t pc, int startline, int lines) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; const address_space *space = dasmdata->space; int minbytes, maxbytes, maxbytes_clamped; int changed = FALSE; int line; dasmdata->divider1 = 1 + space->logaddrchars + 1; dasmdata->divider2 = dasmdata->divider1 + 1 + dasmdata->dasm_width + 1; minbytes = cpu_get_min_opcode_bytes(space->cpu); maxbytes = cpu_get_max_opcode_bytes(space->cpu); pc &= ~memory_byte_to_address_end(space, minbytes - 1); if (dasmdata->right_column == DASM_RIGHTCOL_RAW || dasmdata->right_column == DASM_RIGHTCOL_ENCRYPTED) { maxbytes_clamped = MIN(maxbytes, DASM_MAX_BYTES); view->total.x = dasmdata->divider2 + 1 + 2 * maxbytes_clamped + (maxbytes_clamped / minbytes - 1) + 1; } else if (dasmdata->right_column == DASM_RIGHTCOL_COMMENTS) view->total.x = dasmdata->divider2 + 1 + 50; else view->total.x = dasmdata->divider2 + 1; if (dasmdata->allocated.x < view->total.x || dasmdata->allocated.y < view->total.y) { dasmdata->allocated.x = view->total.x; dasmdata->allocated.y = view->total.y; if (dasmdata->byteaddress != NULL) free(dasmdata->byteaddress); dasmdata->byteaddress = alloc_array_or_die(offs_t, dasmdata->allocated.y); if (dasmdata->dasm != NULL) free(dasmdata->dasm); dasmdata->dasm = alloc_array_or_die(char, dasmdata->allocated.x * dasmdata->allocated.y); } for (line = 0; line < lines; line++) { int instr = startline + line; char *destbuf = &dasmdata->dasm[instr * dasmdata->allocated.x]; char buffer[100], oldbuf[100]; offs_t pcbyte, physpcbyte; int numbytes = 0; pcbyte = memory_address_to_byte(space, pc) & space->logbytemask; if (lines == 1) strncpy(oldbuf, destbuf, MIN(sizeof(oldbuf), dasmdata->allocated.x)); dasmdata->byteaddress[instr] = pcbyte; sprintf(&destbuf[0], " %s ", core_i64_hex_format(memory_byte_to_address(space, pcbyte), space->logaddrchars)); physpcbyte = pcbyte; if (debug_cpu_translate(space, TRANSLATE_FETCH_DEBUG, &physpcbyte)) { UINT8 opbuf[64], argbuf[64]; for (numbytes = 0; numbytes < maxbytes; numbytes++) { opbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, FALSE); argbuf[numbytes] = debug_read_opcode(space, pcbyte + numbytes, 1, TRUE); } pc += numbytes = debug_cpu_disassemble(space->cpu, buffer, pc & space->logaddrmask, opbuf, argbuf) & DASMFLAG_LENGTHMASK; } else strcpy(buffer, "<unmapped>"); sprintf(&destbuf[dasmdata->divider1 + 1], "%-*s ", dasmdata->dasm_width, buffer); if (dasmdata->right_column == DASM_RIGHTCOL_RAW || dasmdata->right_column == DASM_RIGHTCOL_ENCRYPTED) { numbytes = memory_address_to_byte(space, numbytes) & space->logbytemask; disasm_view_generate_bytes(space, pcbyte, numbytes, minbytes, &destbuf[dasmdata->divider2], dasmdata->allocated.x - dasmdata->divider2, dasmdata->right_column == DASM_RIGHTCOL_ENCRYPTED); } else if (dasmdata->right_column == DASM_RIGHTCOL_COMMENTS) { offs_t comment_address = memory_byte_to_address(space, dasmdata->byteaddress[instr]); const char *text; text = debug_comment_get_text(space->cpu, comment_address, debug_comment_get_opcode_crc32(space->cpu, comment_address)); if (text != NULL) sprintf(&destbuf[dasmdata->divider2], "// %.*s", dasmdata->allocated.x - dasmdata->divider2 - 1, text); } if (lines == 1 && strncmp(oldbuf, destbuf, MIN(sizeof(oldbuf), dasmdata->allocated.x)) != 0) changed = TRUE; } dasmdata->last_direct_decrypted = space->direct.decrypted; dasmdata->last_direct_raw = space->direct.raw; dasmdata->last_change_count = debug_comment_all_change_count(space->machine); view->recompute = FALSE; return changed; }
[ "static", "int", "disasm_view_recompute", "(", "debug_view", "*", "view", ",", "offs_t", "pc", ",", "int", "startline", ",", "int", "lines", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "const", "address_space", "*", "space", "=", "dasmdata", "->", "space", ";", "int", "minbytes", ",", "maxbytes", ",", "maxbytes_clamped", ";", "int", "changed", "=", "FALSE", ";", "int", "line", ";", "dasmdata", "->", "divider1", "=", "1", "+", "space", "->", "logaddrchars", "+", "1", ";", "dasmdata", "->", "divider2", "=", "dasmdata", "->", "divider1", "+", "1", "+", "dasmdata", "->", "dasm_width", "+", "1", ";", "minbytes", "=", "cpu_get_min_opcode_bytes", "(", "space", "->", "cpu", ")", ";", "maxbytes", "=", "cpu_get_max_opcode_bytes", "(", "space", "->", "cpu", ")", ";", "pc", "&=", "~", "memory_byte_to_address_end", "(", "space", ",", "minbytes", "-", "1", ")", ";", "if", "(", "dasmdata", "->", "right_column", "==", "DASM_RIGHTCOL_RAW", "||", "dasmdata", "->", "right_column", "==", "DASM_RIGHTCOL_ENCRYPTED", ")", "{", "maxbytes_clamped", "=", "MIN", "(", "maxbytes", ",", "DASM_MAX_BYTES", ")", ";", "view", "->", "total", ".", "x", "=", "dasmdata", "->", "divider2", "+", "1", "+", "2", "*", "maxbytes_clamped", "+", "(", "maxbytes_clamped", "/", "minbytes", "-", "1", ")", "+", "1", ";", "}", "else", "if", "(", "dasmdata", "->", "right_column", "==", "DASM_RIGHTCOL_COMMENTS", ")", "view", "->", "total", ".", "x", "=", "dasmdata", "->", "divider2", "+", "1", "+", "50", ";", "else", "view", "->", "total", ".", "x", "=", "dasmdata", "->", "divider2", "+", "1", ";", "if", "(", "dasmdata", "->", "allocated", ".", "x", "<", "view", "->", "total", ".", "x", "||", "dasmdata", "->", "allocated", ".", "y", "<", "view", "->", "total", ".", "y", ")", "{", "dasmdata", "->", "allocated", ".", "x", "=", "view", "->", "total", ".", "x", ";", "dasmdata", "->", "allocated", ".", "y", "=", "view", "->", "total", ".", "y", ";", "if", "(", "dasmdata", "->", "byteaddress", "!=", "NULL", ")", "free", "(", "dasmdata", "->", "byteaddress", ")", ";", "dasmdata", "->", "byteaddress", "=", "alloc_array_or_die", "(", "offs_t", ",", "dasmdata", "->", "allocated", ".", "y", ")", ";", "if", "(", "dasmdata", "->", "dasm", "!=", "NULL", ")", "free", "(", "dasmdata", "->", "dasm", ")", ";", "dasmdata", "->", "dasm", "=", "alloc_array_or_die", "(", "char", ",", "dasmdata", "->", "allocated", ".", "x", "*", "dasmdata", "->", "allocated", ".", "y", ")", ";", "}", "for", "(", "line", "=", "0", ";", "line", "<", "lines", ";", "line", "++", ")", "{", "int", "instr", "=", "startline", "+", "line", ";", "char", "*", "destbuf", "=", "&", "dasmdata", "->", "dasm", "[", "instr", "*", "dasmdata", "->", "allocated", ".", "x", "]", ";", "char", "buffer", "[", "100", "]", ",", "oldbuf", "[", "100", "]", ";", "offs_t", "pcbyte", ",", "physpcbyte", ";", "int", "numbytes", "=", "0", ";", "pcbyte", "=", "memory_address_to_byte", "(", "space", ",", "pc", ")", "&", "space", "->", "logbytemask", ";", "if", "(", "lines", "==", "1", ")", "strncpy", "(", "oldbuf", ",", "destbuf", ",", "MIN", "(", "sizeof", "(", "oldbuf", ")", ",", "dasmdata", "->", "allocated", ".", "x", ")", ")", ";", "dasmdata", "->", "byteaddress", "[", "instr", "]", "=", "pcbyte", ";", "sprintf", "(", "&", "destbuf", "[", "0", "]", ",", "\"", "\"", ",", "core_i64_hex_format", "(", "memory_byte_to_address", "(", "space", ",", "pcbyte", ")", ",", "space", "->", "logaddrchars", ")", ")", ";", "physpcbyte", "=", "pcbyte", ";", "if", "(", "debug_cpu_translate", "(", "space", ",", "TRANSLATE_FETCH_DEBUG", ",", "&", "physpcbyte", ")", ")", "{", "UINT8", "opbuf", "[", "64", "]", ",", "argbuf", "[", "64", "]", ";", "for", "(", "numbytes", "=", "0", ";", "numbytes", "<", "maxbytes", ";", "numbytes", "++", ")", "{", "opbuf", "[", "numbytes", "]", "=", "debug_read_opcode", "(", "space", ",", "pcbyte", "+", "numbytes", ",", "1", ",", "FALSE", ")", ";", "argbuf", "[", "numbytes", "]", "=", "debug_read_opcode", "(", "space", ",", "pcbyte", "+", "numbytes", ",", "1", ",", "TRUE", ")", ";", "}", "pc", "+=", "numbytes", "=", "debug_cpu_disassemble", "(", "space", "->", "cpu", ",", "buffer", ",", "pc", "&", "space", "->", "logaddrmask", ",", "opbuf", ",", "argbuf", ")", "&", "DASMFLAG_LENGTHMASK", ";", "}", "else", "strcpy", "(", "buffer", ",", "\"", "\"", ")", ";", "sprintf", "(", "&", "destbuf", "[", "dasmdata", "->", "divider1", "+", "1", "]", ",", "\"", "\"", ",", "dasmdata", "->", "dasm_width", ",", "buffer", ")", ";", "if", "(", "dasmdata", "->", "right_column", "==", "DASM_RIGHTCOL_RAW", "||", "dasmdata", "->", "right_column", "==", "DASM_RIGHTCOL_ENCRYPTED", ")", "{", "numbytes", "=", "memory_address_to_byte", "(", "space", ",", "numbytes", ")", "&", "space", "->", "logbytemask", ";", "disasm_view_generate_bytes", "(", "space", ",", "pcbyte", ",", "numbytes", ",", "minbytes", ",", "&", "destbuf", "[", "dasmdata", "->", "divider2", "]", ",", "dasmdata", "->", "allocated", ".", "x", "-", "dasmdata", "->", "divider2", ",", "dasmdata", "->", "right_column", "==", "DASM_RIGHTCOL_ENCRYPTED", ")", ";", "}", "else", "if", "(", "dasmdata", "->", "right_column", "==", "DASM_RIGHTCOL_COMMENTS", ")", "{", "offs_t", "comment_address", "=", "memory_byte_to_address", "(", "space", ",", "dasmdata", "->", "byteaddress", "[", "instr", "]", ")", ";", "const", "char", "*", "text", ";", "text", "=", "debug_comment_get_text", "(", "space", "->", "cpu", ",", "comment_address", ",", "debug_comment_get_opcode_crc32", "(", "space", "->", "cpu", ",", "comment_address", ")", ")", ";", "if", "(", "text", "!=", "NULL", ")", "sprintf", "(", "&", "destbuf", "[", "dasmdata", "->", "divider2", "]", ",", "\"", "\"", ",", "dasmdata", "->", "allocated", ".", "x", "-", "dasmdata", "->", "divider2", "-", "1", ",", "text", ")", ";", "}", "if", "(", "lines", "==", "1", "&&", "strncmp", "(", "oldbuf", ",", "destbuf", ",", "MIN", "(", "sizeof", "(", "oldbuf", ")", ",", "dasmdata", "->", "allocated", ".", "x", ")", ")", "!=", "0", ")", "changed", "=", "TRUE", ";", "}", "dasmdata", "->", "last_direct_decrypted", "=", "space", "->", "direct", ".", "decrypted", ";", "dasmdata", "->", "last_direct_raw", "=", "space", "->", "direct", ".", "raw", ";", "dasmdata", "->", "last_change_count", "=", "debug_comment_all_change_count", "(", "space", "->", "machine", ")", ";", "view", "->", "recompute", "=", "FALSE", ";", "return", "changed", ";", "}" ]
disasm_view_recompute - recompute selected info for the disassembly view
[ "disasm_view_recompute", "-", "recompute", "selected", "info", "for", "the", "disassembly", "view" ]
[ "/* determine how many characters we need for an address and set the divider */", "/* assume a fixed number of characters for the disassembly */", "/* determine how many bytes we might need to display */", "/* ensure that the PC is aligned to the minimum opcode size */", "/* set the width of the third column according to display mode */", "/* DEBUG_COMMENT_MAX_LINE_LENGTH */", "/* reallocate memory if we don't have enough */", "/* update our values */", "/* allocate address array */", "/* allocate disassembly buffer */", "/* iterate over lines */", "/* convert PC to a byte offset */", "/* save a copy of the previous line as a backup if we're only doing one line */", "/* convert back and set the address of this instruction */", "/* make sure we can translate the address, and then disassemble the result */", "/* fetch the bytes up to the maximum */", "/* disassemble the result */", "/* append the disassembly to the buffer */", "/* output the right column */", "/* get the bytes */", "/* get and add the comment, if present */", "/* see if the line changed at all */", "/* update opcode base information */", "/* now longer need to recompute */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "pc", "type": "offs_t" }, { "param": "startline", "type": "int" }, { "param": "lines", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pc", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "startline", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lines", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_update
void
static void disasm_view_update(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; const address_space *space = dasmdata->space; debug_view_char *dest = view->viewdata; int recomputed_this_time = FALSE; offs_t pc, pcbyte; EXPRERR exprerr; UINT32 row; /* no space, do nothing */ if (space == NULL) return; pc = cpu_get_pc(space->cpu); pcbyte = memory_address_to_byte(space, pc) & space->logbytemask; /* if our expression is dirty, fix it */ if (dasmdata->expression.dirty) { parsed_expression *expr; /* parse the new expression */ exprerr = expression_parse(astring_c(dasmdata->expression.string), debug_cpu_get_symtable(space->cpu), &debug_expression_callbacks, space->machine, &expr); /* if it worked, update the expression */ if (exprerr == EXPRERR_NONE) { if (dasmdata->expression.parsed != NULL) expression_free(dasmdata->expression.parsed); dasmdata->expression.parsed = expr; } /* always recompute if the expression is dirty */ view->recompute = TRUE; } /* if we're tracking a value, make sure it is visible */ if (dasmdata->expression.parsed != NULL) { UINT64 result; /* recompute the value of the expression */ exprerr = expression_execute(dasmdata->expression.parsed, &result); if (exprerr == EXPRERR_NONE && result != dasmdata->expression.result) { offs_t resultbyte = memory_address_to_byte(space, result) & space->logbytemask; /* update the result */ dasmdata->expression.result = result; /* see if the new result is an address we already have */ for (row = 0; row < dasmdata->allocated.y; row++) if (dasmdata->byteaddress[row] == resultbyte) break; /* if we didn't find it, or if it's really close to the bottom, recompute */ if (row == dasmdata->allocated.y || row >= view->total.y - view->visible.y) view->recompute = TRUE; /* otherwise, if it's not visible, adjust the view so it is */ else if (row < view->topleft.y || row >= view->topleft.y + view->visible.y - 2) view->topleft.y = (row > 3) ? row - 3 : 0; } /* no longer dirty */ dasmdata->expression.dirty = FALSE; } /* if the opcode base has changed, rework things */ if (space->direct.decrypted != dasmdata->last_direct_decrypted || space->direct.raw != dasmdata->last_direct_raw) view->recompute = TRUE; /* if the comments have changed, redo it */ if (dasmdata->last_change_count != debug_comment_all_change_count(space->machine)) view->recompute = TRUE; /* if we need to recompute, do it */ recompute: if (view->recompute) { /* recompute the view */ if (dasmdata->byteaddress != NULL && dasmdata->last_change_count != debug_comment_all_change_count(space->machine)) { /* smoosh us against the left column, but not the top row */ view->topleft.x = 0; /* recompute from where we last recomputed! */ disasm_view_recompute(view, memory_byte_to_address(space, dasmdata->byteaddress[0]), 0, view->total.y); } else { /* determine the addresses of what we will display */ offs_t backpc = disasm_view_find_pc_backwards(space, (UINT32)dasmdata->expression.result, dasmdata->backwards_steps); /* put ourselves back in the top left */ view->topleft.y = 0; view->topleft.x = 0; disasm_view_recompute(view, backpc, 0, view->total.y); } recomputed_this_time = TRUE; } /* figure out the row where the PC is and recompute the disassembly */ if (pcbyte != dasmdata->last_pcbyte) { /* find the row with the PC on it */ for (row = 0; row < view->visible.y; row++) { UINT32 effrow = view->topleft.y + row; if (effrow >= dasmdata->allocated.y) break; if (pcbyte == dasmdata->byteaddress[effrow]) { /* see if we changed */ int changed = disasm_view_recompute(view, pc, effrow, 1); if (changed && !recomputed_this_time) { view->recompute = TRUE; goto recompute; } /* set the effective row and PC */ view->cursor.y = effrow; } } dasmdata->last_pcbyte = pcbyte; } /* loop over visible rows */ for (row = 0; row < view->visible.y; row++) { UINT32 effrow = view->topleft.y + row; UINT8 attrib = DCA_NORMAL; debug_cpu_breakpoint *bp; UINT32 col = 0; /* if this visible row is valid, add it to the buffer */ if (effrow < dasmdata->allocated.y) { const char *data = &dasmdata->dasm[effrow * dasmdata->allocated.x]; UINT32 effcol = view->topleft.x; UINT32 len = 0; /* if we're on the line with the PC, recompute and hilight it */ if (pcbyte == dasmdata->byteaddress[effrow]) attrib = DCA_CURRENT; /* if we're on a line with a breakpoint, tag it changed */ else { const cpu_debug_data *cpuinfo = cpu_get_debug_data(space->cpu); for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next) if (dasmdata->byteaddress[effrow] == (memory_address_to_byte(space, bp->address) & space->logbytemask)) attrib = DCA_CHANGED; } /* if we're on the active column and everything is couth, highlight it */ if (view->cursor_visible && effrow == view->cursor.y) attrib |= DCA_SELECTED; /* get the effective string */ len = (UINT32)strlen(data); /* copy data */ while (col < view->visible.x && effcol < len) { dest->byte = data[effcol++]; dest->attrib = (effcol <= dasmdata->divider1 || effcol >= dasmdata->divider2) ? (attrib | DCA_ANCILLARY) : attrib; /* comments are just green for now - maybe they shouldn't even be this? */ if (effcol >= dasmdata->divider2 && dasmdata->right_column == DASM_RIGHTCOL_COMMENTS) attrib |= DCA_COMMENT; dest++; col++; } } /* fill the rest with blanks */ while (col < view->visible.x) { dest->byte = ' '; dest->attrib = (effrow < view->total.y) ? (attrib | DCA_ANCILLARY) : attrib; dest++; col++; } } }
/*------------------------------------------------- disasm_view_update - update the contents of the disassembly view -------------------------------------------------*/
update the contents of the disassembly view
[ "update", "the", "contents", "of", "the", "disassembly", "view" ]
static void disasm_view_update(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; const address_space *space = dasmdata->space; debug_view_char *dest = view->viewdata; int recomputed_this_time = FALSE; offs_t pc, pcbyte; EXPRERR exprerr; UINT32 row; if (space == NULL) return; pc = cpu_get_pc(space->cpu); pcbyte = memory_address_to_byte(space, pc) & space->logbytemask; if (dasmdata->expression.dirty) { parsed_expression *expr; exprerr = expression_parse(astring_c(dasmdata->expression.string), debug_cpu_get_symtable(space->cpu), &debug_expression_callbacks, space->machine, &expr); if (exprerr == EXPRERR_NONE) { if (dasmdata->expression.parsed != NULL) expression_free(dasmdata->expression.parsed); dasmdata->expression.parsed = expr; } view->recompute = TRUE; } if (dasmdata->expression.parsed != NULL) { UINT64 result; exprerr = expression_execute(dasmdata->expression.parsed, &result); if (exprerr == EXPRERR_NONE && result != dasmdata->expression.result) { offs_t resultbyte = memory_address_to_byte(space, result) & space->logbytemask; dasmdata->expression.result = result; for (row = 0; row < dasmdata->allocated.y; row++) if (dasmdata->byteaddress[row] == resultbyte) break; if (row == dasmdata->allocated.y || row >= view->total.y - view->visible.y) view->recompute = TRUE; else if (row < view->topleft.y || row >= view->topleft.y + view->visible.y - 2) view->topleft.y = (row > 3) ? row - 3 : 0; } dasmdata->expression.dirty = FALSE; } if (space->direct.decrypted != dasmdata->last_direct_decrypted || space->direct.raw != dasmdata->last_direct_raw) view->recompute = TRUE; if (dasmdata->last_change_count != debug_comment_all_change_count(space->machine)) view->recompute = TRUE; recompute: if (view->recompute) { if (dasmdata->byteaddress != NULL && dasmdata->last_change_count != debug_comment_all_change_count(space->machine)) { view->topleft.x = 0; disasm_view_recompute(view, memory_byte_to_address(space, dasmdata->byteaddress[0]), 0, view->total.y); } else { offs_t backpc = disasm_view_find_pc_backwards(space, (UINT32)dasmdata->expression.result, dasmdata->backwards_steps); view->topleft.y = 0; view->topleft.x = 0; disasm_view_recompute(view, backpc, 0, view->total.y); } recomputed_this_time = TRUE; } if (pcbyte != dasmdata->last_pcbyte) { for (row = 0; row < view->visible.y; row++) { UINT32 effrow = view->topleft.y + row; if (effrow >= dasmdata->allocated.y) break; if (pcbyte == dasmdata->byteaddress[effrow]) { int changed = disasm_view_recompute(view, pc, effrow, 1); if (changed && !recomputed_this_time) { view->recompute = TRUE; goto recompute; } view->cursor.y = effrow; } } dasmdata->last_pcbyte = pcbyte; } for (row = 0; row < view->visible.y; row++) { UINT32 effrow = view->topleft.y + row; UINT8 attrib = DCA_NORMAL; debug_cpu_breakpoint *bp; UINT32 col = 0; if (effrow < dasmdata->allocated.y) { const char *data = &dasmdata->dasm[effrow * dasmdata->allocated.x]; UINT32 effcol = view->topleft.x; UINT32 len = 0; if (pcbyte == dasmdata->byteaddress[effrow]) attrib = DCA_CURRENT; else { const cpu_debug_data *cpuinfo = cpu_get_debug_data(space->cpu); for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next) if (dasmdata->byteaddress[effrow] == (memory_address_to_byte(space, bp->address) & space->logbytemask)) attrib = DCA_CHANGED; } if (view->cursor_visible && effrow == view->cursor.y) attrib |= DCA_SELECTED; len = (UINT32)strlen(data); while (col < view->visible.x && effcol < len) { dest->byte = data[effcol++]; dest->attrib = (effcol <= dasmdata->divider1 || effcol >= dasmdata->divider2) ? (attrib | DCA_ANCILLARY) : attrib; if (effcol >= dasmdata->divider2 && dasmdata->right_column == DASM_RIGHTCOL_COMMENTS) attrib |= DCA_COMMENT; dest++; col++; } } while (col < view->visible.x) { dest->byte = ' '; dest->attrib = (effrow < view->total.y) ? (attrib | DCA_ANCILLARY) : attrib; dest++; col++; } } }
[ "static", "void", "disasm_view_update", "(", "debug_view", "*", "view", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "const", "address_space", "*", "space", "=", "dasmdata", "->", "space", ";", "debug_view_char", "*", "dest", "=", "view", "->", "viewdata", ";", "int", "recomputed_this_time", "=", "FALSE", ";", "offs_t", "pc", ",", "pcbyte", ";", "EXPRERR", "exprerr", ";", "UINT32", "row", ";", "if", "(", "space", "==", "NULL", ")", "return", ";", "pc", "=", "cpu_get_pc", "(", "space", "->", "cpu", ")", ";", "pcbyte", "=", "memory_address_to_byte", "(", "space", ",", "pc", ")", "&", "space", "->", "logbytemask", ";", "if", "(", "dasmdata", "->", "expression", ".", "dirty", ")", "{", "parsed_expression", "*", "expr", ";", "exprerr", "=", "expression_parse", "(", "astring_c", "(", "dasmdata", "->", "expression", ".", "string", ")", ",", "debug_cpu_get_symtable", "(", "space", "->", "cpu", ")", ",", "&", "debug_expression_callbacks", ",", "space", "->", "machine", ",", "&", "expr", ")", ";", "if", "(", "exprerr", "==", "EXPRERR_NONE", ")", "{", "if", "(", "dasmdata", "->", "expression", ".", "parsed", "!=", "NULL", ")", "expression_free", "(", "dasmdata", "->", "expression", ".", "parsed", ")", ";", "dasmdata", "->", "expression", ".", "parsed", "=", "expr", ";", "}", "view", "->", "recompute", "=", "TRUE", ";", "}", "if", "(", "dasmdata", "->", "expression", ".", "parsed", "!=", "NULL", ")", "{", "UINT64", "result", ";", "exprerr", "=", "expression_execute", "(", "dasmdata", "->", "expression", ".", "parsed", ",", "&", "result", ")", ";", "if", "(", "exprerr", "==", "EXPRERR_NONE", "&&", "result", "!=", "dasmdata", "->", "expression", ".", "result", ")", "{", "offs_t", "resultbyte", "=", "memory_address_to_byte", "(", "space", ",", "result", ")", "&", "space", "->", "logbytemask", ";", "dasmdata", "->", "expression", ".", "result", "=", "result", ";", "for", "(", "row", "=", "0", ";", "row", "<", "dasmdata", "->", "allocated", ".", "y", ";", "row", "++", ")", "if", "(", "dasmdata", "->", "byteaddress", "[", "row", "]", "==", "resultbyte", ")", "break", ";", "if", "(", "row", "==", "dasmdata", "->", "allocated", ".", "y", "||", "row", ">=", "view", "->", "total", ".", "y", "-", "view", "->", "visible", ".", "y", ")", "view", "->", "recompute", "=", "TRUE", ";", "else", "if", "(", "row", "<", "view", "->", "topleft", ".", "y", "||", "row", ">=", "view", "->", "topleft", ".", "y", "+", "view", "->", "visible", ".", "y", "-", "2", ")", "view", "->", "topleft", ".", "y", "=", "(", "row", ">", "3", ")", "?", "row", "-", "3", ":", "0", ";", "}", "dasmdata", "->", "expression", ".", "dirty", "=", "FALSE", ";", "}", "if", "(", "space", "->", "direct", ".", "decrypted", "!=", "dasmdata", "->", "last_direct_decrypted", "||", "space", "->", "direct", ".", "raw", "!=", "dasmdata", "->", "last_direct_raw", ")", "view", "->", "recompute", "=", "TRUE", ";", "if", "(", "dasmdata", "->", "last_change_count", "!=", "debug_comment_all_change_count", "(", "space", "->", "machine", ")", ")", "view", "->", "recompute", "=", "TRUE", ";", "recompute", ":", "if", "(", "view", "->", "recompute", ")", "{", "if", "(", "dasmdata", "->", "byteaddress", "!=", "NULL", "&&", "dasmdata", "->", "last_change_count", "!=", "debug_comment_all_change_count", "(", "space", "->", "machine", ")", ")", "{", "view", "->", "topleft", ".", "x", "=", "0", ";", "disasm_view_recompute", "(", "view", ",", "memory_byte_to_address", "(", "space", ",", "dasmdata", "->", "byteaddress", "[", "0", "]", ")", ",", "0", ",", "view", "->", "total", ".", "y", ")", ";", "}", "else", "{", "offs_t", "backpc", "=", "disasm_view_find_pc_backwards", "(", "space", ",", "(", "UINT32", ")", "dasmdata", "->", "expression", ".", "result", ",", "dasmdata", "->", "backwards_steps", ")", ";", "view", "->", "topleft", ".", "y", "=", "0", ";", "view", "->", "topleft", ".", "x", "=", "0", ";", "disasm_view_recompute", "(", "view", ",", "backpc", ",", "0", ",", "view", "->", "total", ".", "y", ")", ";", "}", "recomputed_this_time", "=", "TRUE", ";", "}", "if", "(", "pcbyte", "!=", "dasmdata", "->", "last_pcbyte", ")", "{", "for", "(", "row", "=", "0", ";", "row", "<", "view", "->", "visible", ".", "y", ";", "row", "++", ")", "{", "UINT32", "effrow", "=", "view", "->", "topleft", ".", "y", "+", "row", ";", "if", "(", "effrow", ">=", "dasmdata", "->", "allocated", ".", "y", ")", "break", ";", "if", "(", "pcbyte", "==", "dasmdata", "->", "byteaddress", "[", "effrow", "]", ")", "{", "int", "changed", "=", "disasm_view_recompute", "(", "view", ",", "pc", ",", "effrow", ",", "1", ")", ";", "if", "(", "changed", "&&", "!", "recomputed_this_time", ")", "{", "view", "->", "recompute", "=", "TRUE", ";", "goto", "recompute", ";", "}", "view", "->", "cursor", ".", "y", "=", "effrow", ";", "}", "}", "dasmdata", "->", "last_pcbyte", "=", "pcbyte", ";", "}", "for", "(", "row", "=", "0", ";", "row", "<", "view", "->", "visible", ".", "y", ";", "row", "++", ")", "{", "UINT32", "effrow", "=", "view", "->", "topleft", ".", "y", "+", "row", ";", "UINT8", "attrib", "=", "DCA_NORMAL", ";", "debug_cpu_breakpoint", "*", "bp", ";", "UINT32", "col", "=", "0", ";", "if", "(", "effrow", "<", "dasmdata", "->", "allocated", ".", "y", ")", "{", "const", "char", "*", "data", "=", "&", "dasmdata", "->", "dasm", "[", "effrow", "*", "dasmdata", "->", "allocated", ".", "x", "]", ";", "UINT32", "effcol", "=", "view", "->", "topleft", ".", "x", ";", "UINT32", "len", "=", "0", ";", "if", "(", "pcbyte", "==", "dasmdata", "->", "byteaddress", "[", "effrow", "]", ")", "attrib", "=", "DCA_CURRENT", ";", "else", "{", "const", "cpu_debug_data", "*", "cpuinfo", "=", "cpu_get_debug_data", "(", "space", "->", "cpu", ")", ";", "for", "(", "bp", "=", "cpuinfo", "->", "bplist", ";", "bp", "!=", "NULL", ";", "bp", "=", "bp", "->", "next", ")", "if", "(", "dasmdata", "->", "byteaddress", "[", "effrow", "]", "==", "(", "memory_address_to_byte", "(", "space", ",", "bp", "->", "address", ")", "&", "space", "->", "logbytemask", ")", ")", "attrib", "=", "DCA_CHANGED", ";", "}", "if", "(", "view", "->", "cursor_visible", "&&", "effrow", "==", "view", "->", "cursor", ".", "y", ")", "attrib", "|=", "DCA_SELECTED", ";", "len", "=", "(", "UINT32", ")", "strlen", "(", "data", ")", ";", "while", "(", "col", "<", "view", "->", "visible", ".", "x", "&&", "effcol", "<", "len", ")", "{", "dest", "->", "byte", "=", "data", "[", "effcol", "++", "]", ";", "dest", "->", "attrib", "=", "(", "effcol", "<=", "dasmdata", "->", "divider1", "||", "effcol", ">=", "dasmdata", "->", "divider2", ")", "?", "(", "attrib", "|", "DCA_ANCILLARY", ")", ":", "attrib", ";", "if", "(", "effcol", ">=", "dasmdata", "->", "divider2", "&&", "dasmdata", "->", "right_column", "==", "DASM_RIGHTCOL_COMMENTS", ")", "attrib", "|=", "DCA_COMMENT", ";", "dest", "++", ";", "col", "++", ";", "}", "}", "while", "(", "col", "<", "view", "->", "visible", ".", "x", ")", "{", "dest", "->", "byte", "=", "'", "'", ";", "dest", "->", "attrib", "=", "(", "effrow", "<", "view", "->", "total", ".", "y", ")", "?", "(", "attrib", "|", "DCA_ANCILLARY", ")", ":", "attrib", ";", "dest", "++", ";", "col", "++", ";", "}", "}", "}" ]
disasm_view_update - update the contents of the disassembly view
[ "disasm_view_update", "-", "update", "the", "contents", "of", "the", "disassembly", "view" ]
[ "/* no space, do nothing */", "/* if our expression is dirty, fix it */", "/* parse the new expression */", "/* if it worked, update the expression */", "/* always recompute if the expression is dirty */", "/* if we're tracking a value, make sure it is visible */", "/* recompute the value of the expression */", "/* update the result */", "/* see if the new result is an address we already have */", "/* if we didn't find it, or if it's really close to the bottom, recompute */", "/* otherwise, if it's not visible, adjust the view so it is */", "/* no longer dirty */", "/* if the opcode base has changed, rework things */", "/* if the comments have changed, redo it */", "/* if we need to recompute, do it */", "/* recompute the view */", "/* smoosh us against the left column, but not the top row */", "/* recompute from where we last recomputed! */", "/* determine the addresses of what we will display */", "/* put ourselves back in the top left */", "/* figure out the row where the PC is and recompute the disassembly */", "/* find the row with the PC on it */", "/* see if we changed */", "/* set the effective row and PC */", "/* loop over visible rows */", "/* if this visible row is valid, add it to the buffer */", "/* if we're on the line with the PC, recompute and hilight it */", "/* if we're on a line with a breakpoint, tag it changed */", "/* if we're on the active column and everything is couth, highlight it */", "/* get the effective string */", "/* copy data */", "/* comments are just green for now - maybe they shouldn't even be this? */", "/* fill the rest with blanks */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_get_subview_list
disasm_subview_item
const disasm_subview_item *disasm_view_get_subview_list(debug_view *view) { assert(view->type == DVT_DISASSEMBLY); return view->machine->debugvw_data->disasm_subviews; }
/*------------------------------------------------- disasm_view_get_subview_list - return a linked list of subviews -------------------------------------------------*/
return a linked list of subviews
[ "return", "a", "linked", "list", "of", "subviews" ]
const disasm_subview_item *disasm_view_get_subview_list(debug_view *view) { assert(view->type == DVT_DISASSEMBLY); return view->machine->debugvw_data->disasm_subviews; }
[ "const", "disasm_subview_item", "*", "disasm_view_get_subview_list", "(", "debug_view", "*", "view", ")", "{", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "return", "view", "->", "machine", "->", "debugvw_data", "->", "disasm_subviews", ";", "}" ]
disasm_view_get_subview_list - return a linked list of subviews
[ "disasm_view_get_subview_list", "-", "return", "a", "linked", "list", "of", "subviews" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_get_expression
char
const char *disasm_view_get_expression(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return astring_c(dasmdata->expression.string); }
/*------------------------------------------------- disasm_view_get_expression - return the expression string describing the home address -------------------------------------------------*/
return the expression string describing the home address
[ "return", "the", "expression", "string", "describing", "the", "home", "address" ]
const char *disasm_view_get_expression(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return astring_c(dasmdata->expression.string); }
[ "const", "char", "*", "disasm_view_get_expression", "(", "debug_view", "*", "view", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "astring_c", "(", "dasmdata", "->", "expression", ".", "string", ")", ";", "}" ]
disasm_view_get_expression - return the expression string describing the home address
[ "disasm_view_get_expression", "-", "return", "the", "expression", "string", "describing", "the", "home", "address" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_get_right_column
disasm_right_column
disasm_right_column disasm_view_get_right_column(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return dasmdata->right_column; }
/*------------------------------------------------- disasm_view_get_right_column - return the contents of the right column -------------------------------------------------*/
return the contents of the right column
[ "return", "the", "contents", "of", "the", "right", "column" ]
disasm_right_column disasm_view_get_right_column(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return dasmdata->right_column; }
[ "disasm_right_column", "disasm_view_get_right_column", "(", "debug_view", "*", "view", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "dasmdata", "->", "right_column", ";", "}" ]
disasm_view_get_right_column - return the contents of the right column
[ "disasm_view_get_right_column", "-", "return", "the", "contents", "of", "the", "right", "column" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_get_backward_steps
UINT32
UINT32 disasm_view_get_backward_steps(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return dasmdata->backwards_steps; }
/*------------------------------------------------- disasm_view_get_backward_steps - return the number of instructions displayed before the home address -------------------------------------------------*/
return the number of instructions displayed before the home address
[ "return", "the", "number", "of", "instructions", "displayed", "before", "the", "home", "address" ]
UINT32 disasm_view_get_backward_steps(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return dasmdata->backwards_steps; }
[ "UINT32", "disasm_view_get_backward_steps", "(", "debug_view", "*", "view", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "dasmdata", "->", "backwards_steps", ";", "}" ]
disasm_view_get_backward_steps - return the number of instructions displayed before the home address
[ "disasm_view_get_backward_steps", "-", "return", "the", "number", "of", "instructions", "displayed", "before", "the", "home", "address" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_get_disasm_width
UINT32
UINT32 disasm_view_get_disasm_width(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return dasmdata->dasm_width; }
/*------------------------------------------------- disasm_view_get_disasm_width - return the width in characters of the main disassembly section -------------------------------------------------*/
return the width in characters of the main disassembly section
[ "return", "the", "width", "in", "characters", "of", "the", "main", "disassembly", "section" ]
UINT32 disasm_view_get_disasm_width(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return dasmdata->dasm_width; }
[ "UINT32", "disasm_view_get_disasm_width", "(", "debug_view", "*", "view", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "dasmdata", "->", "dasm_width", ";", "}" ]
disasm_view_get_disasm_width - return the width in characters of the main disassembly section
[ "disasm_view_get_disasm_width", "-", "return", "the", "width", "in", "characters", "of", "the", "main", "disassembly", "section" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_get_selected_address
offs_t
offs_t disasm_view_get_selected_address(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return memory_byte_to_address(dasmdata->space, dasmdata->byteaddress[view->cursor.y]); }
/*------------------------------------------------- disasm_view_get_selected_address - return the PC of the currently selected address in the view -------------------------------------------------*/
return the PC of the currently selected address in the view
[ "return", "the", "PC", "of", "the", "currently", "selected", "address", "in", "the", "view" ]
offs_t disasm_view_get_selected_address(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); debug_view_begin_update(view); debug_view_end_update(view); return memory_byte_to_address(dasmdata->space, dasmdata->byteaddress[view->cursor.y]); }
[ "offs_t", "disasm_view_get_selected_address", "(", "debug_view", "*", "view", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "memory_byte_to_address", "(", "dasmdata", "->", "space", ",", "dasmdata", "->", "byteaddress", "[", "view", "->", "cursor", ".", "y", "]", ")", ";", "}" ]
disasm_view_get_selected_address - return the PC of the currently selected address in the view
[ "disasm_view_get_selected_address", "-", "return", "the", "PC", "of", "the", "currently", "selected", "address", "in", "the", "view" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_set_subview
void
void disasm_view_set_subview(debug_view *view, int index) { const disasm_subview_item *subview = disasm_view_get_subview_by_index(view->machine->debugvw_data->disasm_subviews, index); debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); assert(subview != NULL); if (subview == NULL) return; /* handle a change */ if (subview->space != dasmdata->space) { debug_view_begin_update(view); dasmdata->space = subview->space; /* we need to recompute the expression in the context of the new space's CPU */ dasmdata->expression.dirty = TRUE; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
/*------------------------------------------------- disasm_view_set_subview - select a new subview by index -------------------------------------------------*/
select a new subview by index
[ "select", "a", "new", "subview", "by", "index" ]
void disasm_view_set_subview(debug_view *view, int index) { const disasm_subview_item *subview = disasm_view_get_subview_by_index(view->machine->debugvw_data->disasm_subviews, index); debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); assert(subview != NULL); if (subview == NULL) return; if (subview->space != dasmdata->space) { debug_view_begin_update(view); dasmdata->space = subview->space; dasmdata->expression.dirty = TRUE; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
[ "void", "disasm_view_set_subview", "(", "debug_view", "*", "view", ",", "int", "index", ")", "{", "const", "disasm_subview_item", "*", "subview", "=", "disasm_view_get_subview_by_index", "(", "view", "->", "machine", "->", "debugvw_data", "->", "disasm_subviews", ",", "index", ")", ";", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "assert", "(", "subview", "!=", "NULL", ")", ";", "if", "(", "subview", "==", "NULL", ")", "return", ";", "if", "(", "subview", "->", "space", "!=", "dasmdata", "->", "space", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "dasmdata", "->", "space", "=", "subview", "->", "space", ";", "dasmdata", "->", "expression", ".", "dirty", "=", "TRUE", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
disasm_view_set_subview - select a new subview by index
[ "disasm_view_set_subview", "-", "select", "a", "new", "subview", "by", "index" ]
[ "/* handle a change */", "/* we need to recompute the expression in the context of the new space's CPU */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "index", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "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": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_set_expression
void
void disasm_view_set_expression(debug_view *view, const char *expression) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); assert(expression != NULL); debug_view_begin_update(view); debug_view_expression_set(&dasmdata->expression, expression); view->recompute = view->update_pending = TRUE; debug_view_end_update(view); }
/*------------------------------------------------- disasm_view_set_expression - set the expression string describing the home address -------------------------------------------------*/
set the expression string describing the home address
[ "set", "the", "expression", "string", "describing", "the", "home", "address" ]
void disasm_view_set_expression(debug_view *view, const char *expression) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); assert(expression != NULL); debug_view_begin_update(view); debug_view_expression_set(&dasmdata->expression, expression); view->recompute = view->update_pending = TRUE; debug_view_end_update(view); }
[ "void", "disasm_view_set_expression", "(", "debug_view", "*", "view", ",", "const", "char", "*", "expression", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "assert", "(", "expression", "!=", "NULL", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_expression_set", "(", "&", "dasmdata", "->", "expression", ",", "expression", ")", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}" ]
disasm_view_set_expression - set the expression string describing the home address
[ "disasm_view_set_expression", "-", "set", "the", "expression", "string", "describing", "the", "home", "address" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "expression", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "expression", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_set_right_column
void
void disasm_view_set_right_column(debug_view *view, disasm_right_column contents) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); assert(contents == DASM_RIGHTCOL_RAW || contents == DASM_RIGHTCOL_ENCRYPTED || contents == DASM_RIGHTCOL_COMMENTS); if (contents != dasmdata->right_column) { debug_view_begin_update(view); dasmdata->right_column = contents; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
/*------------------------------------------------- disasm_view_set_right_column - set the contents of the right column -------------------------------------------------*/
set the contents of the right column
[ "set", "the", "contents", "of", "the", "right", "column" ]
void disasm_view_set_right_column(debug_view *view, disasm_right_column contents) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); assert(contents == DASM_RIGHTCOL_RAW || contents == DASM_RIGHTCOL_ENCRYPTED || contents == DASM_RIGHTCOL_COMMENTS); if (contents != dasmdata->right_column) { debug_view_begin_update(view); dasmdata->right_column = contents; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
[ "void", "disasm_view_set_right_column", "(", "debug_view", "*", "view", ",", "disasm_right_column", "contents", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "assert", "(", "contents", "==", "DASM_RIGHTCOL_RAW", "||", "contents", "==", "DASM_RIGHTCOL_ENCRYPTED", "||", "contents", "==", "DASM_RIGHTCOL_COMMENTS", ")", ";", "if", "(", "contents", "!=", "dasmdata", "->", "right_column", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "dasmdata", "->", "right_column", "=", "contents", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
disasm_view_set_right_column - set the contents of the right column
[ "disasm_view_set_right_column", "-", "set", "the", "contents", "of", "the", "right", "column" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "contents", "type": "disasm_right_column" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "contents", "type": "disasm_right_column", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_set_backward_steps
void
void disasm_view_set_backward_steps(debug_view *view, UINT32 steps) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); if (steps != dasmdata->backwards_steps) { debug_view_begin_update(view); dasmdata->backwards_steps = steps; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
/*------------------------------------------------- disasm_view_set_backward_steps - set the number of instructions displayed before the home address -------------------------------------------------*/
set the number of instructions displayed before the home address
[ "set", "the", "number", "of", "instructions", "displayed", "before", "the", "home", "address" ]
void disasm_view_set_backward_steps(debug_view *view, UINT32 steps) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); if (steps != dasmdata->backwards_steps) { debug_view_begin_update(view); dasmdata->backwards_steps = steps; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
[ "void", "disasm_view_set_backward_steps", "(", "debug_view", "*", "view", ",", "UINT32", "steps", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "if", "(", "steps", "!=", "dasmdata", "->", "backwards_steps", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "dasmdata", "->", "backwards_steps", "=", "steps", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
disasm_view_set_backward_steps - set the number of instructions displayed before the home address
[ "disasm_view_set_backward_steps", "-", "set", "the", "number", "of", "instructions", "displayed", "before", "the", "home", "address" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "steps", "type": "UINT32" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "steps", "type": "UINT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_set_disasm_width
void
void disasm_view_set_disasm_width(debug_view *view, UINT32 width) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); if (width != dasmdata->dasm_width) { debug_view_begin_update(view); dasmdata->dasm_width = width; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
/*------------------------------------------------- disasm_view_set_disasm_width - set the width in characters of the main disassembly section -------------------------------------------------*/
set the width in characters of the main disassembly section
[ "set", "the", "width", "in", "characters", "of", "the", "main", "disassembly", "section" ]
void disasm_view_set_disasm_width(debug_view *view, UINT32 width) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; assert(view->type == DVT_DISASSEMBLY); if (width != dasmdata->dasm_width) { debug_view_begin_update(view); dasmdata->dasm_width = width; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
[ "void", "disasm_view_set_disasm_width", "(", "debug_view", "*", "view", ",", "UINT32", "width", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "if", "(", "width", "!=", "dasmdata", "->", "dasm_width", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "dasmdata", "->", "dasm_width", "=", "width", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
disasm_view_set_disasm_width - set the width in characters of the main disassembly section
[ "disasm_view_set_disasm_width", "-", "set", "the", "width", "in", "characters", "of", "the", "main", "disassembly", "section" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "width", "type": "UINT32" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "width", "type": "UINT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_set_selected_address
void
void disasm_view_set_selected_address(debug_view *view, offs_t address) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; offs_t byteaddress = memory_address_to_byte(dasmdata->space, address) & dasmdata->space->logbytemask; int line; assert(view->type == DVT_DISASSEMBLY); for (line = 0; line < view->total.y; line++) if (dasmdata->byteaddress[line] == byteaddress) { view->cursor.y = line; debug_view_set_cursor_position(view, view->cursor); break; } }
/*------------------------------------------------- disasm_view_set_selected_address - set the PC of the currently selected address in the view -------------------------------------------------*/
set the PC of the currently selected address in the view
[ "set", "the", "PC", "of", "the", "currently", "selected", "address", "in", "the", "view" ]
void disasm_view_set_selected_address(debug_view *view, offs_t address) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; offs_t byteaddress = memory_address_to_byte(dasmdata->space, address) & dasmdata->space->logbytemask; int line; assert(view->type == DVT_DISASSEMBLY); for (line = 0; line < view->total.y; line++) if (dasmdata->byteaddress[line] == byteaddress) { view->cursor.y = line; debug_view_set_cursor_position(view, view->cursor); break; } }
[ "void", "disasm_view_set_selected_address", "(", "debug_view", "*", "view", ",", "offs_t", "address", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "offs_t", "byteaddress", "=", "memory_address_to_byte", "(", "dasmdata", "->", "space", ",", "address", ")", "&", "dasmdata", "->", "space", "->", "logbytemask", ";", "int", "line", ";", "assert", "(", "view", "->", "type", "==", "DVT_DISASSEMBLY", ")", ";", "for", "(", "line", "=", "0", ";", "line", "<", "view", "->", "total", ".", "y", ";", "line", "++", ")", "if", "(", "dasmdata", "->", "byteaddress", "[", "line", "]", "==", "byteaddress", ")", "{", "view", "->", "cursor", ".", "y", "=", "line", ";", "debug_view_set_cursor_position", "(", "view", ",", "view", "->", "cursor", ")", ";", "break", ";", "}", "}" ]
disasm_view_set_selected_address - set the PC of the currently selected address in the view
[ "disasm_view_set_selected_address", "-", "set", "the", "PC", "of", "the", "currently", "selected", "address", "in", "the", "view" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "address", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "address", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_enumerate_subviews
memory_subview_item
static const memory_subview_item *memory_view_enumerate_subviews(running_machine *machine) { astring *tempstring = astring_alloc(); memory_subview_item *head = NULL; memory_subview_item **tailptr = &head; const device_config *device; int spacenum; const char *rgntag; int curindex = 0; int itemnum; /* first add all the device's address spaces */ for (device = machine->config->devicelist; device != NULL; device = device->next) for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++) { const address_space *space = memory_find_address_space(device, spacenum); if (space != NULL) { memory_subview_item *subview; /* determine the string and allocate a subview large enough */ if (device->type == CPU) astring_printf(tempstring, "CPU '%s' (%s) %s memory", device->tag, device_get_name(device), space->name); else astring_printf(tempstring, "%s '%s' space #%d memory", device_get_name(device), device->tag, spacenum); subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; subview->index = curindex++; subview->space = space; subview->endianness = space->endianness; subview->prefsize = space->dbits / 8; strcpy(subview->name, astring_c(tempstring)); /* add to the list */ *tailptr = subview; tailptr = &subview->next; } } /* then add all the memory regions */ for (rgntag = memory_region_next(machine, NULL); rgntag != NULL; rgntag = memory_region_next(machine, rgntag)) { UINT32 length = memory_region_length(machine, rgntag); UINT32 flags = memory_region_flags(machine, rgntag); if (length > 0 && (flags & ROMREGION_DATATYPEMASK) == ROMREGION_DATATYPEROM) { UINT8 little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE); UINT8 width = 1 << ((flags & ROMREGION_WIDTHMASK) >> 8); memory_subview_item *subview; /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "Region '%s'", rgntag); subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; subview->index = curindex++; subview->base = memory_region(machine, rgntag); subview->length = memory_region_length(machine, rgntag); subview->offsetxor = NATIVE_ENDIAN_VALUE_LE_BE(width - 1, 0); subview->endianness = little_endian ? ENDIANNESS_LITTLE : ENDIANNESS_BIG; subview->prefsize = MIN(width, 8); strcpy(subview->name, astring_c(tempstring)); /* add to the list */ *tailptr = subview; tailptr = &subview->next; } } /* finally add all global array symbols */ for (itemnum = 0; itemnum < 10000; itemnum++) { UINT32 valsize, valcount; const char *name; void *base; /* stop when we run out of items */ name = state_save_get_indexed_item(machine, itemnum, &base, &valsize, &valcount); if (name == NULL) break; /* if this is a single-entry global, add it */ if (valcount > 1 && strstr(name, "/globals/")) { memory_subview_item *subview; /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "%s", strrchr(name, '/') + 1); subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; subview->index = curindex++; subview->base = base; subview->length = valcount * valsize; subview->offsetxor = 0; subview->endianness = ENDIANNESS_NATIVE; subview->prefsize = MIN(valsize, 8); strcpy(subview->name, astring_c(tempstring)); /* add to the list */ *tailptr = subview; tailptr = &subview->next; } } /* free the temporary string */ astring_free(tempstring); return head; }
/*------------------------------------------------- memory_view_enumerate_subviews - enumerate all possible subviews for a memory view -------------------------------------------------*/
enumerate all possible subviews for a memory view
[ "enumerate", "all", "possible", "subviews", "for", "a", "memory", "view" ]
static const memory_subview_item *memory_view_enumerate_subviews(running_machine *machine) { astring *tempstring = astring_alloc(); memory_subview_item *head = NULL; memory_subview_item **tailptr = &head; const device_config *device; int spacenum; const char *rgntag; int curindex = 0; int itemnum; for (device = machine->config->devicelist; device != NULL; device = device->next) for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++) { const address_space *space = memory_find_address_space(device, spacenum); if (space != NULL) { memory_subview_item *subview; if (device->type == CPU) astring_printf(tempstring, "CPU '%s' (%s) %s memory", device->tag, device_get_name(device), space->name); else astring_printf(tempstring, "%s '%s' space #%d memory", device_get_name(device), device->tag, spacenum); subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); subview->next = NULL; subview->index = curindex++; subview->space = space; subview->endianness = space->endianness; subview->prefsize = space->dbits / 8; strcpy(subview->name, astring_c(tempstring)); *tailptr = subview; tailptr = &subview->next; } } for (rgntag = memory_region_next(machine, NULL); rgntag != NULL; rgntag = memory_region_next(machine, rgntag)) { UINT32 length = memory_region_length(machine, rgntag); UINT32 flags = memory_region_flags(machine, rgntag); if (length > 0 && (flags & ROMREGION_DATATYPEMASK) == ROMREGION_DATATYPEROM) { UINT8 little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE); UINT8 width = 1 << ((flags & ROMREGION_WIDTHMASK) >> 8); memory_subview_item *subview; astring_printf(tempstring, "Region '%s'", rgntag); subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); subview->next = NULL; subview->index = curindex++; subview->base = memory_region(machine, rgntag); subview->length = memory_region_length(machine, rgntag); subview->offsetxor = NATIVE_ENDIAN_VALUE_LE_BE(width - 1, 0); subview->endianness = little_endian ? ENDIANNESS_LITTLE : ENDIANNESS_BIG; subview->prefsize = MIN(width, 8); strcpy(subview->name, astring_c(tempstring)); *tailptr = subview; tailptr = &subview->next; } } for (itemnum = 0; itemnum < 10000; itemnum++) { UINT32 valsize, valcount; const char *name; void *base; name = state_save_get_indexed_item(machine, itemnum, &base, &valsize, &valcount); if (name == NULL) break; if (valcount > 1 && strstr(name, "/globals/")) { memory_subview_item *subview; astring_printf(tempstring, "%s", strrchr(name, '/') + 1); subview = (memory_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); subview->next = NULL; subview->index = curindex++; subview->base = base; subview->length = valcount * valsize; subview->offsetxor = 0; subview->endianness = ENDIANNESS_NATIVE; subview->prefsize = MIN(valsize, 8); strcpy(subview->name, astring_c(tempstring)); *tailptr = subview; tailptr = &subview->next; } } astring_free(tempstring); return head; }
[ "static", "const", "memory_subview_item", "*", "memory_view_enumerate_subviews", "(", "running_machine", "*", "machine", ")", "{", "astring", "*", "tempstring", "=", "astring_alloc", "(", ")", ";", "memory_subview_item", "*", "head", "=", "NULL", ";", "memory_subview_item", "*", "*", "tailptr", "=", "&", "head", ";", "const", "device_config", "*", "device", ";", "int", "spacenum", ";", "const", "char", "*", "rgntag", ";", "int", "curindex", "=", "0", ";", "int", "itemnum", ";", "for", "(", "device", "=", "machine", "->", "config", "->", "devicelist", ";", "device", "!=", "NULL", ";", "device", "=", "device", "->", "next", ")", "for", "(", "spacenum", "=", "0", ";", "spacenum", "<", "ADDRESS_SPACES", ";", "spacenum", "++", ")", "{", "const", "address_space", "*", "space", "=", "memory_find_address_space", "(", "device", ",", "spacenum", ")", ";", "if", "(", "space", "!=", "NULL", ")", "{", "memory_subview_item", "*", "subview", ";", "if", "(", "device", "->", "type", "==", "CPU", ")", "astring_printf", "(", "tempstring", ",", "\"", "\"", ",", "device", "->", "tag", ",", "device_get_name", "(", "device", ")", ",", "space", "->", "name", ")", ";", "else", "astring_printf", "(", "tempstring", ",", "\"", "\"", ",", "device_get_name", "(", "device", ")", ",", "device", "->", "tag", ",", "spacenum", ")", ";", "subview", "=", "(", "memory_subview_item", "*", ")", "auto_alloc_array_clear", "(", "machine", ",", "UINT8", ",", "sizeof", "(", "*", "subview", ")", "+", "astring_len", "(", "tempstring", ")", ")", ";", "subview", "->", "next", "=", "NULL", ";", "subview", "->", "index", "=", "curindex", "++", ";", "subview", "->", "space", "=", "space", ";", "subview", "->", "endianness", "=", "space", "->", "endianness", ";", "subview", "->", "prefsize", "=", "space", "->", "dbits", "/", "8", ";", "strcpy", "(", "subview", "->", "name", ",", "astring_c", "(", "tempstring", ")", ")", ";", "*", "tailptr", "=", "subview", ";", "tailptr", "=", "&", "subview", "->", "next", ";", "}", "}", "for", "(", "rgntag", "=", "memory_region_next", "(", "machine", ",", "NULL", ")", ";", "rgntag", "!=", "NULL", ";", "rgntag", "=", "memory_region_next", "(", "machine", ",", "rgntag", ")", ")", "{", "UINT32", "length", "=", "memory_region_length", "(", "machine", ",", "rgntag", ")", ";", "UINT32", "flags", "=", "memory_region_flags", "(", "machine", ",", "rgntag", ")", ";", "if", "(", "length", ">", "0", "&&", "(", "flags", "&", "ROMREGION_DATATYPEMASK", ")", "==", "ROMREGION_DATATYPEROM", ")", "{", "UINT8", "little_endian", "=", "(", "(", "flags", "&", "ROMREGION_ENDIANMASK", ")", "==", "ROMREGION_LE", ")", ";", "UINT8", "width", "=", "1", "<<", "(", "(", "flags", "&", "ROMREGION_WIDTHMASK", ")", ">>", "8", ")", ";", "memory_subview_item", "*", "subview", ";", "astring_printf", "(", "tempstring", ",", "\"", "\"", ",", "rgntag", ")", ";", "subview", "=", "(", "memory_subview_item", "*", ")", "auto_alloc_array_clear", "(", "machine", ",", "UINT8", ",", "sizeof", "(", "*", "subview", ")", "+", "astring_len", "(", "tempstring", ")", ")", ";", "subview", "->", "next", "=", "NULL", ";", "subview", "->", "index", "=", "curindex", "++", ";", "subview", "->", "base", "=", "memory_region", "(", "machine", ",", "rgntag", ")", ";", "subview", "->", "length", "=", "memory_region_length", "(", "machine", ",", "rgntag", ")", ";", "subview", "->", "offsetxor", "=", "NATIVE_ENDIAN_VALUE_LE_BE", "(", "width", "-", "1", ",", "0", ")", ";", "subview", "->", "endianness", "=", "little_endian", "?", "ENDIANNESS_LITTLE", ":", "ENDIANNESS_BIG", ";", "subview", "->", "prefsize", "=", "MIN", "(", "width", ",", "8", ")", ";", "strcpy", "(", "subview", "->", "name", ",", "astring_c", "(", "tempstring", ")", ")", ";", "*", "tailptr", "=", "subview", ";", "tailptr", "=", "&", "subview", "->", "next", ";", "}", "}", "for", "(", "itemnum", "=", "0", ";", "itemnum", "<", "10000", ";", "itemnum", "++", ")", "{", "UINT32", "valsize", ",", "valcount", ";", "const", "char", "*", "name", ";", "void", "*", "base", ";", "name", "=", "state_save_get_indexed_item", "(", "machine", ",", "itemnum", ",", "&", "base", ",", "&", "valsize", ",", "&", "valcount", ")", ";", "if", "(", "name", "==", "NULL", ")", "break", ";", "if", "(", "valcount", ">", "1", "&&", "strstr", "(", "name", ",", "\"", "\"", ")", ")", "{", "memory_subview_item", "*", "subview", ";", "astring_printf", "(", "tempstring", ",", "\"", "\"", ",", "strrchr", "(", "name", ",", "'", "'", ")", "+", "1", ")", ";", "subview", "=", "(", "memory_subview_item", "*", ")", "auto_alloc_array_clear", "(", "machine", ",", "UINT8", ",", "sizeof", "(", "*", "subview", ")", "+", "astring_len", "(", "tempstring", ")", ")", ";", "subview", "->", "next", "=", "NULL", ";", "subview", "->", "index", "=", "curindex", "++", ";", "subview", "->", "base", "=", "base", ";", "subview", "->", "length", "=", "valcount", "*", "valsize", ";", "subview", "->", "offsetxor", "=", "0", ";", "subview", "->", "endianness", "=", "ENDIANNESS_NATIVE", ";", "subview", "->", "prefsize", "=", "MIN", "(", "valsize", ",", "8", ")", ";", "strcpy", "(", "subview", "->", "name", ",", "astring_c", "(", "tempstring", ")", ")", ";", "*", "tailptr", "=", "subview", ";", "tailptr", "=", "&", "subview", "->", "next", ";", "}", "}", "astring_free", "(", "tempstring", ")", ";", "return", "head", ";", "}" ]
memory_view_enumerate_subviews - enumerate all possible subviews for a memory view
[ "memory_view_enumerate_subviews", "-", "enumerate", "all", "possible", "subviews", "for", "a", "memory", "view" ]
[ "/* first add all the device's address spaces */", "/* determine the string and allocate a subview large enough */", "/* populate the subview */", "/* add to the list */", "/* then add all the memory regions */", "/* determine the string and allocate a subview large enough */", "/* populate the subview */", "/* add to the list */", "/* finally add all global array symbols */", "/* stop when we run out of items */", "/* if this is a single-entry global, add it */", "/* determine the string and allocate a subview large enough */", "/* populate the subview */", "/* add to the list */", "/* free the temporary string */" ]
[ { "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": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_alloc
int
static int memory_view_alloc(debug_view *view) { debug_view_memory *memdata; /* fail if no available subviews */ if (view->machine->debugvw_data->memory_subviews == NULL) return FALSE; /* allocate memory */ memdata = (debug_view_memory *)malloc(sizeof(*memdata)); if (memdata == NULL) return FALSE; memset(memdata, 0, sizeof(*memdata)); /* allocate the expression data */ debug_view_expression_alloc(&memdata->expression); /* stash the extra data pointer */ view->extra_data = memdata; /* we support cursors */ view->supports_cursor = TRUE; /* default to the first subview */ memdata->desc = view->machine->debugvw_data->memory_subviews; /* start out with 16 bytes in a single column and ASCII displayed */ memdata->bytes_per_chunk = memdata->desc->prefsize; memdata->chunks_per_row = 16 / memdata->desc->prefsize; memdata->bytes_per_row = memdata->bytes_per_chunk * memdata->chunks_per_row; memdata->ascii_view = TRUE; return TRUE; }
/*------------------------------------------------- memory_view_alloc - allocate memory for the memory view -------------------------------------------------*/
allocate memory for the memory view
[ "allocate", "memory", "for", "the", "memory", "view" ]
static int memory_view_alloc(debug_view *view) { debug_view_memory *memdata; if (view->machine->debugvw_data->memory_subviews == NULL) return FALSE; memdata = (debug_view_memory *)malloc(sizeof(*memdata)); if (memdata == NULL) return FALSE; memset(memdata, 0, sizeof(*memdata)); debug_view_expression_alloc(&memdata->expression); view->extra_data = memdata; view->supports_cursor = TRUE; memdata->desc = view->machine->debugvw_data->memory_subviews; memdata->bytes_per_chunk = memdata->desc->prefsize; memdata->chunks_per_row = 16 / memdata->desc->prefsize; memdata->bytes_per_row = memdata->bytes_per_chunk * memdata->chunks_per_row; memdata->ascii_view = TRUE; return TRUE; }
[ "static", "int", "memory_view_alloc", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", ";", "if", "(", "view", "->", "machine", "->", "debugvw_data", "->", "memory_subviews", "==", "NULL", ")", "return", "FALSE", ";", "memdata", "=", "(", "debug_view_memory", "*", ")", "malloc", "(", "sizeof", "(", "*", "memdata", ")", ")", ";", "if", "(", "memdata", "==", "NULL", ")", "return", "FALSE", ";", "memset", "(", "memdata", ",", "0", ",", "sizeof", "(", "*", "memdata", ")", ")", ";", "debug_view_expression_alloc", "(", "&", "memdata", "->", "expression", ")", ";", "view", "->", "extra_data", "=", "memdata", ";", "view", "->", "supports_cursor", "=", "TRUE", ";", "memdata", "->", "desc", "=", "view", "->", "machine", "->", "debugvw_data", "->", "memory_subviews", ";", "memdata", "->", "bytes_per_chunk", "=", "memdata", "->", "desc", "->", "prefsize", ";", "memdata", "->", "chunks_per_row", "=", "16", "/", "memdata", "->", "desc", "->", "prefsize", ";", "memdata", "->", "bytes_per_row", "=", "memdata", "->", "bytes_per_chunk", "*", "memdata", "->", "chunks_per_row", ";", "memdata", "->", "ascii_view", "=", "TRUE", ";", "return", "TRUE", ";", "}" ]
memory_view_alloc - allocate memory for the memory view
[ "memory_view_alloc", "-", "allocate", "memory", "for", "the", "memory", "view" ]
[ "/* fail if no available subviews */", "/* allocate memory */", "/* allocate the expression data */", "/* stash the extra data pointer */", "/* we support cursors */", "/* default to the first subview */", "/* start out with 16 bytes in a single column and ASCII displayed */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_free
void
static void memory_view_free(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; /* free any memory we allocated */ if (memdata != NULL) { debug_view_expression_free(&memdata->expression); free(memdata); } view->extra_data = NULL; }
/*------------------------------------------------- memory_view_free - free memory for the memory view -------------------------------------------------*/
free memory for the memory view
[ "free", "memory", "for", "the", "memory", "view" ]
static void memory_view_free(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; if (memdata != NULL) { debug_view_expression_free(&memdata->expression); free(memdata); } view->extra_data = NULL; }
[ "static", "void", "memory_view_free", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "if", "(", "memdata", "!=", "NULL", ")", "{", "debug_view_expression_free", "(", "&", "memdata", "->", "expression", ")", ";", "free", "(", "memdata", ")", ";", "}", "view", "->", "extra_data", "=", "NULL", ";", "}" ]
memory_view_free - free memory for the memory view
[ "memory_view_free", "-", "free", "memory", "for", "the", "memory", "view" ]
[ "/* free any memory we allocated */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_notify
void
static void memory_view_notify(debug_view *view, view_notification type) { if (type == VIEW_NOTIFY_CURSOR_CHANGED) { offs_t address; UINT8 shift; /* normalize the cursor */ memory_view_get_cursor_pos(view, &address, &shift); memory_view_set_cursor_pos(view, address, shift); } }
/*------------------------------------------------- memory_view_notify - handle notification of updates to cursor changes -------------------------------------------------*/
handle notification of updates to cursor changes
[ "handle", "notification", "of", "updates", "to", "cursor", "changes" ]
static void memory_view_notify(debug_view *view, view_notification type) { if (type == VIEW_NOTIFY_CURSOR_CHANGED) { offs_t address; UINT8 shift; memory_view_get_cursor_pos(view, &address, &shift); memory_view_set_cursor_pos(view, address, shift); } }
[ "static", "void", "memory_view_notify", "(", "debug_view", "*", "view", ",", "view_notification", "type", ")", "{", "if", "(", "type", "==", "VIEW_NOTIFY_CURSOR_CHANGED", ")", "{", "offs_t", "address", ";", "UINT8", "shift", ";", "memory_view_get_cursor_pos", "(", "view", ",", "&", "address", ",", "&", "shift", ")", ";", "memory_view_set_cursor_pos", "(", "view", ",", "address", ",", "shift", ")", ";", "}", "}" ]
memory_view_notify - handle notification of updates to cursor changes
[ "memory_view_notify", "-", "handle", "notification", "of", "updates", "to", "cursor", "changes" ]
[ "/* normalize the cursor */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "type", "type": "view_notification" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "view_notification", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_update
void
static void memory_view_update(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const address_space *space = memdata->desc->space; const memory_view_pos *posdata; UINT32 row; /* if we need to recompute, do it now */ if (memory_view_needs_recompute(view)) memory_view_recompute(view); /* get positional data */ posdata = &memory_pos_table[memdata->bytes_per_chunk]; /* loop over visible rows */ for (row = 0; row < view->visible.y; row++) { debug_view_char *destmin = view->viewdata + row * view->visible.x; debug_view_char *destmax = destmin + view->visible.x; debug_view_char *destrow = destmin - view->topleft.x; UINT32 effrow = view->topleft.y + row; debug_view_char *dest; int ch, chunknum; /* reset the line of data; section 1 is normal, others are ancillary, cursor is selected */ dest = destmin; for (ch = 0; ch < view->visible.x; ch++, dest++) { UINT32 effcol = view->topleft.x + ch; dest->byte = ' '; dest->attrib = DCA_ANCILLARY; if (in_section(effcol, &memdata->section[1])) { dest->attrib = DCA_NORMAL; if (view->cursor_visible && effrow == view->cursor.y && effcol == view->cursor.x) dest->attrib |= DCA_SELECTED; } } /* if this visible row is valid, add it to the buffer */ if (effrow < view->total.y) { offs_t addrbyte = memdata->byte_offset + effrow * memdata->bytes_per_row; offs_t address = (space != NULL) ? memory_byte_to_address(space, addrbyte) : addrbyte; char addrtext[20]; /* generate the address */ sprintf(addrtext, memdata->addrformat, address); dest = destrow + memdata->section[0].pos + 1; for (ch = 0; addrtext[ch] != 0 && ch < memdata->section[0].width - 1; ch++, dest++) if (dest >= destmin && dest < destmax) dest->byte = addrtext[ch]; /* generate the data */ for (chunknum = 0; chunknum < memdata->chunks_per_row; chunknum++) { int chunkindex = memdata->reverse_view ? (memdata->chunks_per_row - 1 - chunknum) : chunknum; UINT64 chunkdata; int ismapped; ismapped = memory_view_read(memdata, memdata->bytes_per_chunk, addrbyte + chunknum * memdata->bytes_per_chunk, &chunkdata); dest = destrow + memdata->section[1].pos + 1 + chunkindex * posdata->spacing; for (ch = 0; ch < posdata->spacing; ch++, dest++) if (dest >= destmin && dest < destmax) { UINT8 shift = posdata->shift[ch]; if (shift < 64) dest->byte = ismapped ? "0123456789ABCDEF"[(chunkdata >> shift) & 0x0f] : '*'; } } /* generate the ASCII data */ if (memdata->section[2].width > 0) { dest = destrow + memdata->section[2].pos + 1; for (ch = 0; ch < memdata->bytes_per_row; ch++, dest++) if (dest >= destmin && dest < destmax) { int ismapped; UINT64 chval; ismapped = memory_view_read(memdata, 1, addrbyte + ch, &chval); dest->byte = (ismapped && isprint(chval)) ? chval : '.'; } } } } }
/*------------------------------------------------- memory_view_update - update the contents of the memory view -------------------------------------------------*/
update the contents of the memory view
[ "update", "the", "contents", "of", "the", "memory", "view" ]
static void memory_view_update(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const address_space *space = memdata->desc->space; const memory_view_pos *posdata; UINT32 row; if (memory_view_needs_recompute(view)) memory_view_recompute(view); posdata = &memory_pos_table[memdata->bytes_per_chunk]; for (row = 0; row < view->visible.y; row++) { debug_view_char *destmin = view->viewdata + row * view->visible.x; debug_view_char *destmax = destmin + view->visible.x; debug_view_char *destrow = destmin - view->topleft.x; UINT32 effrow = view->topleft.y + row; debug_view_char *dest; int ch, chunknum; dest = destmin; for (ch = 0; ch < view->visible.x; ch++, dest++) { UINT32 effcol = view->topleft.x + ch; dest->byte = ' '; dest->attrib = DCA_ANCILLARY; if (in_section(effcol, &memdata->section[1])) { dest->attrib = DCA_NORMAL; if (view->cursor_visible && effrow == view->cursor.y && effcol == view->cursor.x) dest->attrib |= DCA_SELECTED; } } if (effrow < view->total.y) { offs_t addrbyte = memdata->byte_offset + effrow * memdata->bytes_per_row; offs_t address = (space != NULL) ? memory_byte_to_address(space, addrbyte) : addrbyte; char addrtext[20]; sprintf(addrtext, memdata->addrformat, address); dest = destrow + memdata->section[0].pos + 1; for (ch = 0; addrtext[ch] != 0 && ch < memdata->section[0].width - 1; ch++, dest++) if (dest >= destmin && dest < destmax) dest->byte = addrtext[ch]; for (chunknum = 0; chunknum < memdata->chunks_per_row; chunknum++) { int chunkindex = memdata->reverse_view ? (memdata->chunks_per_row - 1 - chunknum) : chunknum; UINT64 chunkdata; int ismapped; ismapped = memory_view_read(memdata, memdata->bytes_per_chunk, addrbyte + chunknum * memdata->bytes_per_chunk, &chunkdata); dest = destrow + memdata->section[1].pos + 1 + chunkindex * posdata->spacing; for (ch = 0; ch < posdata->spacing; ch++, dest++) if (dest >= destmin && dest < destmax) { UINT8 shift = posdata->shift[ch]; if (shift < 64) dest->byte = ismapped ? "0123456789ABCDEF"[(chunkdata >> shift) & 0x0f] : '*'; } } if (memdata->section[2].width > 0) { dest = destrow + memdata->section[2].pos + 1; for (ch = 0; ch < memdata->bytes_per_row; ch++, dest++) if (dest >= destmin && dest < destmax) { int ismapped; UINT64 chval; ismapped = memory_view_read(memdata, 1, addrbyte + ch, &chval); dest->byte = (ismapped && isprint(chval)) ? chval : '.'; } } } } }
[ "static", "void", "memory_view_update", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "const", "address_space", "*", "space", "=", "memdata", "->", "desc", "->", "space", ";", "const", "memory_view_pos", "*", "posdata", ";", "UINT32", "row", ";", "if", "(", "memory_view_needs_recompute", "(", "view", ")", ")", "memory_view_recompute", "(", "view", ")", ";", "posdata", "=", "&", "memory_pos_table", "[", "memdata", "->", "bytes_per_chunk", "]", ";", "for", "(", "row", "=", "0", ";", "row", "<", "view", "->", "visible", ".", "y", ";", "row", "++", ")", "{", "debug_view_char", "*", "destmin", "=", "view", "->", "viewdata", "+", "row", "*", "view", "->", "visible", ".", "x", ";", "debug_view_char", "*", "destmax", "=", "destmin", "+", "view", "->", "visible", ".", "x", ";", "debug_view_char", "*", "destrow", "=", "destmin", "-", "view", "->", "topleft", ".", "x", ";", "UINT32", "effrow", "=", "view", "->", "topleft", ".", "y", "+", "row", ";", "debug_view_char", "*", "dest", ";", "int", "ch", ",", "chunknum", ";", "dest", "=", "destmin", ";", "for", "(", "ch", "=", "0", ";", "ch", "<", "view", "->", "visible", ".", "x", ";", "ch", "++", ",", "dest", "++", ")", "{", "UINT32", "effcol", "=", "view", "->", "topleft", ".", "x", "+", "ch", ";", "dest", "->", "byte", "=", "'", "'", ";", "dest", "->", "attrib", "=", "DCA_ANCILLARY", ";", "if", "(", "in_section", "(", "effcol", ",", "&", "memdata", "->", "section", "[", "1", "]", ")", ")", "{", "dest", "->", "attrib", "=", "DCA_NORMAL", ";", "if", "(", "view", "->", "cursor_visible", "&&", "effrow", "==", "view", "->", "cursor", ".", "y", "&&", "effcol", "==", "view", "->", "cursor", ".", "x", ")", "dest", "->", "attrib", "|=", "DCA_SELECTED", ";", "}", "}", "if", "(", "effrow", "<", "view", "->", "total", ".", "y", ")", "{", "offs_t", "addrbyte", "=", "memdata", "->", "byte_offset", "+", "effrow", "*", "memdata", "->", "bytes_per_row", ";", "offs_t", "address", "=", "(", "space", "!=", "NULL", ")", "?", "memory_byte_to_address", "(", "space", ",", "addrbyte", ")", ":", "addrbyte", ";", "char", "addrtext", "[", "20", "]", ";", "sprintf", "(", "addrtext", ",", "memdata", "->", "addrformat", ",", "address", ")", ";", "dest", "=", "destrow", "+", "memdata", "->", "section", "[", "0", "]", ".", "pos", "+", "1", ";", "for", "(", "ch", "=", "0", ";", "addrtext", "[", "ch", "]", "!=", "0", "&&", "ch", "<", "memdata", "->", "section", "[", "0", "]", ".", "width", "-", "1", ";", "ch", "++", ",", "dest", "++", ")", "if", "(", "dest", ">=", "destmin", "&&", "dest", "<", "destmax", ")", "dest", "->", "byte", "=", "addrtext", "[", "ch", "]", ";", "for", "(", "chunknum", "=", "0", ";", "chunknum", "<", "memdata", "->", "chunks_per_row", ";", "chunknum", "++", ")", "{", "int", "chunkindex", "=", "memdata", "->", "reverse_view", "?", "(", "memdata", "->", "chunks_per_row", "-", "1", "-", "chunknum", ")", ":", "chunknum", ";", "UINT64", "chunkdata", ";", "int", "ismapped", ";", "ismapped", "=", "memory_view_read", "(", "memdata", ",", "memdata", "->", "bytes_per_chunk", ",", "addrbyte", "+", "chunknum", "*", "memdata", "->", "bytes_per_chunk", ",", "&", "chunkdata", ")", ";", "dest", "=", "destrow", "+", "memdata", "->", "section", "[", "1", "]", ".", "pos", "+", "1", "+", "chunkindex", "*", "posdata", "->", "spacing", ";", "for", "(", "ch", "=", "0", ";", "ch", "<", "posdata", "->", "spacing", ";", "ch", "++", ",", "dest", "++", ")", "if", "(", "dest", ">=", "destmin", "&&", "dest", "<", "destmax", ")", "{", "UINT8", "shift", "=", "posdata", "->", "shift", "[", "ch", "]", ";", "if", "(", "shift", "<", "64", ")", "dest", "->", "byte", "=", "ismapped", "?", "\"", "\"", "[", "(", "chunkdata", ">>", "shift", ")", "&", "0x0f", "]", ":", "'", "'", ";", "}", "}", "if", "(", "memdata", "->", "section", "[", "2", "]", ".", "width", ">", "0", ")", "{", "dest", "=", "destrow", "+", "memdata", "->", "section", "[", "2", "]", ".", "pos", "+", "1", ";", "for", "(", "ch", "=", "0", ";", "ch", "<", "memdata", "->", "bytes_per_row", ";", "ch", "++", ",", "dest", "++", ")", "if", "(", "dest", ">=", "destmin", "&&", "dest", "<", "destmax", ")", "{", "int", "ismapped", ";", "UINT64", "chval", ";", "ismapped", "=", "memory_view_read", "(", "memdata", ",", "1", ",", "addrbyte", "+", "ch", ",", "&", "chval", ")", ";", "dest", "->", "byte", "=", "(", "ismapped", "&&", "isprint", "(", "chval", ")", ")", "?", "chval", ":", "'", "'", ";", "}", "}", "}", "}", "}" ]
memory_view_update - update the contents of the memory view
[ "memory_view_update", "-", "update", "the", "contents", "of", "the", "memory", "view" ]
[ "/* if we need to recompute, do it now */", "/* get positional data */", "/* loop over visible rows */", "/* reset the line of data; section 1 is normal, others are ancillary, cursor is selected */", "/* if this visible row is valid, add it to the buffer */", "/* generate the address */", "/* generate the data */", "/* generate the ASCII data */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_char
void
static void memory_view_char(debug_view *view, int chval) { static const char hexvals[] = "0123456789abcdef"; debug_view_memory *memdata = (debug_view_memory *)view->extra_data; offs_t address; char *hexchar; int ismapped; UINT64 data; UINT32 delta; UINT8 shift; /* get the position */ memory_view_get_cursor_pos(view, &address, &shift); /* handle the incoming key */ switch (chval) { case DCH_UP: if (address >= memdata->byte_offset + memdata->bytes_per_row) address -= memdata->bytes_per_row; break; case DCH_DOWN: if (address <= memdata->maxaddr - memdata->bytes_per_row) address += memdata->bytes_per_row; break; case DCH_PUP: for (delta = (view->visible.y - 2) * memdata->bytes_per_row; delta > 0; delta -= memdata->bytes_per_row) if (address >= memdata->byte_offset + delta) { address -= delta; break; } break; case DCH_PDOWN: for (delta = (view->visible.y - 2) * memdata->bytes_per_row; delta > 0; delta -= memdata->bytes_per_row) if (address <= memdata->maxaddr - delta) { address += delta; break; } break; case DCH_HOME: address -= address % memdata->bytes_per_row; shift = (memdata->bytes_per_chunk * 8) - 4; break; case DCH_CTRLHOME: address = memdata->byte_offset; shift = (memdata->bytes_per_chunk * 8) - 4; break; case DCH_END: address += (memdata->bytes_per_row - (address % memdata->bytes_per_row) - 1); shift = 0; break; case DCH_CTRLEND: address = memdata->maxaddr; shift = 0; break; case DCH_CTRLLEFT: if (address >= memdata->byte_offset + memdata->bytes_per_chunk) address -= memdata->bytes_per_chunk; break; case DCH_CTRLRIGHT: if (address <= memdata->maxaddr - memdata->bytes_per_chunk) address += memdata->bytes_per_chunk; break; default: hexchar = (char *)strchr(hexvals, tolower(chval)); if (hexchar == NULL) break; ismapped = memory_view_read(memdata, memdata->bytes_per_chunk, address, &data); if (!ismapped) break; data &= ~((UINT64)0x0f << shift); data |= (UINT64)(hexchar - hexvals) << shift; memory_view_write(memdata, memdata->bytes_per_chunk, address, data); /* fall through... */ case DCH_RIGHT: if (shift == 0 && address != memdata->maxaddr) { shift = memdata->bytes_per_chunk * 8 - 4; address += memdata->bytes_per_chunk; } else shift -= 4; break; case DCH_LEFT: if (shift == memdata->bytes_per_chunk * 8 - 4 && address != memdata->byte_offset) { shift = 0; address -= memdata->bytes_per_chunk; } else shift += 4; break; } /* set a new position */ debug_view_begin_update(view); memory_view_set_cursor_pos(view, address, shift); view->update_pending = TRUE; debug_view_end_update(view); }
/*------------------------------------------------- memory_view_char - handle a character typed within the current view -------------------------------------------------*/
handle a character typed within the current view
[ "handle", "a", "character", "typed", "within", "the", "current", "view" ]
static void memory_view_char(debug_view *view, int chval) { static const char hexvals[] = "0123456789abcdef"; debug_view_memory *memdata = (debug_view_memory *)view->extra_data; offs_t address; char *hexchar; int ismapped; UINT64 data; UINT32 delta; UINT8 shift; memory_view_get_cursor_pos(view, &address, &shift); switch (chval) { case DCH_UP: if (address >= memdata->byte_offset + memdata->bytes_per_row) address -= memdata->bytes_per_row; break; case DCH_DOWN: if (address <= memdata->maxaddr - memdata->bytes_per_row) address += memdata->bytes_per_row; break; case DCH_PUP: for (delta = (view->visible.y - 2) * memdata->bytes_per_row; delta > 0; delta -= memdata->bytes_per_row) if (address >= memdata->byte_offset + delta) { address -= delta; break; } break; case DCH_PDOWN: for (delta = (view->visible.y - 2) * memdata->bytes_per_row; delta > 0; delta -= memdata->bytes_per_row) if (address <= memdata->maxaddr - delta) { address += delta; break; } break; case DCH_HOME: address -= address % memdata->bytes_per_row; shift = (memdata->bytes_per_chunk * 8) - 4; break; case DCH_CTRLHOME: address = memdata->byte_offset; shift = (memdata->bytes_per_chunk * 8) - 4; break; case DCH_END: address += (memdata->bytes_per_row - (address % memdata->bytes_per_row) - 1); shift = 0; break; case DCH_CTRLEND: address = memdata->maxaddr; shift = 0; break; case DCH_CTRLLEFT: if (address >= memdata->byte_offset + memdata->bytes_per_chunk) address -= memdata->bytes_per_chunk; break; case DCH_CTRLRIGHT: if (address <= memdata->maxaddr - memdata->bytes_per_chunk) address += memdata->bytes_per_chunk; break; default: hexchar = (char *)strchr(hexvals, tolower(chval)); if (hexchar == NULL) break; ismapped = memory_view_read(memdata, memdata->bytes_per_chunk, address, &data); if (!ismapped) break; data &= ~((UINT64)0x0f << shift); data |= (UINT64)(hexchar - hexvals) << shift; memory_view_write(memdata, memdata->bytes_per_chunk, address, data); case DCH_RIGHT: if (shift == 0 && address != memdata->maxaddr) { shift = memdata->bytes_per_chunk * 8 - 4; address += memdata->bytes_per_chunk; } else shift -= 4; break; case DCH_LEFT: if (shift == memdata->bytes_per_chunk * 8 - 4 && address != memdata->byte_offset) { shift = 0; address -= memdata->bytes_per_chunk; } else shift += 4; break; } debug_view_begin_update(view); memory_view_set_cursor_pos(view, address, shift); view->update_pending = TRUE; debug_view_end_update(view); }
[ "static", "void", "memory_view_char", "(", "debug_view", "*", "view", ",", "int", "chval", ")", "{", "static", "const", "char", "hexvals", "[", "]", "=", "\"", "\"", ";", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "offs_t", "address", ";", "char", "*", "hexchar", ";", "int", "ismapped", ";", "UINT64", "data", ";", "UINT32", "delta", ";", "UINT8", "shift", ";", "memory_view_get_cursor_pos", "(", "view", ",", "&", "address", ",", "&", "shift", ")", ";", "switch", "(", "chval", ")", "{", "case", "DCH_UP", ":", "if", "(", "address", ">=", "memdata", "->", "byte_offset", "+", "memdata", "->", "bytes_per_row", ")", "address", "-=", "memdata", "->", "bytes_per_row", ";", "break", ";", "case", "DCH_DOWN", ":", "if", "(", "address", "<=", "memdata", "->", "maxaddr", "-", "memdata", "->", "bytes_per_row", ")", "address", "+=", "memdata", "->", "bytes_per_row", ";", "break", ";", "case", "DCH_PUP", ":", "for", "(", "delta", "=", "(", "view", "->", "visible", ".", "y", "-", "2", ")", "*", "memdata", "->", "bytes_per_row", ";", "delta", ">", "0", ";", "delta", "-=", "memdata", "->", "bytes_per_row", ")", "if", "(", "address", ">=", "memdata", "->", "byte_offset", "+", "delta", ")", "{", "address", "-=", "delta", ";", "break", ";", "}", "break", ";", "case", "DCH_PDOWN", ":", "for", "(", "delta", "=", "(", "view", "->", "visible", ".", "y", "-", "2", ")", "*", "memdata", "->", "bytes_per_row", ";", "delta", ">", "0", ";", "delta", "-=", "memdata", "->", "bytes_per_row", ")", "if", "(", "address", "<=", "memdata", "->", "maxaddr", "-", "delta", ")", "{", "address", "+=", "delta", ";", "break", ";", "}", "break", ";", "case", "DCH_HOME", ":", "address", "-=", "address", "%", "memdata", "->", "bytes_per_row", ";", "shift", "=", "(", "memdata", "->", "bytes_per_chunk", "*", "8", ")", "-", "4", ";", "break", ";", "case", "DCH_CTRLHOME", ":", "address", "=", "memdata", "->", "byte_offset", ";", "shift", "=", "(", "memdata", "->", "bytes_per_chunk", "*", "8", ")", "-", "4", ";", "break", ";", "case", "DCH_END", ":", "address", "+=", "(", "memdata", "->", "bytes_per_row", "-", "(", "address", "%", "memdata", "->", "bytes_per_row", ")", "-", "1", ")", ";", "shift", "=", "0", ";", "break", ";", "case", "DCH_CTRLEND", ":", "address", "=", "memdata", "->", "maxaddr", ";", "shift", "=", "0", ";", "break", ";", "case", "DCH_CTRLLEFT", ":", "if", "(", "address", ">=", "memdata", "->", "byte_offset", "+", "memdata", "->", "bytes_per_chunk", ")", "address", "-=", "memdata", "->", "bytes_per_chunk", ";", "break", ";", "case", "DCH_CTRLRIGHT", ":", "if", "(", "address", "<=", "memdata", "->", "maxaddr", "-", "memdata", "->", "bytes_per_chunk", ")", "address", "+=", "memdata", "->", "bytes_per_chunk", ";", "break", ";", "default", ":", "hexchar", "=", "(", "char", "*", ")", "strchr", "(", "hexvals", ",", "tolower", "(", "chval", ")", ")", ";", "if", "(", "hexchar", "==", "NULL", ")", "break", ";", "ismapped", "=", "memory_view_read", "(", "memdata", ",", "memdata", "->", "bytes_per_chunk", ",", "address", ",", "&", "data", ")", ";", "if", "(", "!", "ismapped", ")", "break", ";", "data", "&=", "~", "(", "(", "UINT64", ")", "0x0f", "<<", "shift", ")", ";", "data", "|=", "(", "UINT64", ")", "(", "hexchar", "-", "hexvals", ")", "<<", "shift", ";", "memory_view_write", "(", "memdata", ",", "memdata", "->", "bytes_per_chunk", ",", "address", ",", "data", ")", ";", "case", "DCH_RIGHT", ":", "if", "(", "shift", "==", "0", "&&", "address", "!=", "memdata", "->", "maxaddr", ")", "{", "shift", "=", "memdata", "->", "bytes_per_chunk", "*", "8", "-", "4", ";", "address", "+=", "memdata", "->", "bytes_per_chunk", ";", "}", "else", "shift", "-=", "4", ";", "break", ";", "case", "DCH_LEFT", ":", "if", "(", "shift", "==", "memdata", "->", "bytes_per_chunk", "*", "8", "-", "4", "&&", "address", "!=", "memdata", "->", "byte_offset", ")", "{", "shift", "=", "0", ";", "address", "-=", "memdata", "->", "bytes_per_chunk", ";", "}", "else", "shift", "+=", "4", ";", "break", ";", "}", "debug_view_begin_update", "(", "view", ")", ";", "memory_view_set_cursor_pos", "(", "view", ",", "address", ",", "shift", ")", ";", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}" ]
memory_view_char - handle a character typed within the current view
[ "memory_view_char", "-", "handle", "a", "character", "typed", "within", "the", "current", "view" ]
[ "/* get the position */", "/* handle the incoming key */", "/* fall through... */", "/* set a new position */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "chval", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "chval", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_recompute
void
static void memory_view_recompute(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const address_space *space = memdata->desc->space; offs_t cursoraddr; UINT8 cursorshift; int addrchars; /* get the current cursor position */ memory_view_get_cursor_pos(view, &cursoraddr, &cursorshift); /* determine the maximum address and address format string from the raw information */ if (space != NULL) { memdata->maxaddr = memdata->no_translation ? space->bytemask : space->logbytemask; addrchars = memdata->no_translation ? space->addrchars : space->logaddrchars; } else { memdata->maxaddr = memdata->desc->length - 1; addrchars = sprintf(memdata->addrformat, "%X", memdata->maxaddr); } /* generate an 8-byte aligned format for the address */ if (!memdata->reverse_view) sprintf(memdata->addrformat, "%*s%%0%dX", 8 - addrchars, "", addrchars); else sprintf(memdata->addrformat, "%%0%dX%*s", addrchars, 8 - addrchars, ""); /* if we are viewing a space with a minimum chunk size, clamp the bytes per chunk */ if (space != NULL && space->ashift < 0) { UINT32 min_bytes_per_chunk = 1 << -space->ashift; while (memdata->bytes_per_chunk < min_bytes_per_chunk) { memdata->bytes_per_chunk *= 2; memdata->chunks_per_row /= 2; } memdata->chunks_per_row = MAX(1, memdata->chunks_per_row); } /* recompute the byte offset based on the most recent expression result */ memdata->bytes_per_row = memdata->bytes_per_chunk * memdata->chunks_per_row; memdata->byte_offset = memdata->expression.result % memdata->bytes_per_row; /* compute the section widths */ memdata->section[0].width = 1 + 8 + 1; memdata->section[1].width = 1 + 3 * memdata->bytes_per_row + 1; memdata->section[2].width = memdata->ascii_view ? (1 + memdata->bytes_per_row + 1) : 0; /* compute the section positions */ if (!memdata->reverse_view) { memdata->section[0].pos = 0; memdata->section[1].pos = memdata->section[0].pos + memdata->section[0].width; memdata->section[2].pos = memdata->section[1].pos + memdata->section[1].width; view->total.x = memdata->section[2].pos + memdata->section[2].width; } else { memdata->section[2].pos = 0; memdata->section[1].pos = memdata->section[2].pos + memdata->section[2].width; memdata->section[0].pos = memdata->section[1].pos + memdata->section[1].width; view->total.x = memdata->section[0].pos + memdata->section[0].width; } /* derive total sizes from that */ view->total.y = ((UINT64)memdata->maxaddr - (UINT64)memdata->byte_offset + (UINT64)memdata->bytes_per_row - 1) / memdata->bytes_per_row; /* reset the current cursor position */ memory_view_set_cursor_pos(view, cursoraddr, cursorshift); }
/*------------------------------------------------- memory_view_recompute - recompute the internal data and structure of the memory view -------------------------------------------------*/
recompute the internal data and structure of the memory view
[ "recompute", "the", "internal", "data", "and", "structure", "of", "the", "memory", "view" ]
static void memory_view_recompute(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const address_space *space = memdata->desc->space; offs_t cursoraddr; UINT8 cursorshift; int addrchars; memory_view_get_cursor_pos(view, &cursoraddr, &cursorshift); if (space != NULL) { memdata->maxaddr = memdata->no_translation ? space->bytemask : space->logbytemask; addrchars = memdata->no_translation ? space->addrchars : space->logaddrchars; } else { memdata->maxaddr = memdata->desc->length - 1; addrchars = sprintf(memdata->addrformat, "%X", memdata->maxaddr); } if (!memdata->reverse_view) sprintf(memdata->addrformat, "%*s%%0%dX", 8 - addrchars, "", addrchars); else sprintf(memdata->addrformat, "%%0%dX%*s", addrchars, 8 - addrchars, ""); if (space != NULL && space->ashift < 0) { UINT32 min_bytes_per_chunk = 1 << -space->ashift; while (memdata->bytes_per_chunk < min_bytes_per_chunk) { memdata->bytes_per_chunk *= 2; memdata->chunks_per_row /= 2; } memdata->chunks_per_row = MAX(1, memdata->chunks_per_row); } memdata->bytes_per_row = memdata->bytes_per_chunk * memdata->chunks_per_row; memdata->byte_offset = memdata->expression.result % memdata->bytes_per_row; memdata->section[0].width = 1 + 8 + 1; memdata->section[1].width = 1 + 3 * memdata->bytes_per_row + 1; memdata->section[2].width = memdata->ascii_view ? (1 + memdata->bytes_per_row + 1) : 0; if (!memdata->reverse_view) { memdata->section[0].pos = 0; memdata->section[1].pos = memdata->section[0].pos + memdata->section[0].width; memdata->section[2].pos = memdata->section[1].pos + memdata->section[1].width; view->total.x = memdata->section[2].pos + memdata->section[2].width; } else { memdata->section[2].pos = 0; memdata->section[1].pos = memdata->section[2].pos + memdata->section[2].width; memdata->section[0].pos = memdata->section[1].pos + memdata->section[1].width; view->total.x = memdata->section[0].pos + memdata->section[0].width; } view->total.y = ((UINT64)memdata->maxaddr - (UINT64)memdata->byte_offset + (UINT64)memdata->bytes_per_row - 1) / memdata->bytes_per_row; memory_view_set_cursor_pos(view, cursoraddr, cursorshift); }
[ "static", "void", "memory_view_recompute", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "const", "address_space", "*", "space", "=", "memdata", "->", "desc", "->", "space", ";", "offs_t", "cursoraddr", ";", "UINT8", "cursorshift", ";", "int", "addrchars", ";", "memory_view_get_cursor_pos", "(", "view", ",", "&", "cursoraddr", ",", "&", "cursorshift", ")", ";", "if", "(", "space", "!=", "NULL", ")", "{", "memdata", "->", "maxaddr", "=", "memdata", "->", "no_translation", "?", "space", "->", "bytemask", ":", "space", "->", "logbytemask", ";", "addrchars", "=", "memdata", "->", "no_translation", "?", "space", "->", "addrchars", ":", "space", "->", "logaddrchars", ";", "}", "else", "{", "memdata", "->", "maxaddr", "=", "memdata", "->", "desc", "->", "length", "-", "1", ";", "addrchars", "=", "sprintf", "(", "memdata", "->", "addrformat", ",", "\"", "\"", ",", "memdata", "->", "maxaddr", ")", ";", "}", "if", "(", "!", "memdata", "->", "reverse_view", ")", "sprintf", "(", "memdata", "->", "addrformat", ",", "\"", "\"", ",", "8", "-", "addrchars", ",", "\"", "\"", ",", "addrchars", ")", ";", "else", "sprintf", "(", "memdata", "->", "addrformat", ",", "\"", "\"", ",", "addrchars", ",", "8", "-", "addrchars", ",", "\"", "\"", ")", ";", "if", "(", "space", "!=", "NULL", "&&", "space", "->", "ashift", "<", "0", ")", "{", "UINT32", "min_bytes_per_chunk", "=", "1", "<<", "-", "space", "->", "ashift", ";", "while", "(", "memdata", "->", "bytes_per_chunk", "<", "min_bytes_per_chunk", ")", "{", "memdata", "->", "bytes_per_chunk", "*=", "2", ";", "memdata", "->", "chunks_per_row", "/=", "2", ";", "}", "memdata", "->", "chunks_per_row", "=", "MAX", "(", "1", ",", "memdata", "->", "chunks_per_row", ")", ";", "}", "memdata", "->", "bytes_per_row", "=", "memdata", "->", "bytes_per_chunk", "*", "memdata", "->", "chunks_per_row", ";", "memdata", "->", "byte_offset", "=", "memdata", "->", "expression", ".", "result", "%", "memdata", "->", "bytes_per_row", ";", "memdata", "->", "section", "[", "0", "]", ".", "width", "=", "1", "+", "8", "+", "1", ";", "memdata", "->", "section", "[", "1", "]", ".", "width", "=", "1", "+", "3", "*", "memdata", "->", "bytes_per_row", "+", "1", ";", "memdata", "->", "section", "[", "2", "]", ".", "width", "=", "memdata", "->", "ascii_view", "?", "(", "1", "+", "memdata", "->", "bytes_per_row", "+", "1", ")", ":", "0", ";", "if", "(", "!", "memdata", "->", "reverse_view", ")", "{", "memdata", "->", "section", "[", "0", "]", ".", "pos", "=", "0", ";", "memdata", "->", "section", "[", "1", "]", ".", "pos", "=", "memdata", "->", "section", "[", "0", "]", ".", "pos", "+", "memdata", "->", "section", "[", "0", "]", ".", "width", ";", "memdata", "->", "section", "[", "2", "]", ".", "pos", "=", "memdata", "->", "section", "[", "1", "]", ".", "pos", "+", "memdata", "->", "section", "[", "1", "]", ".", "width", ";", "view", "->", "total", ".", "x", "=", "memdata", "->", "section", "[", "2", "]", ".", "pos", "+", "memdata", "->", "section", "[", "2", "]", ".", "width", ";", "}", "else", "{", "memdata", "->", "section", "[", "2", "]", ".", "pos", "=", "0", ";", "memdata", "->", "section", "[", "1", "]", ".", "pos", "=", "memdata", "->", "section", "[", "2", "]", ".", "pos", "+", "memdata", "->", "section", "[", "2", "]", ".", "width", ";", "memdata", "->", "section", "[", "0", "]", ".", "pos", "=", "memdata", "->", "section", "[", "1", "]", ".", "pos", "+", "memdata", "->", "section", "[", "1", "]", ".", "width", ";", "view", "->", "total", ".", "x", "=", "memdata", "->", "section", "[", "0", "]", ".", "pos", "+", "memdata", "->", "section", "[", "0", "]", ".", "width", ";", "}", "view", "->", "total", ".", "y", "=", "(", "(", "UINT64", ")", "memdata", "->", "maxaddr", "-", "(", "UINT64", ")", "memdata", "->", "byte_offset", "+", "(", "UINT64", ")", "memdata", "->", "bytes_per_row", "-", "1", ")", "/", "memdata", "->", "bytes_per_row", ";", "memory_view_set_cursor_pos", "(", "view", ",", "cursoraddr", ",", "cursorshift", ")", ";", "}" ]
memory_view_recompute - recompute the internal data and structure of the memory view
[ "memory_view_recompute", "-", "recompute", "the", "internal", "data", "and", "structure", "of", "the", "memory", "view" ]
[ "/* get the current cursor position */", "/* determine the maximum address and address format string from the raw information */", "/* generate an 8-byte aligned format for the address */", "/* if we are viewing a space with a minimum chunk size, clamp the bytes per chunk */", "/* recompute the byte offset based on the most recent expression result */", "/* compute the section widths */", "/* compute the section positions */", "/* derive total sizes from that */", "/* reset the current cursor position */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_needs_recompute
int
static int memory_view_needs_recompute(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const address_space *space = memdata->desc->space; int recompute = view->recompute; /* handle expression changes */ if (debug_view_expression_changed_value(view, &memdata->expression, (space != NULL && space->cpu != NULL && space->cpu->type == CPU) ? space->cpu : NULL)) { recompute = TRUE; view->topleft.y = (memdata->expression.result - memdata->byte_offset) / memdata->bytes_per_row; view->topleft.y = MAX(view->topleft.y, 0); view->topleft.y = MIN(view->topleft.y, view->total.y - 1); memory_view_set_cursor_pos(view, memdata->expression.result, memdata->bytes_per_chunk * 8 - 4); } /* expression is clean at this point, and future recomputation is not necessary */ view->recompute = FALSE; return recompute; }
/*------------------------------------------------- memory_view_needs_recompute - determine if anything has changed that requires a recomputation -------------------------------------------------*/
determine if anything has changed that requires a recomputation
[ "determine", "if", "anything", "has", "changed", "that", "requires", "a", "recomputation" ]
static int memory_view_needs_recompute(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const address_space *space = memdata->desc->space; int recompute = view->recompute; if (debug_view_expression_changed_value(view, &memdata->expression, (space != NULL && space->cpu != NULL && space->cpu->type == CPU) ? space->cpu : NULL)) { recompute = TRUE; view->topleft.y = (memdata->expression.result - memdata->byte_offset) / memdata->bytes_per_row; view->topleft.y = MAX(view->topleft.y, 0); view->topleft.y = MIN(view->topleft.y, view->total.y - 1); memory_view_set_cursor_pos(view, memdata->expression.result, memdata->bytes_per_chunk * 8 - 4); } view->recompute = FALSE; return recompute; }
[ "static", "int", "memory_view_needs_recompute", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "const", "address_space", "*", "space", "=", "memdata", "->", "desc", "->", "space", ";", "int", "recompute", "=", "view", "->", "recompute", ";", "if", "(", "debug_view_expression_changed_value", "(", "view", ",", "&", "memdata", "->", "expression", ",", "(", "space", "!=", "NULL", "&&", "space", "->", "cpu", "!=", "NULL", "&&", "space", "->", "cpu", "->", "type", "==", "CPU", ")", "?", "space", "->", "cpu", ":", "NULL", ")", ")", "{", "recompute", "=", "TRUE", ";", "view", "->", "topleft", ".", "y", "=", "(", "memdata", "->", "expression", ".", "result", "-", "memdata", "->", "byte_offset", ")", "/", "memdata", "->", "bytes_per_row", ";", "view", "->", "topleft", ".", "y", "=", "MAX", "(", "view", "->", "topleft", ".", "y", ",", "0", ")", ";", "view", "->", "topleft", ".", "y", "=", "MIN", "(", "view", "->", "topleft", ".", "y", ",", "view", "->", "total", ".", "y", "-", "1", ")", ";", "memory_view_set_cursor_pos", "(", "view", ",", "memdata", "->", "expression", ".", "result", ",", "memdata", "->", "bytes_per_chunk", "*", "8", "-", "4", ")", ";", "}", "view", "->", "recompute", "=", "FALSE", ";", "return", "recompute", ";", "}" ]
memory_view_needs_recompute - determine if anything has changed that requires a recomputation
[ "memory_view_needs_recompute", "-", "determine", "if", "anything", "has", "changed", "that", "requires", "a", "recomputation" ]
[ "/* handle expression changes */", "/* expression is clean at this point, and future recomputation is not necessary */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_get_cursor_pos
void
static void memory_view_get_cursor_pos(debug_view *view, offs_t *address, UINT8 *shift) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const memory_view_pos *posdata = &memory_pos_table[memdata->bytes_per_chunk]; int xposition, chunknum, chunkoffs; /* start with the base address for this row */ *address = memdata->byte_offset + view->cursor.y * memdata->bytes_per_chunk * memdata->chunks_per_row; /* determine the X position within the middle section, clamping as necessary */ xposition = view->cursor.x - memdata->section[1].pos - 1; if (xposition < 0) xposition = 0; else if (xposition >= posdata->spacing * memdata->chunks_per_row) xposition = posdata->spacing * memdata->chunks_per_row - 1; /* compute chunk number and offset within that chunk */ chunknum = xposition / posdata->spacing; chunkoffs = xposition % posdata->spacing; /* reverse the chunknum if we're reversed */ if (memdata->reverse_view) chunknum = memdata->chunks_per_row - 1 - chunknum; /* compute the address and shift */ *address += chunknum * memdata->bytes_per_chunk; *shift = posdata->shift[chunkoffs] & 0x7f; }
/*------------------------------------------------- memory_view_get_cursor_pos - return the cursor position as an address and a shift value -------------------------------------------------*/
return the cursor position as an address and a shift value
[ "return", "the", "cursor", "position", "as", "an", "address", "and", "a", "shift", "value" ]
static void memory_view_get_cursor_pos(debug_view *view, offs_t *address, UINT8 *shift) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const memory_view_pos *posdata = &memory_pos_table[memdata->bytes_per_chunk]; int xposition, chunknum, chunkoffs; *address = memdata->byte_offset + view->cursor.y * memdata->bytes_per_chunk * memdata->chunks_per_row; xposition = view->cursor.x - memdata->section[1].pos - 1; if (xposition < 0) xposition = 0; else if (xposition >= posdata->spacing * memdata->chunks_per_row) xposition = posdata->spacing * memdata->chunks_per_row - 1; chunknum = xposition / posdata->spacing; chunkoffs = xposition % posdata->spacing; if (memdata->reverse_view) chunknum = memdata->chunks_per_row - 1 - chunknum; *address += chunknum * memdata->bytes_per_chunk; *shift = posdata->shift[chunkoffs] & 0x7f; }
[ "static", "void", "memory_view_get_cursor_pos", "(", "debug_view", "*", "view", ",", "offs_t", "*", "address", ",", "UINT8", "*", "shift", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "const", "memory_view_pos", "*", "posdata", "=", "&", "memory_pos_table", "[", "memdata", "->", "bytes_per_chunk", "]", ";", "int", "xposition", ",", "chunknum", ",", "chunkoffs", ";", "*", "address", "=", "memdata", "->", "byte_offset", "+", "view", "->", "cursor", ".", "y", "*", "memdata", "->", "bytes_per_chunk", "*", "memdata", "->", "chunks_per_row", ";", "xposition", "=", "view", "->", "cursor", ".", "x", "-", "memdata", "->", "section", "[", "1", "]", ".", "pos", "-", "1", ";", "if", "(", "xposition", "<", "0", ")", "xposition", "=", "0", ";", "else", "if", "(", "xposition", ">=", "posdata", "->", "spacing", "*", "memdata", "->", "chunks_per_row", ")", "xposition", "=", "posdata", "->", "spacing", "*", "memdata", "->", "chunks_per_row", "-", "1", ";", "chunknum", "=", "xposition", "/", "posdata", "->", "spacing", ";", "chunkoffs", "=", "xposition", "%", "posdata", "->", "spacing", ";", "if", "(", "memdata", "->", "reverse_view", ")", "chunknum", "=", "memdata", "->", "chunks_per_row", "-", "1", "-", "chunknum", ";", "*", "address", "+=", "chunknum", "*", "memdata", "->", "bytes_per_chunk", ";", "*", "shift", "=", "posdata", "->", "shift", "[", "chunkoffs", "]", "&", "0x7f", ";", "}" ]
memory_view_get_cursor_pos - return the cursor position as an address and a shift value
[ "memory_view_get_cursor_pos", "-", "return", "the", "cursor", "position", "as", "an", "address", "and", "a", "shift", "value" ]
[ "/* start with the base address for this row */", "/* determine the X position within the middle section, clamping as necessary */", "/* compute chunk number and offset within that chunk */", "/* reverse the chunknum if we're reversed */", "/* compute the address and shift */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "address", "type": "offs_t" }, { "param": "shift", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "address", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "shift", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_set_cursor_pos
void
static void memory_view_set_cursor_pos(debug_view *view, offs_t address, UINT8 shift) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const memory_view_pos *posdata = &memory_pos_table[memdata->bytes_per_chunk]; int chunknum; /* offset the address by the byte offset */ if (address < memdata->byte_offset) address = memdata->byte_offset; address -= memdata->byte_offset; /* compute the Y coordinate and chunk index */ view->cursor.y = address / memdata->bytes_per_row; chunknum = (address % memdata->bytes_per_row) / memdata->bytes_per_chunk; /* reverse the chunknum if we're reversed */ if (memdata->reverse_view) chunknum = memdata->chunks_per_row - 1 - chunknum; /* scan within the chunk to find the shift */ for (view->cursor.x = 0; view->cursor.x < posdata->spacing; view->cursor.x++) if (posdata->shift[view->cursor.x] == shift) break; /* add in the chunk offset and shift to the right of divider1 */ view->cursor.x += memdata->section[1].pos + 1 + posdata->spacing * chunknum; /* clamp to the window bounds */ view->cursor.x = MIN(view->cursor.x, view->total.x); view->cursor.y = MIN(view->cursor.y, view->total.y); /* scroll if out of range */ adjust_visible_x_for_cursor(view); adjust_visible_y_for_cursor(view); }
/*------------------------------------------------- memory_view_set_cursor_pos - set the cursor position as a function of an address and a shift value -------------------------------------------------*/
set the cursor position as a function of an address and a shift value
[ "set", "the", "cursor", "position", "as", "a", "function", "of", "an", "address", "and", "a", "shift", "value" ]
static void memory_view_set_cursor_pos(debug_view *view, offs_t address, UINT8 shift) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; const memory_view_pos *posdata = &memory_pos_table[memdata->bytes_per_chunk]; int chunknum; if (address < memdata->byte_offset) address = memdata->byte_offset; address -= memdata->byte_offset; view->cursor.y = address / memdata->bytes_per_row; chunknum = (address % memdata->bytes_per_row) / memdata->bytes_per_chunk; if (memdata->reverse_view) chunknum = memdata->chunks_per_row - 1 - chunknum; for (view->cursor.x = 0; view->cursor.x < posdata->spacing; view->cursor.x++) if (posdata->shift[view->cursor.x] == shift) break; view->cursor.x += memdata->section[1].pos + 1 + posdata->spacing * chunknum; view->cursor.x = MIN(view->cursor.x, view->total.x); view->cursor.y = MIN(view->cursor.y, view->total.y); adjust_visible_x_for_cursor(view); adjust_visible_y_for_cursor(view); }
[ "static", "void", "memory_view_set_cursor_pos", "(", "debug_view", "*", "view", ",", "offs_t", "address", ",", "UINT8", "shift", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "const", "memory_view_pos", "*", "posdata", "=", "&", "memory_pos_table", "[", "memdata", "->", "bytes_per_chunk", "]", ";", "int", "chunknum", ";", "if", "(", "address", "<", "memdata", "->", "byte_offset", ")", "address", "=", "memdata", "->", "byte_offset", ";", "address", "-=", "memdata", "->", "byte_offset", ";", "view", "->", "cursor", ".", "y", "=", "address", "/", "memdata", "->", "bytes_per_row", ";", "chunknum", "=", "(", "address", "%", "memdata", "->", "bytes_per_row", ")", "/", "memdata", "->", "bytes_per_chunk", ";", "if", "(", "memdata", "->", "reverse_view", ")", "chunknum", "=", "memdata", "->", "chunks_per_row", "-", "1", "-", "chunknum", ";", "for", "(", "view", "->", "cursor", ".", "x", "=", "0", ";", "view", "->", "cursor", ".", "x", "<", "posdata", "->", "spacing", ";", "view", "->", "cursor", ".", "x", "++", ")", "if", "(", "posdata", "->", "shift", "[", "view", "->", "cursor", ".", "x", "]", "==", "shift", ")", "break", ";", "view", "->", "cursor", ".", "x", "+=", "memdata", "->", "section", "[", "1", "]", ".", "pos", "+", "1", "+", "posdata", "->", "spacing", "*", "chunknum", ";", "view", "->", "cursor", ".", "x", "=", "MIN", "(", "view", "->", "cursor", ".", "x", ",", "view", "->", "total", ".", "x", ")", ";", "view", "->", "cursor", ".", "y", "=", "MIN", "(", "view", "->", "cursor", ".", "y", ",", "view", "->", "total", ".", "y", ")", ";", "adjust_visible_x_for_cursor", "(", "view", ")", ";", "adjust_visible_y_for_cursor", "(", "view", ")", ";", "}" ]
memory_view_set_cursor_pos - set the cursor position as a function of an address and a shift value
[ "memory_view_set_cursor_pos", "-", "set", "the", "cursor", "position", "as", "a", "function", "of", "an", "address", "and", "a", "shift", "value" ]
[ "/* offset the address by the byte offset */", "/* compute the Y coordinate and chunk index */", "/* reverse the chunknum if we're reversed */", "/* scan within the chunk to find the shift */", "/* add in the chunk offset and shift to the right of divider1 */", "/* clamp to the window bounds */", "/* scroll if out of range */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "address", "type": "offs_t" }, { "param": "shift", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "address", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "shift", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_get_subview_list
memory_subview_item
const memory_subview_item *memory_view_get_subview_list(debug_view *view) { assert(view->type == DVT_MEMORY); return view->machine->debugvw_data->memory_subviews; }
/*------------------------------------------------- memory_view_get_subview_list - return a linked list of subviews -------------------------------------------------*/
return a linked list of subviews
[ "return", "a", "linked", "list", "of", "subviews" ]
const memory_subview_item *memory_view_get_subview_list(debug_view *view) { assert(view->type == DVT_MEMORY); return view->machine->debugvw_data->memory_subviews; }
[ "const", "memory_subview_item", "*", "memory_view_get_subview_list", "(", "debug_view", "*", "view", ")", "{", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "return", "view", "->", "machine", "->", "debugvw_data", "->", "memory_subviews", ";", "}" ]
memory_view_get_subview_list - return a linked list of subviews
[ "memory_view_get_subview_list", "-", "return", "a", "linked", "list", "of", "subviews" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_get_expression
char
const char *memory_view_get_expression(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return astring_c(memdata->expression.string); }
/*------------------------------------------------- memory_view_get_expression - return the expression string describing the home address -------------------------------------------------*/
return the expression string describing the home address
[ "return", "the", "expression", "string", "describing", "the", "home", "address" ]
const char *memory_view_get_expression(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return astring_c(memdata->expression.string); }
[ "const", "char", "*", "memory_view_get_expression", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "astring_c", "(", "memdata", "->", "expression", ".", "string", ")", ";", "}" ]
memory_view_get_expression - return the expression string describing the home address
[ "memory_view_get_expression", "-", "return", "the", "expression", "string", "describing", "the", "home", "address" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_get_bytes_per_chunk
UINT8
UINT8 memory_view_get_bytes_per_chunk(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->bytes_per_chunk; }
/*------------------------------------------------- memory_view_get_bytes_per_chunk - return the currently displayed bytes per chunk -------------------------------------------------*/
return the currently displayed bytes per chunk
[ "return", "the", "currently", "displayed", "bytes", "per", "chunk" ]
UINT8 memory_view_get_bytes_per_chunk(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->bytes_per_chunk; }
[ "UINT8", "memory_view_get_bytes_per_chunk", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "memdata", "->", "bytes_per_chunk", ";", "}" ]
memory_view_get_bytes_per_chunk - return the currently displayed bytes per chunk
[ "memory_view_get_bytes_per_chunk", "-", "return", "the", "currently", "displayed", "bytes", "per", "chunk" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_get_chunks_per_row
UINT32
UINT32 memory_view_get_chunks_per_row(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->chunks_per_row; }
/*------------------------------------------------- memory_view_get_chunks_per_row - return the number of chunks displayed across a row -------------------------------------------------*/
return the number of chunks displayed across a row
[ "return", "the", "number", "of", "chunks", "displayed", "across", "a", "row" ]
UINT32 memory_view_get_chunks_per_row(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->chunks_per_row; }
[ "UINT32", "memory_view_get_chunks_per_row", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "memdata", "->", "chunks_per_row", ";", "}" ]
memory_view_get_chunks_per_row - return the number of chunks displayed across a row
[ "memory_view_get_chunks_per_row", "-", "return", "the", "number", "of", "chunks", "displayed", "across", "a", "row" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_get_reverse
UINT8
UINT8 memory_view_get_reverse(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->reverse_view; }
/*------------------------------------------------- memory_view_get_reverse - return TRUE if the memory view is displayed reverse -------------------------------------------------*/
return TRUE if the memory view is displayed reverse
[ "return", "TRUE", "if", "the", "memory", "view", "is", "displayed", "reverse" ]
UINT8 memory_view_get_reverse(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->reverse_view; }
[ "UINT8", "memory_view_get_reverse", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "memdata", "->", "reverse_view", ";", "}" ]
memory_view_get_reverse - return TRUE if the memory view is displayed reverse
[ "memory_view_get_reverse", "-", "return", "TRUE", "if", "the", "memory", "view", "is", "displayed", "reverse" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_get_ascii
UINT8
UINT8 memory_view_get_ascii(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->ascii_view; }
/*------------------------------------------------- memory_view_get_ascii - return TRUE if the memory view is displaying an ASCII representation -------------------------------------------------*/
return TRUE if the memory view is displaying an ASCII representation
[ "return", "TRUE", "if", "the", "memory", "view", "is", "displaying", "an", "ASCII", "representation" ]
UINT8 memory_view_get_ascii(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->ascii_view; }
[ "UINT8", "memory_view_get_ascii", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "memdata", "->", "ascii_view", ";", "}" ]
memory_view_get_ascii - return TRUE if the memory view is displaying an ASCII representation
[ "memory_view_get_ascii", "-", "return", "TRUE", "if", "the", "memory", "view", "is", "displaying", "an", "ASCII", "representation" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_get_physical
UINT8
UINT8 memory_view_get_physical(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->no_translation; }
/*------------------------------------------------- memory_view_get_physical - return TRUE if the memory view is displaying physical addresses versus logical addresses -------------------------------------------------*/
return TRUE if the memory view is displaying physical addresses versus logical addresses
[ "return", "TRUE", "if", "the", "memory", "view", "is", "displaying", "physical", "addresses", "versus", "logical", "addresses" ]
UINT8 memory_view_get_physical(debug_view *view) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); debug_view_begin_update(view); debug_view_end_update(view); return memdata->no_translation; }
[ "UINT8", "memory_view_get_physical", "(", "debug_view", "*", "view", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "memdata", "->", "no_translation", ";", "}" ]
memory_view_get_physical - return TRUE if the memory view is displaying physical addresses versus logical addresses
[ "memory_view_get_physical", "-", "return", "TRUE", "if", "the", "memory", "view", "is", "displaying", "physical", "addresses", "versus", "logical", "addresses" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_set_subview
void
void memory_view_set_subview(debug_view *view, int index) { const memory_subview_item *subview = memory_view_get_subview_by_index(view->machine->debugvw_data->memory_subviews, index); debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); assert(subview != NULL); if (subview == NULL) return; /* handle a change */ if (subview != memdata->desc) { debug_view_begin_update(view); memdata->desc = subview; memdata->chunks_per_row = memdata->bytes_per_chunk * memdata->chunks_per_row / memdata->desc->prefsize; memdata->bytes_per_chunk = memdata->desc->prefsize; /* we need to recompute the expression in the context of the new space */ memdata->expression.dirty = TRUE; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
/*------------------------------------------------- memory_view_set_subview - select a new subview by index -------------------------------------------------*/
select a new subview by index
[ "select", "a", "new", "subview", "by", "index" ]
void memory_view_set_subview(debug_view *view, int index) { const memory_subview_item *subview = memory_view_get_subview_by_index(view->machine->debugvw_data->memory_subviews, index); debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); assert(subview != NULL); if (subview == NULL) return; if (subview != memdata->desc) { debug_view_begin_update(view); memdata->desc = subview; memdata->chunks_per_row = memdata->bytes_per_chunk * memdata->chunks_per_row / memdata->desc->prefsize; memdata->bytes_per_chunk = memdata->desc->prefsize; memdata->expression.dirty = TRUE; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
[ "void", "memory_view_set_subview", "(", "debug_view", "*", "view", ",", "int", "index", ")", "{", "const", "memory_subview_item", "*", "subview", "=", "memory_view_get_subview_by_index", "(", "view", "->", "machine", "->", "debugvw_data", "->", "memory_subviews", ",", "index", ")", ";", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "assert", "(", "subview", "!=", "NULL", ")", ";", "if", "(", "subview", "==", "NULL", ")", "return", ";", "if", "(", "subview", "!=", "memdata", "->", "desc", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "memdata", "->", "desc", "=", "subview", ";", "memdata", "->", "chunks_per_row", "=", "memdata", "->", "bytes_per_chunk", "*", "memdata", "->", "chunks_per_row", "/", "memdata", "->", "desc", "->", "prefsize", ";", "memdata", "->", "bytes_per_chunk", "=", "memdata", "->", "desc", "->", "prefsize", ";", "memdata", "->", "expression", ".", "dirty", "=", "TRUE", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
memory_view_set_subview - select a new subview by index
[ "memory_view_set_subview", "-", "select", "a", "new", "subview", "by", "index" ]
[ "/* handle a change */", "/* we need to recompute the expression in the context of the new space */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "index", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "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": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_set_expression
void
void memory_view_set_expression(debug_view *view, const char *expression) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); assert(expression != NULL); debug_view_begin_update(view); debug_view_expression_set(&memdata->expression, expression); view->recompute = view->update_pending = TRUE; debug_view_end_update(view); }
/*------------------------------------------------- memory_view_set_expression - set the expression string describing the home address -------------------------------------------------*/
set the expression string describing the home address
[ "set", "the", "expression", "string", "describing", "the", "home", "address" ]
void memory_view_set_expression(debug_view *view, const char *expression) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); assert(expression != NULL); debug_view_begin_update(view); debug_view_expression_set(&memdata->expression, expression); view->recompute = view->update_pending = TRUE; debug_view_end_update(view); }
[ "void", "memory_view_set_expression", "(", "debug_view", "*", "view", ",", "const", "char", "*", "expression", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "assert", "(", "expression", "!=", "NULL", ")", ";", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_expression_set", "(", "&", "memdata", "->", "expression", ",", "expression", ")", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}" ]
memory_view_set_expression - set the expression string describing the home address
[ "memory_view_set_expression", "-", "set", "the", "expression", "string", "describing", "the", "home", "address" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "expression", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "expression", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_set_bytes_per_chunk
void
void memory_view_set_bytes_per_chunk(debug_view *view, UINT8 chunkbytes) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); assert(chunkbytes < ARRAY_LENGTH(memory_pos_table) && memory_pos_table[chunkbytes].spacing != 0); if (chunkbytes != memdata->bytes_per_chunk) { int endianness = memdata->desc->endianness; offs_t address; UINT8 shift; debug_view_begin_update(view); memory_view_get_cursor_pos(view, &address, &shift); address += (shift / 8) ^ ((endianness == ENDIANNESS_LITTLE) ? 0 : (memdata->bytes_per_chunk - 1)); shift %= 8; memdata->bytes_per_chunk = chunkbytes; memdata->chunks_per_row = memdata->bytes_per_row / chunkbytes; view->recompute = view->update_pending = TRUE; shift += 8 * ((address % memdata->bytes_per_chunk) ^ ((endianness == ENDIANNESS_LITTLE) ? 0 : (memdata->bytes_per_chunk - 1))); address -= address % memdata->bytes_per_chunk; memory_view_set_cursor_pos(view, address, shift); debug_view_end_update(view); } }
/*------------------------------------------------- memory_view_set_bytes_per_chunk - specify the number of bytes displayed per chunk -------------------------------------------------*/
specify the number of bytes displayed per chunk
[ "specify", "the", "number", "of", "bytes", "displayed", "per", "chunk" ]
void memory_view_set_bytes_per_chunk(debug_view *view, UINT8 chunkbytes) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); assert(chunkbytes < ARRAY_LENGTH(memory_pos_table) && memory_pos_table[chunkbytes].spacing != 0); if (chunkbytes != memdata->bytes_per_chunk) { int endianness = memdata->desc->endianness; offs_t address; UINT8 shift; debug_view_begin_update(view); memory_view_get_cursor_pos(view, &address, &shift); address += (shift / 8) ^ ((endianness == ENDIANNESS_LITTLE) ? 0 : (memdata->bytes_per_chunk - 1)); shift %= 8; memdata->bytes_per_chunk = chunkbytes; memdata->chunks_per_row = memdata->bytes_per_row / chunkbytes; view->recompute = view->update_pending = TRUE; shift += 8 * ((address % memdata->bytes_per_chunk) ^ ((endianness == ENDIANNESS_LITTLE) ? 0 : (memdata->bytes_per_chunk - 1))); address -= address % memdata->bytes_per_chunk; memory_view_set_cursor_pos(view, address, shift); debug_view_end_update(view); } }
[ "void", "memory_view_set_bytes_per_chunk", "(", "debug_view", "*", "view", ",", "UINT8", "chunkbytes", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "assert", "(", "chunkbytes", "<", "ARRAY_LENGTH", "(", "memory_pos_table", ")", "&&", "memory_pos_table", "[", "chunkbytes", "]", ".", "spacing", "!=", "0", ")", ";", "if", "(", "chunkbytes", "!=", "memdata", "->", "bytes_per_chunk", ")", "{", "int", "endianness", "=", "memdata", "->", "desc", "->", "endianness", ";", "offs_t", "address", ";", "UINT8", "shift", ";", "debug_view_begin_update", "(", "view", ")", ";", "memory_view_get_cursor_pos", "(", "view", ",", "&", "address", ",", "&", "shift", ")", ";", "address", "+=", "(", "shift", "/", "8", ")", "^", "(", "(", "endianness", "==", "ENDIANNESS_LITTLE", ")", "?", "0", ":", "(", "memdata", "->", "bytes_per_chunk", "-", "1", ")", ")", ";", "shift", "%=", "8", ";", "memdata", "->", "bytes_per_chunk", "=", "chunkbytes", ";", "memdata", "->", "chunks_per_row", "=", "memdata", "->", "bytes_per_row", "/", "chunkbytes", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "shift", "+=", "8", "*", "(", "(", "address", "%", "memdata", "->", "bytes_per_chunk", ")", "^", "(", "(", "endianness", "==", "ENDIANNESS_LITTLE", ")", "?", "0", ":", "(", "memdata", "->", "bytes_per_chunk", "-", "1", ")", ")", ")", ";", "address", "-=", "address", "%", "memdata", "->", "bytes_per_chunk", ";", "memory_view_set_cursor_pos", "(", "view", ",", "address", ",", "shift", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
memory_view_set_bytes_per_chunk - specify the number of bytes displayed per chunk
[ "memory_view_set_bytes_per_chunk", "-", "specify", "the", "number", "of", "bytes", "displayed", "per", "chunk" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "chunkbytes", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "chunkbytes", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_set_chunks_per_row
void
void memory_view_set_chunks_per_row(debug_view *view, UINT32 rowchunks) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); if (rowchunks < 1) return; if (rowchunks != memdata->chunks_per_row) { offs_t address; UINT8 shift; debug_view_begin_update(view); memory_view_get_cursor_pos(view, &address, &shift); memdata->chunks_per_row = rowchunks; view->recompute = view->update_pending = TRUE; memory_view_set_cursor_pos(view, address, shift); debug_view_end_update(view); } }
/*------------------------------------------------- memory_view_set_chunks_per_row - specify the number of chunks displayed across a row -------------------------------------------------*/
specify the number of chunks displayed across a row
[ "specify", "the", "number", "of", "chunks", "displayed", "across", "a", "row" ]
void memory_view_set_chunks_per_row(debug_view *view, UINT32 rowchunks) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); if (rowchunks < 1) return; if (rowchunks != memdata->chunks_per_row) { offs_t address; UINT8 shift; debug_view_begin_update(view); memory_view_get_cursor_pos(view, &address, &shift); memdata->chunks_per_row = rowchunks; view->recompute = view->update_pending = TRUE; memory_view_set_cursor_pos(view, address, shift); debug_view_end_update(view); } }
[ "void", "memory_view_set_chunks_per_row", "(", "debug_view", "*", "view", ",", "UINT32", "rowchunks", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "if", "(", "rowchunks", "<", "1", ")", "return", ";", "if", "(", "rowchunks", "!=", "memdata", "->", "chunks_per_row", ")", "{", "offs_t", "address", ";", "UINT8", "shift", ";", "debug_view_begin_update", "(", "view", ")", ";", "memory_view_get_cursor_pos", "(", "view", ",", "&", "address", ",", "&", "shift", ")", ";", "memdata", "->", "chunks_per_row", "=", "rowchunks", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "memory_view_set_cursor_pos", "(", "view", ",", "address", ",", "shift", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
memory_view_set_chunks_per_row - specify the number of chunks displayed across a row
[ "memory_view_set_chunks_per_row", "-", "specify", "the", "number", "of", "chunks", "displayed", "across", "a", "row" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "rowchunks", "type": "UINT32" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rowchunks", "type": "UINT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_set_reverse
void
void memory_view_set_reverse(debug_view *view, UINT8 reverse) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); if (reverse != memdata->reverse_view) { offs_t address; UINT8 shift; debug_view_begin_update(view); memory_view_get_cursor_pos(view, &address, &shift); memdata->reverse_view = reverse; view->recompute = view->update_pending = TRUE; memory_view_set_cursor_pos(view, address, shift); debug_view_end_update(view); } }
/*------------------------------------------------- memory_view_set_reverse - specify TRUE if the memory view is displayed reverse -------------------------------------------------*/
specify TRUE if the memory view is displayed reverse
[ "specify", "TRUE", "if", "the", "memory", "view", "is", "displayed", "reverse" ]
void memory_view_set_reverse(debug_view *view, UINT8 reverse) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); if (reverse != memdata->reverse_view) { offs_t address; UINT8 shift; debug_view_begin_update(view); memory_view_get_cursor_pos(view, &address, &shift); memdata->reverse_view = reverse; view->recompute = view->update_pending = TRUE; memory_view_set_cursor_pos(view, address, shift); debug_view_end_update(view); } }
[ "void", "memory_view_set_reverse", "(", "debug_view", "*", "view", ",", "UINT8", "reverse", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "if", "(", "reverse", "!=", "memdata", "->", "reverse_view", ")", "{", "offs_t", "address", ";", "UINT8", "shift", ";", "debug_view_begin_update", "(", "view", ")", ";", "memory_view_get_cursor_pos", "(", "view", ",", "&", "address", ",", "&", "shift", ")", ";", "memdata", "->", "reverse_view", "=", "reverse", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "memory_view_set_cursor_pos", "(", "view", ",", "address", ",", "shift", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
memory_view_set_reverse - specify TRUE if the memory view is displayed reverse
[ "memory_view_set_reverse", "-", "specify", "TRUE", "if", "the", "memory", "view", "is", "displayed", "reverse" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "reverse", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "reverse", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_set_ascii
void
void memory_view_set_ascii(debug_view *view, UINT8 ascii) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); if (ascii != memdata->ascii_view) { offs_t address; UINT8 shift; debug_view_begin_update(view); memory_view_get_cursor_pos(view, &address, &shift); memdata->ascii_view = ascii; view->recompute = view->update_pending = TRUE; memory_view_set_cursor_pos(view, address, shift); debug_view_end_update(view); } }
/*------------------------------------------------- memory_view_set_ascii - specify TRUE if the memory view should display an ASCII representation -------------------------------------------------*/
specify TRUE if the memory view should display an ASCII representation
[ "specify", "TRUE", "if", "the", "memory", "view", "should", "display", "an", "ASCII", "representation" ]
void memory_view_set_ascii(debug_view *view, UINT8 ascii) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); if (ascii != memdata->ascii_view) { offs_t address; UINT8 shift; debug_view_begin_update(view); memory_view_get_cursor_pos(view, &address, &shift); memdata->ascii_view = ascii; view->recompute = view->update_pending = TRUE; memory_view_set_cursor_pos(view, address, shift); debug_view_end_update(view); } }
[ "void", "memory_view_set_ascii", "(", "debug_view", "*", "view", ",", "UINT8", "ascii", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "if", "(", "ascii", "!=", "memdata", "->", "ascii_view", ")", "{", "offs_t", "address", ";", "UINT8", "shift", ";", "debug_view_begin_update", "(", "view", ")", ";", "memory_view_get_cursor_pos", "(", "view", ",", "&", "address", ",", "&", "shift", ")", ";", "memdata", "->", "ascii_view", "=", "ascii", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "memory_view_set_cursor_pos", "(", "view", ",", "address", ",", "shift", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
memory_view_set_ascii - specify TRUE if the memory view should display an ASCII representation
[ "memory_view_set_ascii", "-", "specify", "TRUE", "if", "the", "memory", "view", "should", "display", "an", "ASCII", "representation" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "ascii", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ascii", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
memory_view_set_physical
void
void memory_view_set_physical(debug_view *view, UINT8 physical) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); if (physical != memdata->no_translation) { debug_view_begin_update(view); memdata->no_translation = physical; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
/*------------------------------------------------- memory_view_set_physical - specify TRUE if the memory view should display physical addresses versus logical addresses -------------------------------------------------*/
specify TRUE if the memory view should display physical addresses versus logical addresses
[ "specify", "TRUE", "if", "the", "memory", "view", "should", "display", "physical", "addresses", "versus", "logical", "addresses" ]
void memory_view_set_physical(debug_view *view, UINT8 physical) { debug_view_memory *memdata = (debug_view_memory *)view->extra_data; assert(view->type == DVT_MEMORY); if (physical != memdata->no_translation) { debug_view_begin_update(view); memdata->no_translation = physical; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
[ "void", "memory_view_set_physical", "(", "debug_view", "*", "view", ",", "UINT8", "physical", ")", "{", "debug_view_memory", "*", "memdata", "=", "(", "debug_view_memory", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_MEMORY", ")", ";", "if", "(", "physical", "!=", "memdata", "->", "no_translation", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "memdata", "->", "no_translation", "=", "physical", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
memory_view_set_physical - specify TRUE if the memory view should display physical addresses versus logical addresses
[ "memory_view_set_physical", "-", "specify", "TRUE", "if", "the", "memory", "view", "should", "display", "physical", "addresses", "versus", "logical", "addresses" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "physical", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "physical", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c14a5239960cb5abd34c0851f7f867bc49381df
lofunz/mieme
Reloaded/trunk/src/emu/machine/6526cia.c
[ "Unlicense" ]
C
cia_timer_update
void
static void cia_timer_update(cia_timer *timer, INT32 new_count) { int which = timer - timer->cia->timer; /* sanity check arguments */ assert((new_count >= -1) && (new_count <= 0xffff)); /* update the timer count, if necessary */ if ((new_count == -1) && is_timer_active(timer->timer)) { UINT16 current_count = attotime_to_double(attotime_mul(timer_timeelapsed(timer->timer), timer->cia->device->clock())); timer->count = timer->count - MIN(timer->count, current_count); } /* set the timer if we are instructed to */ if (new_count != -1) timer->count = new_count; /* now update the MAME timer */ if ((timer->mode & 0x01) && ((timer->mode & (which ? 0x60 : 0x20)) == 0x00)) { /* timer is on and is connected to clock */ attotime period = attotime_mul(ATTOTIME_IN_HZ(timer->cia->device->clock()), (timer->count ? timer->count : 0x10000)); timer_adjust_oneshot(timer->timer, period, 0); } else { /* timer is off or not connected to clock */ timer_adjust_oneshot(timer->timer, attotime_never, 0); } }
/*------------------------------------------------- cia_timer_update - updates the count and emu_timer for a given CIA timer -------------------------------------------------*/
updates the count and emu_timer for a given CIA timer
[ "updates", "the", "count", "and", "emu_timer", "for", "a", "given", "CIA", "timer" ]
static void cia_timer_update(cia_timer *timer, INT32 new_count) { int which = timer - timer->cia->timer; assert((new_count >= -1) && (new_count <= 0xffff)); if ((new_count == -1) && is_timer_active(timer->timer)) { UINT16 current_count = attotime_to_double(attotime_mul(timer_timeelapsed(timer->timer), timer->cia->device->clock())); timer->count = timer->count - MIN(timer->count, current_count); } if (new_count != -1) timer->count = new_count; if ((timer->mode & 0x01) && ((timer->mode & (which ? 0x60 : 0x20)) == 0x00)) { attotime period = attotime_mul(ATTOTIME_IN_HZ(timer->cia->device->clock()), (timer->count ? timer->count : 0x10000)); timer_adjust_oneshot(timer->timer, period, 0); } else { timer_adjust_oneshot(timer->timer, attotime_never, 0); } }
[ "static", "void", "cia_timer_update", "(", "cia_timer", "*", "timer", ",", "INT32", "new_count", ")", "{", "int", "which", "=", "timer", "-", "timer", "->", "cia", "->", "timer", ";", "assert", "(", "(", "new_count", ">=", "-1", ")", "&&", "(", "new_count", "<=", "0xffff", ")", ")", ";", "if", "(", "(", "new_count", "==", "-1", ")", "&&", "is_timer_active", "(", "timer", "->", "timer", ")", ")", "{", "UINT16", "current_count", "=", "attotime_to_double", "(", "attotime_mul", "(", "timer_timeelapsed", "(", "timer", "->", "timer", ")", ",", "timer", "->", "cia", "->", "device", "->", "clock", "(", ")", ")", ")", ";", "timer", "->", "count", "=", "timer", "->", "count", "-", "MIN", "(", "timer", "->", "count", ",", "current_count", ")", ";", "}", "if", "(", "new_count", "!=", "-1", ")", "timer", "->", "count", "=", "new_count", ";", "if", "(", "(", "timer", "->", "mode", "&", "0x01", ")", "&&", "(", "(", "timer", "->", "mode", "&", "(", "which", "?", "0x60", ":", "0x20", ")", ")", "==", "0x00", ")", ")", "{", "attotime", "period", "=", "attotime_mul", "(", "ATTOTIME_IN_HZ", "(", "timer", "->", "cia", "->", "device", "->", "clock", "(", ")", ")", ",", "(", "timer", "->", "count", "?", "timer", "->", "count", ":", "0x10000", ")", ")", ";", "timer_adjust_oneshot", "(", "timer", "->", "timer", ",", "period", ",", "0", ")", ";", "}", "else", "{", "timer_adjust_oneshot", "(", "timer", "->", "timer", ",", "attotime_never", ",", "0", ")", ";", "}", "}" ]
cia_timer_update - updates the count and emu_timer for a given CIA timer
[ "cia_timer_update", "-", "updates", "the", "count", "and", "emu_timer", "for", "a", "given", "CIA", "timer" ]
[ "/* sanity check arguments */", "/* update the timer count, if necessary */", "/* set the timer if we are instructed to */", "/* now update the MAME timer */", "/* timer is on and is connected to clock */", "/* timer is off or not connected to clock */" ]
[ { "param": "timer", "type": "cia_timer" }, { "param": "new_count", "type": "INT32" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timer", "type": "cia_timer", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_count", "type": "INT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c14a5239960cb5abd34c0851f7f867bc49381df
lofunz/mieme
Reloaded/trunk/src/emu/machine/6526cia.c
[ "Unlicense" ]
C
cia_get_timer
UINT16
static UINT16 cia_get_timer(cia_timer *timer) { UINT16 count; if (is_timer_active(timer->timer)) { UINT16 current_count = attotime_to_double(attotime_mul(timer_timeelapsed(timer->timer), timer->cia->device->clock())); count = timer->count - MIN(timer->count, current_count); } else count = timer->count; return count; }
/*------------------------------------------------- cia_get_timer - get the count for a given CIA timer -------------------------------------------------*/
get the count for a given CIA timer
[ "get", "the", "count", "for", "a", "given", "CIA", "timer" ]
static UINT16 cia_get_timer(cia_timer *timer) { UINT16 count; if (is_timer_active(timer->timer)) { UINT16 current_count = attotime_to_double(attotime_mul(timer_timeelapsed(timer->timer), timer->cia->device->clock())); count = timer->count - MIN(timer->count, current_count); } else count = timer->count; return count; }
[ "static", "UINT16", "cia_get_timer", "(", "cia_timer", "*", "timer", ")", "{", "UINT16", "count", ";", "if", "(", "is_timer_active", "(", "timer", "->", "timer", ")", ")", "{", "UINT16", "current_count", "=", "attotime_to_double", "(", "attotime_mul", "(", "timer_timeelapsed", "(", "timer", "->", "timer", ")", ",", "timer", "->", "cia", "->", "device", "->", "clock", "(", ")", ")", ")", ";", "count", "=", "timer", "->", "count", "-", "MIN", "(", "timer", "->", "count", ",", "current_count", ")", ";", "}", "else", "count", "=", "timer", "->", "count", ";", "return", "count", ";", "}" ]
cia_get_timer - get the count for a given CIA timer
[ "cia_get_timer", "-", "get", "the", "count", "for", "a", "given", "CIA", "timer" ]
[]
[ { "param": "timer", "type": "cia_timer" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timer", "type": "cia_timer", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c646dd06632745fc8598849832a5459780d0cd8b
lofunz/mieme
Reloaded/trunk/src/emu/sound/es5506.c
[ "Unlicense" ]
C
generate_ulaw
void
static void generate_ulaw(es5506_state *chip, es5506_voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples) { UINT32 freqcount = voice->freqcount; UINT32 accum = voice->accum & voice->accum_mask; INT32 lvol = chip->volume_lookup[voice->lvol >> 4]; INT32 rvol = chip->volume_lookup[voice->rvol >> 4]; /* pre-add the bank offset */ base += voice->exbank; /* outer loop, in case we switch directions */ while (samples > 0 && !(voice->control & CONTROL_STOPMASK)) { reverse: /* two cases: first case is forward direction */ if (!(voice->control & CONTROL_DIR)) { /* loop while we still have samples to generate */ while (samples--) { /* fetch two samples */ INT32 val1 = base[accum >> 11]; INT32 val2 = base[((accum + (1 << 11)) & voice->accum_mask) >> 11]; /* decompress u-law */ val1 = chip->ulaw_lookup[val1 >> (16 - ULAW_MAXBITS)]; val2 = chip->ulaw_lookup[val2 >> (16 - ULAW_MAXBITS)]; /* interpolate */ val1 = interpolate(val1, val2, accum); accum = (accum + freqcount) & voice->accum_mask; /* apply filters */ apply_filters(voice, val1); /* update filters/volumes */ if (voice->ecount != 0) { update_envelopes(voice, 1); lvol = chip->volume_lookup[voice->lvol >> 4]; rvol = chip->volume_lookup[voice->rvol >> 4]; } /* apply volumes and add */ *lbuffer++ += (val1 * lvol) >> 11; *rbuffer++ += (val1 * rvol) >> 11; /* check for loop end */ check_for_end_forward(voice, accum); } } /* two cases: second case is backward direction */ else { /* loop while we still have samples to generate */ while (samples--) { /* fetch two samples */ INT32 val1 = base[accum >> 11]; INT32 val2 = base[((accum + (1 << 11)) & voice->accum_mask) >> 11]; /* decompress u-law */ val1 = chip->ulaw_lookup[val1 >> (16 - ULAW_MAXBITS)]; val2 = chip->ulaw_lookup[val2 >> (16 - ULAW_MAXBITS)]; /* interpolate */ val1 = interpolate(val1, val2, accum); accum = (accum - freqcount) & voice->accum_mask; /* apply filters */ apply_filters(voice, val1); /* update filters/volumes */ if (voice->ecount != 0) { update_envelopes(voice, 1); lvol = chip->volume_lookup[voice->lvol >> 4]; rvol = chip->volume_lookup[voice->rvol >> 4]; } /* apply volumes and add */ *lbuffer++ += (val1 * lvol) >> 11; *rbuffer++ += (val1 * rvol) >> 11; /* check for loop end */ check_for_end_reverse(voice, accum); } } } /* if we stopped, process any additional envelope */ alldone: voice->accum = accum; if (samples > 0) update_envelopes(voice, samples); }
/********************************************************************************************** generate_ulaw -- general u-law decoding routine ***********************************************************************************************/
- general u-law decoding routine
[ "-", "general", "u", "-", "law", "decoding", "routine" ]
static void generate_ulaw(es5506_state *chip, es5506_voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples) { UINT32 freqcount = voice->freqcount; UINT32 accum = voice->accum & voice->accum_mask; INT32 lvol = chip->volume_lookup[voice->lvol >> 4]; INT32 rvol = chip->volume_lookup[voice->rvol >> 4]; base += voice->exbank; while (samples > 0 && !(voice->control & CONTROL_STOPMASK)) { reverse: if (!(voice->control & CONTROL_DIR)) { while (samples--) { INT32 val1 = base[accum >> 11]; INT32 val2 = base[((accum + (1 << 11)) & voice->accum_mask) >> 11]; val1 = chip->ulaw_lookup[val1 >> (16 - ULAW_MAXBITS)]; val2 = chip->ulaw_lookup[val2 >> (16 - ULAW_MAXBITS)]; val1 = interpolate(val1, val2, accum); accum = (accum + freqcount) & voice->accum_mask; apply_filters(voice, val1); if (voice->ecount != 0) { update_envelopes(voice, 1); lvol = chip->volume_lookup[voice->lvol >> 4]; rvol = chip->volume_lookup[voice->rvol >> 4]; } *lbuffer++ += (val1 * lvol) >> 11; *rbuffer++ += (val1 * rvol) >> 11; check_for_end_forward(voice, accum); } } else { while (samples--) { INT32 val1 = base[accum >> 11]; INT32 val2 = base[((accum + (1 << 11)) & voice->accum_mask) >> 11]; val1 = chip->ulaw_lookup[val1 >> (16 - ULAW_MAXBITS)]; val2 = chip->ulaw_lookup[val2 >> (16 - ULAW_MAXBITS)]; val1 = interpolate(val1, val2, accum); accum = (accum - freqcount) & voice->accum_mask; apply_filters(voice, val1); if (voice->ecount != 0) { update_envelopes(voice, 1); lvol = chip->volume_lookup[voice->lvol >> 4]; rvol = chip->volume_lookup[voice->rvol >> 4]; } *lbuffer++ += (val1 * lvol) >> 11; *rbuffer++ += (val1 * rvol) >> 11; check_for_end_reverse(voice, accum); } } } alldone: voice->accum = accum; if (samples > 0) update_envelopes(voice, samples); }
[ "static", "void", "generate_ulaw", "(", "es5506_state", "*", "chip", ",", "es5506_voice", "*", "voice", ",", "UINT16", "*", "base", ",", "INT32", "*", "lbuffer", ",", "INT32", "*", "rbuffer", ",", "int", "samples", ")", "{", "UINT32", "freqcount", "=", "voice", "->", "freqcount", ";", "UINT32", "accum", "=", "voice", "->", "accum", "&", "voice", "->", "accum_mask", ";", "INT32", "lvol", "=", "chip", "->", "volume_lookup", "[", "voice", "->", "lvol", ">>", "4", "]", ";", "INT32", "rvol", "=", "chip", "->", "volume_lookup", "[", "voice", "->", "rvol", ">>", "4", "]", ";", "base", "+=", "voice", "->", "exbank", ";", "while", "(", "samples", ">", "0", "&&", "!", "(", "voice", "->", "control", "&", "CONTROL_STOPMASK", ")", ")", "{", "reverse", ":", "if", "(", "!", "(", "voice", "->", "control", "&", "CONTROL_DIR", ")", ")", "{", "while", "(", "samples", "--", ")", "{", "INT32", "val1", "=", "base", "[", "accum", ">>", "11", "]", ";", "INT32", "val2", "=", "base", "[", "(", "(", "accum", "+", "(", "1", "<<", "11", ")", ")", "&", "voice", "->", "accum_mask", ")", ">>", "11", "]", ";", "val1", "=", "chip", "->", "ulaw_lookup", "[", "val1", ">>", "(", "16", "-", "ULAW_MAXBITS", ")", "]", ";", "val2", "=", "chip", "->", "ulaw_lookup", "[", "val2", ">>", "(", "16", "-", "ULAW_MAXBITS", ")", "]", ";", "val1", "=", "interpolate", "(", "val1", ",", "val2", ",", "accum", ")", ";", "accum", "=", "(", "accum", "+", "freqcount", ")", "&", "voice", "->", "accum_mask", ";", "apply_filters", "(", "voice", ",", "val1", ")", ";", "if", "(", "voice", "->", "ecount", "!=", "0", ")", "{", "update_envelopes", "(", "voice", ",", "1", ")", ";", "lvol", "=", "chip", "->", "volume_lookup", "[", "voice", "->", "lvol", ">>", "4", "]", ";", "rvol", "=", "chip", "->", "volume_lookup", "[", "voice", "->", "rvol", ">>", "4", "]", ";", "}", "*", "lbuffer", "++", "+=", "(", "val1", "*", "lvol", ")", ">>", "11", ";", "*", "rbuffer", "++", "+=", "(", "val1", "*", "rvol", ")", ">>", "11", ";", "check_for_end_forward", "(", "voice", ",", "accum", ")", ";", "}", "}", "else", "{", "while", "(", "samples", "--", ")", "{", "INT32", "val1", "=", "base", "[", "accum", ">>", "11", "]", ";", "INT32", "val2", "=", "base", "[", "(", "(", "accum", "+", "(", "1", "<<", "11", ")", ")", "&", "voice", "->", "accum_mask", ")", ">>", "11", "]", ";", "val1", "=", "chip", "->", "ulaw_lookup", "[", "val1", ">>", "(", "16", "-", "ULAW_MAXBITS", ")", "]", ";", "val2", "=", "chip", "->", "ulaw_lookup", "[", "val2", ">>", "(", "16", "-", "ULAW_MAXBITS", ")", "]", ";", "val1", "=", "interpolate", "(", "val1", ",", "val2", ",", "accum", ")", ";", "accum", "=", "(", "accum", "-", "freqcount", ")", "&", "voice", "->", "accum_mask", ";", "apply_filters", "(", "voice", ",", "val1", ")", ";", "if", "(", "voice", "->", "ecount", "!=", "0", ")", "{", "update_envelopes", "(", "voice", ",", "1", ")", ";", "lvol", "=", "chip", "->", "volume_lookup", "[", "voice", "->", "lvol", ">>", "4", "]", ";", "rvol", "=", "chip", "->", "volume_lookup", "[", "voice", "->", "rvol", ">>", "4", "]", ";", "}", "*", "lbuffer", "++", "+=", "(", "val1", "*", "lvol", ")", ">>", "11", ";", "*", "rbuffer", "++", "+=", "(", "val1", "*", "rvol", ")", ">>", "11", ";", "check_for_end_reverse", "(", "voice", ",", "accum", ")", ";", "}", "}", "}", "alldone", ":", "voice", "->", "accum", "=", "accum", ";", "if", "(", "samples", ">", "0", ")", "update_envelopes", "(", "voice", ",", "samples", ")", ";", "}" ]
generate_ulaw -- general u-law decoding routine
[ "generate_ulaw", "--", "general", "u", "-", "law", "decoding", "routine" ]
[ "/* pre-add the bank offset */", "/* outer loop, in case we switch directions */", "/* two cases: first case is forward direction */", "/* loop while we still have samples to generate */", "/* fetch two samples */", "/* decompress u-law */", "/* interpolate */", "/* apply filters */", "/* update filters/volumes */", "/* apply volumes and add */", "/* check for loop end */", "/* two cases: second case is backward direction */", "/* loop while we still have samples to generate */", "/* fetch two samples */", "/* decompress u-law */", "/* interpolate */", "/* apply filters */", "/* update filters/volumes */", "/* apply volumes and add */", "/* check for loop end */", "/* if we stopped, process any additional envelope */" ]
[ { "param": "chip", "type": "es5506_state" }, { "param": "voice", "type": "es5506_voice" }, { "param": "base", "type": "UINT16" }, { "param": "lbuffer", "type": "INT32" }, { "param": "rbuffer", "type": "INT32" }, { "param": "samples", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "chip", "type": "es5506_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "voice", "type": "es5506_voice", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "base", "type": "UINT16", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lbuffer", "type": "INT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rbuffer", "type": "INT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "samples", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c646dd06632745fc8598849832a5459780d0cd8b
lofunz/mieme
Reloaded/trunk/src/emu/sound/es5506.c
[ "Unlicense" ]
C
generate_samples
void
static void generate_samples(es5506_state *chip, INT32 *left, INT32 *right, int samples) { int v; /* skip if nothing to do */ if (!samples) return; /* clear out the accumulator */ memset(left, 0, samples * sizeof(left[0])); memset(right, 0, samples * sizeof(right[0])); /* loop over voices */ for (v = 0; v <= chip->active_voices; v++) { es5506_voice *voice = &chip->voice[v]; UINT16 *base = chip->region_base[voice->control >> 14]; /* special case: if end == start, stop the voice */ if (voice->start == voice->end) voice->control |= CONTROL_STOP0; /* generate from the appropriate source */ if (!base) { logerror("NULL region base %d\n",voice->control >> 14); generate_dummy(chip, voice, base, left, right, samples); } else if (voice->control & 0x2000) generate_ulaw(chip, voice, base, left, right, samples); else generate_pcm(chip, voice, base, left, right, samples); /* does this voice have it's IRQ bit raised? */ if (voice->control&CONTROL_IRQ) { logerror("IRQ raised on voice %d!!\n",v); /* only update voice vector if existing IRQ is acked by host */ if (chip->irqv&0x80) { /* latch voice number into vector, and set high bit low */ chip->irqv=v&0x7f; /* take down IRQ bit on voice */ voice->control&=~CONTROL_IRQ; /* inform host of irq */ update_irq_state(chip); } } } }
/********************************************************************************************** generate_samples -- tell each voice to generate samples ***********************************************************************************************/
- tell each voice to generate samples
[ "-", "tell", "each", "voice", "to", "generate", "samples" ]
static void generate_samples(es5506_state *chip, INT32 *left, INT32 *right, int samples) { int v; if (!samples) return; memset(left, 0, samples * sizeof(left[0])); memset(right, 0, samples * sizeof(right[0])); for (v = 0; v <= chip->active_voices; v++) { es5506_voice *voice = &chip->voice[v]; UINT16 *base = chip->region_base[voice->control >> 14]; if (voice->start == voice->end) voice->control |= CONTROL_STOP0; if (!base) { logerror("NULL region base %d\n",voice->control >> 14); generate_dummy(chip, voice, base, left, right, samples); } else if (voice->control & 0x2000) generate_ulaw(chip, voice, base, left, right, samples); else generate_pcm(chip, voice, base, left, right, samples); if (voice->control&CONTROL_IRQ) { logerror("IRQ raised on voice %d!!\n",v); if (chip->irqv&0x80) { chip->irqv=v&0x7f; voice->control&=~CONTROL_IRQ; update_irq_state(chip); } } } }
[ "static", "void", "generate_samples", "(", "es5506_state", "*", "chip", ",", "INT32", "*", "left", ",", "INT32", "*", "right", ",", "int", "samples", ")", "{", "int", "v", ";", "if", "(", "!", "samples", ")", "return", ";", "memset", "(", "left", ",", "0", ",", "samples", "*", "sizeof", "(", "left", "[", "0", "]", ")", ")", ";", "memset", "(", "right", ",", "0", ",", "samples", "*", "sizeof", "(", "right", "[", "0", "]", ")", ")", ";", "for", "(", "v", "=", "0", ";", "v", "<=", "chip", "->", "active_voices", ";", "v", "++", ")", "{", "es5506_voice", "*", "voice", "=", "&", "chip", "->", "voice", "[", "v", "]", ";", "UINT16", "*", "base", "=", "chip", "->", "region_base", "[", "voice", "->", "control", ">>", "14", "]", ";", "if", "(", "voice", "->", "start", "==", "voice", "->", "end", ")", "voice", "->", "control", "|=", "CONTROL_STOP0", ";", "if", "(", "!", "base", ")", "{", "logerror", "(", "\"", "\\n", "\"", ",", "voice", "->", "control", ">>", "14", ")", ";", "generate_dummy", "(", "chip", ",", "voice", ",", "base", ",", "left", ",", "right", ",", "samples", ")", ";", "}", "else", "if", "(", "voice", "->", "control", "&", "0x2000", ")", "generate_ulaw", "(", "chip", ",", "voice", ",", "base", ",", "left", ",", "right", ",", "samples", ")", ";", "else", "generate_pcm", "(", "chip", ",", "voice", ",", "base", ",", "left", ",", "right", ",", "samples", ")", ";", "if", "(", "voice", "->", "control", "&", "CONTROL_IRQ", ")", "{", "logerror", "(", "\"", "\\n", "\"", ",", "v", ")", ";", "if", "(", "chip", "->", "irqv", "&", "0x80", ")", "{", "chip", "->", "irqv", "=", "v", "&", "0x7f", ";", "voice", "->", "control", "&=", "~", "CONTROL_IRQ", ";", "update_irq_state", "(", "chip", ")", ";", "}", "}", "}", "}" ]
generate_samples -- tell each voice to generate samples
[ "generate_samples", "--", "tell", "each", "voice", "to", "generate", "samples" ]
[ "/* skip if nothing to do */", "/* clear out the accumulator */", "/* loop over voices */", "/* special case: if end == start, stop the voice */", "/* generate from the appropriate source */", "/* does this voice have it's IRQ bit raised? */", "/* only update voice vector if existing IRQ is acked by host */", "/* latch voice number into vector, and set high bit low */", "/* take down IRQ bit on voice */", "/* inform host of irq */" ]
[ { "param": "chip", "type": "es5506_state" }, { "param": "left", "type": "INT32" }, { "param": "right", "type": "INT32" }, { "param": "samples", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "chip", "type": "es5506_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "left", "type": "INT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "right", "type": "INT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "samples", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
80116f6ed0a7b77e367baeb42fdfb8e1317d69b3
lofunz/mieme
Reloaded/trunk/src/emu/sound/es8712.c
[ "Unlicense" ]
C
es8712_set_bank_base
void
void es8712_set_bank_base(running_device *device, int base) { es8712_state *chip = get_safe_token(device); stream_update(chip->stream); chip->bank_offset = base; }
/**************************************************************************** es8712_set_bank_base -- set the base of the bank on a given chip *****************************************************************************/
- set the base of the bank on a given chip
[ "-", "set", "the", "base", "of", "the", "bank", "on", "a", "given", "chip" ]
void es8712_set_bank_base(running_device *device, int base) { es8712_state *chip = get_safe_token(device); stream_update(chip->stream); chip->bank_offset = base; }
[ "void", "es8712_set_bank_base", "(", "running_device", "*", "device", ",", "int", "base", ")", "{", "es8712_state", "*", "chip", "=", "get_safe_token", "(", "device", ")", ";", "stream_update", "(", "chip", "->", "stream", ")", ";", "chip", "->", "bank_offset", "=", "base", ";", "}" ]
es8712_set_bank_base -- set the base of the bank on a given chip
[ "es8712_set_bank_base", "--", "set", "the", "base", "of", "the", "bank", "on", "a", "given", "chip" ]
[]
[ { "param": "device", "type": "running_device" }, { "param": "base", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "running_device", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "base", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
80116f6ed0a7b77e367baeb42fdfb8e1317d69b3
lofunz/mieme
Reloaded/trunk/src/emu/sound/es8712.c
[ "Unlicense" ]
C
es8712_set_frequency
void
void es8712_set_frequency(running_device *device, int frequency) { es8712_state *chip = get_safe_token(device); /* update the stream and set the new base */ stream_update(chip->stream); stream_set_sample_rate(chip->stream, frequency); }
/**************************************************************************** es8712_set_frequency -- dynamically adjusts the frequency of a given ADPCM chip *****************************************************************************/
- dynamically adjusts the frequency of a given ADPCM chip
[ "-", "dynamically", "adjusts", "the", "frequency", "of", "a", "given", "ADPCM", "chip" ]
void es8712_set_frequency(running_device *device, int frequency) { es8712_state *chip = get_safe_token(device); stream_update(chip->stream); stream_set_sample_rate(chip->stream, frequency); }
[ "void", "es8712_set_frequency", "(", "running_device", "*", "device", ",", "int", "frequency", ")", "{", "es8712_state", "*", "chip", "=", "get_safe_token", "(", "device", ")", ";", "stream_update", "(", "chip", "->", "stream", ")", ";", "stream_set_sample_rate", "(", "chip", "->", "stream", ",", "frequency", ")", ";", "}" ]
es8712_set_frequency -- dynamically adjusts the frequency of a given ADPCM chip
[ "es8712_set_frequency", "--", "dynamically", "adjusts", "the", "frequency", "of", "a", "given", "ADPCM", "chip" ]
[ "/* update the stream and set the new base */" ]
[ { "param": "device", "type": "running_device" }, { "param": "frequency", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "running_device", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "frequency", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
80116f6ed0a7b77e367baeb42fdfb8e1317d69b3
lofunz/mieme
Reloaded/trunk/src/emu/sound/es8712.c
[ "Unlicense" ]
C
es8712_play
void
void es8712_play(running_device *device) { es8712_state *chip = get_safe_token(device); if (chip->start < chip->end) { if (!chip->playing) { chip->playing = 1; chip->base_offset = chip->start; chip->sample = 0; chip->count = 2 * (chip->end - chip->start + 1); chip->repeat = 0;//1; /* also reset the ADPCM parameters */ chip->signal = -2; chip->step = 0; } } /* invalid samples go here */ else { logerror("ES871295:'%s' requested to play invalid sample range %06x-%06x\n",device->tag(),chip->start,chip->end); if (chip->playing) { /* update the stream */ stream_update(chip->stream); chip->playing = 0; } } }
/********************************************************************************************** es8712_play -- Begin playing the addressed sample ***********************************************************************************************/
- Begin playing the addressed sample
[ "-", "Begin", "playing", "the", "addressed", "sample" ]
void es8712_play(running_device *device) { es8712_state *chip = get_safe_token(device); if (chip->start < chip->end) { if (!chip->playing) { chip->playing = 1; chip->base_offset = chip->start; chip->sample = 0; chip->count = 2 * (chip->end - chip->start + 1); chip->repeat = 0; chip->signal = -2; chip->step = 0; } } else { logerror("ES871295:'%s' requested to play invalid sample range %06x-%06x\n",device->tag(),chip->start,chip->end); if (chip->playing) { stream_update(chip->stream); chip->playing = 0; } } }
[ "void", "es8712_play", "(", "running_device", "*", "device", ")", "{", "es8712_state", "*", "chip", "=", "get_safe_token", "(", "device", ")", ";", "if", "(", "chip", "->", "start", "<", "chip", "->", "end", ")", "{", "if", "(", "!", "chip", "->", "playing", ")", "{", "chip", "->", "playing", "=", "1", ";", "chip", "->", "base_offset", "=", "chip", "->", "start", ";", "chip", "->", "sample", "=", "0", ";", "chip", "->", "count", "=", "2", "*", "(", "chip", "->", "end", "-", "chip", "->", "start", "+", "1", ")", ";", "chip", "->", "repeat", "=", "0", ";", "chip", "->", "signal", "=", "-2", ";", "chip", "->", "step", "=", "0", ";", "}", "}", "else", "{", "logerror", "(", "\"", "\\n", "\"", ",", "device", "->", "tag", "(", ")", ",", "chip", "->", "start", ",", "chip", "->", "end", ")", ";", "if", "(", "chip", "->", "playing", ")", "{", "stream_update", "(", "chip", "->", "stream", ")", ";", "chip", "->", "playing", "=", "0", ";", "}", "}", "}" ]
es8712_play -- Begin playing the addressed sample
[ "es8712_play", "--", "Begin", "playing", "the", "addressed", "sample" ]
[ "//1;\r", "/* also reset the ADPCM parameters */", "/* invalid samples go here */", "/* update the stream */" ]
[ { "param": "device", "type": "running_device" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "running_device", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3223705c3b1c345b7f2d8ee515286627d14c7c11
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/drivers/tmaster.c
[ "Unlicense" ]
C
galgames_update_rombank
void
static void galgames_update_rombank(running_machine *machine, UINT32 cart) { galgames_cart = cart; tmaster_gfx_offs = 0x200000 * cart; if (memory_get_bank(machine, GALGAMES_BANK_000000_R) == GALGAMES_RAM) memory_set_bank(machine, GALGAMES_BANK_200000_R, GALGAMES_ROM0 + galgames_cart); // rom memory_set_bank(machine, GALGAMES_BANK_240000_R, GALGAMES_ROM0 + galgames_cart); // rom }
// Carts (preliminary, PIC communication is not implemented)
Carts (preliminary, PIC communication is not implemented)
[ "Carts", "(", "preliminary", "PIC", "communication", "is", "not", "implemented", ")" ]
static void galgames_update_rombank(running_machine *machine, UINT32 cart) { galgames_cart = cart; tmaster_gfx_offs = 0x200000 * cart; if (memory_get_bank(machine, GALGAMES_BANK_000000_R) == GALGAMES_RAM) memory_set_bank(machine, GALGAMES_BANK_200000_R, GALGAMES_ROM0 + galgames_cart); memory_set_bank(machine, GALGAMES_BANK_240000_R, GALGAMES_ROM0 + galgames_cart); }
[ "static", "void", "galgames_update_rombank", "(", "running_machine", "*", "machine", ",", "UINT32", "cart", ")", "{", "galgames_cart", "=", "cart", ";", "tmaster_gfx_offs", "=", "0x200000", "*", "cart", ";", "if", "(", "memory_get_bank", "(", "machine", ",", "GALGAMES_BANK_000000_R", ")", "==", "GALGAMES_RAM", ")", "memory_set_bank", "(", "machine", ",", "GALGAMES_BANK_200000_R", ",", "GALGAMES_ROM0", "+", "galgames_cart", ")", ";", "memory_set_bank", "(", "machine", ",", "GALGAMES_BANK_240000_R", ",", "GALGAMES_ROM0", "+", "galgames_cart", ")", ";", "}" ]
Carts (preliminary, PIC communication is not implemented)
[ "Carts", "(", "preliminary", "PIC", "communication", "is", "not", "implemented", ")" ]
[ "// rom", "// rom" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "cart", "type": "UINT32" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cart", "type": "UINT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
32220e67fd3c1c242d7cb181e40a7e48801dc094
lofunz/mieme
Reloaded/trunk/src/emu/sound/k051649.c
[ "Unlicense" ]
C
make_mixer_table
void
static void make_mixer_table(running_machine *machine, k051649_state *info, int voices) { int count = voices * 256; int i; int gain = 8; /* allocate memory */ info->mixer_table = auto_alloc_array(machine, INT16, 512 * voices); /* find the middle of the table */ info->mixer_lookup = info->mixer_table + (256 * 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; info->mixer_lookup[ i] = val; info->mixer_lookup[-i] = -val; } }
/* build a table to divide by the number of voices */
build a table to divide by the number of voices
[ "build", "a", "table", "to", "divide", "by", "the", "number", "of", "voices" ]
static void make_mixer_table(running_machine *machine, k051649_state *info, int voices) { int count = voices * 256; int i; int gain = 8; info->mixer_table = auto_alloc_array(machine, INT16, 512 * voices); info->mixer_lookup = info->mixer_table + (256 * voices); for (i = 0; i < count; i++) { int val = i * gain * 16 / voices; if (val > 32767) val = 32767; info->mixer_lookup[ i] = val; info->mixer_lookup[-i] = -val; } }
[ "static", "void", "make_mixer_table", "(", "running_machine", "*", "machine", ",", "k051649_state", "*", "info", ",", "int", "voices", ")", "{", "int", "count", "=", "voices", "*", "256", ";", "int", "i", ";", "int", "gain", "=", "8", ";", "info", "->", "mixer_table", "=", "auto_alloc_array", "(", "machine", ",", "INT16", ",", "512", "*", "voices", ")", ";", "info", "->", "mixer_lookup", "=", "info", "->", "mixer_table", "+", "(", "256", "*", "voices", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "int", "val", "=", "i", "*", "gain", "*", "16", "/", "voices", ";", "if", "(", "val", ">", "32767", ")", "val", "=", "32767", ";", "info", "->", "mixer_lookup", "[", "i", "]", "=", "val", ";", "info", "->", "mixer_lookup", "[", "-", "i", "]", "=", "-", "val", ";", "}", "}" ]
build a table to divide by the number of voices
[ "build", "a", "table", "to", "divide", "by", "the", "number", "of", "voices" ]
[ "/* allocate memory */", "/* find the middle of the table */", "/* fill in the table - 16 bit case */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "info", "type": "k051649_state" }, { "param": "voices", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "info", "type": "k051649_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "voices", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0c664e77178568388cb5f8cb361f5ab994801671
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/video/vector.c
[ "Unlicense" ]
C
vector_add_point
void
void vector_add_point (running_machine *machine, int x, int y, rgb_t color, int intensity) { point *newpoint; if (intensity > 0xff) intensity = 0xff; if (flicker && (intensity > 0)) { intensity += (intensity * (0x80-(mame_rand(machine)&0xff)) * flicker)>>16; if (intensity < 0) intensity = 0; if (intensity > 0xff) intensity = 0xff; } newpoint = &vector_list[vector_index]; newpoint->x = x; newpoint->y = y; newpoint->col = color; newpoint->intensity = intensity; newpoint->status = VDIRTY; /* mark identical lines as clean later */ vector_index++; if (vector_index >= MAX_POINTS) { vector_index--; logerror("*** Warning! Vector list overflow!\n"); } }
/* * Adds a line end point to the vertices list. The vector processor emulation * needs to call this. */
Adds a line end point to the vertices list. The vector processor emulation needs to call this.
[ "Adds", "a", "line", "end", "point", "to", "the", "vertices", "list", ".", "The", "vector", "processor", "emulation", "needs", "to", "call", "this", "." ]
void vector_add_point (running_machine *machine, int x, int y, rgb_t color, int intensity) { point *newpoint; if (intensity > 0xff) intensity = 0xff; if (flicker && (intensity > 0)) { intensity += (intensity * (0x80-(mame_rand(machine)&0xff)) * flicker)>>16; if (intensity < 0) intensity = 0; if (intensity > 0xff) intensity = 0xff; } newpoint = &vector_list[vector_index]; newpoint->x = x; newpoint->y = y; newpoint->col = color; newpoint->intensity = intensity; newpoint->status = VDIRTY; vector_index++; if (vector_index >= MAX_POINTS) { vector_index--; logerror("*** Warning! Vector list overflow!\n"); } }
[ "void", "vector_add_point", "(", "running_machine", "*", "machine", ",", "int", "x", ",", "int", "y", ",", "rgb_t", "color", ",", "int", "intensity", ")", "{", "point", "*", "newpoint", ";", "if", "(", "intensity", ">", "0xff", ")", "intensity", "=", "0xff", ";", "if", "(", "flicker", "&&", "(", "intensity", ">", "0", ")", ")", "{", "intensity", "+=", "(", "intensity", "*", "(", "0x80", "-", "(", "mame_rand", "(", "machine", ")", "&", "0xff", ")", ")", "*", "flicker", ")", ">>", "16", ";", "if", "(", "intensity", "<", "0", ")", "intensity", "=", "0", ";", "if", "(", "intensity", ">", "0xff", ")", "intensity", "=", "0xff", ";", "}", "newpoint", "=", "&", "vector_list", "[", "vector_index", "]", ";", "newpoint", "->", "x", "=", "x", ";", "newpoint", "->", "y", "=", "y", ";", "newpoint", "->", "col", "=", "color", ";", "newpoint", "->", "intensity", "=", "intensity", ";", "newpoint", "->", "status", "=", "VDIRTY", ";", "vector_index", "++", ";", "if", "(", "vector_index", ">=", "MAX_POINTS", ")", "{", "vector_index", "--", ";", "logerror", "(", "\"", "\\n", "\"", ")", ";", "}", "}" ]
Adds a line end point to the vertices list.
[ "Adds", "a", "line", "end", "point", "to", "the", "vertices", "list", "." ]
[ "/* mark identical lines as clean later */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "x", "type": "int" }, { "param": "y", "type": "int" }, { "param": "color", "type": "rgb_t" }, { "param": "intensity", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "x", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "color", "type": "rgb_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "intensity", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b148921aca652012d877eceeb64d5a1aa00d0941
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/machine/harddriv.c
[ "Unlicense" ]
C
update_ds3_irq
void
static void update_ds3_irq(void) { /* update the IRQ2 signal to the ADSP2101 */ if (!(!ds3_g68flag && ds3_g68irqs) && !(ds3_gflag && ds3_gfirqs)) cpu_set_input_line(hdcpu_adsp, ADSP2100_IRQ2, ASSERT_LINE); else cpu_set_input_line(hdcpu_adsp, ADSP2100_IRQ2, CLEAR_LINE); }
/************************************* * * General DS III I/O * *************************************/
General DS III I/O
[ "General", "DS", "III", "I", "/", "O" ]
static void update_ds3_irq(void) { if (!(!ds3_g68flag && ds3_g68irqs) && !(ds3_gflag && ds3_gfirqs)) cpu_set_input_line(hdcpu_adsp, ADSP2100_IRQ2, ASSERT_LINE); else cpu_set_input_line(hdcpu_adsp, ADSP2100_IRQ2, CLEAR_LINE); }
[ "static", "void", "update_ds3_irq", "(", "void", ")", "{", "if", "(", "!", "(", "!", "ds3_g68flag", "&&", "ds3_g68irqs", ")", "&&", "!", "(", "ds3_gflag", "&&", "ds3_gfirqs", ")", ")", "cpu_set_input_line", "(", "hdcpu_adsp", ",", "ADSP2100_IRQ2", ",", "ASSERT_LINE", ")", ";", "else", "cpu_set_input_line", "(", "hdcpu_adsp", ",", "ADSP2100_IRQ2", ",", "CLEAR_LINE", ")", ";", "}" ]
General DS III I/O
[ "General", "DS", "III", "I", "/", "O" ]
[ "/* update the IRQ2 signal to the ADSP2101 */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
ac2df5b47348ea54990216c721a2291a5632b9a9
lofunz/mieme
Reloaded/trunk/src/mame/drivers/cubocd32.c
[ "Unlicense" ]
C
cndypuzl_input_hack
void
static void cndypuzl_input_hack(running_machine *machine) { if(cpu_get_pc(machine->device("maincpu")) < amiga_chip_ram_size) { // amiga_chip_ram_w(0x051c02, 0x0000); UINT32 r_A5 = cpu_get_reg(machine->device("maincpu"), M68K_A5); amiga_chip_ram_w(r_A5 - 0x7ebe, 0x0000); } }
/************************************* * * Hacks (to allow coins to be inserted) * *************************************/
Hacks (to allow coins to be inserted)
[ "Hacks", "(", "to", "allow", "coins", "to", "be", "inserted", ")" ]
static void cndypuzl_input_hack(running_machine *machine) { if(cpu_get_pc(machine->device("maincpu")) < amiga_chip_ram_size) { UINT32 r_A5 = cpu_get_reg(machine->device("maincpu"), M68K_A5); amiga_chip_ram_w(r_A5 - 0x7ebe, 0x0000); } }
[ "static", "void", "cndypuzl_input_hack", "(", "running_machine", "*", "machine", ")", "{", "if", "(", "cpu_get_pc", "(", "machine", "->", "device", "(", "\"", "\"", ")", ")", "<", "amiga_chip_ram_size", ")", "{", "UINT32", "r_A5", "=", "cpu_get_reg", "(", "machine", "->", "device", "(", "\"", "\"", ")", ",", "M68K_A5", ")", ";", "amiga_chip_ram_w", "(", "r_A5", "-", "0x7ebe", ",", "0x0000", ")", ";", "}", "}" ]
Hacks (to allow coins to be inserted)
[ "Hacks", "(", "to", "allow", "coins", "to", "be", "inserted", ")" ]
[ "// amiga_chip_ram_w(0x051c02, 0x0000);\r" ]
[ { "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": [] }
ac2df5b47348ea54990216c721a2291a5632b9a9
lofunz/mieme
Reloaded/trunk/src/mame/drivers/cubocd32.c
[ "Unlicense" ]
C
lsrquiz2_input_hack
void
static void lsrquiz2_input_hack(running_machine *machine) { if(cpu_get_pc(machine->device("maincpu")) < amiga_chip_ram_size) { // amiga_chip_ram_w8(0x046107, 0x00); UINT32 r_A5 = cpu_get_reg(machine->device("maincpu"), M68K_A5); UINT32 r_A2 = (amiga_chip_ram_r(r_A5 - 0x7fdc + 0) << 16) | (amiga_chip_ram_r(r_A5 - 0x7fdc + 2)); amiga_chip_ram_w8(r_A2 + 0x17, 0x00); } }
/* The hack isn't working if you exit the test mode with P1 button 2 ! */
The hack isn't working if you exit the test mode with P1 button 2 !
[ "The", "hack", "isn", "'", "t", "working", "if", "you", "exit", "the", "test", "mode", "with", "P1", "button", "2", "!" ]
static void lsrquiz2_input_hack(running_machine *machine) { if(cpu_get_pc(machine->device("maincpu")) < amiga_chip_ram_size) { UINT32 r_A5 = cpu_get_reg(machine->device("maincpu"), M68K_A5); UINT32 r_A2 = (amiga_chip_ram_r(r_A5 - 0x7fdc + 0) << 16) | (amiga_chip_ram_r(r_A5 - 0x7fdc + 2)); amiga_chip_ram_w8(r_A2 + 0x17, 0x00); } }
[ "static", "void", "lsrquiz2_input_hack", "(", "running_machine", "*", "machine", ")", "{", "if", "(", "cpu_get_pc", "(", "machine", "->", "device", "(", "\"", "\"", ")", ")", "<", "amiga_chip_ram_size", ")", "{", "UINT32", "r_A5", "=", "cpu_get_reg", "(", "machine", "->", "device", "(", "\"", "\"", ")", ",", "M68K_A5", ")", ";", "UINT32", "r_A2", "=", "(", "amiga_chip_ram_r", "(", "r_A5", "-", "0x7fdc", "+", "0", ")", "<<", "16", ")", "|", "(", "amiga_chip_ram_r", "(", "r_A5", "-", "0x7fdc", "+", "2", ")", ")", ";", "amiga_chip_ram_w8", "(", "r_A2", "+", "0x17", ",", "0x00", ")", ";", "}", "}" ]
The hack isn't working if you exit the test mode with P1 button 2 !
[ "The", "hack", "isn", "'", "t", "working", "if", "you", "exit", "the", "test", "mode", "with", "P1", "button", "2", "!" ]
[ "// amiga_chip_ram_w8(0x046107, 0x00);\r" ]
[ { "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": [] }
74cb8fc4a1a834b461ea1f85b77e8d277eb7e921
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/info.c
[ "Unlicense" ]
C
print_game_switches
void
static void print_game_switches(FILE *out, const game_driver *game, const input_port_config *portlist) { const input_port_config *port; const input_field_config *field; /* iterate looking for DIP switches */ for (port = portlist; port != NULL; port = port->next) for (field = port->fieldlist; field != NULL; field = field->next) if (field->type == IPT_DIPSWITCH) { const input_setting_config *setting; /* output the switch name information */ fprintf(out, "\t\t<dipswitch name=\"%s\">\n", xml_normalize_string(input_field_name(field))); /* loop over settings */ for (setting = field->settinglist; setting != NULL; setting = setting->next) { fprintf(out, "\t\t\t<dipvalue name=\"%s\"", xml_normalize_string(setting->name)); if (setting->value == field->defvalue) fprintf(out, " default=\"yes\""); fprintf(out, "/>\n"); } /* terminate the switch entry */ fprintf(out, "\t\t</dipswitch>\n"); } }
/*------------------------------------------------- print_game_switches - print the DIP switch settings for a game -------------------------------------------------*/
print the DIP switch settings for a game
[ "print", "the", "DIP", "switch", "settings", "for", "a", "game" ]
static void print_game_switches(FILE *out, const game_driver *game, const input_port_config *portlist) { const input_port_config *port; const input_field_config *field; for (port = portlist; port != NULL; port = port->next) for (field = port->fieldlist; field != NULL; field = field->next) if (field->type == IPT_DIPSWITCH) { const input_setting_config *setting; fprintf(out, "\t\t<dipswitch name=\"%s\">\n", xml_normalize_string(input_field_name(field))); for (setting = field->settinglist; setting != NULL; setting = setting->next) { fprintf(out, "\t\t\t<dipvalue name=\"%s\"", xml_normalize_string(setting->name)); if (setting->value == field->defvalue) fprintf(out, " default=\"yes\""); fprintf(out, "/>\n"); } fprintf(out, "\t\t</dipswitch>\n"); } }
[ "static", "void", "print_game_switches", "(", "FILE", "*", "out", ",", "const", "game_driver", "*", "game", ",", "const", "input_port_config", "*", "portlist", ")", "{", "const", "input_port_config", "*", "port", ";", "const", "input_field_config", "*", "field", ";", "for", "(", "port", "=", "portlist", ";", "port", "!=", "NULL", ";", "port", "=", "port", "->", "next", ")", "for", "(", "field", "=", "port", "->", "fieldlist", ";", "field", "!=", "NULL", ";", "field", "=", "field", "->", "next", ")", "if", "(", "field", "->", "type", "==", "IPT_DIPSWITCH", ")", "{", "const", "input_setting_config", "*", "setting", ";", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\\\"", "\\\"", "\\n", "\"", ",", "xml_normalize_string", "(", "input_field_name", "(", "field", ")", ")", ")", ";", "for", "(", "setting", "=", "field", "->", "settinglist", ";", "setting", "!=", "NULL", ";", "setting", "=", "setting", "->", "next", ")", "{", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\\t", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "setting", "->", "name", ")", ")", ";", "if", "(", "setting", "->", "value", "==", "field", "->", "defvalue", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "fprintf", "(", "out", ",", "\"", "\\n", "\"", ")", ";", "}", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\\n", "\"", ")", ";", "}", "}" ]
print_game_switches - print the DIP switch settings for a game
[ "print_game_switches", "-", "print", "the", "DIP", "switch", "settings", "for", "a", "game" ]
[ "/* iterate looking for DIP switches */", "/* output the switch name information */", "/* loop over settings */", "/* terminate the switch entry */" ]
[ { "param": "out", "type": "FILE" }, { "param": "game", "type": "game_driver" }, { "param": "portlist", "type": "input_port_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "game", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "portlist", "type": "input_port_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
74cb8fc4a1a834b461ea1f85b77e8d277eb7e921
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/info.c
[ "Unlicense" ]
C
print_game_configs
void
static void print_game_configs(FILE *out, const game_driver *game, const input_port_config *portlist) { const input_port_config *port; const input_field_config *field; /* iterate looking for configurations */ for (port = portlist; port != NULL; port = port->next) for (field = port->fieldlist; field != NULL; field = field->next) if (field->type == IPT_CONFIG) { const input_setting_config *setting; /* output the configuration name information */ fprintf(out, "\t\t<configuration name=\"%s\">\n", xml_normalize_string(input_field_name(field))); /* loop over settings */ for (setting = field->settinglist; setting != NULL; setting = setting->next) { fprintf(out, "\t\t\t<confsetting name=\"%s\"", xml_normalize_string(setting->name)); if (setting->value == field->defvalue) fprintf(out, " default=\"yes\""); fprintf(out, "/>\n"); } /* terminate the configuration entry */ fprintf(out, "\t\t</configuration>\n"); } }
/*------------------------------------------------- print_game_configs - print the Configuration settings for a game -------------------------------------------------*/
print the Configuration settings for a game
[ "print", "the", "Configuration", "settings", "for", "a", "game" ]
static void print_game_configs(FILE *out, const game_driver *game, const input_port_config *portlist) { const input_port_config *port; const input_field_config *field; for (port = portlist; port != NULL; port = port->next) for (field = port->fieldlist; field != NULL; field = field->next) if (field->type == IPT_CONFIG) { const input_setting_config *setting; fprintf(out, "\t\t<configuration name=\"%s\">\n", xml_normalize_string(input_field_name(field))); for (setting = field->settinglist; setting != NULL; setting = setting->next) { fprintf(out, "\t\t\t<confsetting name=\"%s\"", xml_normalize_string(setting->name)); if (setting->value == field->defvalue) fprintf(out, " default=\"yes\""); fprintf(out, "/>\n"); } fprintf(out, "\t\t</configuration>\n"); } }
[ "static", "void", "print_game_configs", "(", "FILE", "*", "out", ",", "const", "game_driver", "*", "game", ",", "const", "input_port_config", "*", "portlist", ")", "{", "const", "input_port_config", "*", "port", ";", "const", "input_field_config", "*", "field", ";", "for", "(", "port", "=", "portlist", ";", "port", "!=", "NULL", ";", "port", "=", "port", "->", "next", ")", "for", "(", "field", "=", "port", "->", "fieldlist", ";", "field", "!=", "NULL", ";", "field", "=", "field", "->", "next", ")", "if", "(", "field", "->", "type", "==", "IPT_CONFIG", ")", "{", "const", "input_setting_config", "*", "setting", ";", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\\\"", "\\\"", "\\n", "\"", ",", "xml_normalize_string", "(", "input_field_name", "(", "field", ")", ")", ")", ";", "for", "(", "setting", "=", "field", "->", "settinglist", ";", "setting", "!=", "NULL", ";", "setting", "=", "setting", "->", "next", ")", "{", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\\t", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "setting", "->", "name", ")", ")", ";", "if", "(", "setting", "->", "value", "==", "field", "->", "defvalue", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "fprintf", "(", "out", ",", "\"", "\\n", "\"", ")", ";", "}", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\\n", "\"", ")", ";", "}", "}" ]
print_game_configs - print the Configuration settings for a game
[ "print_game_configs", "-", "print", "the", "Configuration", "settings", "for", "a", "game" ]
[ "/* iterate looking for configurations */", "/* output the configuration name information */", "/* loop over settings */", "/* terminate the configuration entry */" ]
[ { "param": "out", "type": "FILE" }, { "param": "game", "type": "game_driver" }, { "param": "portlist", "type": "input_port_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "game", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "portlist", "type": "input_port_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
74cb8fc4a1a834b461ea1f85b77e8d277eb7e921
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/info.c
[ "Unlicense" ]
C
print_game_adjusters
void
static void print_game_adjusters(FILE *out, const game_driver *game, const input_port_config *portlist) { const input_port_config *port; const input_field_config *field; /* iterate looking for Adjusters */ for (port = portlist; port != NULL; port = port->next) for (field = port->fieldlist; field != NULL; field = field->next) if (field->type == IPT_ADJUSTER) { /* output the adjuster information */ fprintf(out, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", xml_normalize_string(input_field_name(field)), field->defvalue); } }
/*------------------------------------------------- print_game_adjusters - print the Analog Adjusters for a game -------------------------------------------------*/
print the Analog Adjusters for a game
[ "print", "the", "Analog", "Adjusters", "for", "a", "game" ]
static void print_game_adjusters(FILE *out, const game_driver *game, const input_port_config *portlist) { const input_port_config *port; const input_field_config *field; for (port = portlist; port != NULL; port = port->next) for (field = port->fieldlist; field != NULL; field = field->next) if (field->type == IPT_ADJUSTER) { fprintf(out, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", xml_normalize_string(input_field_name(field)), field->defvalue); } }
[ "static", "void", "print_game_adjusters", "(", "FILE", "*", "out", ",", "const", "game_driver", "*", "game", ",", "const", "input_port_config", "*", "portlist", ")", "{", "const", "input_port_config", "*", "port", ";", "const", "input_field_config", "*", "field", ";", "for", "(", "port", "=", "portlist", ";", "port", "!=", "NULL", ";", "port", "=", "port", "->", "next", ")", "for", "(", "field", "=", "port", "->", "fieldlist", ";", "field", "!=", "NULL", ";", "field", "=", "field", "->", "next", ")", "if", "(", "field", "->", "type", "==", "IPT_ADJUSTER", ")", "{", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\\\"", "\\\"", "\\\"", "\\\"", "\\n", "\"", ",", "xml_normalize_string", "(", "input_field_name", "(", "field", ")", ")", ",", "field", "->", "defvalue", ")", ";", "}", "}" ]
print_game_adjusters - print the Analog Adjusters for a game
[ "print_game_adjusters", "-", "print", "the", "Analog", "Adjusters", "for", "a", "game" ]
[ "/* iterate looking for Adjusters */", "/* output the adjuster information */" ]
[ { "param": "out", "type": "FILE" }, { "param": "game", "type": "game_driver" }, { "param": "portlist", "type": "input_port_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "game", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "portlist", "type": "input_port_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
74cb8fc4a1a834b461ea1f85b77e8d277eb7e921
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/info.c
[ "Unlicense" ]
C
print_game_rom
void
static void print_game_rom(FILE *out, const game_driver *game, const machine_config *config) { const game_driver *clone_of = driver_get_clone(game); int rom_type; machine_config *pconfig = (clone_of != NULL) ? machine_config_alloc(clone_of->machine_config) : NULL; /* iterate over 3 different ROM "types": BIOS, ROMs, DISKs */ for (rom_type = 0; rom_type < 3; rom_type++) { const rom_source *source; const rom_entry *region; /* iterate over ROM sources: first the game, then any devices */ for (source = rom_first_source(game, config); source != NULL; source = rom_next_source(game, config, source)) for (region = rom_first_region(game, source); region != NULL; region = rom_next_region(region)) { int is_disk = ROMREGION_ISDISKDATA(region); const rom_entry *rom; /* disk regions only work for disks */ if ((is_disk && rom_type != 2) || (!is_disk && rom_type == 2)) continue; /* iterate through ROM entries */ for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) { int is_bios = ROM_GETBIOSFLAGS(rom); const char *name = ROM_GETNAME(rom); int offset = ROM_GETOFFSET(rom); const rom_entry *parent_rom = NULL; char bios_name[100]; /* BIOS ROMs only apply to bioses */ if ((is_bios && rom_type != 0) || (!is_bios && rom_type == 0)) continue; /* if we have a valid ROM and we are a clone, see if we can find the parent ROM */ if (!ROM_NOGOODDUMP(rom) && clone_of != NULL) { const rom_source *psource; const rom_entry *pregion, *prom; /* scan the clone_of ROM for a matching ROM entry */ for (psource = rom_first_source(clone_of, pconfig); psource != NULL; psource = rom_next_source(clone_of, pconfig, psource)) for (pregion = rom_first_region(clone_of, psource); pregion != NULL; pregion = rom_next_region(pregion)) for (prom = rom_first_file(pregion); prom != NULL; prom = rom_next_file(prom)) if (hash_data_is_equal(ROM_GETHASHDATA(rom), ROM_GETHASHDATA(prom), 0)) { parent_rom = prom; break; } } /* scan for a BIOS name */ bios_name[0] = 0; if (!is_disk && is_bios) { const rom_entry *brom; /* scan backwards through the ROM entries */ for (brom = rom - 1; brom != game->rom; brom--) if (ROMENTRY_ISSYSTEM_BIOS(brom)) { strcpy(bios_name, ROM_GETNAME(brom)); break; } } /* opening tag */ if (!is_disk) fprintf(out, "\t\t<rom"); else fprintf(out, "\t\t<disk"); /* add name, merge, bios, and size tags */ if (name != NULL && name[0] != 0) fprintf(out, " name=\"%s\"", xml_normalize_string(name)); if (parent_rom != NULL) fprintf(out, " merge=\"%s\"", xml_normalize_string(ROM_GETNAME(parent_rom))); if (bios_name[0] != 0) fprintf(out, " bios=\"%s\"", xml_normalize_string(bios_name)); if (!is_disk) fprintf(out, " size=\"%d\"", rom_file_size(rom)); /* dump checksum information only if there is a known dump */ if (!hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) { char checksum[HASH_BUF_SIZE]; int hashtype; /* iterate over hash function types and print out their values */ for (hashtype = 0; hashtype < HASH_NUM_FUNCTIONS; hashtype++) if (hash_data_extract_printable_checksum(ROM_GETHASHDATA(rom), 1 << hashtype, checksum)) fprintf(out, " %s=\"%s\"", hash_function_name(1 << hashtype), checksum); } /* append a region name */ fprintf(out, " region=\"%s\"", ROMREGION_GETTAG(region)); /* add nodump/baddump flags */ if (hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) fprintf(out, " status=\"nodump\""); if (hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_BAD_DUMP)) fprintf(out, " status=\"baddump\""); /* for non-disk entries, print offset */ if (!is_disk) fprintf(out, " offset=\"%x\"", offset); /* for disk entries, add the disk index */ else fprintf(out, " index=\"%x\"", DISK_GETINDEX(rom)); /* add optional flag */ if ((!is_disk && ROM_ISOPTIONAL(rom)) || (is_disk && DISK_ISOPTIONAL(rom))) fprintf(out, " optional=\"yes\""); fprintf(out, "/>\n"); } } } if (pconfig != NULL) machine_config_free(pconfig); }
/*------------------------------------------------- print_game_rom - print the roms section of the XML output -------------------------------------------------*/
print the roms section of the XML output
[ "print", "the", "roms", "section", "of", "the", "XML", "output" ]
static void print_game_rom(FILE *out, const game_driver *game, const machine_config *config) { const game_driver *clone_of = driver_get_clone(game); int rom_type; machine_config *pconfig = (clone_of != NULL) ? machine_config_alloc(clone_of->machine_config) : NULL; for (rom_type = 0; rom_type < 3; rom_type++) { const rom_source *source; const rom_entry *region; for (source = rom_first_source(game, config); source != NULL; source = rom_next_source(game, config, source)) for (region = rom_first_region(game, source); region != NULL; region = rom_next_region(region)) { int is_disk = ROMREGION_ISDISKDATA(region); const rom_entry *rom; if ((is_disk && rom_type != 2) || (!is_disk && rom_type == 2)) continue; for (rom = rom_first_file(region); rom != NULL; rom = rom_next_file(rom)) { int is_bios = ROM_GETBIOSFLAGS(rom); const char *name = ROM_GETNAME(rom); int offset = ROM_GETOFFSET(rom); const rom_entry *parent_rom = NULL; char bios_name[100]; if ((is_bios && rom_type != 0) || (!is_bios && rom_type == 0)) continue; if (!ROM_NOGOODDUMP(rom) && clone_of != NULL) { const rom_source *psource; const rom_entry *pregion, *prom; for (psource = rom_first_source(clone_of, pconfig); psource != NULL; psource = rom_next_source(clone_of, pconfig, psource)) for (pregion = rom_first_region(clone_of, psource); pregion != NULL; pregion = rom_next_region(pregion)) for (prom = rom_first_file(pregion); prom != NULL; prom = rom_next_file(prom)) if (hash_data_is_equal(ROM_GETHASHDATA(rom), ROM_GETHASHDATA(prom), 0)) { parent_rom = prom; break; } } bios_name[0] = 0; if (!is_disk && is_bios) { const rom_entry *brom; for (brom = rom - 1; brom != game->rom; brom--) if (ROMENTRY_ISSYSTEM_BIOS(brom)) { strcpy(bios_name, ROM_GETNAME(brom)); break; } } if (!is_disk) fprintf(out, "\t\t<rom"); else fprintf(out, "\t\t<disk"); if (name != NULL && name[0] != 0) fprintf(out, " name=\"%s\"", xml_normalize_string(name)); if (parent_rom != NULL) fprintf(out, " merge=\"%s\"", xml_normalize_string(ROM_GETNAME(parent_rom))); if (bios_name[0] != 0) fprintf(out, " bios=\"%s\"", xml_normalize_string(bios_name)); if (!is_disk) fprintf(out, " size=\"%d\"", rom_file_size(rom)); if (!hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) { char checksum[HASH_BUF_SIZE]; int hashtype; for (hashtype = 0; hashtype < HASH_NUM_FUNCTIONS; hashtype++) if (hash_data_extract_printable_checksum(ROM_GETHASHDATA(rom), 1 << hashtype, checksum)) fprintf(out, " %s=\"%s\"", hash_function_name(1 << hashtype), checksum); } fprintf(out, " region=\"%s\"", ROMREGION_GETTAG(region)); if (hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_NO_DUMP)) fprintf(out, " status=\"nodump\""); if (hash_data_has_info(ROM_GETHASHDATA(rom), HASH_INFO_BAD_DUMP)) fprintf(out, " status=\"baddump\""); if (!is_disk) fprintf(out, " offset=\"%x\"", offset); else fprintf(out, " index=\"%x\"", DISK_GETINDEX(rom)); if ((!is_disk && ROM_ISOPTIONAL(rom)) || (is_disk && DISK_ISOPTIONAL(rom))) fprintf(out, " optional=\"yes\""); fprintf(out, "/>\n"); } } } if (pconfig != NULL) machine_config_free(pconfig); }
[ "static", "void", "print_game_rom", "(", "FILE", "*", "out", ",", "const", "game_driver", "*", "game", ",", "const", "machine_config", "*", "config", ")", "{", "const", "game_driver", "*", "clone_of", "=", "driver_get_clone", "(", "game", ")", ";", "int", "rom_type", ";", "machine_config", "*", "pconfig", "=", "(", "clone_of", "!=", "NULL", ")", "?", "machine_config_alloc", "(", "clone_of", "->", "machine_config", ")", ":", "NULL", ";", "for", "(", "rom_type", "=", "0", ";", "rom_type", "<", "3", ";", "rom_type", "++", ")", "{", "const", "rom_source", "*", "source", ";", "const", "rom_entry", "*", "region", ";", "for", "(", "source", "=", "rom_first_source", "(", "game", ",", "config", ")", ";", "source", "!=", "NULL", ";", "source", "=", "rom_next_source", "(", "game", ",", "config", ",", "source", ")", ")", "for", "(", "region", "=", "rom_first_region", "(", "game", ",", "source", ")", ";", "region", "!=", "NULL", ";", "region", "=", "rom_next_region", "(", "region", ")", ")", "{", "int", "is_disk", "=", "ROMREGION_ISDISKDATA", "(", "region", ")", ";", "const", "rom_entry", "*", "rom", ";", "if", "(", "(", "is_disk", "&&", "rom_type", "!=", "2", ")", "||", "(", "!", "is_disk", "&&", "rom_type", "==", "2", ")", ")", "continue", ";", "for", "(", "rom", "=", "rom_first_file", "(", "region", ")", ";", "rom", "!=", "NULL", ";", "rom", "=", "rom_next_file", "(", "rom", ")", ")", "{", "int", "is_bios", "=", "ROM_GETBIOSFLAGS", "(", "rom", ")", ";", "const", "char", "*", "name", "=", "ROM_GETNAME", "(", "rom", ")", ";", "int", "offset", "=", "ROM_GETOFFSET", "(", "rom", ")", ";", "const", "rom_entry", "*", "parent_rom", "=", "NULL", ";", "char", "bios_name", "[", "100", "]", ";", "if", "(", "(", "is_bios", "&&", "rom_type", "!=", "0", ")", "||", "(", "!", "is_bios", "&&", "rom_type", "==", "0", ")", ")", "continue", ";", "if", "(", "!", "ROM_NOGOODDUMP", "(", "rom", ")", "&&", "clone_of", "!=", "NULL", ")", "{", "const", "rom_source", "*", "psource", ";", "const", "rom_entry", "*", "pregion", ",", "*", "prom", ";", "for", "(", "psource", "=", "rom_first_source", "(", "clone_of", ",", "pconfig", ")", ";", "psource", "!=", "NULL", ";", "psource", "=", "rom_next_source", "(", "clone_of", ",", "pconfig", ",", "psource", ")", ")", "for", "(", "pregion", "=", "rom_first_region", "(", "clone_of", ",", "psource", ")", ";", "pregion", "!=", "NULL", ";", "pregion", "=", "rom_next_region", "(", "pregion", ")", ")", "for", "(", "prom", "=", "rom_first_file", "(", "pregion", ")", ";", "prom", "!=", "NULL", ";", "prom", "=", "rom_next_file", "(", "prom", ")", ")", "if", "(", "hash_data_is_equal", "(", "ROM_GETHASHDATA", "(", "rom", ")", ",", "ROM_GETHASHDATA", "(", "prom", ")", ",", "0", ")", ")", "{", "parent_rom", "=", "prom", ";", "break", ";", "}", "}", "bios_name", "[", "0", "]", "=", "0", ";", "if", "(", "!", "is_disk", "&&", "is_bios", ")", "{", "const", "rom_entry", "*", "brom", ";", "for", "(", "brom", "=", "rom", "-", "1", ";", "brom", "!=", "game", "->", "rom", ";", "brom", "--", ")", "if", "(", "ROMENTRY_ISSYSTEM_BIOS", "(", "brom", ")", ")", "{", "strcpy", "(", "bios_name", ",", "ROM_GETNAME", "(", "brom", ")", ")", ";", "break", ";", "}", "}", "if", "(", "!", "is_disk", ")", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\"", ")", ";", "else", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\"", ")", ";", "if", "(", "name", "!=", "NULL", "&&", "name", "[", "0", "]", "!=", "0", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "name", ")", ")", ";", "if", "(", "parent_rom", "!=", "NULL", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "ROM_GETNAME", "(", "parent_rom", ")", ")", ")", ";", "if", "(", "bios_name", "[", "0", "]", "!=", "0", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "bios_name", ")", ")", ";", "if", "(", "!", "is_disk", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "rom_file_size", "(", "rom", ")", ")", ";", "if", "(", "!", "hash_data_has_info", "(", "ROM_GETHASHDATA", "(", "rom", ")", ",", "HASH_INFO_NO_DUMP", ")", ")", "{", "char", "checksum", "[", "HASH_BUF_SIZE", "]", ";", "int", "hashtype", ";", "for", "(", "hashtype", "=", "0", ";", "hashtype", "<", "HASH_NUM_FUNCTIONS", ";", "hashtype", "++", ")", "if", "(", "hash_data_extract_printable_checksum", "(", "ROM_GETHASHDATA", "(", "rom", ")", ",", "1", "<<", "hashtype", ",", "checksum", ")", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "hash_function_name", "(", "1", "<<", "hashtype", ")", ",", "checksum", ")", ";", "}", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "ROMREGION_GETTAG", "(", "region", ")", ")", ";", "if", "(", "hash_data_has_info", "(", "ROM_GETHASHDATA", "(", "rom", ")", ",", "HASH_INFO_NO_DUMP", ")", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "if", "(", "hash_data_has_info", "(", "ROM_GETHASHDATA", "(", "rom", ")", ",", "HASH_INFO_BAD_DUMP", ")", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "if", "(", "!", "is_disk", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "offset", ")", ";", "else", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "DISK_GETINDEX", "(", "rom", ")", ")", ";", "if", "(", "(", "!", "is_disk", "&&", "ROM_ISOPTIONAL", "(", "rom", ")", ")", "||", "(", "is_disk", "&&", "DISK_ISOPTIONAL", "(", "rom", ")", ")", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "fprintf", "(", "out", ",", "\"", "\\n", "\"", ")", ";", "}", "}", "}", "if", "(", "pconfig", "!=", "NULL", ")", "machine_config_free", "(", "pconfig", ")", ";", "}" ]
print_game_rom - print the roms section of the XML output
[ "print_game_rom", "-", "print", "the", "roms", "section", "of", "the", "XML", "output" ]
[ "/* iterate over 3 different ROM \"types\": BIOS, ROMs, DISKs */", "/* iterate over ROM sources: first the game, then any devices */", "/* disk regions only work for disks */", "/* iterate through ROM entries */", "/* BIOS ROMs only apply to bioses */", "/* if we have a valid ROM and we are a clone, see if we can find the parent ROM */", "/* scan the clone_of ROM for a matching ROM entry */", "/* scan for a BIOS name */", "/* scan backwards through the ROM entries */", "/* opening tag */", "/* add name, merge, bios, and size tags */", "/* dump checksum information only if there is a known dump */", "/* iterate over hash function types and print out their values */", "/* append a region name */", "/* add nodump/baddump flags */", "/* for non-disk entries, print offset */", "/* for disk entries, add the disk index */", "/* add optional flag */" ]
[ { "param": "out", "type": "FILE" }, { "param": "game", "type": "game_driver" }, { "param": "config", "type": "machine_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "game", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": "machine_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
74cb8fc4a1a834b461ea1f85b77e8d277eb7e921
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/info.c
[ "Unlicense" ]
C
print_game_sampleof
void
static void print_game_sampleof(FILE *out, const game_driver *game, const machine_config *config) { #if (HAS_SAMPLES) const device_config *device; for (device = sound_first(config); device != NULL; device = sound_next(device)) if (sound_get_type(device) == SOUND_SAMPLES) { const char *const *samplenames = ((const samples_interface *)device->static_config)->samplenames; if (samplenames != NULL) { int sampnum; /* iterate over sample names */ for (sampnum = 0; samplenames[sampnum] != NULL; sampnum++) { const char *cursampname = samplenames[sampnum]; /* only output sampleof if different from the game name */ if (cursampname[0] == '*' && strcmp(cursampname + 1, game->name) != 0) fprintf(out, " sampleof=\"%s\"", xml_normalize_string(cursampname + 1)); } } } #endif }
/*------------------------------------------------- print_game_sampleof - print the 'sampleof' attribute, if appropriate -------------------------------------------------*/
print the 'sampleof' attribute, if appropriate
[ "print", "the", "'", "sampleof", "'", "attribute", "if", "appropriate" ]
static void print_game_sampleof(FILE *out, const game_driver *game, const machine_config *config) { #if (HAS_SAMPLES) const device_config *device; for (device = sound_first(config); device != NULL; device = sound_next(device)) if (sound_get_type(device) == SOUND_SAMPLES) { const char *const *samplenames = ((const samples_interface *)device->static_config)->samplenames; if (samplenames != NULL) { int sampnum; for (sampnum = 0; samplenames[sampnum] != NULL; sampnum++) { const char *cursampname = samplenames[sampnum]; if (cursampname[0] == '*' && strcmp(cursampname + 1, game->name) != 0) fprintf(out, " sampleof=\"%s\"", xml_normalize_string(cursampname + 1)); } } } #endif }
[ "static", "void", "print_game_sampleof", "(", "FILE", "*", "out", ",", "const", "game_driver", "*", "game", ",", "const", "machine_config", "*", "config", ")", "{", "#if", "(", "HAS_SAMPLES", ")", "\n", "const", "device_config", "*", "device", ";", "for", "(", "device", "=", "sound_first", "(", "config", ")", ";", "device", "!=", "NULL", ";", "device", "=", "sound_next", "(", "device", ")", ")", "if", "(", "sound_get_type", "(", "device", ")", "==", "SOUND_SAMPLES", ")", "{", "const", "char", "*", "const", "*", "samplenames", "=", "(", "(", "const", "samples_interface", "*", ")", "device", "->", "static_config", ")", "->", "samplenames", ";", "if", "(", "samplenames", "!=", "NULL", ")", "{", "int", "sampnum", ";", "for", "(", "sampnum", "=", "0", ";", "samplenames", "[", "sampnum", "]", "!=", "NULL", ";", "sampnum", "++", ")", "{", "const", "char", "*", "cursampname", "=", "samplenames", "[", "sampnum", "]", ";", "if", "(", "cursampname", "[", "0", "]", "==", "'", "'", "&&", "strcmp", "(", "cursampname", "+", "1", ",", "game", "->", "name", ")", "!=", "0", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "cursampname", "+", "1", ")", ")", ";", "}", "}", "}", "#endif", "}" ]
print_game_sampleof - print the 'sampleof' attribute, if appropriate
[ "print_game_sampleof", "-", "print", "the", "'", "sampleof", "'", "attribute", "if", "appropriate" ]
[ "/* iterate over sample names */", "/* only output sampleof if different from the game name */" ]
[ { "param": "out", "type": "FILE" }, { "param": "game", "type": "game_driver" }, { "param": "config", "type": "machine_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "game", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": "machine_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
74cb8fc4a1a834b461ea1f85b77e8d277eb7e921
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/info.c
[ "Unlicense" ]
C
print_game_sample
void
static void print_game_sample(FILE *out, const game_driver *game, const machine_config *config) { #if (HAS_SAMPLES) const device_config *device; /* iterate over sound chips looking for samples */ for (device = sound_first(config); device != NULL; device = sound_next(device)) if (sound_get_type(device) == SOUND_SAMPLES) { const char *const *samplenames = ((const samples_interface *)device->static_config)->samplenames; if (samplenames != NULL) { int sampnum; /* iterate over sample names */ for (sampnum = 0; samplenames[sampnum] != NULL; sampnum++) { const char *cursampname = samplenames[sampnum]; int dupnum; /* ignore the special '*' samplename */ if (sampnum == 0 && cursampname[0] == '*') continue; /* filter out duplicates */ for (dupnum = 0; dupnum < sampnum; dupnum++) if (strcmp(samplenames[dupnum], cursampname) == 0) break; if (dupnum < sampnum) continue; /* output the sample name */ fprintf(out, "\t\t<sample name=\"%s\"/>\n", xml_normalize_string(cursampname)); } } } #endif }
/*------------------------------------------------- print_game_sample - print a list of all samples referenced by a game_driver -------------------------------------------------*/
print a list of all samples referenced by a game_driver
[ "print", "a", "list", "of", "all", "samples", "referenced", "by", "a", "game_driver" ]
static void print_game_sample(FILE *out, const game_driver *game, const machine_config *config) { #if (HAS_SAMPLES) const device_config *device; for (device = sound_first(config); device != NULL; device = sound_next(device)) if (sound_get_type(device) == SOUND_SAMPLES) { const char *const *samplenames = ((const samples_interface *)device->static_config)->samplenames; if (samplenames != NULL) { int sampnum; for (sampnum = 0; samplenames[sampnum] != NULL; sampnum++) { const char *cursampname = samplenames[sampnum]; int dupnum; if (sampnum == 0 && cursampname[0] == '*') continue; for (dupnum = 0; dupnum < sampnum; dupnum++) if (strcmp(samplenames[dupnum], cursampname) == 0) break; if (dupnum < sampnum) continue; fprintf(out, "\t\t<sample name=\"%s\"/>\n", xml_normalize_string(cursampname)); } } } #endif }
[ "static", "void", "print_game_sample", "(", "FILE", "*", "out", ",", "const", "game_driver", "*", "game", ",", "const", "machine_config", "*", "config", ")", "{", "#if", "(", "HAS_SAMPLES", ")", "\n", "const", "device_config", "*", "device", ";", "for", "(", "device", "=", "sound_first", "(", "config", ")", ";", "device", "!=", "NULL", ";", "device", "=", "sound_next", "(", "device", ")", ")", "if", "(", "sound_get_type", "(", "device", ")", "==", "SOUND_SAMPLES", ")", "{", "const", "char", "*", "const", "*", "samplenames", "=", "(", "(", "const", "samples_interface", "*", ")", "device", "->", "static_config", ")", "->", "samplenames", ";", "if", "(", "samplenames", "!=", "NULL", ")", "{", "int", "sampnum", ";", "for", "(", "sampnum", "=", "0", ";", "samplenames", "[", "sampnum", "]", "!=", "NULL", ";", "sampnum", "++", ")", "{", "const", "char", "*", "cursampname", "=", "samplenames", "[", "sampnum", "]", ";", "int", "dupnum", ";", "if", "(", "sampnum", "==", "0", "&&", "cursampname", "[", "0", "]", "==", "'", "'", ")", "continue", ";", "for", "(", "dupnum", "=", "0", ";", "dupnum", "<", "sampnum", ";", "dupnum", "++", ")", "if", "(", "strcmp", "(", "samplenames", "[", "dupnum", "]", ",", "cursampname", ")", "==", "0", ")", "break", ";", "if", "(", "dupnum", "<", "sampnum", ")", "continue", ";", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\\\"", "\\\"", "\\n", "\"", ",", "xml_normalize_string", "(", "cursampname", ")", ")", ";", "}", "}", "}", "#endif", "}" ]
print_game_sample - print a list of all samples referenced by a game_driver
[ "print_game_sample", "-", "print", "a", "list", "of", "all", "samples", "referenced", "by", "a", "game_driver" ]
[ "/* iterate over sound chips looking for samples */", "/* iterate over sample names */", "/* ignore the special '*' samplename */", "/* filter out duplicates */", "/* output the sample name */" ]
[ { "param": "out", "type": "FILE" }, { "param": "game", "type": "game_driver" }, { "param": "config", "type": "machine_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "game", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": "machine_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
74cb8fc4a1a834b461ea1f85b77e8d277eb7e921
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/info.c
[ "Unlicense" ]
C
print_game_chips
void
static void print_game_chips(FILE *out, const game_driver *game, const machine_config *config) { const device_config *device; /* iterate over CPUs */ for (device = cpu_first(config); device != NULL; device = cpu_next(device)) { fprintf(out, "\t\t<chip"); fprintf(out, " type=\"cpu\""); fprintf(out, " tag=\"%s\"", xml_normalize_string(device->tag)); fprintf(out, " name=\"%s\"", xml_normalize_string(device_get_name(device))); fprintf(out, " clock=\"%d\"", device->clock); fprintf(out, "/>\n"); } /* iterate over sound chips */ for (device = sound_first(config); device != NULL; device = sound_next(device)) { fprintf(out, "\t\t<chip"); fprintf(out, " type=\"audio\""); fprintf(out, " tag=\"%s\"", xml_normalize_string(device->tag)); fprintf(out, " name=\"%s\"", xml_normalize_string(device_get_name(device))); if (device->clock != 0) fprintf(out, " clock=\"%d\"", device->clock); fprintf(out, "/>\n"); } }
/*------------------------------------------------- print_game_chips - print a list of CPU and sound chips used by a game -------------------------------------------------*/
print a list of CPU and sound chips used by a game
[ "print", "a", "list", "of", "CPU", "and", "sound", "chips", "used", "by", "a", "game" ]
static void print_game_chips(FILE *out, const game_driver *game, const machine_config *config) { const device_config *device; for (device = cpu_first(config); device != NULL; device = cpu_next(device)) { fprintf(out, "\t\t<chip"); fprintf(out, " type=\"cpu\""); fprintf(out, " tag=\"%s\"", xml_normalize_string(device->tag)); fprintf(out, " name=\"%s\"", xml_normalize_string(device_get_name(device))); fprintf(out, " clock=\"%d\"", device->clock); fprintf(out, "/>\n"); } for (device = sound_first(config); device != NULL; device = sound_next(device)) { fprintf(out, "\t\t<chip"); fprintf(out, " type=\"audio\""); fprintf(out, " tag=\"%s\"", xml_normalize_string(device->tag)); fprintf(out, " name=\"%s\"", xml_normalize_string(device_get_name(device))); if (device->clock != 0) fprintf(out, " clock=\"%d\"", device->clock); fprintf(out, "/>\n"); } }
[ "static", "void", "print_game_chips", "(", "FILE", "*", "out", ",", "const", "game_driver", "*", "game", ",", "const", "machine_config", "*", "config", ")", "{", "const", "device_config", "*", "device", ";", "for", "(", "device", "=", "cpu_first", "(", "config", ")", ";", "device", "!=", "NULL", ";", "device", "=", "cpu_next", "(", "device", ")", ")", "{", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\"", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "device", "->", "tag", ")", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "device_get_name", "(", "device", ")", ")", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "device", "->", "clock", ")", ";", "fprintf", "(", "out", ",", "\"", "\\n", "\"", ")", ";", "}", "for", "(", "device", "=", "sound_first", "(", "config", ")", ";", "device", "!=", "NULL", ";", "device", "=", "sound_next", "(", "device", ")", ")", "{", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\"", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "device", "->", "tag", ")", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "xml_normalize_string", "(", "device_get_name", "(", "device", ")", ")", ")", ";", "if", "(", "device", "->", "clock", "!=", "0", ")", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "device", "->", "clock", ")", ";", "fprintf", "(", "out", ",", "\"", "\\n", "\"", ")", ";", "}", "}" ]
print_game_chips - print a list of CPU and sound chips used by a game
[ "print_game_chips", "-", "print", "a", "list", "of", "CPU", "and", "sound", "chips", "used", "by", "a", "game" ]
[ "/* iterate over CPUs */", "/* iterate over sound chips */" ]
[ { "param": "out", "type": "FILE" }, { "param": "game", "type": "game_driver" }, { "param": "config", "type": "machine_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "game", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": "machine_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
74cb8fc4a1a834b461ea1f85b77e8d277eb7e921
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/info.c
[ "Unlicense" ]
C
print_game_display
void
static void print_game_display(FILE *out, const game_driver *game, const machine_config *config) { const device_config *screen; /* iterate over screens */ for (screen = video_screen_first(config); screen != NULL; screen = video_screen_next(screen)) { const screen_config *scrconfig = (const screen_config *)screen->inline_config; fprintf(out, "\t\t<display"); switch (scrconfig->type) { case SCREEN_TYPE_RASTER: fprintf(out, " type=\"raster\""); break; case SCREEN_TYPE_VECTOR: fprintf(out, " type=\"vector\""); break; case SCREEN_TYPE_LCD: fprintf(out, " type=\"lcd\""); break; default: fprintf(out, " type=\"unknown\""); break; } /* output the orientation as a string */ switch (game->flags & ORIENTATION_MASK) { case ORIENTATION_FLIP_X: fprintf(out, " rotate=\"0\" flipx=\"yes\""); break; case ORIENTATION_FLIP_Y: fprintf(out, " rotate=\"180\" flipx=\"yes\""); break; case ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: fprintf(out, " rotate=\"180\""); break; case ORIENTATION_SWAP_XY: fprintf(out, " rotate=\"90\" flipx=\"yes\""); break; case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X: fprintf(out, " rotate=\"90\""); break; case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y: fprintf(out, " rotate=\"270\""); break; case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: fprintf(out, " rotate=\"270\" flipx=\"yes\""); break; default: fprintf(out, " rotate=\"0\""); break; } /* output width and height only for games that are not vector */ if (scrconfig->type != SCREEN_TYPE_VECTOR) { int dx = scrconfig->visarea.max_x - scrconfig->visarea.min_x + 1; int dy = scrconfig->visarea.max_y - scrconfig->visarea.min_y + 1; fprintf(out, " width=\"%d\"", dx); fprintf(out, " height=\"%d\"", dy); } /* output refresh rate */ fprintf(out, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(scrconfig->refresh)); /* output raw video parameters only for games that are not vector */ /* and had raw parameters specified */ if ((scrconfig->type != SCREEN_TYPE_VECTOR) && !scrconfig->oldstyle_vblank_supplied) { int pixclock = scrconfig->width * scrconfig->height * ATTOSECONDS_TO_HZ(scrconfig->refresh); fprintf(out, " pixclock=\"%d\"", pixclock); fprintf(out, " htotal=\"%d\"", scrconfig->width); fprintf(out, " hbend=\"%d\"", scrconfig->visarea.min_x); fprintf(out, " hbstart=\"%d\"", scrconfig->visarea.max_x+1); fprintf(out, " vtotal=\"%d\"", scrconfig->height); fprintf(out, " vbend=\"%d\"", scrconfig->visarea.min_y); fprintf(out, " vbstart=\"%d\"", scrconfig->visarea.max_y+1); } fprintf(out, " />\n"); } }
/*------------------------------------------------- print_game_display - print a list of all the displays -------------------------------------------------*/
print a list of all the displays
[ "print", "a", "list", "of", "all", "the", "displays" ]
static void print_game_display(FILE *out, const game_driver *game, const machine_config *config) { const device_config *screen; for (screen = video_screen_first(config); screen != NULL; screen = video_screen_next(screen)) { const screen_config *scrconfig = (const screen_config *)screen->inline_config; fprintf(out, "\t\t<display"); switch (scrconfig->type) { case SCREEN_TYPE_RASTER: fprintf(out, " type=\"raster\""); break; case SCREEN_TYPE_VECTOR: fprintf(out, " type=\"vector\""); break; case SCREEN_TYPE_LCD: fprintf(out, " type=\"lcd\""); break; default: fprintf(out, " type=\"unknown\""); break; } switch (game->flags & ORIENTATION_MASK) { case ORIENTATION_FLIP_X: fprintf(out, " rotate=\"0\" flipx=\"yes\""); break; case ORIENTATION_FLIP_Y: fprintf(out, " rotate=\"180\" flipx=\"yes\""); break; case ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: fprintf(out, " rotate=\"180\""); break; case ORIENTATION_SWAP_XY: fprintf(out, " rotate=\"90\" flipx=\"yes\""); break; case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X: fprintf(out, " rotate=\"90\""); break; case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y: fprintf(out, " rotate=\"270\""); break; case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: fprintf(out, " rotate=\"270\" flipx=\"yes\""); break; default: fprintf(out, " rotate=\"0\""); break; } if (scrconfig->type != SCREEN_TYPE_VECTOR) { int dx = scrconfig->visarea.max_x - scrconfig->visarea.min_x + 1; int dy = scrconfig->visarea.max_y - scrconfig->visarea.min_y + 1; fprintf(out, " width=\"%d\"", dx); fprintf(out, " height=\"%d\"", dy); } fprintf(out, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(scrconfig->refresh)); if ((scrconfig->type != SCREEN_TYPE_VECTOR) && !scrconfig->oldstyle_vblank_supplied) { int pixclock = scrconfig->width * scrconfig->height * ATTOSECONDS_TO_HZ(scrconfig->refresh); fprintf(out, " pixclock=\"%d\"", pixclock); fprintf(out, " htotal=\"%d\"", scrconfig->width); fprintf(out, " hbend=\"%d\"", scrconfig->visarea.min_x); fprintf(out, " hbstart=\"%d\"", scrconfig->visarea.max_x+1); fprintf(out, " vtotal=\"%d\"", scrconfig->height); fprintf(out, " vbend=\"%d\"", scrconfig->visarea.min_y); fprintf(out, " vbstart=\"%d\"", scrconfig->visarea.max_y+1); } fprintf(out, " />\n"); } }
[ "static", "void", "print_game_display", "(", "FILE", "*", "out", ",", "const", "game_driver", "*", "game", ",", "const", "machine_config", "*", "config", ")", "{", "const", "device_config", "*", "screen", ";", "for", "(", "screen", "=", "video_screen_first", "(", "config", ")", ";", "screen", "!=", "NULL", ";", "screen", "=", "video_screen_next", "(", "screen", ")", ")", "{", "const", "screen_config", "*", "scrconfig", "=", "(", "const", "screen_config", "*", ")", "screen", "->", "inline_config", ";", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\"", ")", ";", "switch", "(", "scrconfig", "->", "type", ")", "{", "case", "SCREEN_TYPE_RASTER", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "case", "SCREEN_TYPE_VECTOR", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "case", "SCREEN_TYPE_LCD", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "default", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "}", "switch", "(", "game", "->", "flags", "&", "ORIENTATION_MASK", ")", "{", "case", "ORIENTATION_FLIP_X", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "case", "ORIENTATION_FLIP_Y", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "case", "ORIENTATION_FLIP_X", "|", "ORIENTATION_FLIP_Y", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "case", "ORIENTATION_SWAP_XY", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "case", "ORIENTATION_SWAP_XY", "|", "ORIENTATION_FLIP_X", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "case", "ORIENTATION_SWAP_XY", "|", "ORIENTATION_FLIP_Y", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "case", "ORIENTATION_SWAP_XY", "|", "ORIENTATION_FLIP_X", "|", "ORIENTATION_FLIP_Y", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "default", ":", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ")", ";", "break", ";", "}", "if", "(", "scrconfig", "->", "type", "!=", "SCREEN_TYPE_VECTOR", ")", "{", "int", "dx", "=", "scrconfig", "->", "visarea", ".", "max_x", "-", "scrconfig", "->", "visarea", ".", "min_x", "+", "1", ";", "int", "dy", "=", "scrconfig", "->", "visarea", ".", "max_y", "-", "scrconfig", "->", "visarea", ".", "min_y", "+", "1", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "dx", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "dy", ")", ";", "}", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "ATTOSECONDS_TO_HZ", "(", "scrconfig", "->", "refresh", ")", ")", ";", "if", "(", "(", "scrconfig", "->", "type", "!=", "SCREEN_TYPE_VECTOR", ")", "&&", "!", "scrconfig", "->", "oldstyle_vblank_supplied", ")", "{", "int", "pixclock", "=", "scrconfig", "->", "width", "*", "scrconfig", "->", "height", "*", "ATTOSECONDS_TO_HZ", "(", "scrconfig", "->", "refresh", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "pixclock", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "scrconfig", "->", "width", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "scrconfig", "->", "visarea", ".", "min_x", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "scrconfig", "->", "visarea", ".", "max_x", "+", "1", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "scrconfig", "->", "height", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "scrconfig", "->", "visarea", ".", "min_y", ")", ";", "fprintf", "(", "out", ",", "\"", "\\\"", "\\\"", "\"", ",", "scrconfig", "->", "visarea", ".", "max_y", "+", "1", ")", ";", "}", "fprintf", "(", "out", ",", "\"", "\\n", "\"", ")", ";", "}", "}" ]
print_game_display - print a list of all the displays
[ "print_game_display", "-", "print", "a", "list", "of", "all", "the", "displays" ]
[ "/* iterate over screens */", "/* output the orientation as a string */", "/* output width and height only for games that are not vector */", "/* output refresh rate */", "/* output raw video parameters only for games that are not vector */", "/* and had raw parameters specified */" ]
[ { "param": "out", "type": "FILE" }, { "param": "game", "type": "game_driver" }, { "param": "config", "type": "machine_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "game", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": "machine_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
74cb8fc4a1a834b461ea1f85b77e8d277eb7e921
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/info.c
[ "Unlicense" ]
C
print_game_sound
void
static void print_game_sound(FILE *out, const game_driver *game, const machine_config *config) { int speakers = speaker_output_count(config); /* if we have no sound, zero out the speaker count */ if (sound_first(config) == NULL) speakers = 0; fprintf(out, "\t\t<sound channels=\"%d\"/>\n", speakers); }
/*------------------------------------------------- print_game_sound - print a list of all the displays -------------------------------------------------*/
print a list of all the displays
[ "print", "a", "list", "of", "all", "the", "displays" ]
static void print_game_sound(FILE *out, const game_driver *game, const machine_config *config) { int speakers = speaker_output_count(config); if (sound_first(config) == NULL) speakers = 0; fprintf(out, "\t\t<sound channels=\"%d\"/>\n", speakers); }
[ "static", "void", "print_game_sound", "(", "FILE", "*", "out", ",", "const", "game_driver", "*", "game", ",", "const", "machine_config", "*", "config", ")", "{", "int", "speakers", "=", "speaker_output_count", "(", "config", ")", ";", "if", "(", "sound_first", "(", "config", ")", "==", "NULL", ")", "speakers", "=", "0", ";", "fprintf", "(", "out", ",", "\"", "\\t", "\\t", "\\\"", "\\\"", "\\n", "\"", ",", "speakers", ")", ";", "}" ]
print_game_sound - print a list of all the displays
[ "print_game_sound", "-", "print", "a", "list", "of", "all", "the", "displays" ]
[ "/* if we have no sound, zero out the speaker count */" ]
[ { "param": "out", "type": "FILE" }, { "param": "game", "type": "game_driver" }, { "param": "config", "type": "machine_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "out", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "game", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": "machine_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
80a14348e049d88d195c3d384daf7b3ac2e5974a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/okim6376.c
[ "Unlicense" ]
C
clock_adpcm
INT16
static INT16 clock_adpcm(struct ADPCMVoice *voice, UINT8 nibble) { voice->signal += diff_lookup[voice->step * 16 + (nibble & 15)]; /* clamp to the maximum 12bit */ if (voice->signal > 2047) voice->signal = 2047; else if (voice->signal < -2048) voice->signal = -2048; /* adjust the step size and clamp */ voice->step += index_shift[nibble & 7]; if (voice->step > 48) voice->step = 48; else if (voice->step < 0) voice->step = 0; /* return the signal */ return voice->signal; }
/********************************************************************************************** clock_adpcm -- clock the next ADPCM byte ***********************************************************************************************/
- clock the next ADPCM byte
[ "-", "clock", "the", "next", "ADPCM", "byte" ]
static INT16 clock_adpcm(struct ADPCMVoice *voice, UINT8 nibble) { voice->signal += diff_lookup[voice->step * 16 + (nibble & 15)]; if (voice->signal > 2047) voice->signal = 2047; else if (voice->signal < -2048) voice->signal = -2048; voice->step += index_shift[nibble & 7]; if (voice->step > 48) voice->step = 48; else if (voice->step < 0) voice->step = 0; return voice->signal; }
[ "static", "INT16", "clock_adpcm", "(", "struct", "ADPCMVoice", "*", "voice", ",", "UINT8", "nibble", ")", "{", "voice", "->", "signal", "+=", "diff_lookup", "[", "voice", "->", "step", "*", "16", "+", "(", "nibble", "&", "15", ")", "]", ";", "if", "(", "voice", "->", "signal", ">", "2047", ")", "voice", "->", "signal", "=", "2047", ";", "else", "if", "(", "voice", "->", "signal", "<", "-2048", ")", "voice", "->", "signal", "=", "-2048", ";", "voice", "->", "step", "+=", "index_shift", "[", "nibble", "&", "7", "]", ";", "if", "(", "voice", "->", "step", ">", "48", ")", "voice", "->", "step", "=", "48", ";", "else", "if", "(", "voice", "->", "step", "<", "0", ")", "voice", "->", "step", "=", "0", ";", "return", "voice", "->", "signal", ";", "}" ]
clock_adpcm -- clock the next ADPCM byte
[ "clock_adpcm", "--", "clock", "the", "next", "ADPCM", "byte" ]
[ "/* clamp to the maximum 12bit */", "/* adjust the step size and clamp */", "/* return the signal */" ]
[ { "param": "voice", "type": "struct ADPCMVoice" }, { "param": "nibble", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "voice", "type": "struct ADPCMVoice", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nibble", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c6cf0dddbe2affcb99ebeb9a761673f96728a847
lofunz/mieme
Reloaded/trunk/src/mame/video/othunder.c
[ "Unlicense" ]
C
draw_sprites
void
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const int *primasks, int y_offs ) { othunder_state *state = machine->driver_data<othunder_state>(); UINT16 *spritemap = (UINT16 *)memory_region(machine, "user1"); UINT16 tile_mask = (machine->gfx[0]->total_elements) - 1; UINT16 *spriteram16 = state->spriteram; int offs, data, tilenum, color, flipx, flipy; int x, y, priority, curx, cury; int sprites_flipscreen = 0; int zoomx, zoomy, zx, zy; int sprite_chunk, map_offset, code, j, k, px, py; int bad_chunks; /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list while processing sprite ram and then draw them all at the end */ struct othunder_tempsprite *sprite_ptr = state->spritelist; for (offs = (state->spriteram_size / 2) - 4; offs >= 0; offs -= 4) { data = spriteram16[offs + 0]; zoomy = (data & 0xfe00) >> 9; y = data & 0x1ff; data = spriteram16[offs + 1]; flipx = (data & 0x4000) >> 14; priority = (data & 0x8000) >> 15; x = data & 0x1ff; data = spriteram16[offs + 2]; color = (data & 0xff00) >> 8; zoomx = (data & 0x7f); data = spriteram16[offs + 3]; tilenum = data & 0x1fff; // $80000 spritemap rom maps up to $2000 64x64 sprites flipy = (data & 0x8000) >> 15; if (!tilenum) continue; map_offset = tilenum << 5; zoomx += 1; zoomy += 1; y += y_offs; /* treat coords as signed */ if (x > 0x140) x -= 0x200; if (y > 0x140) y -= 0x200; bad_chunks = 0; for (sprite_chunk = 0; sprite_chunk < 32; sprite_chunk++) { k = sprite_chunk % 4; /* 4 chunks per row */ j = sprite_chunk / 4; /* 8 rows */ px = k; py = j; if (flipx) px = 3 - k; /* pick tiles back to front for x and y flips */ if (flipy) py = 7 - j; code = spritemap[map_offset + px + (py << 2)] & tile_mask; if (code == 0xffff) { bad_chunks += 1; continue; } curx = x + ((k * zoomx) / 4); cury = y + ((j * zoomy) / 8); zx= x + (((k + 1) * zoomx) / 4) - curx; zy= y + (((j + 1) * zoomy) / 8) - cury; if (sprites_flipscreen) { /* -zx/y is there to fix zoomed sprite coords in screenflip. drawgfxzoom does not know to draw from flip-side of sprites when screen is flipped; so we must correct the coords ourselves. */ curx = 320 - curx - zx; cury = 256 - cury - zy; flipx = !flipx; flipy = !flipy; } sprite_ptr->code = code; sprite_ptr->color = color; sprite_ptr->flipx = flipx; sprite_ptr->flipy = flipy; sprite_ptr->x = curx; sprite_ptr->y = cury; sprite_ptr->zoomx = zx << 12; sprite_ptr->zoomy = zy << 13; if (primasks) { sprite_ptr->primask = primasks[priority]; sprite_ptr++; } else { drawgfxzoom_transpen(bitmap,cliprect,machine->gfx[0], sprite_ptr->code, sprite_ptr->color, sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->x,sprite_ptr->y, sprite_ptr->zoomx,sprite_ptr->zoomy,0); } } if (bad_chunks) logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); } /* this happens only if primsks != NULL */ while (sprite_ptr != state->spritelist) { sprite_ptr--; pdrawgfxzoom_transpen(bitmap,cliprect,machine->gfx[0], sprite_ptr->code, sprite_ptr->color, sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->x,sprite_ptr->y, sprite_ptr->zoomx,sprite_ptr->zoomy, machine->priority_bitmap,sprite_ptr->primask,0); } }
/************************************************************ SPRITE DRAW ROUTINE It draws a series of small tiles ("chunks") together to create a big sprite. The spritemap rom provides the lookup table for this. We look up the 16x8 sprite chunks from the spritemap rom, creating each 64x64 sprite as follows: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 The game makes heavy use of sprite zooming. *** NB: unused portions of the spritemap rom contain hex FF's. It is a useful coding check to warn in the log if these are being accessed. [They can be inadvertently while spriteram is being tested, take no notice of that.] Othunder (modified table from Raine) Byte | Bit(s) | Description -----+76543210+------------------------------------- 0 |xxxxxxx.| ZoomY (0 min, 63 max - msb unused as sprites are 64x64) 0 |.......x| Y position (High) 1 |xxxxxxxx| Y position (Low) 2 |x.......| Sprite/BG Priority (0=sprites high) 2 |.x......| Flip X 2 |..?????.| unknown/unused ? 2 |.......x| X position (High) 3 |xxxxxxxx| X position (Low) 4 |xxxxxxxx| Palette bank 5 |?.......| unknown/unused ? 5 |.xxxxxxx| ZoomX (0 min, 63 max - msb unused as sprites are 64x64) 6 |x.......| Flip Y 6 |.??.....| unknown/unused ? 6 |...xxxxx| Sprite Tile high (2 msbs unused - 3/4 of spritemap rom empty) 7 |xxxxxxxx| Sprite Tile low ********************************************************/
SPRITE DRAW ROUTINE It draws a series of small tiles ("chunks") together to create a big sprite. The spritemap rom provides the lookup table for this. We look up the 16x8 sprite chunks from the spritemap rom, creating each 64x64 sprite as follows. The game makes heavy use of sprite zooming. unused portions of the spritemap rom contain hex FF's. It is a useful coding check to warn in the log if these are being accessed. [They can be inadvertently while spriteram is being tested, take no notice of that.] Othunder (modified table from Raine)
[ "SPRITE", "DRAW", "ROUTINE", "It", "draws", "a", "series", "of", "small", "tiles", "(", "\"", "chunks", "\"", ")", "together", "to", "create", "a", "big", "sprite", ".", "The", "spritemap", "rom", "provides", "the", "lookup", "table", "for", "this", ".", "We", "look", "up", "the", "16x8", "sprite", "chunks", "from", "the", "spritemap", "rom", "creating", "each", "64x64", "sprite", "as", "follows", ".", "The", "game", "makes", "heavy", "use", "of", "sprite", "zooming", ".", "unused", "portions", "of", "the", "spritemap", "rom", "contain", "hex", "FF", "'", "s", ".", "It", "is", "a", "useful", "coding", "check", "to", "warn", "in", "the", "log", "if", "these", "are", "being", "accessed", ".", "[", "They", "can", "be", "inadvertently", "while", "spriteram", "is", "being", "tested", "take", "no", "notice", "of", "that", ".", "]", "Othunder", "(", "modified", "table", "from", "Raine", ")" ]
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const int *primasks, int y_offs ) { othunder_state *state = machine->driver_data<othunder_state>(); UINT16 *spritemap = (UINT16 *)memory_region(machine, "user1"); UINT16 tile_mask = (machine->gfx[0]->total_elements) - 1; UINT16 *spriteram16 = state->spriteram; int offs, data, tilenum, color, flipx, flipy; int x, y, priority, curx, cury; int sprites_flipscreen = 0; int zoomx, zoomy, zx, zy; int sprite_chunk, map_offset, code, j, k, px, py; int bad_chunks; struct othunder_tempsprite *sprite_ptr = state->spritelist; for (offs = (state->spriteram_size / 2) - 4; offs >= 0; offs -= 4) { data = spriteram16[offs + 0]; zoomy = (data & 0xfe00) >> 9; y = data & 0x1ff; data = spriteram16[offs + 1]; flipx = (data & 0x4000) >> 14; priority = (data & 0x8000) >> 15; x = data & 0x1ff; data = spriteram16[offs + 2]; color = (data & 0xff00) >> 8; zoomx = (data & 0x7f); data = spriteram16[offs + 3]; tilenum = data & 0x1fff; flipy = (data & 0x8000) >> 15; if (!tilenum) continue; map_offset = tilenum << 5; zoomx += 1; zoomy += 1; y += y_offs; if (x > 0x140) x -= 0x200; if (y > 0x140) y -= 0x200; bad_chunks = 0; for (sprite_chunk = 0; sprite_chunk < 32; sprite_chunk++) { k = sprite_chunk % 4; j = sprite_chunk / 4; px = k; py = j; if (flipx) px = 3 - k; if (flipy) py = 7 - j; code = spritemap[map_offset + px + (py << 2)] & tile_mask; if (code == 0xffff) { bad_chunks += 1; continue; } curx = x + ((k * zoomx) / 4); cury = y + ((j * zoomy) / 8); zx= x + (((k + 1) * zoomx) / 4) - curx; zy= y + (((j + 1) * zoomy) / 8) - cury; if (sprites_flipscreen) { curx = 320 - curx - zx; cury = 256 - cury - zy; flipx = !flipx; flipy = !flipy; } sprite_ptr->code = code; sprite_ptr->color = color; sprite_ptr->flipx = flipx; sprite_ptr->flipy = flipy; sprite_ptr->x = curx; sprite_ptr->y = cury; sprite_ptr->zoomx = zx << 12; sprite_ptr->zoomy = zy << 13; if (primasks) { sprite_ptr->primask = primasks[priority]; sprite_ptr++; } else { drawgfxzoom_transpen(bitmap,cliprect,machine->gfx[0], sprite_ptr->code, sprite_ptr->color, sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->x,sprite_ptr->y, sprite_ptr->zoomx,sprite_ptr->zoomy,0); } } if (bad_chunks) logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); } while (sprite_ptr != state->spritelist) { sprite_ptr--; pdrawgfxzoom_transpen(bitmap,cliprect,machine->gfx[0], sprite_ptr->code, sprite_ptr->color, sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->x,sprite_ptr->y, sprite_ptr->zoomx,sprite_ptr->zoomy, machine->priority_bitmap,sprite_ptr->primask,0); } }
[ "static", "void", "draw_sprites", "(", "running_machine", "*", "machine", ",", "bitmap_t", "*", "bitmap", ",", "const", "rectangle", "*", "cliprect", ",", "const", "int", "*", "primasks", ",", "int", "y_offs", ")", "{", "othunder_state", "*", "state", "=", "machine", "->", "driver_data", "<", "othunder_state", ">", "(", "", ")", ";", "UINT16", "*", "spritemap", "=", "(", "UINT16", "*", ")", "memory_region", "(", "machine", ",", "\"", "\"", ")", ";", "UINT16", "tile_mask", "=", "(", "machine", "->", "gfx", "[", "0", "]", "->", "total_elements", ")", "-", "1", ";", "UINT16", "*", "spriteram16", "=", "state", "->", "spriteram", ";", "int", "offs", ",", "data", ",", "tilenum", ",", "color", ",", "flipx", ",", "flipy", ";", "int", "x", ",", "y", ",", "priority", ",", "curx", ",", "cury", ";", "int", "sprites_flipscreen", "=", "0", ";", "int", "zoomx", ",", "zoomy", ",", "zx", ",", "zy", ";", "int", "sprite_chunk", ",", "map_offset", ",", "code", ",", "j", ",", "k", ",", "px", ",", "py", ";", "int", "bad_chunks", ";", "struct", "othunder_tempsprite", "*", "sprite_ptr", "=", "state", "->", "spritelist", ";", "for", "(", "offs", "=", "(", "state", "->", "spriteram_size", "/", "2", ")", "-", "4", ";", "offs", ">=", "0", ";", "offs", "-=", "4", ")", "{", "data", "=", "spriteram16", "[", "offs", "+", "0", "]", ";", "zoomy", "=", "(", "data", "&", "0xfe00", ")", ">>", "9", ";", "y", "=", "data", "&", "0x1ff", ";", "data", "=", "spriteram16", "[", "offs", "+", "1", "]", ";", "flipx", "=", "(", "data", "&", "0x4000", ")", ">>", "14", ";", "priority", "=", "(", "data", "&", "0x8000", ")", ">>", "15", ";", "x", "=", "data", "&", "0x1ff", ";", "data", "=", "spriteram16", "[", "offs", "+", "2", "]", ";", "color", "=", "(", "data", "&", "0xff00", ")", ">>", "8", ";", "zoomx", "=", "(", "data", "&", "0x7f", ")", ";", "data", "=", "spriteram16", "[", "offs", "+", "3", "]", ";", "tilenum", "=", "data", "&", "0x1fff", ";", "flipy", "=", "(", "data", "&", "0x8000", ")", ">>", "15", ";", "if", "(", "!", "tilenum", ")", "continue", ";", "map_offset", "=", "tilenum", "<<", "5", ";", "zoomx", "+=", "1", ";", "zoomy", "+=", "1", ";", "y", "+=", "y_offs", ";", "if", "(", "x", ">", "0x140", ")", "x", "-=", "0x200", ";", "if", "(", "y", ">", "0x140", ")", "y", "-=", "0x200", ";", "bad_chunks", "=", "0", ";", "for", "(", "sprite_chunk", "=", "0", ";", "sprite_chunk", "<", "32", ";", "sprite_chunk", "++", ")", "{", "k", "=", "sprite_chunk", "%", "4", ";", "j", "=", "sprite_chunk", "/", "4", ";", "px", "=", "k", ";", "py", "=", "j", ";", "if", "(", "flipx", ")", "px", "=", "3", "-", "k", ";", "if", "(", "flipy", ")", "py", "=", "7", "-", "j", ";", "code", "=", "spritemap", "[", "map_offset", "+", "px", "+", "(", "py", "<<", "2", ")", "]", "&", "tile_mask", ";", "if", "(", "code", "==", "0xffff", ")", "{", "bad_chunks", "+=", "1", ";", "continue", ";", "}", "curx", "=", "x", "+", "(", "(", "k", "*", "zoomx", ")", "/", "4", ")", ";", "cury", "=", "y", "+", "(", "(", "j", "*", "zoomy", ")", "/", "8", ")", ";", "zx", "=", "x", "+", "(", "(", "(", "k", "+", "1", ")", "*", "zoomx", ")", "/", "4", ")", "-", "curx", ";", "zy", "=", "y", "+", "(", "(", "(", "j", "+", "1", ")", "*", "zoomy", ")", "/", "8", ")", "-", "cury", ";", "if", "(", "sprites_flipscreen", ")", "{", "curx", "=", "320", "-", "curx", "-", "zx", ";", "cury", "=", "256", "-", "cury", "-", "zy", ";", "flipx", "=", "!", "flipx", ";", "flipy", "=", "!", "flipy", ";", "}", "sprite_ptr", "->", "code", "=", "code", ";", "sprite_ptr", "->", "color", "=", "color", ";", "sprite_ptr", "->", "flipx", "=", "flipx", ";", "sprite_ptr", "->", "flipy", "=", "flipy", ";", "sprite_ptr", "->", "x", "=", "curx", ";", "sprite_ptr", "->", "y", "=", "cury", ";", "sprite_ptr", "->", "zoomx", "=", "zx", "<<", "12", ";", "sprite_ptr", "->", "zoomy", "=", "zy", "<<", "13", ";", "if", "(", "primasks", ")", "{", "sprite_ptr", "->", "primask", "=", "primasks", "[", "priority", "]", ";", "sprite_ptr", "++", ";", "}", "else", "{", "drawgfxzoom_transpen", "(", "bitmap", ",", "cliprect", ",", "machine", "->", "gfx", "[", "0", "]", ",", "sprite_ptr", "->", "code", ",", "sprite_ptr", "->", "color", ",", "sprite_ptr", "->", "flipx", ",", "sprite_ptr", "->", "flipy", ",", "sprite_ptr", "->", "x", ",", "sprite_ptr", "->", "y", ",", "sprite_ptr", "->", "zoomx", ",", "sprite_ptr", "->", "zoomy", ",", "0", ")", ";", "}", "}", "if", "(", "bad_chunks", ")", "logerror", "(", "\"", "\\n", "\"", ",", "tilenum", ",", "bad_chunks", ")", ";", "}", "while", "(", "sprite_ptr", "!=", "state", "->", "spritelist", ")", "{", "sprite_ptr", "--", ";", "pdrawgfxzoom_transpen", "(", "bitmap", ",", "cliprect", ",", "machine", "->", "gfx", "[", "0", "]", ",", "sprite_ptr", "->", "code", ",", "sprite_ptr", "->", "color", ",", "sprite_ptr", "->", "flipx", ",", "sprite_ptr", "->", "flipy", ",", "sprite_ptr", "->", "x", ",", "sprite_ptr", "->", "y", ",", "sprite_ptr", "->", "zoomx", ",", "sprite_ptr", "->", "zoomy", ",", "machine", "->", "priority_bitmap", ",", "sprite_ptr", "->", "primask", ",", "0", ")", ";", "}", "}" ]
SPRITE DRAW ROUTINE It draws a series of small tiles ("chunks") together to create a big sprite.
[ "SPRITE", "DRAW", "ROUTINE", "It", "draws", "a", "series", "of", "small", "tiles", "(", "\"", "chunks", "\"", ")", "together", "to", "create", "a", "big", "sprite", "." ]
[ "/* pdrawgfx() needs us to draw sprites front to back, so we have to build a list\r\n while processing sprite ram and then draw them all at the end */", "// $80000 spritemap rom maps up to $2000 64x64 sprites\r", "/* treat coords as signed */", "/* 4 chunks per row */", "/* 8 rows */", "/* pick tiles back to front for x and y flips */", "/* -zx/y is there to fix zoomed sprite coords in screenflip.\r\n drawgfxzoom does not know to draw from flip-side of sprites when\r\n screen is flipped; so we must correct the coords ourselves. */", "/* this happens only if primsks != NULL */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "bitmap", "type": "bitmap_t" }, { "param": "cliprect", "type": "rectangle" }, { "param": "primasks", "type": "int" }, { "param": "y_offs", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bitmap", "type": "bitmap_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cliprect", "type": "rectangle", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "primasks", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y_offs", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c6944d0ae14d9d4bfdf857b0caa6b9d6bbd1bdf7
lofunz/mieme
Reloaded/trunk/src/emu/cpu/z180/z180.c
[ "Unlicense" ]
C
clock_timers
void
static void clock_timers(z180_state *cpustate) { cpustate->timer_cnt++; if (cpustate->timer_cnt >= 20) { cpustate->timer_cnt = 0; /* Programmable Reload Timer 0 */ if(cpustate->IO_TCR & Z180_TCR_TDE0) { if(cpustate->tmdr_value[0] == 0) { cpustate->tmdr_value[0] = cpustate->IO_RLDR0L | (cpustate->IO_RLDR0H << 8); cpustate->tif[0] = 1; } else cpustate->tmdr_value[0]--; } /* Programmable Reload Timer 1 */ if(cpustate->IO_TCR & Z180_TCR_TDE1) { if(cpustate->tmdr_value[1] == 0) { cpustate->tmdr_value[1] = cpustate->IO_RLDR1L | (cpustate->IO_RLDR1H << 8); cpustate->tif[1] = 1; } else cpustate->tmdr_value[1]--; } if((cpustate->IO_TCR & Z180_TCR_TIE0) && cpustate->tif[0]) { // check if we can take the interrupt if(cpustate->IFF1 && !cpustate->after_EI) { cpustate->int_pending[Z180_INT_PRT0] = 1; } } if((cpustate->IO_TCR & Z180_TCR_TIE1) && cpustate->tif[1]) { // check if we can take the interrupt if(cpustate->IFF1 && !cpustate->after_EI) { cpustate->int_pending[Z180_INT_PRT1] = 1; } } } }
/* Handle PRT timers, decreasing them after 20 clocks and returning the new icount base that needs to be used for the next check */
Handle PRT timers, decreasing them after 20 clocks and returning the new icount base that needs to be used for the next check
[ "Handle", "PRT", "timers", "decreasing", "them", "after", "20", "clocks", "and", "returning", "the", "new", "icount", "base", "that", "needs", "to", "be", "used", "for", "the", "next", "check" ]
static void clock_timers(z180_state *cpustate) { cpustate->timer_cnt++; if (cpustate->timer_cnt >= 20) { cpustate->timer_cnt = 0; if(cpustate->IO_TCR & Z180_TCR_TDE0) { if(cpustate->tmdr_value[0] == 0) { cpustate->tmdr_value[0] = cpustate->IO_RLDR0L | (cpustate->IO_RLDR0H << 8); cpustate->tif[0] = 1; } else cpustate->tmdr_value[0]--; } if(cpustate->IO_TCR & Z180_TCR_TDE1) { if(cpustate->tmdr_value[1] == 0) { cpustate->tmdr_value[1] = cpustate->IO_RLDR1L | (cpustate->IO_RLDR1H << 8); cpustate->tif[1] = 1; } else cpustate->tmdr_value[1]--; } if((cpustate->IO_TCR & Z180_TCR_TIE0) && cpustate->tif[0]) { if(cpustate->IFF1 && !cpustate->after_EI) { cpustate->int_pending[Z180_INT_PRT0] = 1; } } if((cpustate->IO_TCR & Z180_TCR_TIE1) && cpustate->tif[1]) { if(cpustate->IFF1 && !cpustate->after_EI) { cpustate->int_pending[Z180_INT_PRT1] = 1; } } } }
[ "static", "void", "clock_timers", "(", "z180_state", "*", "cpustate", ")", "{", "cpustate", "->", "timer_cnt", "++", ";", "if", "(", "cpustate", "->", "timer_cnt", ">=", "20", ")", "{", "cpustate", "->", "timer_cnt", "=", "0", ";", "if", "(", "cpustate", "->", "IO_TCR", "&", "Z180_TCR_TDE0", ")", "{", "if", "(", "cpustate", "->", "tmdr_value", "[", "0", "]", "==", "0", ")", "{", "cpustate", "->", "tmdr_value", "[", "0", "]", "=", "cpustate", "->", "IO_RLDR0L", "|", "(", "cpustate", "->", "IO_RLDR0H", "<<", "8", ")", ";", "cpustate", "->", "tif", "[", "0", "]", "=", "1", ";", "}", "else", "cpustate", "->", "tmdr_value", "[", "0", "]", "--", ";", "}", "if", "(", "cpustate", "->", "IO_TCR", "&", "Z180_TCR_TDE1", ")", "{", "if", "(", "cpustate", "->", "tmdr_value", "[", "1", "]", "==", "0", ")", "{", "cpustate", "->", "tmdr_value", "[", "1", "]", "=", "cpustate", "->", "IO_RLDR1L", "|", "(", "cpustate", "->", "IO_RLDR1H", "<<", "8", ")", ";", "cpustate", "->", "tif", "[", "1", "]", "=", "1", ";", "}", "else", "cpustate", "->", "tmdr_value", "[", "1", "]", "--", ";", "}", "if", "(", "(", "cpustate", "->", "IO_TCR", "&", "Z180_TCR_TIE0", ")", "&&", "cpustate", "->", "tif", "[", "0", "]", ")", "{", "if", "(", "cpustate", "->", "IFF1", "&&", "!", "cpustate", "->", "after_EI", ")", "{", "cpustate", "->", "int_pending", "[", "Z180_INT_PRT0", "]", "=", "1", ";", "}", "}", "if", "(", "(", "cpustate", "->", "IO_TCR", "&", "Z180_TCR_TIE1", ")", "&&", "cpustate", "->", "tif", "[", "1", "]", ")", "{", "if", "(", "cpustate", "->", "IFF1", "&&", "!", "cpustate", "->", "after_EI", ")", "{", "cpustate", "->", "int_pending", "[", "Z180_INT_PRT1", "]", "=", "1", ";", "}", "}", "}", "}" ]
Handle PRT timers, decreasing them after 20 clocks and returning the new icount base that needs to be used for the next check
[ "Handle", "PRT", "timers", "decreasing", "them", "after", "20", "clocks", "and", "returning", "the", "new", "icount", "base", "that", "needs", "to", "be", "used", "for", "the", "next", "check" ]
[ "/* Programmable Reload Timer 0 */", "/* Programmable Reload Timer 1 */", "// check if we can take the interrupt\r", "// check if we can take the interrupt\r" ]
[ { "param": "cpustate", "type": "z180_state" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "z180_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c6944d0ae14d9d4bfdf857b0caa6b9d6bbd1bdf7
lofunz/mieme
Reloaded/trunk/src/emu/cpu/z180/z180.c
[ "Unlicense" ]
C
handle_io_timers
void
static void handle_io_timers(z180_state *cpustate, int cycles) { while (cycles-- > 0) { clock_timers(cpustate); } }
/**************************************************************************** * Handle I/O and timers ****************************************************************************/
Handle I/O and timers
[ "Handle", "I", "/", "O", "and", "timers" ]
static void handle_io_timers(z180_state *cpustate, int cycles) { while (cycles-- > 0) { clock_timers(cpustate); } }
[ "static", "void", "handle_io_timers", "(", "z180_state", "*", "cpustate", ",", "int", "cycles", ")", "{", "while", "(", "cycles", "--", ">", "0", ")", "{", "clock_timers", "(", "cpustate", ")", ";", "}", "}" ]
Handle I/O and timers
[ "Handle", "I", "/", "O", "and", "timers" ]
[]
[ { "param": "cpustate", "type": "z180_state" }, { "param": "cycles", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "z180_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cycles", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3563935db04ec2c8d95af62f21d125c01c2c4ebc
lofunz/mieme
Reloaded/trunk/src/mame/video/genesis.c
[ "Unlicense" ]
C
start_genesis_vdp
void
static void start_genesis_vdp(screen_device *screen) { static const UINT8 vdp_init[24] = { 0x04, 0x44, 0x30, 0x3C, 0x07, 0x6C, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x01, 0x37, 0x00, 0x02, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x80, }; int i; genesis_screen = screen; /* allocate memory for the VDP, the lookup table, and the buffer bitmap */ vdp_vram = auto_alloc_array(screen->machine, UINT8, VRAM_SIZE); vdp_vsram = auto_alloc_array(screen->machine, UINT8, VSRAM_SIZE); transparent_lookup = auto_alloc_array(screen->machine, UINT16, 0x1000); /* clear the VDP memory, prevents corrupt tile in Puyo Puyo 2 */ memset(vdp_vram, 0, VRAM_SIZE); memset(vdp_vsram, 0, VSRAM_SIZE); /* init transparency table */ for (i = 0; i < 0x1000; i++) { int orig_color = i & 0x7ff; int half_bright = i & 0x800; if (orig_color & 0x100) transparent_lookup[i] = orig_color; else if (half_bright) transparent_lookup[i] = orig_color | 0x800; else transparent_lookup[i] = orig_color | 0x1000; } /* reset the palettes */ genesis_palette_base = 0; genesis_bg_pal_lookup[0] = genesis_sp_pal_lookup[0] = 0x00; genesis_bg_pal_lookup[1] = genesis_sp_pal_lookup[1] = 0x10; genesis_bg_pal_lookup[2] = genesis_sp_pal_lookup[2] = 0x20; genesis_bg_pal_lookup[3] = genesis_sp_pal_lookup[3] = 0x30; /* reset VDP */ for (i = 0; i < 24; i++) vdp_register_w(screen->machine, 0x8000 | (i << 8) | vdp_init[i], 1); vdp_cmdpart = 0; vdp_code = 0; vdp_address = 0; /* Save State Stuff */ state_save_register_global_array(screen->machine, genesis_vdp_regs); state_save_register_global_pointer(screen->machine, vdp_vram, 0x10000); state_save_register_global_pointer(screen->machine, vdp_vsram, 0x80); state_save_register_global_array(screen->machine, genesis_bg_pal_lookup); state_save_register_global_array(screen->machine, genesis_sp_pal_lookup); state_save_register_global(screen->machine, display_enable); state_save_register_global(screen->machine, vdp_scrollabase); state_save_register_global(screen->machine, vdp_scrollbbase); state_save_register_global(screen->machine, vdp_windowbase); state_save_register_global(screen->machine, vdp_spritebase); state_save_register_global(screen->machine, vdp_hscrollbase); state_save_register_global(screen->machine, vdp_hscrollmask); state_save_register_global(screen->machine, vdp_hscrollsize); state_save_register_global(screen->machine, vdp_vscrollmode); state_save_register_global(screen->machine, vdp_cmdpart); state_save_register_global(screen->machine, vdp_code); state_save_register_global(screen->machine, vdp_address); state_save_register_global(screen->machine, vdp_dmafill); state_save_register_global(screen->machine, scrollheight); state_save_register_global(screen->machine, scrollwidth); state_save_register_global(screen->machine, bgcol); state_save_register_global(screen->machine, window_down); state_save_register_global(screen->machine, window_vpos); }
/****************************************************************************** Video Start / Stop Functions ******************************************************************************* Here we allocate memory used by the VDP and various other video related parts of the System C/C2 hardware such as the Palette RAM. Here is what is needed 64kb of VRAM (multi-purpose, storing tiles, tilemaps, hscroll data, spritelist etc.) 80bytes of VSRAM (used exclusively for storing Vertical Scroll values) ******************************************************************************/
Video Start / Stop Functions Here we allocate memory used by the VDP and various other video related parts of the System C/C2 hardware such as the Palette RAM. Here is what is needed 64kb of VRAM (multi-purpose, storing tiles, tilemaps, hscroll data, spritelist etc.) 80bytes of VSRAM (used exclusively for storing Vertical Scroll values)
[ "Video", "Start", "/", "Stop", "Functions", "Here", "we", "allocate", "memory", "used", "by", "the", "VDP", "and", "various", "other", "video", "related", "parts", "of", "the", "System", "C", "/", "C2", "hardware", "such", "as", "the", "Palette", "RAM", ".", "Here", "is", "what", "is", "needed", "64kb", "of", "VRAM", "(", "multi", "-", "purpose", "storing", "tiles", "tilemaps", "hscroll", "data", "spritelist", "etc", ".", ")", "80bytes", "of", "VSRAM", "(", "used", "exclusively", "for", "storing", "Vertical", "Scroll", "values", ")" ]
static void start_genesis_vdp(screen_device *screen) { static const UINT8 vdp_init[24] = { 0x04, 0x44, 0x30, 0x3C, 0x07, 0x6C, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x01, 0x37, 0x00, 0x02, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x80, }; int i; genesis_screen = screen; vdp_vram = auto_alloc_array(screen->machine, UINT8, VRAM_SIZE); vdp_vsram = auto_alloc_array(screen->machine, UINT8, VSRAM_SIZE); transparent_lookup = auto_alloc_array(screen->machine, UINT16, 0x1000); memset(vdp_vram, 0, VRAM_SIZE); memset(vdp_vsram, 0, VSRAM_SIZE); for (i = 0; i < 0x1000; i++) { int orig_color = i & 0x7ff; int half_bright = i & 0x800; if (orig_color & 0x100) transparent_lookup[i] = orig_color; else if (half_bright) transparent_lookup[i] = orig_color | 0x800; else transparent_lookup[i] = orig_color | 0x1000; } genesis_palette_base = 0; genesis_bg_pal_lookup[0] = genesis_sp_pal_lookup[0] = 0x00; genesis_bg_pal_lookup[1] = genesis_sp_pal_lookup[1] = 0x10; genesis_bg_pal_lookup[2] = genesis_sp_pal_lookup[2] = 0x20; genesis_bg_pal_lookup[3] = genesis_sp_pal_lookup[3] = 0x30; for (i = 0; i < 24; i++) vdp_register_w(screen->machine, 0x8000 | (i << 8) | vdp_init[i], 1); vdp_cmdpart = 0; vdp_code = 0; vdp_address = 0; state_save_register_global_array(screen->machine, genesis_vdp_regs); state_save_register_global_pointer(screen->machine, vdp_vram, 0x10000); state_save_register_global_pointer(screen->machine, vdp_vsram, 0x80); state_save_register_global_array(screen->machine, genesis_bg_pal_lookup); state_save_register_global_array(screen->machine, genesis_sp_pal_lookup); state_save_register_global(screen->machine, display_enable); state_save_register_global(screen->machine, vdp_scrollabase); state_save_register_global(screen->machine, vdp_scrollbbase); state_save_register_global(screen->machine, vdp_windowbase); state_save_register_global(screen->machine, vdp_spritebase); state_save_register_global(screen->machine, vdp_hscrollbase); state_save_register_global(screen->machine, vdp_hscrollmask); state_save_register_global(screen->machine, vdp_hscrollsize); state_save_register_global(screen->machine, vdp_vscrollmode); state_save_register_global(screen->machine, vdp_cmdpart); state_save_register_global(screen->machine, vdp_code); state_save_register_global(screen->machine, vdp_address); state_save_register_global(screen->machine, vdp_dmafill); state_save_register_global(screen->machine, scrollheight); state_save_register_global(screen->machine, scrollwidth); state_save_register_global(screen->machine, bgcol); state_save_register_global(screen->machine, window_down); state_save_register_global(screen->machine, window_vpos); }
[ "static", "void", "start_genesis_vdp", "(", "screen_device", "*", "screen", ")", "{", "static", "const", "UINT8", "vdp_init", "[", "24", "]", "=", "{", "0x04", ",", "0x44", ",", "0x30", ",", "0x3C", ",", "0x07", ",", "0x6C", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0xFF", ",", "0x00", ",", "0x01", ",", "0x37", ",", "0x00", ",", "0x02", ",", "0x01", ",", "0x00", ",", "0x00", ",", "0xFF", ",", "0xFF", ",", "0x00", ",", "0x00", ",", "0x80", ",", "}", ";", "int", "i", ";", "genesis_screen", "=", "screen", ";", "vdp_vram", "=", "auto_alloc_array", "(", "screen", "->", "machine", ",", "UINT8", ",", "VRAM_SIZE", ")", ";", "vdp_vsram", "=", "auto_alloc_array", "(", "screen", "->", "machine", ",", "UINT8", ",", "VSRAM_SIZE", ")", ";", "transparent_lookup", "=", "auto_alloc_array", "(", "screen", "->", "machine", ",", "UINT16", ",", "0x1000", ")", ";", "memset", "(", "vdp_vram", ",", "0", ",", "VRAM_SIZE", ")", ";", "memset", "(", "vdp_vsram", ",", "0", ",", "VSRAM_SIZE", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "0x1000", ";", "i", "++", ")", "{", "int", "orig_color", "=", "i", "&", "0x7ff", ";", "int", "half_bright", "=", "i", "&", "0x800", ";", "if", "(", "orig_color", "&", "0x100", ")", "transparent_lookup", "[", "i", "]", "=", "orig_color", ";", "else", "if", "(", "half_bright", ")", "transparent_lookup", "[", "i", "]", "=", "orig_color", "|", "0x800", ";", "else", "transparent_lookup", "[", "i", "]", "=", "orig_color", "|", "0x1000", ";", "}", "genesis_palette_base", "=", "0", ";", "genesis_bg_pal_lookup", "[", "0", "]", "=", "genesis_sp_pal_lookup", "[", "0", "]", "=", "0x00", ";", "genesis_bg_pal_lookup", "[", "1", "]", "=", "genesis_sp_pal_lookup", "[", "1", "]", "=", "0x10", ";", "genesis_bg_pal_lookup", "[", "2", "]", "=", "genesis_sp_pal_lookup", "[", "2", "]", "=", "0x20", ";", "genesis_bg_pal_lookup", "[", "3", "]", "=", "genesis_sp_pal_lookup", "[", "3", "]", "=", "0x30", ";", "for", "(", "i", "=", "0", ";", "i", "<", "24", ";", "i", "++", ")", "vdp_register_w", "(", "screen", "->", "machine", ",", "0x8000", "|", "(", "i", "<<", "8", ")", "|", "vdp_init", "[", "i", "]", ",", "1", ")", ";", "vdp_cmdpart", "=", "0", ";", "vdp_code", "=", "0", ";", "vdp_address", "=", "0", ";", "state_save_register_global_array", "(", "screen", "->", "machine", ",", "genesis_vdp_regs", ")", ";", "state_save_register_global_pointer", "(", "screen", "->", "machine", ",", "vdp_vram", ",", "0x10000", ")", ";", "state_save_register_global_pointer", "(", "screen", "->", "machine", ",", "vdp_vsram", ",", "0x80", ")", ";", "state_save_register_global_array", "(", "screen", "->", "machine", ",", "genesis_bg_pal_lookup", ")", ";", "state_save_register_global_array", "(", "screen", "->", "machine", ",", "genesis_sp_pal_lookup", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "display_enable", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_scrollabase", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_scrollbbase", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_windowbase", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_spritebase", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_hscrollbase", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_hscrollmask", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_hscrollsize", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_vscrollmode", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_cmdpart", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_code", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_address", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "vdp_dmafill", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "scrollheight", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "scrollwidth", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "bgcol", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "window_down", ")", ";", "state_save_register_global", "(", "screen", "->", "machine", ",", "window_vpos", ")", ";", "}" ]
Video Start / Stop Functions Here we allocate memory used by the VDP and various other video related parts of the System C/C2 hardware such as the Palette RAM.
[ "Video", "Start", "/", "Stop", "Functions", "Here", "we", "allocate", "memory", "used", "by", "the", "VDP", "and", "various", "other", "video", "related", "parts", "of", "the", "System", "C", "/", "C2", "hardware", "such", "as", "the", "Palette", "RAM", "." ]
[ "/* allocate memory for the VDP, the lookup table, and the buffer bitmap */", "/* clear the VDP memory, prevents corrupt tile in Puyo Puyo 2 */", "/* init transparency table */", "/* reset the palettes */", "/* reset VDP */", "/* Save State Stuff */" ]
[ { "param": "screen", "type": "screen_device" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "screen", "type": "screen_device", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3563935db04ec2c8d95af62f21d125c01c2c4ebc
lofunz/mieme
Reloaded/trunk/src/mame/video/genesis.c
[ "Unlicense" ]
C
system18_vdp_update
void
void system18_vdp_update( bitmap_t *bitmap, const rectangle *cliprect ) { int y; /* generate the final screen */ for (y = cliprect->min_y; y <= cliprect->max_y; y++) drawline(BITMAP_ADDR16(bitmap, y, 0), y, 0xffff); }
/****************************************************************************** Screen Refresh Functions ******************************************************************************* These are responsible for the core drawing. The update_display function can be called under several circumstances to cache all the currently displayed lines before a significant palette or scrolling change is set to occur. The actual refresh routine marks the accumulated palette entries and then converts the raw pens in the cache bitmap to their final remapped values. ******************************************************************************/
Screen Refresh Functions These are responsible for the core drawing. The update_display function can be called under several circumstances to cache all the currently displayed lines before a significant palette or scrolling change is set to occur. The actual refresh routine marks the accumulated palette entries and then converts the raw pens in the cache bitmap to their final remapped values.
[ "Screen", "Refresh", "Functions", "These", "are", "responsible", "for", "the", "core", "drawing", ".", "The", "update_display", "function", "can", "be", "called", "under", "several", "circumstances", "to", "cache", "all", "the", "currently", "displayed", "lines", "before", "a", "significant", "palette", "or", "scrolling", "change", "is", "set", "to", "occur", ".", "The", "actual", "refresh", "routine", "marks", "the", "accumulated", "palette", "entries", "and", "then", "converts", "the", "raw", "pens", "in", "the", "cache", "bitmap", "to", "their", "final", "remapped", "values", "." ]
void system18_vdp_update( bitmap_t *bitmap, const rectangle *cliprect ) { int y; for (y = cliprect->min_y; y <= cliprect->max_y; y++) drawline(BITMAP_ADDR16(bitmap, y, 0), y, 0xffff); }
[ "void", "system18_vdp_update", "(", "bitmap_t", "*", "bitmap", ",", "const", "rectangle", "*", "cliprect", ")", "{", "int", "y", ";", "for", "(", "y", "=", "cliprect", "->", "min_y", ";", "y", "<=", "cliprect", "->", "max_y", ";", "y", "++", ")", "drawline", "(", "BITMAP_ADDR16", "(", "bitmap", ",", "y", ",", "0", ")", ",", "y", ",", "0xffff", ")", ";", "}" ]
Screen Refresh Functions These are responsible for the core drawing.
[ "Screen", "Refresh", "Functions", "These", "are", "responsible", "for", "the", "core", "drawing", "." ]
[ "/* generate the final screen */" ]
[ { "param": "bitmap", "type": "bitmap_t" }, { "param": "cliprect", "type": "rectangle" } ]
{ "returns": [], "raises": [], "params": [ { "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": [] }
3563935db04ec2c8d95af62f21d125c01c2c4ebc
lofunz/mieme
Reloaded/trunk/src/mame/video/genesis.c
[ "Unlicense" ]
C
vdp_control_r
int
static int vdp_control_r(running_machine *machine) { int status = 0x3600; // wwally needs fifo empty set /* kill 2nd write pending flag */ vdp_cmdpart = 0; /* set the VBLANK bit */ if (machine->primary_screen->vblank()) status |= 0x0008; /* set the HBLANK bit */ if (machine->primary_screen->hblank()) status |= 0x0004; return (status); }
/****************************************************************************** VDP CTRL Reads / Writes (Accesses to 0xC00004 - 0xC00007) ******************************************************************************* A Read from the Control Port will return the Status Register Value. 16-bits are used to report the VDP status | 0 | 0 | 1 | 1 | 0 | 1 | FIFE | FIFF | | VIP | SOF | SCL | ODD | VBLK | HBLK | DMA | PAL | 0,1 = Set Values FIFE = FIFO Empty FIFF = FIFO Full VIP = Vertical Interrupt Pending SOF = Sprite Overflow (Not used in C2 afaik) SCL = Sprite Collision (Not used in C2 afaik) ODD = Odd Frame (Interlace Mode) (Not used in C2 afaik) VBLK = In Vertical Blank HBLK = In Horizontal Blank DMA = DMA In Progress PAL = Pal Mode Flag Control Writes are used for setting VDP Registers, setting up DMA Transfers etc. A Write to the Control port can consist of 2 16-bit Words. When the VDP _isn't_ expecting the 2nd part of a command the highest 2 bits of the data written will determine what it is we want to do. 10xxxxxx xxxxxxxx will cause a register to be set anything else will trigger the 1st half of a 2 Part Mode Setting Command If the VDP is already expecting the 2nd half of a command the data written will be the 2nd half of the Mode setup. ******************************************************************************/
VDP CTRL Reads / Writes (Accesses to 0xC00004 - 0xC00007) A Read from the Control Port will return the Status Register Value. Control Writes are used for setting VDP Registers, setting up DMA Transfers etc. A Write to the Control port can consist of 2 16-bit Words. When the VDP _isn't_ expecting the 2nd part of a command the highest 2 bits of the data written will determine what it is we want to do. 10xxxxxx xxxxxxxx will cause a register to be set anything else will trigger the 1st half of a 2 Part Mode Setting Command If the VDP is already expecting the 2nd half of a command the data written will be the 2nd half of the Mode setup.
[ "VDP", "CTRL", "Reads", "/", "Writes", "(", "Accesses", "to", "0xC00004", "-", "0xC00007", ")", "A", "Read", "from", "the", "Control", "Port", "will", "return", "the", "Status", "Register", "Value", ".", "Control", "Writes", "are", "used", "for", "setting", "VDP", "Registers", "setting", "up", "DMA", "Transfers", "etc", ".", "A", "Write", "to", "the", "Control", "port", "can", "consist", "of", "2", "16", "-", "bit", "Words", ".", "When", "the", "VDP", "_isn", "'", "t_", "expecting", "the", "2nd", "part", "of", "a", "command", "the", "highest", "2", "bits", "of", "the", "data", "written", "will", "determine", "what", "it", "is", "we", "want", "to", "do", ".", "10xxxxxx", "xxxxxxxx", "will", "cause", "a", "register", "to", "be", "set", "anything", "else", "will", "trigger", "the", "1st", "half", "of", "a", "2", "Part", "Mode", "Setting", "Command", "If", "the", "VDP", "is", "already", "expecting", "the", "2nd", "half", "of", "a", "command", "the", "data", "written", "will", "be", "the", "2nd", "half", "of", "the", "Mode", "setup", "." ]
static int vdp_control_r(running_machine *machine) { int status = 0x3600; vdp_cmdpart = 0; if (machine->primary_screen->vblank()) status |= 0x0008; if (machine->primary_screen->hblank()) status |= 0x0004; return (status); }
[ "static", "int", "vdp_control_r", "(", "running_machine", "*", "machine", ")", "{", "int", "status", "=", "0x3600", ";", "vdp_cmdpart", "=", "0", ";", "if", "(", "machine", "->", "primary_screen", "->", "vblank", "(", ")", ")", "status", "|=", "0x0008", ";", "if", "(", "machine", "->", "primary_screen", "->", "hblank", "(", ")", ")", "status", "|=", "0x0004", ";", "return", "(", "status", ")", ";", "}" ]
VDP CTRL Reads / Writes (Accesses to 0xC00004 - 0xC00007) A Read from the Control Port will return the Status Register Value.
[ "VDP", "CTRL", "Reads", "/", "Writes", "(", "Accesses", "to", "0xC00004", "-", "0xC00007", ")", "A", "Read", "from", "the", "Control", "Port", "will", "return", "the", "Status", "Register", "Value", "." ]
[ "// wwally needs fifo empty set\r", "/* kill 2nd write pending flag */", "/* set the VBLANK bit */", "/* set the HBLANK bit */" ]
[ { "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": [] }
3563935db04ec2c8d95af62f21d125c01c2c4ebc
lofunz/mieme
Reloaded/trunk/src/mame/video/genesis.c
[ "Unlicense" ]
C
vdp_dma_68k
void
static void vdp_dma_68k(const address_space *space) { int length = genesis_vdp_regs[19] | (genesis_vdp_regs[20] << 8); int source = (genesis_vdp_regs[21] << 1) | (genesis_vdp_regs[22] << 9) | ((genesis_vdp_regs[23] & 0x7f) << 17); int count; /* length of 0 means 64k likely */ if (!length) length = 0xffff; /* handle the DMA */ for (count = 0; count < length; count++) { vdp_data_w(space->machine, memory_read_word(space, source)); source += 2; } }
/****************************************************************************** DMA handling ******************************************************************************* These are currently Pretty much directly from the C2 emu ******************************************************************************/
DMA handling These are currently Pretty much directly from the C2 emu
[ "DMA", "handling", "These", "are", "currently", "Pretty", "much", "directly", "from", "the", "C2", "emu" ]
static void vdp_dma_68k(const address_space *space) { int length = genesis_vdp_regs[19] | (genesis_vdp_regs[20] << 8); int source = (genesis_vdp_regs[21] << 1) | (genesis_vdp_regs[22] << 9) | ((genesis_vdp_regs[23] & 0x7f) << 17); int count; if (!length) length = 0xffff; for (count = 0; count < length; count++) { vdp_data_w(space->machine, memory_read_word(space, source)); source += 2; } }
[ "static", "void", "vdp_dma_68k", "(", "const", "address_space", "*", "space", ")", "{", "int", "length", "=", "genesis_vdp_regs", "[", "19", "]", "|", "(", "genesis_vdp_regs", "[", "20", "]", "<<", "8", ")", ";", "int", "source", "=", "(", "genesis_vdp_regs", "[", "21", "]", "<<", "1", ")", "|", "(", "genesis_vdp_regs", "[", "22", "]", "<<", "9", ")", "|", "(", "(", "genesis_vdp_regs", "[", "23", "]", "&", "0x7f", ")", "<<", "17", ")", ";", "int", "count", ";", "if", "(", "!", "length", ")", "length", "=", "0xffff", ";", "for", "(", "count", "=", "0", ";", "count", "<", "length", ";", "count", "++", ")", "{", "vdp_data_w", "(", "space", "->", "machine", ",", "memory_read_word", "(", "space", ",", "source", ")", ")", ";", "source", "+=", "2", ";", "}", "}" ]
DMA handling These are currently Pretty much directly from the C2 emu
[ "DMA", "handling", "These", "are", "currently", "Pretty", "much", "directly", "from", "the", "C2", "emu" ]
[ "/* length of 0 means 64k likely */", "/* handle the DMA */" ]
[ { "param": "space", "type": "address_space" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3563935db04ec2c8d95af62f21d125c01c2c4ebc
lofunz/mieme
Reloaded/trunk/src/mame/video/genesis.c
[ "Unlicense" ]
C
drawline
void
static void drawline(UINT16 *bitmap, int line, int bgfill) { int lowsprites, highsprites, link; UINT32 scrolla_tiles[41], scrollb_tiles[41], window_tiles[41]; int scrolla_offset, scrollb_offset; UINT8 *lowlist[81], *highlist[81]; int bgcolor = bgfill ? bgfill : genesis_bg_pal_lookup[0]; int window_lclip, window_rclip; int scrolla_lclip, scrolla_rclip; int column, sprite; /* clear to the background color */ for (column = 0; column < BITMAP_WIDTH; column++) bitmap[column] = bgcolor; /* if display is disabled, stop */ if (!(genesis_vdp_regs[1] & 0x40)) return; /* Sprites need to be Drawn in Reverse order .. may as well sort them here */ link = lowsprites = highsprites = 0; for (sprite = 0; sprite < 80; sprite++) { UINT8 *spritebase = &VDP_VRAM_BYTE(vdp_spritebase + 8 * link); /* sort into high/low priorities */ if (spritebase[4] & 0x0080) highlist[++highsprites] = spritebase; else lowlist[++lowsprites] = spritebase; /* get the link; if 0, stop processing */ link = spritebase[3] & 0x7F; if (!link) break; } /* get tiles for the B scroll layer */ get_scroll_tiles(line, 2, vdp_scrollbbase, scrollb_tiles, &scrollb_offset); /* get tiles for the A scroll layer */ get_scroll_tiles(line, 0, vdp_scrollabase, scrolla_tiles, &scrolla_offset); /* get tiles for the window layer */ get_window_tiles(line, vdp_windowbase, window_tiles); /* compute the windowing for this line */ if ((window_down && line >= window_vpos) || (!window_down && line < window_vpos)) window_lclip = 0, window_rclip = BITMAP_WIDTH - 1; else if (window_right) window_lclip = window_hpos, window_rclip = BITMAP_WIDTH - 1; else window_lclip = 0, window_rclip = window_hpos - 1; /* compute the clipping of the scroll A layer */ if (window_lclip == 0) { scrolla_lclip = window_rclip + 1; scrolla_rclip = BITMAP_WIDTH - 1; } else { scrolla_lclip = 0; scrolla_rclip = window_lclip - 1; } /* Scroll B Low */ drawline_tiles(scrollb_tiles, bitmap, 0, scrollb_offset, 0, BITMAP_WIDTH - 1); /* Scroll A Low */ drawline_tiles(scrolla_tiles, bitmap, 0, scrolla_offset, scrolla_lclip, scrolla_rclip); /* Window Low */ drawline_tiles(window_tiles, bitmap, 0, 0, window_lclip, window_rclip); /* Sprites Low */ for (sprite = lowsprites; sprite > 0; sprite--) drawline_sprite(line, bitmap, 0, lowlist[sprite]); /* Scroll B High */ drawline_tiles(scrollb_tiles, bitmap, 1, scrollb_offset, 0, BITMAP_WIDTH - 1); /* Scroll A High */ drawline_tiles(scrolla_tiles, bitmap, 1, scrolla_offset, scrolla_lclip, scrolla_rclip); /* Window High */ drawline_tiles(window_tiles, bitmap, 1, 0, window_lclip, window_rclip); /* Sprites High */ for (sprite = highsprites; sprite > 0; sprite--) drawline_sprite(line, bitmap, 1, highlist[sprite]); }
/****************************************************************************** Drawing Functions ******************************************************************************* These are used by the Screen Refresh functions to do the actual rendering of a screenline to the bitmap. Draw Planes in Order Scroll B Low Scroll A Low / Window Low Sprites Low Scroll B High Scroll A High / Window High Sprites High NOTE: Low Sprites _can_ overlap High sprites, however none of the C2 games do this ever so its safe to draw them in this order. ******************************************************************************/
Drawing Functions These are used by the Screen Refresh functions to do the actual rendering of a screenline to the bitmap. Draw Planes in Order Scroll B Low Scroll A Low / Window Low Sprites Low Scroll B High Scroll A High / Window High Sprites High Low Sprites _can_ overlap High sprites, however none of the C2 games do this ever so its safe to draw them in this order.
[ "Drawing", "Functions", "These", "are", "used", "by", "the", "Screen", "Refresh", "functions", "to", "do", "the", "actual", "rendering", "of", "a", "screenline", "to", "the", "bitmap", ".", "Draw", "Planes", "in", "Order", "Scroll", "B", "Low", "Scroll", "A", "Low", "/", "Window", "Low", "Sprites", "Low", "Scroll", "B", "High", "Scroll", "A", "High", "/", "Window", "High", "Sprites", "High", "Low", "Sprites", "_can_", "overlap", "High", "sprites", "however", "none", "of", "the", "C2", "games", "do", "this", "ever", "so", "its", "safe", "to", "draw", "them", "in", "this", "order", "." ]
static void drawline(UINT16 *bitmap, int line, int bgfill) { int lowsprites, highsprites, link; UINT32 scrolla_tiles[41], scrollb_tiles[41], window_tiles[41]; int scrolla_offset, scrollb_offset; UINT8 *lowlist[81], *highlist[81]; int bgcolor = bgfill ? bgfill : genesis_bg_pal_lookup[0]; int window_lclip, window_rclip; int scrolla_lclip, scrolla_rclip; int column, sprite; for (column = 0; column < BITMAP_WIDTH; column++) bitmap[column] = bgcolor; if (!(genesis_vdp_regs[1] & 0x40)) return; link = lowsprites = highsprites = 0; for (sprite = 0; sprite < 80; sprite++) { UINT8 *spritebase = &VDP_VRAM_BYTE(vdp_spritebase + 8 * link); if (spritebase[4] & 0x0080) highlist[++highsprites] = spritebase; else lowlist[++lowsprites] = spritebase; link = spritebase[3] & 0x7F; if (!link) break; } get_scroll_tiles(line, 2, vdp_scrollbbase, scrollb_tiles, &scrollb_offset); get_scroll_tiles(line, 0, vdp_scrollabase, scrolla_tiles, &scrolla_offset); get_window_tiles(line, vdp_windowbase, window_tiles); if ((window_down && line >= window_vpos) || (!window_down && line < window_vpos)) window_lclip = 0, window_rclip = BITMAP_WIDTH - 1; else if (window_right) window_lclip = window_hpos, window_rclip = BITMAP_WIDTH - 1; else window_lclip = 0, window_rclip = window_hpos - 1; if (window_lclip == 0) { scrolla_lclip = window_rclip + 1; scrolla_rclip = BITMAP_WIDTH - 1; } else { scrolla_lclip = 0; scrolla_rclip = window_lclip - 1; } drawline_tiles(scrollb_tiles, bitmap, 0, scrollb_offset, 0, BITMAP_WIDTH - 1); drawline_tiles(scrolla_tiles, bitmap, 0, scrolla_offset, scrolla_lclip, scrolla_rclip); drawline_tiles(window_tiles, bitmap, 0, 0, window_lclip, window_rclip); for (sprite = lowsprites; sprite > 0; sprite--) drawline_sprite(line, bitmap, 0, lowlist[sprite]); drawline_tiles(scrollb_tiles, bitmap, 1, scrollb_offset, 0, BITMAP_WIDTH - 1); drawline_tiles(scrolla_tiles, bitmap, 1, scrolla_offset, scrolla_lclip, scrolla_rclip); drawline_tiles(window_tiles, bitmap, 1, 0, window_lclip, window_rclip); for (sprite = highsprites; sprite > 0; sprite--) drawline_sprite(line, bitmap, 1, highlist[sprite]); }
[ "static", "void", "drawline", "(", "UINT16", "*", "bitmap", ",", "int", "line", ",", "int", "bgfill", ")", "{", "int", "lowsprites", ",", "highsprites", ",", "link", ";", "UINT32", "scrolla_tiles", "[", "41", "]", ",", "scrollb_tiles", "[", "41", "]", ",", "window_tiles", "[", "41", "]", ";", "int", "scrolla_offset", ",", "scrollb_offset", ";", "UINT8", "*", "lowlist", "[", "81", "]", ",", "*", "highlist", "[", "81", "]", ";", "int", "bgcolor", "=", "bgfill", "?", "bgfill", ":", "genesis_bg_pal_lookup", "[", "0", "]", ";", "int", "window_lclip", ",", "window_rclip", ";", "int", "scrolla_lclip", ",", "scrolla_rclip", ";", "int", "column", ",", "sprite", ";", "for", "(", "column", "=", "0", ";", "column", "<", "BITMAP_WIDTH", ";", "column", "++", ")", "bitmap", "[", "column", "]", "=", "bgcolor", ";", "if", "(", "!", "(", "genesis_vdp_regs", "[", "1", "]", "&", "0x40", ")", ")", "return", ";", "link", "=", "lowsprites", "=", "highsprites", "=", "0", ";", "for", "(", "sprite", "=", "0", ";", "sprite", "<", "80", ";", "sprite", "++", ")", "{", "UINT8", "*", "spritebase", "=", "&", "VDP_VRAM_BYTE", "(", "vdp_spritebase", "+", "8", "*", "link", ")", ";", "if", "(", "spritebase", "[", "4", "]", "&", "0x0080", ")", "highlist", "[", "++", "highsprites", "]", "=", "spritebase", ";", "else", "lowlist", "[", "++", "lowsprites", "]", "=", "spritebase", ";", "link", "=", "spritebase", "[", "3", "]", "&", "0x7F", ";", "if", "(", "!", "link", ")", "break", ";", "}", "get_scroll_tiles", "(", "line", ",", "2", ",", "vdp_scrollbbase", ",", "scrollb_tiles", ",", "&", "scrollb_offset", ")", ";", "get_scroll_tiles", "(", "line", ",", "0", ",", "vdp_scrollabase", ",", "scrolla_tiles", ",", "&", "scrolla_offset", ")", ";", "get_window_tiles", "(", "line", ",", "vdp_windowbase", ",", "window_tiles", ")", ";", "if", "(", "(", "window_down", "&&", "line", ">=", "window_vpos", ")", "||", "(", "!", "window_down", "&&", "line", "<", "window_vpos", ")", ")", "window_lclip", "=", "0", ",", "window_rclip", "=", "BITMAP_WIDTH", "-", "1", ";", "else", "if", "(", "window_right", ")", "window_lclip", "=", "window_hpos", ",", "window_rclip", "=", "BITMAP_WIDTH", "-", "1", ";", "else", "window_lclip", "=", "0", ",", "window_rclip", "=", "window_hpos", "-", "1", ";", "if", "(", "window_lclip", "==", "0", ")", "{", "scrolla_lclip", "=", "window_rclip", "+", "1", ";", "scrolla_rclip", "=", "BITMAP_WIDTH", "-", "1", ";", "}", "else", "{", "scrolla_lclip", "=", "0", ";", "scrolla_rclip", "=", "window_lclip", "-", "1", ";", "}", "drawline_tiles", "(", "scrollb_tiles", ",", "bitmap", ",", "0", ",", "scrollb_offset", ",", "0", ",", "BITMAP_WIDTH", "-", "1", ")", ";", "drawline_tiles", "(", "scrolla_tiles", ",", "bitmap", ",", "0", ",", "scrolla_offset", ",", "scrolla_lclip", ",", "scrolla_rclip", ")", ";", "drawline_tiles", "(", "window_tiles", ",", "bitmap", ",", "0", ",", "0", ",", "window_lclip", ",", "window_rclip", ")", ";", "for", "(", "sprite", "=", "lowsprites", ";", "sprite", ">", "0", ";", "sprite", "--", ")", "drawline_sprite", "(", "line", ",", "bitmap", ",", "0", ",", "lowlist", "[", "sprite", "]", ")", ";", "drawline_tiles", "(", "scrollb_tiles", ",", "bitmap", ",", "1", ",", "scrollb_offset", ",", "0", ",", "BITMAP_WIDTH", "-", "1", ")", ";", "drawline_tiles", "(", "scrolla_tiles", ",", "bitmap", ",", "1", ",", "scrolla_offset", ",", "scrolla_lclip", ",", "scrolla_rclip", ")", ";", "drawline_tiles", "(", "window_tiles", ",", "bitmap", ",", "1", ",", "0", ",", "window_lclip", ",", "window_rclip", ")", ";", "for", "(", "sprite", "=", "highsprites", ";", "sprite", ">", "0", ";", "sprite", "--", ")", "drawline_sprite", "(", "line", ",", "bitmap", ",", "1", ",", "highlist", "[", "sprite", "]", ")", ";", "}" ]
Drawing Functions These are used by the Screen Refresh functions to do the actual rendering of a screenline to the bitmap.
[ "Drawing", "Functions", "These", "are", "used", "by", "the", "Screen", "Refresh", "functions", "to", "do", "the", "actual", "rendering", "of", "a", "screenline", "to", "the", "bitmap", "." ]
[ "/* clear to the background color */", "/* if display is disabled, stop */", "/* Sprites need to be Drawn in Reverse order .. may as well sort them here */", "/* sort into high/low priorities */", "/* get the link; if 0, stop processing */", "/* get tiles for the B scroll layer */", "/* get tiles for the A scroll layer */", "/* get tiles for the window layer */", "/* compute the windowing for this line */", "/* compute the clipping of the scroll A layer */", "/* Scroll B Low */", "/* Scroll A Low */", "/* Window Low */", "/* Sprites Low */", "/* Scroll B High */", "/* Scroll A High */", "/* Window High */", "/* Sprites High */" ]
[ { "param": "bitmap", "type": "UINT16" }, { "param": "line", "type": "int" }, { "param": "bgfill", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bitmap", "type": "UINT16", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "line", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bgfill", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a24295115a484aefb140547c0f3c9067ebcddfe7
lofunz/mieme
Reloaded/trunk/src/emu/emuopts.c
[ "Unlicense" ]
C
image_add_device_options
void
void image_add_device_options(core_options *opts, const game_driver *driver) { int index = 0; machine_config *config; const device_config_image_interface *image = NULL; /* create the configuration */ config = global_alloc(machine_config(driver->machine_config)); /* enumerate our callback for every device */ /* loop on each device instance */ for (bool gotone = config->m_devicelist.first(image); gotone; gotone = image->next(image)) { options_entry entry[2]; astring dev_full_name; /* first device? add the header as to be pretty */ if (index == 0) { memset(entry, 0, sizeof(entry)); entry[0].description = "IMAGE DEVICES"; entry[0].flags = OPTION_HEADER; options_add_entries(opts, entry); } /* retrieve info about the device instance */ dev_full_name.printf("%s;%s", image->instance_name(), image->brief_instance_name()); /* add the option */ memset(entry, 0, sizeof(entry)); entry[0].name = dev_full_name; options_add_entries(opts, entry); index++; } /* record that we've added device options */ options_set_bool(opts, OPTION_ADDED_DEVICE_OPTIONS, TRUE, OPTION_PRIORITY_CMDLINE); /* free the configuration */ global_free(config); }
/*------------------------------------------------- image_add_device_options - add all of the device options for a specified device -------------------------------------------------*/
add all of the device options for a specified device
[ "add", "all", "of", "the", "device", "options", "for", "a", "specified", "device" ]
void image_add_device_options(core_options *opts, const game_driver *driver) { int index = 0; machine_config *config; const device_config_image_interface *image = NULL; config = global_alloc(machine_config(driver->machine_config)); for (bool gotone = config->m_devicelist.first(image); gotone; gotone = image->next(image)) { options_entry entry[2]; astring dev_full_name; if (index == 0) { memset(entry, 0, sizeof(entry)); entry[0].description = "IMAGE DEVICES"; entry[0].flags = OPTION_HEADER; options_add_entries(opts, entry); } dev_full_name.printf("%s;%s", image->instance_name(), image->brief_instance_name()); memset(entry, 0, sizeof(entry)); entry[0].name = dev_full_name; options_add_entries(opts, entry); index++; } options_set_bool(opts, OPTION_ADDED_DEVICE_OPTIONS, TRUE, OPTION_PRIORITY_CMDLINE); global_free(config); }
[ "void", "image_add_device_options", "(", "core_options", "*", "opts", ",", "const", "game_driver", "*", "driver", ")", "{", "int", "index", "=", "0", ";", "machine_config", "*", "config", ";", "const", "device_config_image_interface", "*", "image", "=", "NULL", ";", "config", "=", "global_alloc", "(", "machine_config", "(", "driver", "->", "machine_config", ")", ")", ";", "for", "(", "bool", "gotone", "=", "config", "->", "m_devicelist", ".", "first", "(", "image", ")", ";", "gotone", ";", "gotone", "=", "image", "->", "next", "(", "image", ")", ")", "{", "options_entry", "entry", "[", "2", "]", ";", "astring", "dev_full_name", ";", "if", "(", "index", "==", "0", ")", "{", "memset", "(", "entry", ",", "0", ",", "sizeof", "(", "entry", ")", ")", ";", "entry", "[", "0", "]", ".", "description", "=", "\"", "\"", ";", "entry", "[", "0", "]", ".", "flags", "=", "OPTION_HEADER", ";", "options_add_entries", "(", "opts", ",", "entry", ")", ";", "}", "dev_full_name", ".", "printf", "(", "\"", "\"", ",", "image", "->", "instance_name", "(", ")", ",", "image", "->", "brief_instance_name", "(", ")", ")", ";", "memset", "(", "entry", ",", "0", ",", "sizeof", "(", "entry", ")", ")", ";", "entry", "[", "0", "]", ".", "name", "=", "dev_full_name", ";", "options_add_entries", "(", "opts", ",", "entry", ")", ";", "index", "++", ";", "}", "options_set_bool", "(", "opts", ",", "OPTION_ADDED_DEVICE_OPTIONS", ",", "TRUE", ",", "OPTION_PRIORITY_CMDLINE", ")", ";", "global_free", "(", "config", ")", ";", "}" ]
image_add_device_options - add all of the device options for a specified device
[ "image_add_device_options", "-", "add", "all", "of", "the", "device", "options", "for", "a", "specified", "device" ]
[ "/* create the configuration */", "/* enumerate our callback for every device */", "/* loop on each device instance */", "/* first device? add the header as to be pretty */", "/* retrieve info about the device instance */", "/* add the option */", "/* record that we've added device options */", "/* free the configuration */" ]
[ { "param": "opts", "type": "core_options" }, { "param": "driver", "type": "game_driver" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "opts", "type": "core_options", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "driver", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a24295115a484aefb140547c0f3c9067ebcddfe7
lofunz/mieme
Reloaded/trunk/src/emu/emuopts.c
[ "Unlicense" ]
C
image_driver_name_callback
void
static void image_driver_name_callback(core_options *opts, const char *arg) { const game_driver *driver; /* only add these options if we have not yet added them */ if (!options_get_bool(opts, OPTION_ADDED_DEVICE_OPTIONS)) { driver = driver_get_name(arg); if (driver != NULL) { image_add_device_options(opts, driver); } } }
/*------------------------------------------------- image_driver_name_callback - called when we parse the driver name, so we can add options specific to that driver -------------------------------------------------*/
called when we parse the driver name, so we can add options specific to that driver
[ "called", "when", "we", "parse", "the", "driver", "name", "so", "we", "can", "add", "options", "specific", "to", "that", "driver" ]
static void image_driver_name_callback(core_options *opts, const char *arg) { const game_driver *driver; if (!options_get_bool(opts, OPTION_ADDED_DEVICE_OPTIONS)) { driver = driver_get_name(arg); if (driver != NULL) { image_add_device_options(opts, driver); } } }
[ "static", "void", "image_driver_name_callback", "(", "core_options", "*", "opts", ",", "const", "char", "*", "arg", ")", "{", "const", "game_driver", "*", "driver", ";", "if", "(", "!", "options_get_bool", "(", "opts", ",", "OPTION_ADDED_DEVICE_OPTIONS", ")", ")", "{", "driver", "=", "driver_get_name", "(", "arg", ")", ";", "if", "(", "driver", "!=", "NULL", ")", "{", "image_add_device_options", "(", "opts", ",", "driver", ")", ";", "}", "}", "}" ]
image_driver_name_callback - called when we parse the driver name, so we can add options specific to that driver
[ "image_driver_name_callback", "-", "called", "when", "we", "parse", "the", "driver", "name", "so", "we", "can", "add", "options", "specific", "to", "that", "driver" ]
[ "/* only add these options if we have not yet added them */" ]
[ { "param": "opts", "type": "core_options" }, { "param": "arg", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "opts", "type": "core_options", "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": [] }
9e55c7aed0204da6c0614a0d0930602e3cdd1d47
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/dec8.c
[ "Unlicense" ]
C
draw_sprites1
void
static void draw_sprites1(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, int priority) { int offs,x,y,sprite,sprite2,colour,extra,fx,fy; for (offs = 0;offs < 0x800;offs += 8) { y=buffered_spriteram[offs+1]+(buffered_spriteram[offs]<<8); if ((y&0x8000) == 0) continue; fx=buffered_spriteram[offs+3]; if ((fx&0x1) == 0) continue; extra=fx&0x10; fy=fx&0x2; fx=fx&0x4; x = buffered_spriteram[offs+5]+(buffered_spriteram[offs+4]<<8); colour = buffered_spriteram[offs+6] >> 4; if (priority==1 && (colour&8)) continue; if (priority==2 && !(colour&8)) continue; sprite = buffered_spriteram[offs+7]+(buffered_spriteram[offs+6]<<8); sprite &= 0x0fff; if (extra) {y=y+16;sprite&=0xffe;} x = x & 0x01ff; y = y & 0x01ff; x=(x+16)%0x200; y=(y+16)%0x200; x=256 - x; y=256 - y; if (flip_screen_get(machine)) { y=240-y; x=240-x; if (fx) fx=0; else fx=1; if (fy) fy=0; else fy=1; if (extra) y=y-16; } /* Y Flip determines order of multi-sprite */ if (extra && fy) { sprite2=sprite; sprite++; } else sprite2=sprite+1; drawgfx_transpen(bitmap,cliprect,machine->gfx[1], sprite, colour,fx,fy,x,y,0); /* 1 more sprite drawn underneath */ if (extra) drawgfx_transpen(bitmap,cliprect,machine->gfx[1], sprite2, colour,fx,fy,x,y+16,0); } }
/* 'Karnov' sprites, used by Gondomania, Last Mission, Shackled, Ghostbusters */
'Karnov' sprites, used by Gondomania, Last Mission, Shackled, Ghostbusters
[ "'", "Karnov", "'", "sprites", "used", "by", "Gondomania", "Last", "Mission", "Shackled", "Ghostbusters" ]
static void draw_sprites1(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect, int priority) { int offs,x,y,sprite,sprite2,colour,extra,fx,fy; for (offs = 0;offs < 0x800;offs += 8) { y=buffered_spriteram[offs+1]+(buffered_spriteram[offs]<<8); if ((y&0x8000) == 0) continue; fx=buffered_spriteram[offs+3]; if ((fx&0x1) == 0) continue; extra=fx&0x10; fy=fx&0x2; fx=fx&0x4; x = buffered_spriteram[offs+5]+(buffered_spriteram[offs+4]<<8); colour = buffered_spriteram[offs+6] >> 4; if (priority==1 && (colour&8)) continue; if (priority==2 && !(colour&8)) continue; sprite = buffered_spriteram[offs+7]+(buffered_spriteram[offs+6]<<8); sprite &= 0x0fff; if (extra) {y=y+16;sprite&=0xffe;} x = x & 0x01ff; y = y & 0x01ff; x=(x+16)%0x200; y=(y+16)%0x200; x=256 - x; y=256 - y; if (flip_screen_get(machine)) { y=240-y; x=240-x; if (fx) fx=0; else fx=1; if (fy) fy=0; else fy=1; if (extra) y=y-16; } if (extra && fy) { sprite2=sprite; sprite++; } else sprite2=sprite+1; drawgfx_transpen(bitmap,cliprect,machine->gfx[1], sprite, colour,fx,fy,x,y,0); if (extra) drawgfx_transpen(bitmap,cliprect,machine->gfx[1], sprite2, colour,fx,fy,x,y+16,0); } }
[ "static", "void", "draw_sprites1", "(", "running_machine", "*", "machine", ",", "bitmap_t", "*", "bitmap", ",", "const", "rectangle", "*", "cliprect", ",", "int", "priority", ")", "{", "int", "offs", ",", "x", ",", "y", ",", "sprite", ",", "sprite2", ",", "colour", ",", "extra", ",", "fx", ",", "fy", ";", "for", "(", "offs", "=", "0", ";", "offs", "<", "0x800", ";", "offs", "+=", "8", ")", "{", "y", "=", "buffered_spriteram", "[", "offs", "+", "1", "]", "+", "(", "buffered_spriteram", "[", "offs", "]", "<<", "8", ")", ";", "if", "(", "(", "y", "&", "0x8000", ")", "==", "0", ")", "continue", ";", "fx", "=", "buffered_spriteram", "[", "offs", "+", "3", "]", ";", "if", "(", "(", "fx", "&", "0x1", ")", "==", "0", ")", "continue", ";", "extra", "=", "fx", "&", "0x10", ";", "fy", "=", "fx", "&", "0x2", ";", "fx", "=", "fx", "&", "0x4", ";", "x", "=", "buffered_spriteram", "[", "offs", "+", "5", "]", "+", "(", "buffered_spriteram", "[", "offs", "+", "4", "]", "<<", "8", ")", ";", "colour", "=", "buffered_spriteram", "[", "offs", "+", "6", "]", ">>", "4", ";", "if", "(", "priority", "==", "1", "&&", "(", "colour", "&", "8", ")", ")", "continue", ";", "if", "(", "priority", "==", "2", "&&", "!", "(", "colour", "&", "8", ")", ")", "continue", ";", "sprite", "=", "buffered_spriteram", "[", "offs", "+", "7", "]", "+", "(", "buffered_spriteram", "[", "offs", "+", "6", "]", "<<", "8", ")", ";", "sprite", "&=", "0x0fff", ";", "if", "(", "extra", ")", "{", "y", "=", "y", "+", "16", ";", "sprite", "&=", "0xffe", ";", "}", "x", "=", "x", "&", "0x01ff", ";", "y", "=", "y", "&", "0x01ff", ";", "x", "=", "(", "x", "+", "16", ")", "%", "0x200", ";", "y", "=", "(", "y", "+", "16", ")", "%", "0x200", ";", "x", "=", "256", "-", "x", ";", "y", "=", "256", "-", "y", ";", "if", "(", "flip_screen_get", "(", "machine", ")", ")", "{", "y", "=", "240", "-", "y", ";", "x", "=", "240", "-", "x", ";", "if", "(", "fx", ")", "fx", "=", "0", ";", "else", "fx", "=", "1", ";", "if", "(", "fy", ")", "fy", "=", "0", ";", "else", "fy", "=", "1", ";", "if", "(", "extra", ")", "y", "=", "y", "-", "16", ";", "}", "if", "(", "extra", "&&", "fy", ")", "{", "sprite2", "=", "sprite", ";", "sprite", "++", ";", "}", "else", "sprite2", "=", "sprite", "+", "1", ";", "drawgfx_transpen", "(", "bitmap", ",", "cliprect", ",", "machine", "->", "gfx", "[", "1", "]", ",", "sprite", ",", "colour", ",", "fx", ",", "fy", ",", "x", ",", "y", ",", "0", ")", ";", "if", "(", "extra", ")", "drawgfx_transpen", "(", "bitmap", ",", "cliprect", ",", "machine", "->", "gfx", "[", "1", "]", ",", "sprite2", ",", "colour", ",", "fx", ",", "fy", ",", "x", ",", "y", "+", "16", ",", "0", ")", ";", "}", "}" ]
'Karnov' sprites, used by Gondomania, Last Mission, Shackled, Ghostbusters
[ "'", "Karnov", "'", "sprites", "used", "by", "Gondomania", "Last", "Mission", "Shackled", "Ghostbusters" ]
[ "/* Y Flip determines order of multi-sprite */", "/* 1 more sprite drawn underneath */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "bitmap", "type": "bitmap_t" }, { "param": "cliprect", "type": "rectangle" }, { "param": "priority", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bitmap", "type": "bitmap_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cliprect", "type": "rectangle", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "priority", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
readbyte
int
static int readbyte(tms99xx_state *cpustate, int addr) { cpustate->icount -= 2; if (addr & 1) { cpustate->extra_byte = memory_read_byte_8be(cpustate->program, addr-1); return memory_read_byte_8be(cpustate->program, addr); } else { int val = memory_read_byte_8be(cpustate->program, addr); cpustate->extra_byte = memory_read_byte_8be(cpustate->program, addr+1); return val; } }
/*This is how it really works*/ /*Note that every writebyte must match a readbyte (which is indeed the case)*/
This is how it really works Note that every writebyte must match a readbyte (which is indeed the case)
[ "This", "is", "how", "it", "really", "works", "Note", "that", "every", "writebyte", "must", "match", "a", "readbyte", "(", "which", "is", "indeed", "the", "case", ")" ]
static int readbyte(tms99xx_state *cpustate, int addr) { cpustate->icount -= 2; if (addr & 1) { cpustate->extra_byte = memory_read_byte_8be(cpustate->program, addr-1); return memory_read_byte_8be(cpustate->program, addr); } else { int val = memory_read_byte_8be(cpustate->program, addr); cpustate->extra_byte = memory_read_byte_8be(cpustate->program, addr+1); return val; } }
[ "static", "int", "readbyte", "(", "tms99xx_state", "*", "cpustate", ",", "int", "addr", ")", "{", "cpustate", "->", "icount", "-=", "2", ";", "if", "(", "addr", "&", "1", ")", "{", "cpustate", "->", "extra_byte", "=", "memory_read_byte_8be", "(", "cpustate", "->", "program", ",", "addr", "-", "1", ")", ";", "return", "memory_read_byte_8be", "(", "cpustate", "->", "program", ",", "addr", ")", ";", "}", "else", "{", "int", "val", "=", "memory_read_byte_8be", "(", "cpustate", "->", "program", ",", "addr", ")", ";", "cpustate", "->", "extra_byte", "=", "memory_read_byte_8be", "(", "cpustate", "->", "program", ",", "addr", "+", "1", ")", ";", "return", "val", ";", "}", "}" ]
This is how it really works Note that every writebyte must match a readbyte (which is indeed the case)
[ "This", "is", "how", "it", "really", "works", "Note", "that", "every", "writebyte", "must", "match", "a", "readbyte", "(", "which", "is", "indeed", "the", "case", ")" ]
[]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "addr", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addr", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
readword
int
static int readword(tms99xx_state *cpustate, int addr) { if (addr < 0x2000) { } else if ((addr >= 0x8300) && (addr < 0x8400)) { } else { cpustate->icount -= 2; return (memory_read_byte_8be(cpustate->program, addr) << 8) + memory_read_byte_8be(cpustate->program, addr + 1); } }
/*Note that every writebyte must match a readbyte (which is indeed the case)*/
Note that every writebyte must match a readbyte (which is indeed the case)
[ "Note", "that", "every", "writebyte", "must", "match", "a", "readbyte", "(", "which", "is", "indeed", "the", "case", ")" ]
static int readword(tms99xx_state *cpustate, int addr) { if (addr < 0x2000) { } else if ((addr >= 0x8300) && (addr < 0x8400)) { } else { cpustate->icount -= 2; return (memory_read_byte_8be(cpustate->program, addr) << 8) + memory_read_byte_8be(cpustate->program, addr + 1); } }
[ "static", "int", "readword", "(", "tms99xx_state", "*", "cpustate", ",", "int", "addr", ")", "{", "if", "(", "addr", "<", "0x2000", ")", "{", "}", "else", "if", "(", "(", "addr", ">=", "0x8300", ")", "&&", "(", "addr", "<", "0x8400", ")", ")", "{", "}", "else", "{", "cpustate", "->", "icount", "-=", "2", ";", "return", "(", "memory_read_byte_8be", "(", "cpustate", "->", "program", ",", "addr", ")", "<<", "8", ")", "+", "memory_read_byte_8be", "(", "cpustate", "->", "program", ",", "addr", "+", "1", ")", ";", "}", "}" ]
Note that every writebyte must match a readbyte (which is indeed the case)
[ "Note", "that", "every", "writebyte", "must", "match", "a", "readbyte", "(", "which", "is", "indeed", "the", "case", ")" ]
[]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "addr", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addr", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
tms99xx_set_irq_line
void
static void tms99xx_set_irq_line(tms99xx_state *cpustate, int irqline, int state) { if (irqline == INPUT_LINE_NMI) { cpustate->load_state = state; /* save new state */ field_interrupt(cpustate); /* interrupt status changed */ } else { /*if (cpustate->irq_state == state) return;*/ cpustate->irq_state = state; if (state == CLEAR_LINE) cpustate->irq_level = 16; /* trick : 16 will always be bigger than the IM (0-15), so there will never be interrupts */ else cpustate->irq_level = (* cpustate->irq_callback)(cpustate->device, 0); field_interrupt(cpustate); /* interrupt state is likely to have changed */ } }
/* * HJB 990430: changed to use irq_callback(cpustate) to retrieve the vector * instead of using 16 irqlines. * * R Nabet 990830 : My mistake, I rewrote all these once again ; I think it is now correct. * A driver using the TMS9900 should do : * cpu_0_irq_line_vector_w(0, level); * cpu_set_irq_line(0,0,ASSERT_LINE); * * R Nabet 991108 : revised once again, with advice from Juergen Buchmueller, after a discussion * with Nicola... * We use the callback to retreive the interrupt level as soon as INTREQ* is asserted. * As a consequence, I do not support HOLD_LINE normally... However, we do not really have to * support HOLD_LINE, since no real world TMS9900-based system can support this. * FYI, there are two alternatives to retreiving the interrupt level with the callback : * a) using 16 pseudo-IRQ lines. Mostly OK, though it would require a few core changes. * However, this could cause some problems if someone tried to set two lines simulteanously... * And TMS9900 did NOT have 16 lines ! This is why Juergen and I did not retain this solution. * b) modifying the interrupt system in order to provide an extra int to every xxx_set_irq_line * function. I think this solution would be fine, but it would require quite a number of * changes in the MAME core. (And I did not feel the courage to check out 4000 drivers and 25 * cpu cores ;-) .) * * Note that this does not apply to tms9995. */
HJB 990430: changed to use irq_callback(cpustate) to retrieve the vector instead of using 16 irqlines. R Nabet 990830 : My mistake, I rewrote all these once again ; I think it is now correct. A driver using the TMS9900 should do : cpu_0_irq_line_vector_w(0, level); cpu_set_irq_line(0,0,ASSERT_LINE). R Nabet 991108 : revised once again, with advice from Juergen Buchmueller, after a discussion with Nicola We use the callback to retreive the interrupt level as soon as INTREQ* is asserted. As a consequence, I do not support HOLD_LINE normally... However, we do not really have to support HOLD_LINE, since no real world TMS9900-based system can support this. FYI, there are two alternatives to retreiving the interrupt level with the callback : a) using 16 pseudo-IRQ lines. Mostly OK, though it would require a few core changes. However, this could cause some problems if someone tried to set two lines simulteanously And TMS9900 did NOT have 16 lines . This is why Juergen and I did not retain this solution. b) modifying the interrupt system in order to provide an extra int to every xxx_set_irq_line function. I think this solution would be fine, but it would require quite a number of changes in the MAME core. (And I did not feel the courage to check out 4000 drivers and 25 cpu cores ;-) .) Note that this does not apply to tms9995.
[ "HJB", "990430", ":", "changed", "to", "use", "irq_callback", "(", "cpustate", ")", "to", "retrieve", "the", "vector", "instead", "of", "using", "16", "irqlines", ".", "R", "Nabet", "990830", ":", "My", "mistake", "I", "rewrote", "all", "these", "once", "again", ";", "I", "think", "it", "is", "now", "correct", ".", "A", "driver", "using", "the", "TMS9900", "should", "do", ":", "cpu_0_irq_line_vector_w", "(", "0", "level", ")", ";", "cpu_set_irq_line", "(", "0", "0", "ASSERT_LINE", ")", ".", "R", "Nabet", "991108", ":", "revised", "once", "again", "with", "advice", "from", "Juergen", "Buchmueller", "after", "a", "discussion", "with", "Nicola", "We", "use", "the", "callback", "to", "retreive", "the", "interrupt", "level", "as", "soon", "as", "INTREQ", "*", "is", "asserted", ".", "As", "a", "consequence", "I", "do", "not", "support", "HOLD_LINE", "normally", "...", "However", "we", "do", "not", "really", "have", "to", "support", "HOLD_LINE", "since", "no", "real", "world", "TMS9900", "-", "based", "system", "can", "support", "this", ".", "FYI", "there", "are", "two", "alternatives", "to", "retreiving", "the", "interrupt", "level", "with", "the", "callback", ":", "a", ")", "using", "16", "pseudo", "-", "IRQ", "lines", ".", "Mostly", "OK", "though", "it", "would", "require", "a", "few", "core", "changes", ".", "However", "this", "could", "cause", "some", "problems", "if", "someone", "tried", "to", "set", "two", "lines", "simulteanously", "And", "TMS9900", "did", "NOT", "have", "16", "lines", ".", "This", "is", "why", "Juergen", "and", "I", "did", "not", "retain", "this", "solution", ".", "b", ")", "modifying", "the", "interrupt", "system", "in", "order", "to", "provide", "an", "extra", "int", "to", "every", "xxx_set_irq_line", "function", ".", "I", "think", "this", "solution", "would", "be", "fine", "but", "it", "would", "require", "quite", "a", "number", "of", "changes", "in", "the", "MAME", "core", ".", "(", "And", "I", "did", "not", "feel", "the", "courage", "to", "check", "out", "4000", "drivers", "and", "25", "cpu", "cores", ";", "-", ")", ".", ")", "Note", "that", "this", "does", "not", "apply", "to", "tms9995", "." ]
static void tms99xx_set_irq_line(tms99xx_state *cpustate, int irqline, int state) { if (irqline == INPUT_LINE_NMI) { cpustate->load_state = state; field_interrupt(cpustate); } else { cpustate->irq_state = state; if (state == CLEAR_LINE) cpustate->irq_level = 16; else cpustate->irq_level = (* cpustate->irq_callback)(cpustate->device, 0); field_interrupt(cpustate); } }
[ "static", "void", "tms99xx_set_irq_line", "(", "tms99xx_state", "*", "cpustate", ",", "int", "irqline", ",", "int", "state", ")", "{", "if", "(", "irqline", "==", "INPUT_LINE_NMI", ")", "{", "cpustate", "->", "load_state", "=", "state", ";", "field_interrupt", "(", "cpustate", ")", ";", "}", "else", "{", "cpustate", "->", "irq_state", "=", "state", ";", "if", "(", "state", "==", "CLEAR_LINE", ")", "cpustate", "->", "irq_level", "=", "16", ";", "else", "cpustate", "->", "irq_level", "=", "(", "*", "cpustate", "->", "irq_callback", ")", "(", "cpustate", "->", "device", ",", "0", ")", ";", "field_interrupt", "(", "cpustate", ")", ";", "}", "}" ]
HJB 990430: changed to use irq_callback(cpustate) to retrieve the vector instead of using 16 irqlines.
[ "HJB", "990430", ":", "changed", "to", "use", "irq_callback", "(", "cpustate", ")", "to", "retrieve", "the", "vector", "instead", "of", "using", "16", "irqlines", "." ]
[ "/* save new state */", "/* interrupt status changed */", "/*if (cpustate->irq_state == state)\r\n return;*/", "/* trick : 16 will always be bigger than the IM (0-15), so there will never be interrupts */", "/* interrupt state is likely to have changed */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "irqline", "type": "int" }, { "param": "state", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "irqline", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "state", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
tms99xx_set_irq_line
void
static void tms99xx_set_irq_line(tms99xx_state *cpustate, int irqline, int state) { if (state == CLEAR_LINE) { cpustate->load_state = 0; cpustate->irq_state = 0; cpustate->irq_level = 16; /* trick : 16 will always be bigger than the IM (0-15), so there will never be interrupts */ } else { int level; if (irqline == INPUT_LINE_NMI) level = 2; /* translate MAME's convention to CPU's representation */ else level = (* cpustate->irq_callback)(cpustate->device, 0); switch (level) { case 0: case 1: cpustate->load_state = 0; cpustate->irq_state = 0; cpustate->irq_level = 16; CPU_RESET_NAME(tms99xx)(cpustate->device); break; case 2: cpustate->load_state = 1; cpustate->irq_state = 0; cpustate->irq_level = 16; break; case 7: cpustate->load_state = 0; cpustate->irq_state = 0; cpustate->irq_level = 16; break; default: /* external levels 1, 2, 3, 4 */ cpustate->load_state = 0; cpustate->irq_state = 1; cpustate->irq_level = level - 2; break; } } field_interrupt(cpustate); /* interrupt state is likely to have changed */ }
/* interrupt system similar to tms9900, but only 3 interrupt pins (IC0-IC2) */
interrupt system similar to tms9900, but only 3 interrupt pins (IC0-IC2)
[ "interrupt", "system", "similar", "to", "tms9900", "but", "only", "3", "interrupt", "pins", "(", "IC0", "-", "IC2", ")" ]
static void tms99xx_set_irq_line(tms99xx_state *cpustate, int irqline, int state) { if (state == CLEAR_LINE) { cpustate->load_state = 0; cpustate->irq_state = 0; cpustate->irq_level = 16; } else { int level; if (irqline == INPUT_LINE_NMI) level = 2; else level = (* cpustate->irq_callback)(cpustate->device, 0); switch (level) { case 0: case 1: cpustate->load_state = 0; cpustate->irq_state = 0; cpustate->irq_level = 16; CPU_RESET_NAME(tms99xx)(cpustate->device); break; case 2: cpustate->load_state = 1; cpustate->irq_state = 0; cpustate->irq_level = 16; break; case 7: cpustate->load_state = 0; cpustate->irq_state = 0; cpustate->irq_level = 16; break; default: cpustate->load_state = 0; cpustate->irq_state = 1; cpustate->irq_level = level - 2; break; } } field_interrupt(cpustate); }
[ "static", "void", "tms99xx_set_irq_line", "(", "tms99xx_state", "*", "cpustate", ",", "int", "irqline", ",", "int", "state", ")", "{", "if", "(", "state", "==", "CLEAR_LINE", ")", "{", "cpustate", "->", "load_state", "=", "0", ";", "cpustate", "->", "irq_state", "=", "0", ";", "cpustate", "->", "irq_level", "=", "16", ";", "}", "else", "{", "int", "level", ";", "if", "(", "irqline", "==", "INPUT_LINE_NMI", ")", "level", "=", "2", ";", "else", "level", "=", "(", "*", "cpustate", "->", "irq_callback", ")", "(", "cpustate", "->", "device", ",", "0", ")", ";", "switch", "(", "level", ")", "{", "case", "0", ":", "case", "1", ":", "cpustate", "->", "load_state", "=", "0", ";", "cpustate", "->", "irq_state", "=", "0", ";", "cpustate", "->", "irq_level", "=", "16", ";", "CPU_RESET_NAME", "(", "tms99xx", ")", "(", "cpustate", "->", "device", ")", ";", "break", ";", "case", "2", ":", "cpustate", "->", "load_state", "=", "1", ";", "cpustate", "->", "irq_state", "=", "0", ";", "cpustate", "->", "irq_level", "=", "16", ";", "break", ";", "case", "7", ":", "cpustate", "->", "load_state", "=", "0", ";", "cpustate", "->", "irq_state", "=", "0", ";", "cpustate", "->", "irq_level", "=", "16", ";", "break", ";", "default", ":", "cpustate", "->", "load_state", "=", "0", ";", "cpustate", "->", "irq_state", "=", "1", ";", "cpustate", "->", "irq_level", "=", "level", "-", "2", ";", "break", ";", "}", "}", "field_interrupt", "(", "cpustate", ")", ";", "}" ]
interrupt system similar to tms9900, but only 3 interrupt pins (IC0-IC2)
[ "interrupt", "system", "similar", "to", "tms9900", "but", "only", "3", "interrupt", "pins", "(", "IC0", "-", "IC2", ")" ]
[ "/* trick : 16 will always be bigger than the IM (0-15), so there will never be interrupts */", "/* translate MAME's convention to CPU's representation */", "/* external levels 1, 2, 3, 4 */", "/* interrupt state is likely to have changed */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "irqline", "type": "int" }, { "param": "state", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "irqline", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "state", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
tms99xx_set_irq_line
void
static void tms99xx_set_irq_line(tms99xx_state *cpustate, int irqline, int state) { int mask; if (irqline == 0) /* INT1 */ mask = 1; else if (irqline == 1) /* INT2 */ mask = 4; else /* What on earth??? */ return; if (state) cpustate->irq_state |= mask; else cpustate->irq_state &= ~mask; field_interrupt(cpustate); /* interrupt state is likely to have changed */ }
/* 2 interrupt pins (int1 and int2) */
2 interrupt pins (int1 and int2)
[ "2", "interrupt", "pins", "(", "int1", "and", "int2", ")" ]
static void tms99xx_set_irq_line(tms99xx_state *cpustate, int irqline, int state) { int mask; if (irqline == 0) mask = 1; else if (irqline == 1) mask = 4; else return; if (state) cpustate->irq_state |= mask; else cpustate->irq_state &= ~mask; field_interrupt(cpustate); }
[ "static", "void", "tms99xx_set_irq_line", "(", "tms99xx_state", "*", "cpustate", ",", "int", "irqline", ",", "int", "state", ")", "{", "int", "mask", ";", "if", "(", "irqline", "==", "0", ")", "mask", "=", "1", ";", "else", "if", "(", "irqline", "==", "1", ")", "mask", "=", "4", ";", "else", "return", ";", "if", "(", "state", ")", "cpustate", "->", "irq_state", "|=", "mask", ";", "else", "cpustate", "->", "irq_state", "&=", "~", "mask", ";", "field_interrupt", "(", "cpustate", ")", ";", "}" ]
2 interrupt pins (int1 and int2)
[ "2", "interrupt", "pins", "(", "int1", "and", "int2", ")" ]
[ "/* INT1 */", "/* INT2 */", "/* What on earth??? */", "/* interrupt state is likely to have changed */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "irqline", "type": "int" }, { "param": "state", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "irqline", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "state", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
reset_decrementer
void
static void reset_decrementer(tms99xx_state *cpustate) { timer_adjust_oneshot(cpustate->timer, attotime_never, 0); /* reload count */ cpustate->decrementer_count = cpustate->decrementer_interval; /* decrementer / timer enabled ? */ cpustate->decrementer_enabled = ((cpustate->flag & 2) && (cpustate->decrementer_interval)); if (cpustate->decrementer_enabled && ! (cpustate->flag & 1)) { /* timer */ attotime period = cpustate->device->cycles_to_attotime(cpustate->decrementer_interval * 16L); timer_adjust_periodic(cpustate->timer, period, 0, period); } }
/* reset and load the timer/decrementer Note that I don't know whether toggling flag0/flag1 causes the decrementer to be reloaded or not */
reset and load the timer/decrementer Note that I don't know whether toggling flag0/flag1 causes the decrementer to be reloaded or not
[ "reset", "and", "load", "the", "timer", "/", "decrementer", "Note", "that", "I", "don", "'", "t", "know", "whether", "toggling", "flag0", "/", "flag1", "causes", "the", "decrementer", "to", "be", "reloaded", "or", "not" ]
static void reset_decrementer(tms99xx_state *cpustate) { timer_adjust_oneshot(cpustate->timer, attotime_never, 0); cpustate->decrementer_count = cpustate->decrementer_interval; cpustate->decrementer_enabled = ((cpustate->flag & 2) && (cpustate->decrementer_interval)); if (cpustate->decrementer_enabled && ! (cpustate->flag & 1)) { attotime period = cpustate->device->cycles_to_attotime(cpustate->decrementer_interval * 16L); timer_adjust_periodic(cpustate->timer, period, 0, period); } }
[ "static", "void", "reset_decrementer", "(", "tms99xx_state", "*", "cpustate", ")", "{", "timer_adjust_oneshot", "(", "cpustate", "->", "timer", ",", "attotime_never", ",", "0", ")", ";", "cpustate", "->", "decrementer_count", "=", "cpustate", "->", "decrementer_interval", ";", "cpustate", "->", "decrementer_enabled", "=", "(", "(", "cpustate", "->", "flag", "&", "2", ")", "&&", "(", "cpustate", "->", "decrementer_interval", ")", ")", ";", "if", "(", "cpustate", "->", "decrementer_enabled", "&&", "!", "(", "cpustate", "->", "flag", "&", "1", ")", ")", "{", "attotime", "period", "=", "cpustate", "->", "device", "->", "cycles_to_attotime", "(", "cpustate", "->", "decrementer_interval", "*", "16L", ")", ";", "timer_adjust_periodic", "(", "cpustate", "->", "timer", ",", "period", ",", "0", ",", "period", ")", ";", "}", "}" ]
reset and load the timer/decrementer Note that I don't know whether toggling flag0/flag1 causes the decrementer to be reloaded or not
[ "reset", "and", "load", "the", "timer", "/", "decrementer", "Note", "that", "I", "don", "'", "t", "know", "whether", "toggling", "flag0", "/", "flag1", "causes", "the", "decrementer", "to", "be", "reloaded", "or", "not" ]
[ "/* reload count */", "/* decrementer / timer enabled ? */", "/* timer */" ]
[ { "param": "cpustate", "type": "tms99xx_state" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
tms99xx_set_irq_line
void
static void tms99xx_set_irq_line(tms99xx_state *cpustate, int irqline, int state) { if (irqline == INPUT_LINE_NMI) { cpustate->load_state = state; /* save new state */ field_interrupt(cpustate); /* interrupt status changed */ } else { int mask = (irqline == 0) ? 0x2 : 0x10; int flag_mask = (irqline == 0) ? 0x4 : 0x10; if (((cpustate->int_state & mask) != 0) ^ (state != 0)) { /* only if state changes */ if (state) { cpustate->int_state |= mask; if ((irqline == 1) && (cpustate->flag & 1)) { /* event counter mode : INT4* triggers no interrupt... */ if (cpustate->decrementer_enabled) { /* decrement, then interrupt if reach 0 */ if ((-- cpustate->decrementer_count) == 0) { decrementer_callback(cpustate->device->machine, cpustate, 0); cpustate->decrementer_count = cpustate->decrementer_interval; /* reload */ } } } else { /* plain interrupt mode */ cpustate->int_latch |= mask; cpustate->flag |= flag_mask; } } else { cpustate->int_state &= ~ mask; } field_interrupt(cpustate); /* interrupt status changed */ } } }
/* You have two interrupt line : one triggers level-1 interrupts, the other triggers level-4 interrupts (or decrements the decrementer register). According to the hardware, you may use PULSE_LINE (edge-triggered interrupts), or ASSERT_LINE (level-triggered interrupts). Edge-triggered interrupts are way simpler, but if multiple devices share the same line, they must use level-triggered interrupts. */
You have two interrupt line : one triggers level-1 interrupts, the other triggers level-4 interrupts (or decrements the decrementer register). According to the hardware, you may use PULSE_LINE (edge-triggered interrupts), or ASSERT_LINE (level-triggered interrupts). Edge-triggered interrupts are way simpler, but if multiple devices share the same line, they must use level-triggered interrupts.
[ "You", "have", "two", "interrupt", "line", ":", "one", "triggers", "level", "-", "1", "interrupts", "the", "other", "triggers", "level", "-", "4", "interrupts", "(", "or", "decrements", "the", "decrementer", "register", ")", ".", "According", "to", "the", "hardware", "you", "may", "use", "PULSE_LINE", "(", "edge", "-", "triggered", "interrupts", ")", "or", "ASSERT_LINE", "(", "level", "-", "triggered", "interrupts", ")", ".", "Edge", "-", "triggered", "interrupts", "are", "way", "simpler", "but", "if", "multiple", "devices", "share", "the", "same", "line", "they", "must", "use", "level", "-", "triggered", "interrupts", "." ]
static void tms99xx_set_irq_line(tms99xx_state *cpustate, int irqline, int state) { if (irqline == INPUT_LINE_NMI) { cpustate->load_state = state; field_interrupt(cpustate); } else { int mask = (irqline == 0) ? 0x2 : 0x10; int flag_mask = (irqline == 0) ? 0x4 : 0x10; if (((cpustate->int_state & mask) != 0) ^ (state != 0)) { if (state) { cpustate->int_state |= mask; if ((irqline == 1) && (cpustate->flag & 1)) { if (cpustate->decrementer_enabled) { if ((-- cpustate->decrementer_count) == 0) { decrementer_callback(cpustate->device->machine, cpustate, 0); cpustate->decrementer_count = cpustate->decrementer_interval; } } } else { cpustate->int_latch |= mask; cpustate->flag |= flag_mask; } } else { cpustate->int_state &= ~ mask; } field_interrupt(cpustate); } } }
[ "static", "void", "tms99xx_set_irq_line", "(", "tms99xx_state", "*", "cpustate", ",", "int", "irqline", ",", "int", "state", ")", "{", "if", "(", "irqline", "==", "INPUT_LINE_NMI", ")", "{", "cpustate", "->", "load_state", "=", "state", ";", "field_interrupt", "(", "cpustate", ")", ";", "}", "else", "{", "int", "mask", "=", "(", "irqline", "==", "0", ")", "?", "0x2", ":", "0x10", ";", "int", "flag_mask", "=", "(", "irqline", "==", "0", ")", "?", "0x4", ":", "0x10", ";", "if", "(", "(", "(", "cpustate", "->", "int_state", "&", "mask", ")", "!=", "0", ")", "^", "(", "state", "!=", "0", ")", ")", "{", "if", "(", "state", ")", "{", "cpustate", "->", "int_state", "|=", "mask", ";", "if", "(", "(", "irqline", "==", "1", ")", "&&", "(", "cpustate", "->", "flag", "&", "1", ")", ")", "{", "if", "(", "cpustate", "->", "decrementer_enabled", ")", "{", "if", "(", "(", "--", "cpustate", "->", "decrementer_count", ")", "==", "0", ")", "{", "decrementer_callback", "(", "cpustate", "->", "device", "->", "machine", ",", "cpustate", ",", "0", ")", ";", "cpustate", "->", "decrementer_count", "=", "cpustate", "->", "decrementer_interval", ";", "}", "}", "}", "else", "{", "cpustate", "->", "int_latch", "|=", "mask", ";", "cpustate", "->", "flag", "|=", "flag_mask", ";", "}", "}", "else", "{", "cpustate", "->", "int_state", "&=", "~", "mask", ";", "}", "field_interrupt", "(", "cpustate", ")", ";", "}", "}", "}" ]
You have two interrupt line : one triggers level-1 interrupts, the other triggers level-4 interrupts (or decrements the decrementer register).
[ "You", "have", "two", "interrupt", "line", ":", "one", "triggers", "level", "-", "1", "interrupts", "the", "other", "triggers", "level", "-", "4", "interrupts", "(", "or", "decrements", "the", "decrementer", "register", ")", "." ]
[ "/* save new state */", "/* interrupt status changed */", "/* only if state changes */", "/* event counter mode : INT4* triggers no interrupt... */", "/* decrement, then interrupt if reach 0 */", "/* reload */", "/* plain interrupt mode */", "/* interrupt status changed */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "irqline", "type": "int" }, { "param": "state", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "irqline", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "state", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
write_single_CRU
void
static void write_single_CRU(tms99xx_state *cpustate, int port, int data) { /* Internal CRU */ switch (port) { case 0xF70: set_flag0(cpustate, data & 0x01); break; case 0xF71: set_flag1(cpustate, data & 0x01); break; case 0xF72: case 0xF73: case 0xF74: break; /* ignored */ case 0xF75: case 0xF76: case 0xF77: case 0xF78: case 0xF79: case 0xF7A: case 0xF7B: case 0xF7C: case 0xF7D: case 0xF7E: case 0xF7F: { /* user defined flags */ int mask = 1 << (port - 0xF70); if (data & 0x01) cpustate->flag |= mask; else cpustate->flag &= ~ mask; } break; case 0x0FED: /* MID flag */ cpustate->MID_flag = data & 0x01; break; } /* External CRU */ /* Even though all the registers above are implemented internally, accesses are passed to the external bus, too, and an external device might respond to a write to these CRU address as well (particularly a write to the user flag registers). */ WRITEPORT(cpustate, port, (data & 0x01)); }
/* on tms9995, we have to handle internal CRU ports */
on tms9995, we have to handle internal CRU ports
[ "on", "tms9995", "we", "have", "to", "handle", "internal", "CRU", "ports" ]
static void write_single_CRU(tms99xx_state *cpustate, int port, int data) { switch (port) { case 0xF70: set_flag0(cpustate, data & 0x01); break; case 0xF71: set_flag1(cpustate, data & 0x01); break; case 0xF72: case 0xF73: case 0xF74: break; case 0xF75: case 0xF76: case 0xF77: case 0xF78: case 0xF79: case 0xF7A: case 0xF7B: case 0xF7C: case 0xF7D: case 0xF7E: case 0xF7F: { int mask = 1 << (port - 0xF70); if (data & 0x01) cpustate->flag |= mask; else cpustate->flag &= ~ mask; } break; case 0x0FED: cpustate->MID_flag = data & 0x01; break; } WRITEPORT(cpustate, port, (data & 0x01)); }
[ "static", "void", "write_single_CRU", "(", "tms99xx_state", "*", "cpustate", ",", "int", "port", ",", "int", "data", ")", "{", "switch", "(", "port", ")", "{", "case", "0xF70", ":", "set_flag0", "(", "cpustate", ",", "data", "&", "0x01", ")", ";", "break", ";", "case", "0xF71", ":", "set_flag1", "(", "cpustate", ",", "data", "&", "0x01", ")", ";", "break", ";", "case", "0xF72", ":", "case", "0xF73", ":", "case", "0xF74", ":", "break", ";", "case", "0xF75", ":", "case", "0xF76", ":", "case", "0xF77", ":", "case", "0xF78", ":", "case", "0xF79", ":", "case", "0xF7A", ":", "case", "0xF7B", ":", "case", "0xF7C", ":", "case", "0xF7D", ":", "case", "0xF7E", ":", "case", "0xF7F", ":", "{", "int", "mask", "=", "1", "<<", "(", "port", "-", "0xF70", ")", ";", "if", "(", "data", "&", "0x01", ")", "cpustate", "->", "flag", "|=", "mask", ";", "else", "cpustate", "->", "flag", "&=", "~", "mask", ";", "}", "break", ";", "case", "0x0FED", ":", "cpustate", "->", "MID_flag", "=", "data", "&", "0x01", ";", "break", ";", "}", "WRITEPORT", "(", "cpustate", ",", "port", ",", "(", "data", "&", "0x01", ")", ")", ";", "}" ]
on tms9995, we have to handle internal CRU ports
[ "on", "tms9995", "we", "have", "to", "handle", "internal", "CRU", "ports" ]
[ "/* Internal CRU */", "/* ignored */", "/* user defined flags */", "/* MID flag */", "/* External CRU */", "/* Even though all the registers above are implemented internally, accesses\r\n are passed to the external bus, too, and an external device might respond\r\n to a write to these CRU address as well (particularly a write to the user\r\n flag registers). */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "port", "type": "int" }, { "param": "data", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "port", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
external_instruction_notify
void
static void external_instruction_notify(tms99xx_state *cpustate, int ext_op_ID) { #if 1 /* I guess we can support this like normal CRU operations */ #if (TMS99XX_MODEL == TMS9900_ID) WRITEPORT(cpustate, ext_op_ID << 12, 0); /* or is it 1 ??? */ #elif (TMS99XX_MODEL == TMS9980_ID) WRITEPORT(cpustate, (ext_op_ID & 3) << 11, (ext_op_ID & 4) ? 1 : 0); #elif (TMS99XX_MODEL == TMS9995_ID) WRITEPORT(cpustate, ext_op_ID << 15, 0); /* or is it 1 ??? */ #else #warning "I don't know how your processor handles external opcodes (maybe you don't need them, though)." #endif #else switch (ext_op_ID) { case 2: /* IDLE */ break; case 3: /* RSET */ break; case 5: /* CKON */ break; case 6: /* CKOF */ break; case 7: /* LREX */ break; case 0: /* normal CRU write !!! */ logerror("PC %4.4x : external_instruction_notify : wrong ext_op_ID",cpustate->PC); break; default: /* unknown address */ logerror("PC %4.4x : external_instruction_notify : unknown ext_op_ID",cpustate->PC); break; } #endif }
/* Some opcodes perform a dummy write to a special CRU address, so that an external function may be triggered. Only the first 3 MSBs of the address matter : other address bits and the written value itself are undefined. How should we support this ? With callback functions ? Actually, as long as we do not support hardware which makes use of this feature, it does not really matter :-) . */
Some opcodes perform a dummy write to a special CRU address, so that an external function may be triggered. Only the first 3 MSBs of the address matter : other address bits and the written value itself are undefined.
[ "Some", "opcodes", "perform", "a", "dummy", "write", "to", "a", "special", "CRU", "address", "so", "that", "an", "external", "function", "may", "be", "triggered", ".", "Only", "the", "first", "3", "MSBs", "of", "the", "address", "matter", ":", "other", "address", "bits", "and", "the", "written", "value", "itself", "are", "undefined", "." ]
static void external_instruction_notify(tms99xx_state *cpustate, int ext_op_ID) { #if 1 #if (TMS99XX_MODEL == TMS9900_ID) WRITEPORT(cpustate, ext_op_ID << 12, 0); #elif (TMS99XX_MODEL == TMS9980_ID) WRITEPORT(cpustate, (ext_op_ID & 3) << 11, (ext_op_ID & 4) ? 1 : 0); #elif (TMS99XX_MODEL == TMS9995_ID) WRITEPORT(cpustate, ext_op_ID << 15, 0); #else #warning "I don't know how your processor handles external opcodes (maybe you don't need them, though)." #endif #else switch (ext_op_ID) { case 2: break; case 3: break; case 5: break; case 6: break; case 7: break; case 0: logerror("PC %4.4x : external_instruction_notify : wrong ext_op_ID",cpustate->PC); break; default: logerror("PC %4.4x : external_instruction_notify : unknown ext_op_ID",cpustate->PC); break; } #endif }
[ "static", "void", "external_instruction_notify", "(", "tms99xx_state", "*", "cpustate", ",", "int", "ext_op_ID", ")", "{", "#if", "1", "\n", "#if", "(", "TMS99XX_MODEL", "==", "TMS9900_ID", ")", "\n", "WRITEPORT", "(", "cpustate", ",", "ext_op_ID", "<<", "12", ",", "0", ")", ";", "#elif", "(", "TMS99XX_MODEL", "==", "TMS9980_ID", ")", "\n", "WRITEPORT", "(", "cpustate", ",", "(", "ext_op_ID", "&", "3", ")", "<<", "11", ",", "(", "ext_op_ID", "&", "4", ")", "?", "1", ":", "0", ")", ";", "#elif", "(", "TMS99XX_MODEL", "==", "TMS9995_ID", ")", "\n", "WRITEPORT", "(", "cpustate", ",", "ext_op_ID", "<<", "15", ",", "0", ")", ";", "#else", "#warning", " \"I don't know how your processor handles external opcodes (maybe you don't need them, though).\"\r", "\n", "#endif", "#else", "switch", "(", "ext_op_ID", ")", "{", "case", "2", ":", "break", ";", "case", "3", ":", "break", ";", "case", "5", ":", "break", ";", "case", "6", ":", "break", ";", "case", "7", ":", "break", ";", "case", "0", ":", "logerror", "(", "\"", "\"", ",", "cpustate", "->", "PC", ")", ";", "break", ";", "default", ":", "logerror", "(", "\"", "\"", ",", "cpustate", "->", "PC", ")", ";", "break", ";", "}", "#endif", "}" ]
Some opcodes perform a dummy write to a special CRU address, so that an external function may be triggered.
[ "Some", "opcodes", "perform", "a", "dummy", "write", "to", "a", "special", "CRU", "address", "so", "that", "an", "external", "function", "may", "be", "triggered", "." ]
[ "/* I guess we can support this like normal CRU operations */", "/* or is it 1 ??? */", "/* or is it 1 ??? */", "/* IDLE */", "/* RSET */", "/* CKON */", "/* CKOF */", "/* LREX */", "/* normal CRU write !!! */", "/* unknown address */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "ext_op_ID", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ext_op_ID", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
read_single_CRU
int
static int read_single_CRU(tms99xx_state *cpustate, int port) { int reply; int shift; if (! (port & 0x20)) { /*if (cpustate->config & CB0)*/ /* External CRU */ reply = READPORT(cpustate, port, (data & 0x01)); } else { /* internal CRU */ switch (port) { case 0x10: /* read interrupt state */ reply = cpustate->irq_state; break; case 0x12: /* read decrementer LSB */ /* ... */ break; case 0x13: /* read decrementer MSB */ /* ... */ break; case 0x14: /* read multiprocessor system interface LSB */ /* ... */ break; case 0x15: /* read multiprocessor system interface MSB */ /* ... */ break; case 0x16: /* read flags LSB */ /* ... */ break; case 0x17: /* read flags MSB */ /* ... */ break; case 0x18: case 0x19: case 0x1A: case 0x1B: /* direction for P0-P31 */ shift = (port - 0x18) << 3; /* ... */ break; case 0x1C: case 0x1D: case 0x1E: case 0x1F: /* data for P0-P31 */ shift = (port - 0x1C) << 3; /* ... */ break; default: reply = 0; break; } } return reply; }
/* on tms9940, we have to handle internal CRU ports */
on tms9940, we have to handle internal CRU ports
[ "on", "tms9940", "we", "have", "to", "handle", "internal", "CRU", "ports" ]
static int read_single_CRU(tms99xx_state *cpustate, int port) { int reply; int shift; if (! (port & 0x20)) { reply = READPORT(cpustate, port, (data & 0x01)); } else { switch (port) { case 0x10: reply = cpustate->irq_state; break; case 0x12: break; case 0x13: break; case 0x14: break; case 0x15: break; case 0x16: break; case 0x17: break; case 0x18: case 0x19: case 0x1A: case 0x1B: shift = (port - 0x18) << 3; break; case 0x1C: case 0x1D: case 0x1E: case 0x1F: shift = (port - 0x1C) << 3; break; default: reply = 0; break; } } return reply; }
[ "static", "int", "read_single_CRU", "(", "tms99xx_state", "*", "cpustate", ",", "int", "port", ")", "{", "int", "reply", ";", "int", "shift", ";", "if", "(", "!", "(", "port", "&", "0x20", ")", ")", "{", "reply", "=", "READPORT", "(", "cpustate", ",", "port", ",", "(", "data", "&", "0x01", ")", ")", ";", "}", "else", "{", "switch", "(", "port", ")", "{", "case", "0x10", ":", "reply", "=", "cpustate", "->", "irq_state", ";", "break", ";", "case", "0x12", ":", "break", ";", "case", "0x13", ":", "break", ";", "case", "0x14", ":", "break", ";", "case", "0x15", ":", "break", ";", "case", "0x16", ":", "break", ";", "case", "0x17", ":", "break", ";", "case", "0x18", ":", "case", "0x19", ":", "case", "0x1A", ":", "case", "0x1B", ":", "shift", "=", "(", "port", "-", "0x18", ")", "<<", "3", ";", "break", ";", "case", "0x1C", ":", "case", "0x1D", ":", "case", "0x1E", ":", "case", "0x1F", ":", "shift", "=", "(", "port", "-", "0x1C", ")", "<<", "3", ";", "break", ";", "default", ":", "reply", "=", "0", ";", "break", ";", "}", "}", "return", "reply", ";", "}" ]
on tms9940, we have to handle internal CRU ports
[ "on", "tms9940", "we", "have", "to", "handle", "internal", "CRU", "ports" ]
[ "/*if (cpustate->config & CB0)*/", "/* External CRU */", "/* internal CRU */", "/* read interrupt state */", "/* read decrementer LSB */", "/* ... */", "/* read decrementer MSB */", "/* ... */", "/* read multiprocessor system interface LSB */", "/* ... */", "/* read multiprocessor system interface MSB */", "/* ... */", "/* read flags LSB */", "/* ... */", "/* read flags MSB */", "/* ... */", "/* direction for P0-P31 */", "/* ... */", "/* data for P0-P31 */", "/* ... */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "port", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "port", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
read_single_CRU
int
static int read_single_CRU(tms99xx_state *cpustate, int port) { switch (port) { case 0x1EE: /* flag, bits 0-7 */ return cpustate->flag & 0xFF; case 0x1EF: /* flag, bits 8-15 */ return (cpustate->flag >> 8) & 0xFF; case 0x1FD: /* MID flag, and external devices */ if (cpustate->MID_flag) return READPORT(cpustate, port) | 0x10; else return READPORT(cpustate, port) & ~ 0x10; default: /* external devices */ return READPORT(cpustate, port); } }
/* on tms9995, we have to handle internal CRU ports */
on tms9995, we have to handle internal CRU ports
[ "on", "tms9995", "we", "have", "to", "handle", "internal", "CRU", "ports" ]
static int read_single_CRU(tms99xx_state *cpustate, int port) { switch (port) { case 0x1EE: return cpustate->flag & 0xFF; case 0x1EF: return (cpustate->flag >> 8) & 0xFF; case 0x1FD: if (cpustate->MID_flag) return READPORT(cpustate, port) | 0x10; else return READPORT(cpustate, port) & ~ 0x10; default: return READPORT(cpustate, port); } }
[ "static", "int", "read_single_CRU", "(", "tms99xx_state", "*", "cpustate", ",", "int", "port", ")", "{", "switch", "(", "port", ")", "{", "case", "0x1EE", ":", "return", "cpustate", "->", "flag", "&", "0xFF", ";", "case", "0x1EF", ":", "return", "(", "cpustate", "->", "flag", ">>", "8", ")", "&", "0xFF", ";", "case", "0x1FD", ":", "if", "(", "cpustate", "->", "MID_flag", ")", "return", "READPORT", "(", "cpustate", ",", "port", ")", "|", "0x10", ";", "else", "return", "READPORT", "(", "cpustate", ",", "port", ")", "&", "~", "0x10", ";", "default", ":", "return", "READPORT", "(", "cpustate", ",", "port", ")", ";", "}", "}" ]
on tms9995, we have to handle internal CRU ports
[ "on", "tms9995", "we", "have", "to", "handle", "internal", "CRU", "ports" ]
[ "/* flag, bits 0-7 */", "/* flag, bits 8-15 */", "/* MID flag, and external devices */", "/* external devices */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "port", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "port", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
load_map_file
void
static void load_map_file(tms99xx_state *cpustate, UINT16 src_addr, int src_map_file, int dst_file) { int i; /* load mapped address into the memory address register */ if ((src_map_file == 0) && (src_addr >= 0xf800)) { /* intercept TPCS and CPU ROM */ if (src_addr < 0xfc00) /* TPCS */ cpustate->mapper_address_latch = 0x1f0000+src_addr; else /* CPU ROM */ cpustate->mapper_address_latch = 0x1f0000+src_addr; /* hack... */ } else if (! cpustate->mapping_on) { cpustate->mapper_address_latch = src_addr; } else { int map_index; if (src_addr <= cpustate->map_files[src_map_file].limit[0]) map_index = 0; else if (src_addr <= cpustate->map_files[src_map_file].limit[1]) map_index = 1; else if (src_addr <= cpustate->map_files[src_map_file].limit[2]) map_index = 2; else { if ((! cpustate->reset_maperr) && ! (cpustate->error_interrupt_register & EIR_MAPERR)) { cpustate->error_interrupt_register |= EIR_MAPERR; cpustate->write_inhibit = 1; } cpustate->mapper_address_latch = src_addr; map_index = -1; } if (map_index != -1) cpustate->mapper_address_latch = cpustate->map_files[src_map_file].bias[map_index]+src_addr; } for (i=0; i<3; i++) { cpustate->map_files[dst_file].L[i] = memory_read_word_16be(cpustate->program, cpustate->mapper_address_latch) & 0xffe0; cpustate->map_files[dst_file].limit[i] = (cpustate->map_files[dst_file].L[i] ^ 0xffe0) | 0x001f; cpustate->mapper_address_latch = (cpustate->mapper_address_latch+2) & 0x1fffff; cpustate->map_files[dst_file].B[i] = memory_read_word_16be(cpustate->program, cpustate->mapper_address_latch); cpustate->map_files[dst_file].bias[i] = ((unsigned int) cpustate->map_files[dst_file].B[i]) << 5; cpustate->mapper_address_latch = (cpustate->mapper_address_latch+2) & 0x1fffff; } }
/* load a map file from memory */
load a map file from memory
[ "load", "a", "map", "file", "from", "memory" ]
static void load_map_file(tms99xx_state *cpustate, UINT16 src_addr, int src_map_file, int dst_file) { int i; if ((src_map_file == 0) && (src_addr >= 0xf800)) { if (src_addr < 0xfc00) cpustate->mapper_address_latch = 0x1f0000+src_addr; else cpustate->mapper_address_latch = 0x1f0000+src_addr; } else if (! cpustate->mapping_on) { cpustate->mapper_address_latch = src_addr; } else { int map_index; if (src_addr <= cpustate->map_files[src_map_file].limit[0]) map_index = 0; else if (src_addr <= cpustate->map_files[src_map_file].limit[1]) map_index = 1; else if (src_addr <= cpustate->map_files[src_map_file].limit[2]) map_index = 2; else { if ((! cpustate->reset_maperr) && ! (cpustate->error_interrupt_register & EIR_MAPERR)) { cpustate->error_interrupt_register |= EIR_MAPERR; cpustate->write_inhibit = 1; } cpustate->mapper_address_latch = src_addr; map_index = -1; } if (map_index != -1) cpustate->mapper_address_latch = cpustate->map_files[src_map_file].bias[map_index]+src_addr; } for (i=0; i<3; i++) { cpustate->map_files[dst_file].L[i] = memory_read_word_16be(cpustate->program, cpustate->mapper_address_latch) & 0xffe0; cpustate->map_files[dst_file].limit[i] = (cpustate->map_files[dst_file].L[i] ^ 0xffe0) | 0x001f; cpustate->mapper_address_latch = (cpustate->mapper_address_latch+2) & 0x1fffff; cpustate->map_files[dst_file].B[i] = memory_read_word_16be(cpustate->program, cpustate->mapper_address_latch); cpustate->map_files[dst_file].bias[i] = ((unsigned int) cpustate->map_files[dst_file].B[i]) << 5; cpustate->mapper_address_latch = (cpustate->mapper_address_latch+2) & 0x1fffff; } }
[ "static", "void", "load_map_file", "(", "tms99xx_state", "*", "cpustate", ",", "UINT16", "src_addr", ",", "int", "src_map_file", ",", "int", "dst_file", ")", "{", "int", "i", ";", "if", "(", "(", "src_map_file", "==", "0", ")", "&&", "(", "src_addr", ">=", "0xf800", ")", ")", "{", "if", "(", "src_addr", "<", "0xfc00", ")", "cpustate", "->", "mapper_address_latch", "=", "0x1f0000", "+", "src_addr", ";", "else", "cpustate", "->", "mapper_address_latch", "=", "0x1f0000", "+", "src_addr", ";", "}", "else", "if", "(", "!", "cpustate", "->", "mapping_on", ")", "{", "cpustate", "->", "mapper_address_latch", "=", "src_addr", ";", "}", "else", "{", "int", "map_index", ";", "if", "(", "src_addr", "<=", "cpustate", "->", "map_files", "[", "src_map_file", "]", ".", "limit", "[", "0", "]", ")", "map_index", "=", "0", ";", "else", "if", "(", "src_addr", "<=", "cpustate", "->", "map_files", "[", "src_map_file", "]", ".", "limit", "[", "1", "]", ")", "map_index", "=", "1", ";", "else", "if", "(", "src_addr", "<=", "cpustate", "->", "map_files", "[", "src_map_file", "]", ".", "limit", "[", "2", "]", ")", "map_index", "=", "2", ";", "else", "{", "if", "(", "(", "!", "cpustate", "->", "reset_maperr", ")", "&&", "!", "(", "cpustate", "->", "error_interrupt_register", "&", "EIR_MAPERR", ")", ")", "{", "cpustate", "->", "error_interrupt_register", "|=", "EIR_MAPERR", ";", "cpustate", "->", "write_inhibit", "=", "1", ";", "}", "cpustate", "->", "mapper_address_latch", "=", "src_addr", ";", "map_index", "=", "-1", ";", "}", "if", "(", "map_index", "!=", "-1", ")", "cpustate", "->", "mapper_address_latch", "=", "cpustate", "->", "map_files", "[", "src_map_file", "]", ".", "bias", "[", "map_index", "]", "+", "src_addr", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "cpustate", "->", "map_files", "[", "dst_file", "]", ".", "L", "[", "i", "]", "=", "memory_read_word_16be", "(", "cpustate", "->", "program", ",", "cpustate", "->", "mapper_address_latch", ")", "&", "0xffe0", ";", "cpustate", "->", "map_files", "[", "dst_file", "]", ".", "limit", "[", "i", "]", "=", "(", "cpustate", "->", "map_files", "[", "dst_file", "]", ".", "L", "[", "i", "]", "^", "0xffe0", ")", "|", "0x001f", ";", "cpustate", "->", "mapper_address_latch", "=", "(", "cpustate", "->", "mapper_address_latch", "+", "2", ")", "&", "0x1fffff", ";", "cpustate", "->", "map_files", "[", "dst_file", "]", ".", "B", "[", "i", "]", "=", "memory_read_word_16be", "(", "cpustate", "->", "program", ",", "cpustate", "->", "mapper_address_latch", ")", ";", "cpustate", "->", "map_files", "[", "dst_file", "]", ".", "bias", "[", "i", "]", "=", "(", "(", "unsigned", "int", ")", "cpustate", "->", "map_files", "[", "dst_file", "]", ".", "B", "[", "i", "]", ")", "<<", "5", ";", "cpustate", "->", "mapper_address_latch", "=", "(", "cpustate", "->", "mapper_address_latch", "+", "2", ")", "&", "0x1fffff", ";", "}", "}" ]
load a map file from memory
[ "load", "a", "map", "file", "from", "memory" ]
[ "/* load mapped address into the memory address register */", "/* intercept TPCS and CPU ROM */", "/* TPCS */", "/* CPU ROM */", "/* hack... */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "src_addr", "type": "UINT16" }, { "param": "src_map_file", "type": "int" }, { "param": "dst_file", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src_addr", "type": "UINT16", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src_map_file", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dst_file", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
contextswitchX
void
static void contextswitchX(tms99xx_state *cpustate, UINT16 addr) { UINT16 oldWP, oldpc, oldST; /* save old state */ oldWP = cpustate->WP; oldpc = cpustate->PC; setstat(cpustate); oldST = cpustate->STATUS; /* enter priviledged mode and select map file 0 */ #if HAS_PRIVILEGE cpustate->STATUS &= ~ ST_PR; #endif #if HAS_MAPPING cpustate->STATUS &= ~ ST_MF; #endif getstat(cpustate); /* load vector */ cpustate->WP = readword(cpustate, addr) & ~1; cpustate->PC = readword(cpustate, addr+2) & ~1; /* write old state to regs */ WRITEREG(R13, oldWP); WRITEREG(R14, oldpc); WRITEREG(R15, oldST); }
/* For CPU that have no priviledge support, contextswitchX would behave identically to contextswitch, so we can call contextswitch in all cases. */
For CPU that have no priviledge support, contextswitchX would behave identically to contextswitch, so we can call contextswitch in all cases.
[ "For", "CPU", "that", "have", "no", "priviledge", "support", "contextswitchX", "would", "behave", "identically", "to", "contextswitch", "so", "we", "can", "call", "contextswitch", "in", "all", "cases", "." ]
static void contextswitchX(tms99xx_state *cpustate, UINT16 addr) { UINT16 oldWP, oldpc, oldST; oldWP = cpustate->WP; oldpc = cpustate->PC; setstat(cpustate); oldST = cpustate->STATUS; #if HAS_PRIVILEGE cpustate->STATUS &= ~ ST_PR; #endif #if HAS_MAPPING cpustate->STATUS &= ~ ST_MF; #endif getstat(cpustate); cpustate->WP = readword(cpustate, addr) & ~1; cpustate->PC = readword(cpustate, addr+2) & ~1; WRITEREG(R13, oldWP); WRITEREG(R14, oldpc); WRITEREG(R15, oldST); }
[ "static", "void", "contextswitchX", "(", "tms99xx_state", "*", "cpustate", ",", "UINT16", "addr", ")", "{", "UINT16", "oldWP", ",", "oldpc", ",", "oldST", ";", "oldWP", "=", "cpustate", "->", "WP", ";", "oldpc", "=", "cpustate", "->", "PC", ";", "setstat", "(", "cpustate", ")", ";", "oldST", "=", "cpustate", "->", "STATUS", ";", "#if", "HAS_PRIVILEGE", "\n", "cpustate", "->", "STATUS", "&=", "~", "ST_PR", ";", "#endif", "#if", "HAS_MAPPING", "\n", "cpustate", "->", "STATUS", "&=", "~", "ST_MF", ";", "#endif", "getstat", "(", "cpustate", ")", ";", "cpustate", "->", "WP", "=", "readword", "(", "cpustate", ",", "addr", ")", "&", "~", "1", ";", "cpustate", "->", "PC", "=", "readword", "(", "cpustate", ",", "addr", "+", "2", ")", "&", "~", "1", ";", "WRITEREG", "(", "R13", ",", "oldWP", ")", ";", "WRITEREG", "(", "R14", ",", "oldpc", ")", ";", "WRITEREG", "(", "R15", ",", "oldST", ")", ";", "}" ]
For CPU that have no priviledge support, contextswitchX would behave identically to contextswitch, so we can call contextswitch in all cases.
[ "For", "CPU", "that", "have", "no", "priviledge", "support", "contextswitchX", "would", "behave", "identically", "to", "contextswitch", "so", "we", "can", "call", "contextswitch", "in", "all", "cases", "." ]
[ "/* save old state */", "/* enter priviledged mode and select map file 0 */", "/* load vector */", "/* write old state to regs */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "addr", "type": "UINT16" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addr", "type": "UINT16", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
decipheraddr
UINT16
static UINT16 decipheraddr(tms99xx_state *cpustate, UINT16 opcode) { register UINT16 ts = opcode & 0x30; register UINT16 reg = opcode & 0xF; reg += reg; if (ts == 0) /* Rx */ return(reg + cpustate->WP); else if (ts == 0x10) { /* *Rx */ CYCLES(0, 4, 1); return(readword(cpustate, reg + cpustate->WP)); } else if (ts == 0x20) { register UINT16 imm; imm = fetch(cpustate); if (reg) { /* @>xxxx(Rx) */ CYCLES(1, 8, 3); return(readword(cpustate, reg + cpustate->WP) + imm); } else { /* @>xxxx */ CYCLES(3, 8, 1); return(imm); } } else /*if (ts == 0x30)*/ { /* *Rx+ */ register UINT16 response; reg += cpustate->WP; /* reg now contains effective address */ CYCLES(1, 8, 3); response = readword(cpustate, reg); writeword(cpustate, reg, response+2); /* we increment register content */ return(response); } }
/* * decipheraddr : compute and return the effective adress in word instructions. * * NOTA : the LSBit is always ignored in word adresses, * but we do not set it to 0 because of XOP... */
decipheraddr : compute and return the effective adress in word instructions. NOTA : the LSBit is always ignored in word adresses, but we do not set it to 0 because of XOP
[ "decipheraddr", ":", "compute", "and", "return", "the", "effective", "adress", "in", "word", "instructions", ".", "NOTA", ":", "the", "LSBit", "is", "always", "ignored", "in", "word", "adresses", "but", "we", "do", "not", "set", "it", "to", "0", "because", "of", "XOP" ]
static UINT16 decipheraddr(tms99xx_state *cpustate, UINT16 opcode) { register UINT16 ts = opcode & 0x30; register UINT16 reg = opcode & 0xF; reg += reg; if (ts == 0) return(reg + cpustate->WP); else if (ts == 0x10) { CYCLES(0, 4, 1); return(readword(cpustate, reg + cpustate->WP)); } else if (ts == 0x20) { register UINT16 imm; imm = fetch(cpustate); if (reg) { CYCLES(1, 8, 3); return(readword(cpustate, reg + cpustate->WP) + imm); } else { CYCLES(3, 8, 1); return(imm); } } else { register UINT16 response; reg += cpustate->WP; CYCLES(1, 8, 3); response = readword(cpustate, reg); writeword(cpustate, reg, response+2); return(response); } }
[ "static", "UINT16", "decipheraddr", "(", "tms99xx_state", "*", "cpustate", ",", "UINT16", "opcode", ")", "{", "register", "UINT16", "ts", "=", "opcode", "&", "0x30", ";", "register", "UINT16", "reg", "=", "opcode", "&", "0xF", ";", "reg", "+=", "reg", ";", "if", "(", "ts", "==", "0", ")", "return", "(", "reg", "+", "cpustate", "->", "WP", ")", ";", "else", "if", "(", "ts", "==", "0x10", ")", "{", "CYCLES", "(", "0", ",", "4", ",", "1", ")", ";", "return", "(", "readword", "(", "cpustate", ",", "reg", "+", "cpustate", "->", "WP", ")", ")", ";", "}", "else", "if", "(", "ts", "==", "0x20", ")", "{", "register", "UINT16", "imm", ";", "imm", "=", "fetch", "(", "cpustate", ")", ";", "if", "(", "reg", ")", "{", "CYCLES", "(", "1", ",", "8", ",", "3", ")", ";", "return", "(", "readword", "(", "cpustate", ",", "reg", "+", "cpustate", "->", "WP", ")", "+", "imm", ")", ";", "}", "else", "{", "CYCLES", "(", "3", ",", "8", ",", "1", ")", ";", "return", "(", "imm", ")", ";", "}", "}", "else", "{", "register", "UINT16", "response", ";", "reg", "+=", "cpustate", "->", "WP", ";", "CYCLES", "(", "1", ",", "8", ",", "3", ")", ";", "response", "=", "readword", "(", "cpustate", ",", "reg", ")", ";", "writeword", "(", "cpustate", ",", "reg", ",", "response", "+", "2", ")", ";", "return", "(", "response", ")", ";", "}", "}" ]
decipheraddr : compute and return the effective adress in word instructions.
[ "decipheraddr", ":", "compute", "and", "return", "the", "effective", "adress", "in", "word", "instructions", "." ]
[ "/* Rx */", "/* *Rx */", "/* @>xxxx(Rx) */", "/* @>xxxx */", "/*if (ts == 0x30)*/", "/* *Rx+ */", "/* reg now contains effective address */", "/* we increment register content */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "opcode", "type": "UINT16" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "opcode", "type": "UINT16", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
decipheraddrbyte
UINT16
static UINT16 decipheraddrbyte(tms99xx_state *cpustate, UINT16 opcode) { register UINT16 ts = opcode & 0x30; register UINT16 reg = opcode & 0xF; reg += reg; if (ts == 0) /* Rx */ return(reg + cpustate->WP); else if (ts == 0x10) { /* *Rx */ CYCLES(0, 4, 1); return(readword(cpustate, reg + cpustate->WP)); } else if (ts == 0x20) { register UINT16 imm; imm = fetch(cpustate); if (reg) { /* @>xxxx(Rx) */ CYCLES(1, 8, 3); return(readword(cpustate, reg + cpustate->WP) + imm); } else { /* @>xxxx */ CYCLES(3, 8, 1); return(imm); } } else /*if (ts == 0x30)*/ { /* *Rx+ */ register UINT16 response; reg += cpustate->WP; /* reg now contains effective address */ CYCLES(1, 6, 3); response = readword(cpustate, reg); writeword(cpustate, reg, response+1); /* we increment register content */ return(response); } }
/* decipheraddrbyte : compute and return the effective adress in byte instructions. */
decipheraddrbyte : compute and return the effective adress in byte instructions.
[ "decipheraddrbyte", ":", "compute", "and", "return", "the", "effective", "adress", "in", "byte", "instructions", "." ]
static UINT16 decipheraddrbyte(tms99xx_state *cpustate, UINT16 opcode) { register UINT16 ts = opcode & 0x30; register UINT16 reg = opcode & 0xF; reg += reg; if (ts == 0) return(reg + cpustate->WP); else if (ts == 0x10) { CYCLES(0, 4, 1); return(readword(cpustate, reg + cpustate->WP)); } else if (ts == 0x20) { register UINT16 imm; imm = fetch(cpustate); if (reg) { CYCLES(1, 8, 3); return(readword(cpustate, reg + cpustate->WP) + imm); } else { CYCLES(3, 8, 1); return(imm); } } else { register UINT16 response; reg += cpustate->WP; CYCLES(1, 6, 3); response = readword(cpustate, reg); writeword(cpustate, reg, response+1); return(response); } }
[ "static", "UINT16", "decipheraddrbyte", "(", "tms99xx_state", "*", "cpustate", ",", "UINT16", "opcode", ")", "{", "register", "UINT16", "ts", "=", "opcode", "&", "0x30", ";", "register", "UINT16", "reg", "=", "opcode", "&", "0xF", ";", "reg", "+=", "reg", ";", "if", "(", "ts", "==", "0", ")", "return", "(", "reg", "+", "cpustate", "->", "WP", ")", ";", "else", "if", "(", "ts", "==", "0x10", ")", "{", "CYCLES", "(", "0", ",", "4", ",", "1", ")", ";", "return", "(", "readword", "(", "cpustate", ",", "reg", "+", "cpustate", "->", "WP", ")", ")", ";", "}", "else", "if", "(", "ts", "==", "0x20", ")", "{", "register", "UINT16", "imm", ";", "imm", "=", "fetch", "(", "cpustate", ")", ";", "if", "(", "reg", ")", "{", "CYCLES", "(", "1", ",", "8", ",", "3", ")", ";", "return", "(", "readword", "(", "cpustate", ",", "reg", "+", "cpustate", "->", "WP", ")", "+", "imm", ")", ";", "}", "else", "{", "CYCLES", "(", "3", ",", "8", ",", "1", ")", ";", "return", "(", "imm", ")", ";", "}", "}", "else", "{", "register", "UINT16", "response", ";", "reg", "+=", "cpustate", "->", "WP", ";", "CYCLES", "(", "1", ",", "6", ",", "3", ")", ";", "response", "=", "readword", "(", "cpustate", ",", "reg", ")", ";", "writeword", "(", "cpustate", ",", "reg", ",", "response", "+", "1", ")", ";", "return", "(", "response", ")", ";", "}", "}" ]
decipheraddrbyte : compute and return the effective adress in byte instructions.
[ "decipheraddrbyte", ":", "compute", "and", "return", "the", "effective", "adress", "in", "byte", "instructions", "." ]
[ "/* Rx */", "/* *Rx */", "/* @>xxxx(Rx) */", "/* @>xxxx */", "/*if (ts == 0x30)*/", "/* *Rx+ */", "/* reg now contains effective address */", "/* we increment register content */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "opcode", "type": "UINT16" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "opcode", "type": "UINT16", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
138a8bd548f9badb1ff47adbb2456868fe76cfa8
lofunz/mieme
Reloaded/trunk/src/emu/cpu/tms9900/99xxcore.h
[ "Unlicense" ]
C
h2000
void
static void h2000(tms99xx_state *cpustate, UINT16 opcode) { register UINT16 dest = (opcode & 0x3C0) >> 6; register UINT16 src; register UINT16 value; #if HAS_MAPPING int src_map = (opcode & 0x0030) ? cpustate->cur_src_map : cpustate->cur_map; #endif src = decipheraddr(cpustate, opcode) & ~1; dest = ((dest+dest) + cpustate->WP) & ~1; switch ((opcode & 0x1C00) >> 10) { case 0: /* COC */ /* COC --- Compare Ones Corresponding */ /* status E bit = (S&D == S) */ value = readwordX(cpustate, src, src_map); setst_e(cpustate, value & readword(cpustate, dest), value); CYCLES(5, 14, 4); break; case 1: /* CZC */ /* CZC --- Compare Zeroes Corresponding */ /* status E bit = (S&~D == S) */ value = readwordX(cpustate, src, src_map); setst_e(cpustate, value & (~ readword(cpustate, dest)), value); CYCLES(5, 14, 4); break; case 2: /* XOR */ /* XOR --- eXclusive OR */ /* D ^= S */ value = readwordX(cpustate, src, src_map); value ^= readword(cpustate, dest); setst_lae(cpustate, value); writeword(cpustate, dest,value); CYCLES(3, 14, 4); break; /*case 3:*/ /* XOP is implemented elsewhere */ /*case 4:*/ /* LDCR is implemented elsewhere */ /*case 5:*/ /* STCR is implemented elsewhere */ case 6: /* MPY */ /* MPY --- MultiPlY (unsigned) */ /* Results: D:D+1 = D*S */ /* Note that early TMS9995 reportedly performs an extra dummy read in PC space */ { unsigned long prod = ((unsigned long) readwordX(cpustate, src, src_map)); prod = prod * ((unsigned long) readword(cpustate, dest)); writeword(cpustate, dest, prod >> 16); writeword(cpustate, (dest+2)&0xffff, prod); } /* ti990/10 : from 19 to 35, possibly 19 + (number of bits to 1 in one operand) */ CYCLES(35, 52, 23); break; case 7: /* DIV */ /* DIV --- DIVide (unsigned) */ /* D = D/S D+1 = D%S */ { UINT16 d = readwordX(cpustate, src, src_map); UINT16 hi = readword(cpustate, dest); unsigned long divq = (((unsigned long) hi) << 16) | readword(cpustate, (dest+2)&0xffff); if (d <= hi) { cpustate->STATUS |= ST_OV; CYCLES(4, 16, 6); } else { cpustate->STATUS &= ~ST_OV; writeword(cpustate, dest, divq/d); writeword(cpustate, (dest+2)&0xffff, divq%d); /* tms9900 : from 92 to 124, possibly 92 + 2*(number of bits to 1 (or 0?) in quotient) */ /* tms9995 : 28 is the worst case */ /* ti990/10 : from 41 to 58, possibly 41 + (number of bits to 1 (or 0?) in quotient) */ CYCLES(41, 92, 28); } } break; } }
/* xop, ldcr and stcr are handled elsewhere */
xop, ldcr and stcr are handled elsewhere
[ "xop", "ldcr", "and", "stcr", "are", "handled", "elsewhere" ]
static void h2000(tms99xx_state *cpustate, UINT16 opcode) { register UINT16 dest = (opcode & 0x3C0) >> 6; register UINT16 src; register UINT16 value; #if HAS_MAPPING int src_map = (opcode & 0x0030) ? cpustate->cur_src_map : cpustate->cur_map; #endif src = decipheraddr(cpustate, opcode) & ~1; dest = ((dest+dest) + cpustate->WP) & ~1; switch ((opcode & 0x1C00) >> 10) { case 0: value = readwordX(cpustate, src, src_map); setst_e(cpustate, value & readword(cpustate, dest), value); CYCLES(5, 14, 4); break; case 1: value = readwordX(cpustate, src, src_map); setst_e(cpustate, value & (~ readword(cpustate, dest)), value); CYCLES(5, 14, 4); break; case 2: value = readwordX(cpustate, src, src_map); value ^= readword(cpustate, dest); setst_lae(cpustate, value); writeword(cpustate, dest,value); CYCLES(3, 14, 4); break; case 6: { unsigned long prod = ((unsigned long) readwordX(cpustate, src, src_map)); prod = prod * ((unsigned long) readword(cpustate, dest)); writeword(cpustate, dest, prod >> 16); writeword(cpustate, (dest+2)&0xffff, prod); } CYCLES(35, 52, 23); break; case 7: { UINT16 d = readwordX(cpustate, src, src_map); UINT16 hi = readword(cpustate, dest); unsigned long divq = (((unsigned long) hi) << 16) | readword(cpustate, (dest+2)&0xffff); if (d <= hi) { cpustate->STATUS |= ST_OV; CYCLES(4, 16, 6); } else { cpustate->STATUS &= ~ST_OV; writeword(cpustate, dest, divq/d); writeword(cpustate, (dest+2)&0xffff, divq%d); CYCLES(41, 92, 28); } } break; } }
[ "static", "void", "h2000", "(", "tms99xx_state", "*", "cpustate", ",", "UINT16", "opcode", ")", "{", "register", "UINT16", "dest", "=", "(", "opcode", "&", "0x3C0", ")", ">>", "6", ";", "register", "UINT16", "src", ";", "register", "UINT16", "value", ";", "#if", "HAS_MAPPING", "\n", "int", "src_map", "=", "(", "opcode", "&", "0x0030", ")", "?", "cpustate", "->", "cur_src_map", ":", "cpustate", "->", "cur_map", ";", "#endif", "src", "=", "decipheraddr", "(", "cpustate", ",", "opcode", ")", "&", "~", "1", ";", "dest", "=", "(", "(", "dest", "+", "dest", ")", "+", "cpustate", "->", "WP", ")", "&", "~", "1", ";", "switch", "(", "(", "opcode", "&", "0x1C00", ")", ">>", "10", ")", "{", "case", "0", ":", "value", "=", "readwordX", "(", "cpustate", ",", "src", ",", "src_map", ")", ";", "setst_e", "(", "cpustate", ",", "value", "&", "readword", "(", "cpustate", ",", "dest", ")", ",", "value", ")", ";", "CYCLES", "(", "5", ",", "14", ",", "4", ")", ";", "break", ";", "case", "1", ":", "value", "=", "readwordX", "(", "cpustate", ",", "src", ",", "src_map", ")", ";", "setst_e", "(", "cpustate", ",", "value", "&", "(", "~", "readword", "(", "cpustate", ",", "dest", ")", ")", ",", "value", ")", ";", "CYCLES", "(", "5", ",", "14", ",", "4", ")", ";", "break", ";", "case", "2", ":", "value", "=", "readwordX", "(", "cpustate", ",", "src", ",", "src_map", ")", ";", "value", "^=", "readword", "(", "cpustate", ",", "dest", ")", ";", "setst_lae", "(", "cpustate", ",", "value", ")", ";", "writeword", "(", "cpustate", ",", "dest", ",", "value", ")", ";", "CYCLES", "(", "3", ",", "14", ",", "4", ")", ";", "break", ";", "case", "6", ":", "{", "unsigned", "long", "prod", "=", "(", "(", "unsigned", "long", ")", "readwordX", "(", "cpustate", ",", "src", ",", "src_map", ")", ")", ";", "prod", "=", "prod", "*", "(", "(", "unsigned", "long", ")", "readword", "(", "cpustate", ",", "dest", ")", ")", ";", "writeword", "(", "cpustate", ",", "dest", ",", "prod", ">>", "16", ")", ";", "writeword", "(", "cpustate", ",", "(", "dest", "+", "2", ")", "&", "0xffff", ",", "prod", ")", ";", "}", "CYCLES", "(", "35", ",", "52", ",", "23", ")", ";", "break", ";", "case", "7", ":", "{", "UINT16", "d", "=", "readwordX", "(", "cpustate", ",", "src", ",", "src_map", ")", ";", "UINT16", "hi", "=", "readword", "(", "cpustate", ",", "dest", ")", ";", "unsigned", "long", "divq", "=", "(", "(", "(", "unsigned", "long", ")", "hi", ")", "<<", "16", ")", "|", "readword", "(", "cpustate", ",", "(", "dest", "+", "2", ")", "&", "0xffff", ")", ";", "if", "(", "d", "<=", "hi", ")", "{", "cpustate", "->", "STATUS", "|=", "ST_OV", ";", "CYCLES", "(", "4", ",", "16", ",", "6", ")", ";", "}", "else", "{", "cpustate", "->", "STATUS", "&=", "~", "ST_OV", ";", "writeword", "(", "cpustate", ",", "dest", ",", "divq", "/", "d", ")", ";", "writeword", "(", "cpustate", ",", "(", "dest", "+", "2", ")", "&", "0xffff", ",", "divq", "%", "d", ")", ";", "CYCLES", "(", "41", ",", "92", ",", "28", ")", ";", "}", "}", "break", ";", "}", "}" ]
xop, ldcr and stcr are handled elsewhere
[ "xop", "ldcr", "and", "stcr", "are", "handled", "elsewhere" ]
[ "/* COC */", "/* COC --- Compare Ones Corresponding */", "/* status E bit = (S&D == S) */", "/* CZC */", "/* CZC --- Compare Zeroes Corresponding */", "/* status E bit = (S&~D == S) */", "/* XOR */", "/* XOR --- eXclusive OR */", "/* D ^= S */", "/*case 3:*/", "/* XOP is implemented elsewhere */", "/*case 4:*/", "/* LDCR is implemented elsewhere */", "/*case 5:*/", "/* STCR is implemented elsewhere */", "/* MPY */", "/* MPY --- MultiPlY (unsigned) */", "/* Results: D:D+1 = D*S */", "/* Note that early TMS9995 reportedly performs an extra dummy read in PC space */", "/* ti990/10 : from 19 to 35, possibly 19 + (number of bits to 1 in one operand) */", "/* DIV */", "/* DIV --- DIVide (unsigned) */", "/* D = D/S D+1 = D%S */", "/* tms9900 : from 92 to 124, possibly 92 + 2*(number of bits to 1 (or 0?) in quotient) */", "/* tms9995 : 28 is the worst case */", "/* ti990/10 : from 41 to 58, possibly 41 + (number of bits to 1 (or 0?) in quotient) */" ]
[ { "param": "cpustate", "type": "tms99xx_state" }, { "param": "opcode", "type": "UINT16" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cpustate", "type": "tms99xx_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "opcode", "type": "UINT16", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c31a0832e410174b68d207be92bd7217e2d7850d
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/machine/atari.c
[ "Unlicense" ]
C
a5200_handle_keypads
void
void a5200_handle_keypads(running_machine *machine) { const device_config *pokey = devtag_get_device(machine, "pokey"); int atari_code, count, ipt, i; static const char *const tag[] = { "keypad_0", "keypad_1", "keypad_2", "keypad_3" }; /* check keypad */ for( i = 0; i < 4; i++ ) { ipt = input_port_read_safe(machine, tag[i], 0); if( ipt ) { count = 0; while(ipt / 2) { ipt = ipt/2; count++; } atari_code = i*4 + count; if( atari_code == atari_last ) return; atari_last = atari_code; if( atari_code == 0 ) { pokey_break_w(pokey, atari_code & 0x40); return; } pokey_kbcode_w(pokey, (atari_code << 1) | 0x21, 1); return; } } /* check top button */ if ((input_port_read(machine, "djoy_b") & 0x10) == 0) { if (atari_last == 0xfe) return; pokey_kbcode_w(pokey, 0x61, 1); //pokey_break_w(pokey, 0x40); atari_last = 0xfe; return; } else if (atari_last == 0xfe) pokey_kbcode_w(pokey, 0x21, 1); /* remove key pressed status bit from skstat */ pokey_kbcode_w(pokey, 0xff, 0); atari_last = 0xff; }
/************************************************************** A5200 keypad inputs use 4bits to read the 16keys in the key matrix. We currently read the key matrix by lines and convert the input to the value expected by the POKEY (see the code below to determine atari_code values). K2,K1,K0 | 00x | 01x | 10x | 11x | K5,K4,K3 ---------------------------------- x00 | | # | 0 | * | x01 |Reset| 9 | 8 | 7 | x10 |Pause| 6 | 5 | 4 | x11 |Start| 3 | 2 | 1 | K0 & K5 are ignored (we send them as 1, see the code below where we pass "(atari_code << 1) | 0x21" ) To Do: investigate implementation of KR2 to read accurately the secondary Fire button (primary read through GTIA). **************************************************************/
A5200 keypad inputs use 4bits to read the 16keys in the key matrix. We currently read the key matrix by lines and convert the input to the value expected by the POKEY (see the code below to determine atari_code values). K0 & K5 are ignored (we send them as 1, see the code below where we pass "(atari_code << 1) | 0x21" ) To Do: investigate implementation of KR2 to read accurately the secondary Fire button (primary read through GTIA).
[ "A5200", "keypad", "inputs", "use", "4bits", "to", "read", "the", "16keys", "in", "the", "key", "matrix", ".", "We", "currently", "read", "the", "key", "matrix", "by", "lines", "and", "convert", "the", "input", "to", "the", "value", "expected", "by", "the", "POKEY", "(", "see", "the", "code", "below", "to", "determine", "atari_code", "values", ")", ".", "K0", "&", "K5", "are", "ignored", "(", "we", "send", "them", "as", "1", "see", "the", "code", "below", "where", "we", "pass", "\"", "(", "atari_code", "<<", "1", ")", "|", "0x21", "\"", ")", "To", "Do", ":", "investigate", "implementation", "of", "KR2", "to", "read", "accurately", "the", "secondary", "Fire", "button", "(", "primary", "read", "through", "GTIA", ")", "." ]
void a5200_handle_keypads(running_machine *machine) { const device_config *pokey = devtag_get_device(machine, "pokey"); int atari_code, count, ipt, i; static const char *const tag[] = { "keypad_0", "keypad_1", "keypad_2", "keypad_3" }; for( i = 0; i < 4; i++ ) { ipt = input_port_read_safe(machine, tag[i], 0); if( ipt ) { count = 0; while(ipt / 2) { ipt = ipt/2; count++; } atari_code = i*4 + count; if( atari_code == atari_last ) return; atari_last = atari_code; if( atari_code == 0 ) { pokey_break_w(pokey, atari_code & 0x40); return; } pokey_kbcode_w(pokey, (atari_code << 1) | 0x21, 1); return; } } if ((input_port_read(machine, "djoy_b") & 0x10) == 0) { if (atari_last == 0xfe) return; pokey_kbcode_w(pokey, 0x61, 1); atari_last = 0xfe; return; } else if (atari_last == 0xfe) pokey_kbcode_w(pokey, 0x21, 1); pokey_kbcode_w(pokey, 0xff, 0); atari_last = 0xff; }
[ "void", "a5200_handle_keypads", "(", "running_machine", "*", "machine", ")", "{", "const", "device_config", "*", "pokey", "=", "devtag_get_device", "(", "machine", ",", "\"", "\"", ")", ";", "int", "atari_code", ",", "count", ",", "ipt", ",", "i", ";", "static", "const", "char", "*", "const", "tag", "[", "]", "=", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ";", "for", "(", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "ipt", "=", "input_port_read_safe", "(", "machine", ",", "tag", "[", "i", "]", ",", "0", ")", ";", "if", "(", "ipt", ")", "{", "count", "=", "0", ";", "while", "(", "ipt", "/", "2", ")", "{", "ipt", "=", "ipt", "/", "2", ";", "count", "++", ";", "}", "atari_code", "=", "i", "*", "4", "+", "count", ";", "if", "(", "atari_code", "==", "atari_last", ")", "return", ";", "atari_last", "=", "atari_code", ";", "if", "(", "atari_code", "==", "0", ")", "{", "pokey_break_w", "(", "pokey", ",", "atari_code", "&", "0x40", ")", ";", "return", ";", "}", "pokey_kbcode_w", "(", "pokey", ",", "(", "atari_code", "<<", "1", ")", "|", "0x21", ",", "1", ")", ";", "return", ";", "}", "}", "if", "(", "(", "input_port_read", "(", "machine", ",", "\"", "\"", ")", "&", "0x10", ")", "==", "0", ")", "{", "if", "(", "atari_last", "==", "0xfe", ")", "return", ";", "pokey_kbcode_w", "(", "pokey", ",", "0x61", ",", "1", ")", ";", "atari_last", "=", "0xfe", ";", "return", ";", "}", "else", "if", "(", "atari_last", "==", "0xfe", ")", "pokey_kbcode_w", "(", "pokey", ",", "0x21", ",", "1", ")", ";", "pokey_kbcode_w", "(", "pokey", ",", "0xff", ",", "0", ")", ";", "atari_last", "=", "0xff", ";", "}" ]
A5200 keypad inputs use 4bits to read the 16keys in the key matrix.
[ "A5200", "keypad", "inputs", "use", "4bits", "to", "read", "the", "16keys", "in", "the", "key", "matrix", "." ]
[ "/* check keypad */", "/* check top button */", "//pokey_break_w(pokey, 0x40);", "/* remove key pressed status bit from skstat */" ]
[ { "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": [] }
13562e19fa097ec8d8a8211feac5641a4463904c
lofunz/mieme
Reloaded/trunk/src/mame/machine/s16fd.c
[ "Unlicense" ]
C
fd1094_setstate_and_decrypt
void
static void fd1094_setstate_and_decrypt(running_machine *machine, int state) { int i; UINT32 addr; switch (state & 0x300) { case 0x000: case FD1094_STATE_RESET: fd1094_selected_state = state & 0xff; break; } fd1094_state = state; cpu_set_reg(machine->device(fd1094_cputag), M68K_PREF_ADDR, 0x0010); // force a flush of the prefetch cache /* set the FD1094 state ready to decrypt.. */ state = fd1094_set_state(fd1094_key, state) & 0xff; /* first check the cache, if its cached we don't need to decrypt it, just copy */ for (i = 0; i < CACHE_ENTRIES; i++) { if (fd1094_cached_states[i] == state) { /* copy cached state */ fd1094_userregion = fd1094_cacheregion[i]; set_decrypted_region(machine); m68k_set_encrypted_opcode_range(machine->device(fd1094_cputag), 0, fd1094_cpuregionsize); return; } } /* mark it as cached (because it will be once we decrypt it) */ fd1094_cached_states[fd1094_current_cacheposition] = state; for (addr = 0; addr < fd1094_cpuregionsize / 2; addr++) { UINT16 dat; dat = fd1094_decode(addr,fd1094_cpuregion[addr],fd1094_key,0); fd1094_cacheregion[fd1094_current_cacheposition][addr]=dat; } /* copy newly decrypted data to user region */ fd1094_userregion = fd1094_cacheregion[fd1094_current_cacheposition]; set_decrypted_region(machine); m68k_set_encrypted_opcode_range(machine->device(fd1094_cputag), 0, fd1094_cpuregionsize); fd1094_current_cacheposition++; if (fd1094_current_cacheposition >= CACHE_ENTRIES) { mame_printf_debug("out of cache, performance may suffer, incrase CACHE_ENTRIES!\n"); fd1094_current_cacheposition = 0; } }
/* this function checks the cache to see if the current state is cached, if it is then it copies the cached data to the user region where code is executed from, if its not cached then it gets decrypted to the current cache position using the functions in fd1094.c */
this function checks the cache to see if the current state is cached, if it is then it copies the cached data to the user region where code is executed from, if its not cached then it gets decrypted to the current cache position using the functions in fd1094.c
[ "this", "function", "checks", "the", "cache", "to", "see", "if", "the", "current", "state", "is", "cached", "if", "it", "is", "then", "it", "copies", "the", "cached", "data", "to", "the", "user", "region", "where", "code", "is", "executed", "from", "if", "its", "not", "cached", "then", "it", "gets", "decrypted", "to", "the", "current", "cache", "position", "using", "the", "functions", "in", "fd1094", ".", "c" ]
static void fd1094_setstate_and_decrypt(running_machine *machine, int state) { int i; UINT32 addr; switch (state & 0x300) { case 0x000: case FD1094_STATE_RESET: fd1094_selected_state = state & 0xff; break; } fd1094_state = state; cpu_set_reg(machine->device(fd1094_cputag), M68K_PREF_ADDR, 0x0010); state = fd1094_set_state(fd1094_key, state) & 0xff; for (i = 0; i < CACHE_ENTRIES; i++) { if (fd1094_cached_states[i] == state) { fd1094_userregion = fd1094_cacheregion[i]; set_decrypted_region(machine); m68k_set_encrypted_opcode_range(machine->device(fd1094_cputag), 0, fd1094_cpuregionsize); return; } } fd1094_cached_states[fd1094_current_cacheposition] = state; for (addr = 0; addr < fd1094_cpuregionsize / 2; addr++) { UINT16 dat; dat = fd1094_decode(addr,fd1094_cpuregion[addr],fd1094_key,0); fd1094_cacheregion[fd1094_current_cacheposition][addr]=dat; } fd1094_userregion = fd1094_cacheregion[fd1094_current_cacheposition]; set_decrypted_region(machine); m68k_set_encrypted_opcode_range(machine->device(fd1094_cputag), 0, fd1094_cpuregionsize); fd1094_current_cacheposition++; if (fd1094_current_cacheposition >= CACHE_ENTRIES) { mame_printf_debug("out of cache, performance may suffer, incrase CACHE_ENTRIES!\n"); fd1094_current_cacheposition = 0; } }
[ "static", "void", "fd1094_setstate_and_decrypt", "(", "running_machine", "*", "machine", ",", "int", "state", ")", "{", "int", "i", ";", "UINT32", "addr", ";", "switch", "(", "state", "&", "0x300", ")", "{", "case", "0x000", ":", "case", "FD1094_STATE_RESET", ":", "fd1094_selected_state", "=", "state", "&", "0xff", ";", "break", ";", "}", "fd1094_state", "=", "state", ";", "cpu_set_reg", "(", "machine", "->", "device", "(", "fd1094_cputag", ")", ",", "M68K_PREF_ADDR", ",", "0x0010", ")", ";", "state", "=", "fd1094_set_state", "(", "fd1094_key", ",", "state", ")", "&", "0xff", ";", "for", "(", "i", "=", "0", ";", "i", "<", "CACHE_ENTRIES", ";", "i", "++", ")", "{", "if", "(", "fd1094_cached_states", "[", "i", "]", "==", "state", ")", "{", "fd1094_userregion", "=", "fd1094_cacheregion", "[", "i", "]", ";", "set_decrypted_region", "(", "machine", ")", ";", "m68k_set_encrypted_opcode_range", "(", "machine", "->", "device", "(", "fd1094_cputag", ")", ",", "0", ",", "fd1094_cpuregionsize", ")", ";", "return", ";", "}", "}", "fd1094_cached_states", "[", "fd1094_current_cacheposition", "]", "=", "state", ";", "for", "(", "addr", "=", "0", ";", "addr", "<", "fd1094_cpuregionsize", "/", "2", ";", "addr", "++", ")", "{", "UINT16", "dat", ";", "dat", "=", "fd1094_decode", "(", "addr", ",", "fd1094_cpuregion", "[", "addr", "]", ",", "fd1094_key", ",", "0", ")", ";", "fd1094_cacheregion", "[", "fd1094_current_cacheposition", "]", "[", "addr", "]", "=", "dat", ";", "}", "fd1094_userregion", "=", "fd1094_cacheregion", "[", "fd1094_current_cacheposition", "]", ";", "set_decrypted_region", "(", "machine", ")", ";", "m68k_set_encrypted_opcode_range", "(", "machine", "->", "device", "(", "fd1094_cputag", ")", ",", "0", ",", "fd1094_cpuregionsize", ")", ";", "fd1094_current_cacheposition", "++", ";", "if", "(", "fd1094_current_cacheposition", ">=", "CACHE_ENTRIES", ")", "{", "mame_printf_debug", "(", "\"", "\\n", "\"", ")", ";", "fd1094_current_cacheposition", "=", "0", ";", "}", "}" ]
this function checks the cache to see if the current state is cached, if it is then it copies the cached data to the user region where code is executed from, if its not cached then it gets decrypted to the current cache position using the functions in fd1094.c
[ "this", "function", "checks", "the", "cache", "to", "see", "if", "the", "current", "state", "is", "cached", "if", "it", "is", "then", "it", "copies", "the", "cached", "data", "to", "the", "user", "region", "where", "code", "is", "executed", "from", "if", "its", "not", "cached", "then", "it", "gets", "decrypted", "to", "the", "current", "cache", "position", "using", "the", "functions", "in", "fd1094", ".", "c" ]
[ "// force a flush of the prefetch cache\r", "/* set the FD1094 state ready to decrypt.. */", "/* first check the cache, if its cached we don't need to decrypt it, just copy */", "/* copy cached state */", "/* mark it as cached (because it will be once we decrypt it) */", "/* copy newly decrypted data to user region */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "state", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "state", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
13562e19fa097ec8d8a8211feac5641a4463904c
lofunz/mieme
Reloaded/trunk/src/mame/machine/s16fd.c
[ "Unlicense" ]
C
fd1094_cmp_callback
void
static void fd1094_cmp_callback(running_device *device, UINT32 val, UINT8 reg) { if (reg == 0 && (val & 0x0000ffff) == 0x0000ffff) // ? { fd1094_setstate_and_decrypt(device->machine, (val & 0xffff0000) >> 16); } }
/* Callback for CMP.L instructions (state change) */
Callback for CMP.L instructions (state change)
[ "Callback", "for", "CMP", ".", "L", "instructions", "(", "state", "change", ")" ]
static void fd1094_cmp_callback(running_device *device, UINT32 val, UINT8 reg) { if (reg == 0 && (val & 0x0000ffff) == 0x0000ffff) { fd1094_setstate_and_decrypt(device->machine, (val & 0xffff0000) >> 16); } }
[ "static", "void", "fd1094_cmp_callback", "(", "running_device", "*", "device", ",", "UINT32", "val", ",", "UINT8", "reg", ")", "{", "if", "(", "reg", "==", "0", "&&", "(", "val", "&", "0x0000ffff", ")", "==", "0x0000ffff", ")", "{", "fd1094_setstate_and_decrypt", "(", "device", "->", "machine", ",", "(", "val", "&", "0xffff0000", ")", ">>", "16", ")", ";", "}", "}" ]
Callback for CMP.L instructions (state change)
[ "Callback", "for", "CMP", ".", "L", "instructions", "(", "state", "change", ")" ]
[ "// ?\r" ]
[ { "param": "device", "type": "running_device" }, { "param": "val", "type": "UINT32" }, { "param": "reg", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "running_device", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "val", "type": "UINT32", "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": [] }
13562e19fa097ec8d8a8211feac5641a4463904c
lofunz/mieme
Reloaded/trunk/src/mame/machine/s16fd.c
[ "Unlicense" ]
C
fd1094_kludge_reset_values
void
static void fd1094_kludge_reset_values(void) { int i; for (i = 0;i < 4;i++) fd1094_userregion[i] = fd1094_decode(i,fd1094_cpuregion[i],fd1094_key,1); }
/* KLUDGE, set the initial PC / SP based on table as we can't decrypt them yet */
KLUDGE, set the initial PC / SP based on table as we can't decrypt them yet
[ "KLUDGE", "set", "the", "initial", "PC", "/", "SP", "based", "on", "table", "as", "we", "can", "'", "t", "decrypt", "them", "yet" ]
static void fd1094_kludge_reset_values(void) { int i; for (i = 0;i < 4;i++) fd1094_userregion[i] = fd1094_decode(i,fd1094_cpuregion[i],fd1094_key,1); }
[ "static", "void", "fd1094_kludge_reset_values", "(", "void", ")", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "fd1094_userregion", "[", "i", "]", "=", "fd1094_decode", "(", "i", ",", "fd1094_cpuregion", "[", "i", "]", ",", "fd1094_key", ",", "1", ")", ";", "}" ]
KLUDGE, set the initial PC / SP based on table as we can't decrypt them yet
[ "KLUDGE", "set", "the", "initial", "PC", "/", "SP", "based", "on", "table", "as", "we", "can", "'", "t", "decrypt", "them", "yet" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
13562e19fa097ec8d8a8211feac5641a4463904c
lofunz/mieme
Reloaded/trunk/src/mame/machine/s16fd.c
[ "Unlicense" ]
C
fd1094_machine_init
void
void fd1094_machine_init(running_device *device) { /* punt if no key; this allows us to be called even for non-FD1094 games */ if (!fd1094_key) return; fd1094_setstate_and_decrypt(device->machine, FD1094_STATE_RESET); fd1094_kludge_reset_values(); m68k_set_cmpild_callback(device, fd1094_cmp_callback); m68k_set_rte_callback(device, fd1094_rte_callback); cpu_set_irq_callback(device, fd1094_int_callback); device->reset(); }
/* function, to be called from MACHINE_RESET (every reset) */
function, to be called from MACHINE_RESET (every reset)
[ "function", "to", "be", "called", "from", "MACHINE_RESET", "(", "every", "reset", ")" ]
void fd1094_machine_init(running_device *device) { if (!fd1094_key) return; fd1094_setstate_and_decrypt(device->machine, FD1094_STATE_RESET); fd1094_kludge_reset_values(); m68k_set_cmpild_callback(device, fd1094_cmp_callback); m68k_set_rte_callback(device, fd1094_rte_callback); cpu_set_irq_callback(device, fd1094_int_callback); device->reset(); }
[ "void", "fd1094_machine_init", "(", "running_device", "*", "device", ")", "{", "if", "(", "!", "fd1094_key", ")", "return", ";", "fd1094_setstate_and_decrypt", "(", "device", "->", "machine", ",", "FD1094_STATE_RESET", ")", ";", "fd1094_kludge_reset_values", "(", ")", ";", "m68k_set_cmpild_callback", "(", "device", ",", "fd1094_cmp_callback", ")", ";", "m68k_set_rte_callback", "(", "device", ",", "fd1094_rte_callback", ")", ";", "cpu_set_irq_callback", "(", "device", ",", "fd1094_int_callback", ")", ";", "device", "->", "reset", "(", ")", ";", "}" ]
function, to be called from MACHINE_RESET (every reset)
[ "function", "to", "be", "called", "from", "MACHINE_RESET", "(", "every", "reset", ")" ]
[ "/* punt if no key; this allows us to be called even for non-FD1094 games */" ]
[ { "param": "device", "type": "running_device" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "running_device", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
13562e19fa097ec8d8a8211feac5641a4463904c
lofunz/mieme
Reloaded/trunk/src/mame/machine/s16fd.c
[ "Unlicense" ]
C
fd1094_driver_init
void
void fd1094_driver_init(running_machine *machine, const char* tag, void (*set_decrypted)(running_machine *, UINT8 *)) { int i; strcpy(fd1094_cputag, tag); fd1094_cpuregion = (UINT16*)memory_region(machine, fd1094_cputag); fd1094_cpuregionsize = memory_region_length(machine, fd1094_cputag); fd1094_key = memory_region(machine, "user1"); fd1094_set_decrypted = set_decrypted; /* punt if no key; this allows us to be called even for non-FD1094 games */ if (fd1094_key == NULL) return; for (i = 0; i < CACHE_ENTRIES; i++) { fd1094_cacheregion[i] = auto_alloc_array(machine, UINT16, fd1094_cpuregionsize / 2); fd1094_cached_states[i] = -1; } fd1094_current_cacheposition = 0; fd1094_state = -1; /* key debugging */ if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0 && memory_region(machine, "user2") != NULL) { fd1094_init_debugging(machine, fd1094_cputag, "user1", "user2", key_changed); } state_save_register_global(machine, fd1094_selected_state); state_save_register_global(machine, fd1094_state); state_save_register_postload(machine, fd1094_postload, NULL); }
/* startup function, to be called from DRIVER_INIT (once on startup) */
startup function, to be called from DRIVER_INIT (once on startup)
[ "startup", "function", "to", "be", "called", "from", "DRIVER_INIT", "(", "once", "on", "startup", ")" ]
void fd1094_driver_init(running_machine *machine, const char* tag, void (*set_decrypted)(running_machine *, UINT8 *)) { int i; strcpy(fd1094_cputag, tag); fd1094_cpuregion = (UINT16*)memory_region(machine, fd1094_cputag); fd1094_cpuregionsize = memory_region_length(machine, fd1094_cputag); fd1094_key = memory_region(machine, "user1"); fd1094_set_decrypted = set_decrypted; if (fd1094_key == NULL) return; for (i = 0; i < CACHE_ENTRIES; i++) { fd1094_cacheregion[i] = auto_alloc_array(machine, UINT16, fd1094_cpuregionsize / 2); fd1094_cached_states[i] = -1; } fd1094_current_cacheposition = 0; fd1094_state = -1; if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0 && memory_region(machine, "user2") != NULL) { fd1094_init_debugging(machine, fd1094_cputag, "user1", "user2", key_changed); } state_save_register_global(machine, fd1094_selected_state); state_save_register_global(machine, fd1094_state); state_save_register_postload(machine, fd1094_postload, NULL); }
[ "void", "fd1094_driver_init", "(", "running_machine", "*", "machine", ",", "const", "char", "*", "tag", ",", "void", "(", "*", "set_decrypted", ")", "(", "running_machine", "*", ",", "UINT8", "*", ")", ")", "{", "int", "i", ";", "strcpy", "(", "fd1094_cputag", ",", "tag", ")", ";", "fd1094_cpuregion", "=", "(", "UINT16", "*", ")", "memory_region", "(", "machine", ",", "fd1094_cputag", ")", ";", "fd1094_cpuregionsize", "=", "memory_region_length", "(", "machine", ",", "fd1094_cputag", ")", ";", "fd1094_key", "=", "memory_region", "(", "machine", ",", "\"", "\"", ")", ";", "fd1094_set_decrypted", "=", "set_decrypted", ";", "if", "(", "fd1094_key", "==", "NULL", ")", "return", ";", "for", "(", "i", "=", "0", ";", "i", "<", "CACHE_ENTRIES", ";", "i", "++", ")", "{", "fd1094_cacheregion", "[", "i", "]", "=", "auto_alloc_array", "(", "machine", ",", "UINT16", ",", "fd1094_cpuregionsize", "/", "2", ")", ";", "fd1094_cached_states", "[", "i", "]", "=", "-1", ";", "}", "fd1094_current_cacheposition", "=", "0", ";", "fd1094_state", "=", "-1", ";", "if", "(", "(", "machine", "->", "debug_flags", "&", "DEBUG_FLAG_ENABLED", ")", "!=", "0", "&&", "memory_region", "(", "machine", ",", "\"", "\"", ")", "!=", "NULL", ")", "{", "fd1094_init_debugging", "(", "machine", ",", "fd1094_cputag", ",", "\"", "\"", ",", "\"", "\"", ",", "key_changed", ")", ";", "}", "state_save_register_global", "(", "machine", ",", "fd1094_selected_state", ")", ";", "state_save_register_global", "(", "machine", ",", "fd1094_state", ")", ";", "state_save_register_postload", "(", "machine", ",", "fd1094_postload", ",", "NULL", ")", ";", "}" ]
startup function, to be called from DRIVER_INIT (once on startup)
[ "startup", "function", "to", "be", "called", "from", "DRIVER_INIT", "(", "once", "on", "startup", ")" ]
[ "/* punt if no key; this allows us to be called even for non-FD1094 games */", "/* key debugging */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "tag", "type": "char" }, { "param": "set_decrypted", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tag", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "set_decrypted", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7edd4cf5460bcd0dc84060313c2dbd7c19a9077f
lofunz/mieme
Reloaded/trunk/src/mame/video/pacland.c
[ "Unlicense" ]
C
switch_palette
void
static void switch_palette(running_machine *machine) { int i; const UINT8 *color_prom = pacland_color_prom + 256 * palette_bank; for (i = 0;i < 256;i++) { int bit0,bit1,bit2,bit3; int r,g,b; bit0 = (color_prom[0] >> 0) & 0x01; bit1 = (color_prom[0] >> 1) & 0x01; bit2 = (color_prom[0] >> 2) & 0x01; bit3 = (color_prom[0] >> 3) & 0x01; r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; bit0 = (color_prom[0] >> 4) & 0x01; bit1 = (color_prom[0] >> 5) & 0x01; bit2 = (color_prom[0] >> 6) & 0x01; bit3 = (color_prom[0] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; bit0 = (color_prom[1024] >> 0) & 0x01; bit1 = (color_prom[1024] >> 1) & 0x01; bit2 = (color_prom[1024] >> 2) & 0x01; bit3 = (color_prom[1024] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; color_prom++; colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); } }
/*************************************************************************** Convert the color PROMs. Pacland has one 1024x8 and one 1024x4 palette PROM; and three 1024x8 lookup table PROMs (sprites, bg tiles, fg tiles). The palette has 1024 colors, but it is bank switched (4 banks) and only 256 colors are visible at a time. So, instead of creating a static palette, we modify it when the bank switching takes place. The color PROMs are connected to the RGB output this way: bit 7 -- 220 ohm resistor -- GREEN -- 470 ohm resistor -- GREEN -- 1 kohm resistor -- GREEN -- 2.2kohm resistor -- GREEN -- 220 ohm resistor -- RED -- 470 ohm resistor -- RED -- 1 kohm resistor -- RED bit 0 -- 2.2kohm resistor -- RED bit 3 -- 220 ohm resistor -- BLUE -- 470 ohm resistor -- BLUE -- 1 kohm resistor -- BLUE bit 0 -- 2.2kohm resistor -- BLUE ***************************************************************************/
Convert the color PROMs. Pacland has one 1024x8 and one 1024x4 palette PROM; and three 1024x8 lookup table PROMs (sprites, bg tiles, fg tiles). The palette has 1024 colors, but it is bank switched (4 banks) and only 256 colors are visible at a time. So, instead of creating a static palette, we modify it when the bank switching takes place. The color PROMs are connected to the RGB output this way.
[ "Convert", "the", "color", "PROMs", ".", "Pacland", "has", "one", "1024x8", "and", "one", "1024x4", "palette", "PROM", ";", "and", "three", "1024x8", "lookup", "table", "PROMs", "(", "sprites", "bg", "tiles", "fg", "tiles", ")", ".", "The", "palette", "has", "1024", "colors", "but", "it", "is", "bank", "switched", "(", "4", "banks", ")", "and", "only", "256", "colors", "are", "visible", "at", "a", "time", ".", "So", "instead", "of", "creating", "a", "static", "palette", "we", "modify", "it", "when", "the", "bank", "switching", "takes", "place", ".", "The", "color", "PROMs", "are", "connected", "to", "the", "RGB", "output", "this", "way", "." ]
static void switch_palette(running_machine *machine) { int i; const UINT8 *color_prom = pacland_color_prom + 256 * palette_bank; for (i = 0;i < 256;i++) { int bit0,bit1,bit2,bit3; int r,g,b; bit0 = (color_prom[0] >> 0) & 0x01; bit1 = (color_prom[0] >> 1) & 0x01; bit2 = (color_prom[0] >> 2) & 0x01; bit3 = (color_prom[0] >> 3) & 0x01; r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; bit0 = (color_prom[0] >> 4) & 0x01; bit1 = (color_prom[0] >> 5) & 0x01; bit2 = (color_prom[0] >> 6) & 0x01; bit3 = (color_prom[0] >> 7) & 0x01; g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; bit0 = (color_prom[1024] >> 0) & 0x01; bit1 = (color_prom[1024] >> 1) & 0x01; bit2 = (color_prom[1024] >> 2) & 0x01; bit3 = (color_prom[1024] >> 3) & 0x01; b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; color_prom++; colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b)); } }
[ "static", "void", "switch_palette", "(", "running_machine", "*", "machine", ")", "{", "int", "i", ";", "const", "UINT8", "*", "color_prom", "=", "pacland_color_prom", "+", "256", "*", "palette_bank", ";", "for", "(", "i", "=", "0", ";", "i", "<", "256", ";", "i", "++", ")", "{", "int", "bit0", ",", "bit1", ",", "bit2", ",", "bit3", ";", "int", "r", ",", "g", ",", "b", ";", "bit0", "=", "(", "color_prom", "[", "0", "]", ">>", "0", ")", "&", "0x01", ";", "bit1", "=", "(", "color_prom", "[", "0", "]", ">>", "1", ")", "&", "0x01", ";", "bit2", "=", "(", "color_prom", "[", "0", "]", ">>", "2", ")", "&", "0x01", ";", "bit3", "=", "(", "color_prom", "[", "0", "]", ">>", "3", ")", "&", "0x01", ";", "r", "=", "0x0e", "*", "bit0", "+", "0x1f", "*", "bit1", "+", "0x43", "*", "bit2", "+", "0x8f", "*", "bit3", ";", "bit0", "=", "(", "color_prom", "[", "0", "]", ">>", "4", ")", "&", "0x01", ";", "bit1", "=", "(", "color_prom", "[", "0", "]", ">>", "5", ")", "&", "0x01", ";", "bit2", "=", "(", "color_prom", "[", "0", "]", ">>", "6", ")", "&", "0x01", ";", "bit3", "=", "(", "color_prom", "[", "0", "]", ">>", "7", ")", "&", "0x01", ";", "g", "=", "0x0e", "*", "bit0", "+", "0x1f", "*", "bit1", "+", "0x43", "*", "bit2", "+", "0x8f", "*", "bit3", ";", "bit0", "=", "(", "color_prom", "[", "1024", "]", ">>", "0", ")", "&", "0x01", ";", "bit1", "=", "(", "color_prom", "[", "1024", "]", ">>", "1", ")", "&", "0x01", ";", "bit2", "=", "(", "color_prom", "[", "1024", "]", ">>", "2", ")", "&", "0x01", ";", "bit3", "=", "(", "color_prom", "[", "1024", "]", ">>", "3", ")", "&", "0x01", ";", "b", "=", "0x0e", "*", "bit0", "+", "0x1f", "*", "bit1", "+", "0x43", "*", "bit2", "+", "0x8f", "*", "bit3", ";", "color_prom", "++", ";", "colortable_palette_set_color", "(", "machine", "->", "colortable", ",", "i", ",", "MAKE_RGB", "(", "r", ",", "g", ",", "b", ")", ")", ";", "}", "}" ]
Convert the color PROMs.
[ "Convert", "the", "color", "PROMs", "." ]
[]
[ { "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": [] }
7edd4cf5460bcd0dc84060313c2dbd7c19a9077f
lofunz/mieme
Reloaded/trunk/src/mame/video/pacland.c
[ "Unlicense" ]
C
draw_sprites
void
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int whichmask) { UINT8 *spriteram = pacland_spriteram + 0x780; UINT8 *spriteram_2 = spriteram + 0x800; UINT8 *spriteram_3 = spriteram_2 + 0x800; int offs; for (offs = 0;offs < 0x80;offs += 2) { static const int gfx_offs[2][2] = { { 0, 1 }, { 2, 3 } }; int sprite = spriteram[offs] + ((spriteram_3[offs] & 0x80) << 1); int color = spriteram[offs+1] & 0x3f; int sx = (spriteram_2[offs+1]) + 0x100*(spriteram_3[offs+1] & 1) - 47; int sy = 256 - spriteram_2[offs] + 9; int flipx = (spriteram_3[offs] & 0x01); int flipy = (spriteram_3[offs] & 0x02) >> 1; int sizex = (spriteram_3[offs] & 0x04) >> 2; int sizey = (spriteram_3[offs] & 0x08) >> 3; int x,y; sprite &= ~sizex; sprite &= ~(sizey << 1); if (flip_screen_get(machine)) { flipx ^= 1; flipy ^= 1; } sy -= 16 * sizey; sy = (sy & 0xff) - 32; // fix wraparound for (y = 0;y <= sizey;y++) { for (x = 0;x <= sizex;x++) { if (whichmask != 0) drawgfx_transmask(bitmap,cliprect,machine->gfx[2], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], color, flipx,flipy, sx + 16*x,sy + 16*y,transmask[whichmask][color]); else pdrawgfx_transmask(bitmap,cliprect,machine->gfx[2], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], color, flipx,flipy, sx + 16*x,sy + 16*y, machine->priority_bitmap,0,transmask[whichmask][color]); } } } }
/* the sprite generator IC is the same as Mappy */
the sprite generator IC is the same as Mappy
[ "the", "sprite", "generator", "IC", "is", "the", "same", "as", "Mappy" ]
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int whichmask) { UINT8 *spriteram = pacland_spriteram + 0x780; UINT8 *spriteram_2 = spriteram + 0x800; UINT8 *spriteram_3 = spriteram_2 + 0x800; int offs; for (offs = 0;offs < 0x80;offs += 2) { static const int gfx_offs[2][2] = { { 0, 1 }, { 2, 3 } }; int sprite = spriteram[offs] + ((spriteram_3[offs] & 0x80) << 1); int color = spriteram[offs+1] & 0x3f; int sx = (spriteram_2[offs+1]) + 0x100*(spriteram_3[offs+1] & 1) - 47; int sy = 256 - spriteram_2[offs] + 9; int flipx = (spriteram_3[offs] & 0x01); int flipy = (spriteram_3[offs] & 0x02) >> 1; int sizex = (spriteram_3[offs] & 0x04) >> 2; int sizey = (spriteram_3[offs] & 0x08) >> 3; int x,y; sprite &= ~sizex; sprite &= ~(sizey << 1); if (flip_screen_get(machine)) { flipx ^= 1; flipy ^= 1; } sy -= 16 * sizey; sy = (sy & 0xff) - 32; for (y = 0;y <= sizey;y++) { for (x = 0;x <= sizex;x++) { if (whichmask != 0) drawgfx_transmask(bitmap,cliprect,machine->gfx[2], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], color, flipx,flipy, sx + 16*x,sy + 16*y,transmask[whichmask][color]); else pdrawgfx_transmask(bitmap,cliprect,machine->gfx[2], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], color, flipx,flipy, sx + 16*x,sy + 16*y, machine->priority_bitmap,0,transmask[whichmask][color]); } } } }
[ "static", "void", "draw_sprites", "(", "running_machine", "*", "machine", ",", "bitmap_t", "*", "bitmap", ",", "const", "rectangle", "*", "cliprect", ",", "int", "whichmask", ")", "{", "UINT8", "*", "spriteram", "=", "pacland_spriteram", "+", "0x780", ";", "UINT8", "*", "spriteram_2", "=", "spriteram", "+", "0x800", ";", "UINT8", "*", "spriteram_3", "=", "spriteram_2", "+", "0x800", ";", "int", "offs", ";", "for", "(", "offs", "=", "0", ";", "offs", "<", "0x80", ";", "offs", "+=", "2", ")", "{", "static", "const", "int", "gfx_offs", "[", "2", "]", "[", "2", "]", "=", "{", "{", "0", ",", "1", "}", ",", "{", "2", ",", "3", "}", "}", ";", "int", "sprite", "=", "spriteram", "[", "offs", "]", "+", "(", "(", "spriteram_3", "[", "offs", "]", "&", "0x80", ")", "<<", "1", ")", ";", "int", "color", "=", "spriteram", "[", "offs", "+", "1", "]", "&", "0x3f", ";", "int", "sx", "=", "(", "spriteram_2", "[", "offs", "+", "1", "]", ")", "+", "0x100", "*", "(", "spriteram_3", "[", "offs", "+", "1", "]", "&", "1", ")", "-", "47", ";", "int", "sy", "=", "256", "-", "spriteram_2", "[", "offs", "]", "+", "9", ";", "int", "flipx", "=", "(", "spriteram_3", "[", "offs", "]", "&", "0x01", ")", ";", "int", "flipy", "=", "(", "spriteram_3", "[", "offs", "]", "&", "0x02", ")", ">>", "1", ";", "int", "sizex", "=", "(", "spriteram_3", "[", "offs", "]", "&", "0x04", ")", ">>", "2", ";", "int", "sizey", "=", "(", "spriteram_3", "[", "offs", "]", "&", "0x08", ")", ">>", "3", ";", "int", "x", ",", "y", ";", "sprite", "&=", "~", "sizex", ";", "sprite", "&=", "~", "(", "sizey", "<<", "1", ")", ";", "if", "(", "flip_screen_get", "(", "machine", ")", ")", "{", "flipx", "^=", "1", ";", "flipy", "^=", "1", ";", "}", "sy", "-=", "16", "*", "sizey", ";", "sy", "=", "(", "sy", "&", "0xff", ")", "-", "32", ";", "for", "(", "y", "=", "0", ";", "y", "<=", "sizey", ";", "y", "++", ")", "{", "for", "(", "x", "=", "0", ";", "x", "<=", "sizex", ";", "x", "++", ")", "{", "if", "(", "whichmask", "!=", "0", ")", "drawgfx_transmask", "(", "bitmap", ",", "cliprect", ",", "machine", "->", "gfx", "[", "2", "]", ",", "sprite", "+", "gfx_offs", "[", "y", "^", "(", "sizey", "*", "flipy", ")", "]", "[", "x", "^", "(", "sizex", "*", "flipx", ")", "]", ",", "color", ",", "flipx", ",", "flipy", ",", "sx", "+", "16", "*", "x", ",", "sy", "+", "16", "*", "y", ",", "transmask", "[", "whichmask", "]", "[", "color", "]", ")", ";", "else", "pdrawgfx_transmask", "(", "bitmap", ",", "cliprect", ",", "machine", "->", "gfx", "[", "2", "]", ",", "sprite", "+", "gfx_offs", "[", "y", "^", "(", "sizey", "*", "flipy", ")", "]", "[", "x", "^", "(", "sizex", "*", "flipx", ")", "]", ",", "color", ",", "flipx", ",", "flipy", ",", "sx", "+", "16", "*", "x", ",", "sy", "+", "16", "*", "y", ",", "machine", "->", "priority_bitmap", ",", "0", ",", "transmask", "[", "whichmask", "]", "[", "color", "]", ")", ";", "}", "}", "}", "}" ]
the sprite generator IC is the same as Mappy
[ "the", "sprite", "generator", "IC", "is", "the", "same", "as", "Mappy" ]
[ "// fix wraparound\r" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "bitmap", "type": "bitmap_t" }, { "param": "cliprect", "type": "rectangle" }, { "param": "whichmask", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bitmap", "type": "bitmap_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cliprect", "type": "rectangle", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whichmask", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3299d0b3a4533cca6eb93d685626004cb29f016c
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/hng64.c
[ "Unlicense" ]
C
draw_sprites
void
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { const gfx_element *gfx; UINT32 *source = hng64_spriteram; UINT32 *finish = hng64_spriteram + 0xb000/4; /* find end of list? */ while( source<finish) { int endlist; endlist=(source[2]&0xffff0000)>>16; if (endlist == 0x07ff) break; source+=8; } // for (int iii = 0; iii < 0x0f; iii++) // mame_printf_debug("%.8x ", hng64_videoregs[iii]) ; // mame_printf_debug("\n") ; finish = hng64_spriteram; /* draw backwards .. */ while( source>finish ) { int xpos, ypos, tileno,chainx,chainy,xflip; int xdrw,ydrw,pal,xinc,yinc,yflip; UINT32 zoomx,zoomy; //float foomX, foomY; source-=8; ypos = (source[0]&0xffff0000)>>16; xpos = (source[0]&0x0000ffff)>>0; tileno=(source[4]&0x00ffffff); chainx=(source[2]&0x000000f0)>>4; chainy=(source[2]&0x0000000f); zoomy = (source[1]&0xffff0000)>>16; zoomx = (source[1]&0x0000ffff)>>0; pal =(source[3]&0x00ff0000)>>16; xflip=(source[4]&0x02000000)>>25; yflip=(source[4]&0x01000000)>>24; if(xpos&0x8000) xpos -=0x10000; if(ypos&0x8000) ypos -=0x10000; // if (!(source[4] == 0x00000000 || source[4] == 0x000000aa)) // mame_printf_debug("unknown : %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x \n", source[0], source[1], source[2], source[3], // source[4], source[5], source[6], source[7]) ; /* Calculate the zoom */ /* First, prevent any possible divide by zero errors */ #if 0 if(!zoomx) zoomx=0x1000; if(!zoomy) zoomy=0x1000; foomX = (float)(0x1000) / (float)zoomx ; foomY = (float)(0x1000) / (float)zoomy ; zoomx = ((int)foomX) << 16 ; zoomy = ((int)foomY) << 16 ; zoomx += (int)((foomX - floor(foomX)) * (float)0x10000) ; zoomy += (int)((foomY - floor(foomY)) * (float)0x10000) ; #endif zoomx = 0x10000; zoomy = 0x10000; if (source[3]&0x00800000) // maybe .. { gfx= machine->gfx[4]; } else { gfx= machine->gfx[5]; tileno>>=1; // Just a big hack to make the top and bottom tiles in the intro not crash (a pal value of 0x70 is bad) // Is there a problem with draw_sprites? Doubtful... if (source[2] == 0x00080000) pal >>=4; } // Accomodate for chaining and flipping if(xflip) { //xinc=-(int)(16.0f*foomX); xinc=-16; xpos-=xinc*chainx; } else { //xinc=(int)(16.0f*foomX); xinc = 16; } if(yflip) { //yinc=-(int)(16.0f*foomY); yinc = -16; ypos-=yinc*chainy; } else { yinc = 16; //yinc=(int)(16.0f*foomY); } // if (((source[2] & 0xffff0000) >> 16) == 0x0001) // { // usrintf_showmessage("T %.8x %.8x %.8x %.8x %.8x", source[0], source[1], source[2], source[3], source[4]) ; // // usrintf_showmessage("T %.8x %.8x %.8x %.8x %.8x", source[0], source[1], source[2], source[3], source[4]) ; // } for(ydrw=0;ydrw<=chainy;ydrw++) { for(xdrw=0;xdrw<=chainx;xdrw++) { drawgfxzoom_transpen(bitmap,cliprect,gfx,tileno,pal,xflip,yflip,xpos+(xinc*xdrw),ypos+(yinc*ydrw),zoomx,zoomy/*0x10000*/,0); tileno++; } } } }
/* xxxx---- | I think this part of UINT32 2 is interesting as more than just a list end marker (AJG) */
xxxx---- | I think this part of UINT32 2 is interesting as more than just a list end marker (AJG)
[ "xxxx", "----", "|", "I", "think", "this", "part", "of", "UINT32", "2", "is", "interesting", "as", "more", "than", "just", "a", "list", "end", "marker", "(", "AJG", ")" ]
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { const gfx_element *gfx; UINT32 *source = hng64_spriteram; UINT32 *finish = hng64_spriteram + 0xb000/4; while( source<finish) { int endlist; endlist=(source[2]&0xffff0000)>>16; if (endlist == 0x07ff) break; source+=8; } finish = hng64_spriteram; while( source>finish ) { int xpos, ypos, tileno,chainx,chainy,xflip; int xdrw,ydrw,pal,xinc,yinc,yflip; UINT32 zoomx,zoomy; source-=8; ypos = (source[0]&0xffff0000)>>16; xpos = (source[0]&0x0000ffff)>>0; tileno=(source[4]&0x00ffffff); chainx=(source[2]&0x000000f0)>>4; chainy=(source[2]&0x0000000f); zoomy = (source[1]&0xffff0000)>>16; zoomx = (source[1]&0x0000ffff)>>0; pal =(source[3]&0x00ff0000)>>16; xflip=(source[4]&0x02000000)>>25; yflip=(source[4]&0x01000000)>>24; if(xpos&0x8000) xpos -=0x10000; if(ypos&0x8000) ypos -=0x10000; #if 0 if(!zoomx) zoomx=0x1000; if(!zoomy) zoomy=0x1000; foomX = (float)(0x1000) / (float)zoomx ; foomY = (float)(0x1000) / (float)zoomy ; zoomx = ((int)foomX) << 16 ; zoomy = ((int)foomY) << 16 ; zoomx += (int)((foomX - floor(foomX)) * (float)0x10000) ; zoomy += (int)((foomY - floor(foomY)) * (float)0x10000) ; #endif zoomx = 0x10000; zoomy = 0x10000; if (source[3]&0x00800000) { gfx= machine->gfx[4]; } else { gfx= machine->gfx[5]; tileno>>=1; if (source[2] == 0x00080000) pal >>=4; } if(xflip) { xinc=-16; xpos-=xinc*chainx; } else { xinc = 16; } if(yflip) { yinc = -16; ypos-=yinc*chainy; } else { yinc = 16; } for(ydrw=0;ydrw<=chainy;ydrw++) { for(xdrw=0;xdrw<=chainx;xdrw++) { drawgfxzoom_transpen(bitmap,cliprect,gfx,tileno,pal,xflip,yflip,xpos+(xinc*xdrw),ypos+(yinc*ydrw),zoomx,zoomy,0); tileno++; } } } }
[ "static", "void", "draw_sprites", "(", "running_machine", "*", "machine", ",", "bitmap_t", "*", "bitmap", ",", "const", "rectangle", "*", "cliprect", ")", "{", "const", "gfx_element", "*", "gfx", ";", "UINT32", "*", "source", "=", "hng64_spriteram", ";", "UINT32", "*", "finish", "=", "hng64_spriteram", "+", "0xb000", "/", "4", ";", "while", "(", "source", "<", "finish", ")", "{", "int", "endlist", ";", "endlist", "=", "(", "source", "[", "2", "]", "&", "0xffff0000", ")", ">>", "16", ";", "if", "(", "endlist", "==", "0x07ff", ")", "break", ";", "source", "+=", "8", ";", "}", "finish", "=", "hng64_spriteram", ";", "while", "(", "source", ">", "finish", ")", "{", "int", "xpos", ",", "ypos", ",", "tileno", ",", "chainx", ",", "chainy", ",", "xflip", ";", "int", "xdrw", ",", "ydrw", ",", "pal", ",", "xinc", ",", "yinc", ",", "yflip", ";", "UINT32", "zoomx", ",", "zoomy", ";", "source", "-=", "8", ";", "ypos", "=", "(", "source", "[", "0", "]", "&", "0xffff0000", ")", ">>", "16", ";", "xpos", "=", "(", "source", "[", "0", "]", "&", "0x0000ffff", ")", ">>", "0", ";", "tileno", "=", "(", "source", "[", "4", "]", "&", "0x00ffffff", ")", ";", "chainx", "=", "(", "source", "[", "2", "]", "&", "0x000000f0", ")", ">>", "4", ";", "chainy", "=", "(", "source", "[", "2", "]", "&", "0x0000000f", ")", ";", "zoomy", "=", "(", "source", "[", "1", "]", "&", "0xffff0000", ")", ">>", "16", ";", "zoomx", "=", "(", "source", "[", "1", "]", "&", "0x0000ffff", ")", ">>", "0", ";", "pal", "=", "(", "source", "[", "3", "]", "&", "0x00ff0000", ")", ">>", "16", ";", "xflip", "=", "(", "source", "[", "4", "]", "&", "0x02000000", ")", ">>", "25", ";", "yflip", "=", "(", "source", "[", "4", "]", "&", "0x01000000", ")", ">>", "24", ";", "if", "(", "xpos", "&", "0x8000", ")", "xpos", "-=", "0x10000", ";", "if", "(", "ypos", "&", "0x8000", ")", "ypos", "-=", "0x10000", ";", "#if", "0", "\n", "if", "(", "!", "zoomx", ")", "zoomx", "=", "0x1000", ";", "if", "(", "!", "zoomy", ")", "zoomy", "=", "0x1000", ";", "foomX", "=", "(", "float", ")", "(", "0x1000", ")", "/", "(", "float", ")", "zoomx", ";", "foomY", "=", "(", "float", ")", "(", "0x1000", ")", "/", "(", "float", ")", "zoomy", ";", "zoomx", "=", "(", "(", "int", ")", "foomX", ")", "<<", "16", ";", "zoomy", "=", "(", "(", "int", ")", "foomY", ")", "<<", "16", ";", "zoomx", "+=", "(", "int", ")", "(", "(", "foomX", "-", "floor", "(", "foomX", ")", ")", "*", "(", "float", ")", "0x10000", ")", ";", "zoomy", "+=", "(", "int", ")", "(", "(", "foomY", "-", "floor", "(", "foomY", ")", ")", "*", "(", "float", ")", "0x10000", ")", ";", "#endif", "zoomx", "=", "0x10000", ";", "zoomy", "=", "0x10000", ";", "if", "(", "source", "[", "3", "]", "&", "0x00800000", ")", "{", "gfx", "=", "machine", "->", "gfx", "[", "4", "]", ";", "}", "else", "{", "gfx", "=", "machine", "->", "gfx", "[", "5", "]", ";", "tileno", ">>=", "1", ";", "if", "(", "source", "[", "2", "]", "==", "0x00080000", ")", "pal", ">>=", "4", ";", "}", "if", "(", "xflip", ")", "{", "xinc", "=", "-16", ";", "xpos", "-=", "xinc", "*", "chainx", ";", "}", "else", "{", "xinc", "=", "16", ";", "}", "if", "(", "yflip", ")", "{", "yinc", "=", "-16", ";", "ypos", "-=", "yinc", "*", "chainy", ";", "}", "else", "{", "yinc", "=", "16", ";", "}", "for", "(", "ydrw", "=", "0", ";", "ydrw", "<=", "chainy", ";", "ydrw", "++", ")", "{", "for", "(", "xdrw", "=", "0", ";", "xdrw", "<=", "chainx", ";", "xdrw", "++", ")", "{", "drawgfxzoom_transpen", "(", "bitmap", ",", "cliprect", ",", "gfx", ",", "tileno", ",", "pal", ",", "xflip", ",", "yflip", ",", "xpos", "+", "(", "xinc", "*", "xdrw", ")", ",", "ypos", "+", "(", "yinc", "*", "ydrw", ")", ",", "zoomx", ",", "zoomy", ",", "0", ")", ";", "tileno", "++", ";", "}", "}", "}", "}" ]
xxxx---- | I think this part of UINT32 2 is interesting as more than just a list end marker (AJG)
[ "xxxx", "----", "|", "I", "think", "this", "part", "of", "UINT32", "2", "is", "interesting", "as", "more", "than", "just", "a", "list", "end", "marker", "(", "AJG", ")" ]
[ "/* find end of list? */", "// for (int iii = 0; iii < 0x0f; iii++)", "// mame_printf_debug(\"%.8x \", hng64_videoregs[iii]) ;", "// mame_printf_debug(\"\\n\") ;", "/* draw backwards .. */", "//float foomX, foomY;", "// if (!(source[4] == 0x00000000 || source[4] == 0x000000aa))", "// mame_printf_debug(\"unknown : %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x \\n\", source[0], source[1], source[2], source[3],", "// source[4], source[5], source[6], source[7]) ;", "/* Calculate the zoom */", "/* First, prevent any possible divide by zero errors */", "// maybe ..", "// Just a big hack to make the top and bottom tiles in the intro not crash (a pal value of 0x70 is bad)", "// Is there a problem with draw_sprites? Doubtful...", "// Accomodate for chaining and flipping", "//xinc=-(int)(16.0f*foomX);", "//xinc=(int)(16.0f*foomX);", "//yinc=-(int)(16.0f*foomY);", "//yinc=(int)(16.0f*foomY);", "// if (((source[2] & 0xffff0000) >> 16) == 0x0001)", "// {", "// usrintf_showmessage(\"T %.8x %.8x %.8x %.8x %.8x\", source[0], source[1], source[2], source[3], source[4]) ;", "// // usrintf_showmessage(\"T %.8x %.8x %.8x %.8x %.8x\", source[0], source[1], source[2], source[3], source[4]) ;", "// }", "/*0x10000*/" ]
[ { "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": [] }
3299d0b3a4533cca6eb93d685626004cb29f016c
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/video/hng64.c
[ "Unlicense" ]
C
transition_control
void
static void transition_control(bitmap_t *bitmap, const rectangle *cliprect) { int i, j ; // float colorScaleR, colorScaleG, colorScaleB ; // float finR, finG, finB ; INT32 finR, finG, finB ; INT32 darkR, darkG, darkB ; INT32 brigR, brigG, brigB ; // If either of the fading memory regions is non-zero... if (hng64_tcram[0x00000007] != 0x00000000 || hng64_tcram[0x0000000a] != 0x00000000) { darkR = (INT32)( hng64_tcram[0x00000007] & 0xff) ; darkG = (INT32)((hng64_tcram[0x00000007] >> 8) & 0xff) ; darkB = (INT32)((hng64_tcram[0x00000007] >> 16) & 0xff) ; brigR = (INT32)( hng64_tcram[0x0000000a] & 0xff) ; brigG = (INT32)((hng64_tcram[0x0000000a] >> 8) & 0xff) ; brigB = (INT32)((hng64_tcram[0x0000000a] >> 16) & 0xff) ; for (i = cliprect->min_x; i < cliprect->max_x; i++) { for (j = cliprect->min_y; j < cliprect->max_y; j++) { UINT32* thePixel = BITMAP_ADDR32(bitmap, j, i); finR = (INT32)RGB_RED(*thePixel) ; finG = (INT32)RGB_GREEN(*thePixel) ; finB = (INT32)RGB_BLUE(*thePixel) ; /* // Apply the darkening pass (0x07)... colorScaleR = 1.0f - (float)( hng64_tcram[0x00000007] & 0xff) / 255.0f ; colorScaleG = 1.0f - (float)((hng64_tcram[0x00000007] >> 8) & 0xff) / 255.0f ; colorScaleB = 1.0f - (float)((hng64_tcram[0x00000007] >> 16) & 0xff) / 255.0f ; finR = ((float)RGB_RED(*thePixel) * colorScaleR) ; finG = ((float)RGB_GREEN(*thePixel) * colorScaleG) ; finB = ((float)RGB_BLUE(*thePixel) * colorScaleB) ; // Apply the lightening pass (0x0a)... colorScaleR = 1.0f + (float)( hng64_tcram[0x0000000a] & 0xff) / 255.0f ; colorScaleG = 1.0f + (float)((hng64_tcram[0x0000000a] >> 8) & 0xff) / 255.0f ; colorScaleB = 1.0f + (float)((hng64_tcram[0x0000000a] >> 16) & 0xff) / 255.0f ; finR *= colorScaleR ; finG *= colorScaleG ; finB *= colorScaleB ; // Clamp if (finR > 255.0f) finR = 255.0f ; if (finG > 255.0f) finG = 255.0f ; if (finB > 255.0f) finB = 255.0f ; */ // Subtractive fading if (hng64_tcram[0x00000007] != 0x00000000) { finR -= darkR ; finG -= darkG ; finB -= darkB ; } // Additive fading if (hng64_tcram[0x0000000a] != 0x00000000) { finR += brigR ; finG += brigG ; finB += brigB ; } // Clamp the high end if (finR > 255) finR = 255 ; if (finG > 255) finG = 255 ; if (finB > 255) finB = 255 ; // Clamp the low end if (finR < 0) finR = 0 ; if (finG < 0) finG = 0 ; if (finB < 0) finB = 0 ; *thePixel = MAKE_ARGB(255, (UINT8)finR, (UINT8)finG, (UINT8)finB) ; } } } }
/* Transition_Control Memory Region Map * ------------------------------ * * UINT32 | Bytes | Use * -------+-76543210-+---------- * 0 | | * 1 | | * 2 | | * 3 | | * 4 | | * 5 | | * 6 | --xxxxxx | I popped into Buriki and saw some of these values changing to the same as 7. hmmmm... * 7 | --xxxxxx | Almost certainly RGB darkening * 8 | | * 9 | | * 10 | --xxxxxx | Almost certainly RGB brightening * 11 | xxxxxxxx | Unknown - looks like an ARGB value - it seems to change when the scene changes * 12 | | * 13 | | * 14 | | * 15 | | * * Various bits change depending on what is happening in the scene. * These bits may set which 'layer' is affected by the blending. * Or maybe they adjust the scale of the lightening and darkening... * Or maybe it switches from fading by scaling to fading using absolute addition and subtraction... * Or maybe they set transition type (there seems to be a cute scaling-squares transition in there somewhere)... */
Transition_Control Memory Region Map Various bits change depending on what is happening in the scene. These bits may set which 'layer' is affected by the blending. Or maybe they adjust the scale of the lightening and darkening Or maybe it switches from fading by scaling to fading using absolute addition and subtraction Or maybe they set transition type (there seems to be a cute scaling-squares transition in there somewhere)
[ "Transition_Control", "Memory", "Region", "Map", "Various", "bits", "change", "depending", "on", "what", "is", "happening", "in", "the", "scene", ".", "These", "bits", "may", "set", "which", "'", "layer", "'", "is", "affected", "by", "the", "blending", ".", "Or", "maybe", "they", "adjust", "the", "scale", "of", "the", "lightening", "and", "darkening", "Or", "maybe", "it", "switches", "from", "fading", "by", "scaling", "to", "fading", "using", "absolute", "addition", "and", "subtraction", "Or", "maybe", "they", "set", "transition", "type", "(", "there", "seems", "to", "be", "a", "cute", "scaling", "-", "squares", "transition", "in", "there", "somewhere", ")" ]
static void transition_control(bitmap_t *bitmap, const rectangle *cliprect) { int i, j ; INT32 finR, finG, finB ; INT32 darkR, darkG, darkB ; INT32 brigR, brigG, brigB ; if (hng64_tcram[0x00000007] != 0x00000000 || hng64_tcram[0x0000000a] != 0x00000000) { darkR = (INT32)( hng64_tcram[0x00000007] & 0xff) ; darkG = (INT32)((hng64_tcram[0x00000007] >> 8) & 0xff) ; darkB = (INT32)((hng64_tcram[0x00000007] >> 16) & 0xff) ; brigR = (INT32)( hng64_tcram[0x0000000a] & 0xff) ; brigG = (INT32)((hng64_tcram[0x0000000a] >> 8) & 0xff) ; brigB = (INT32)((hng64_tcram[0x0000000a] >> 16) & 0xff) ; for (i = cliprect->min_x; i < cliprect->max_x; i++) { for (j = cliprect->min_y; j < cliprect->max_y; j++) { UINT32* thePixel = BITMAP_ADDR32(bitmap, j, i); finR = (INT32)RGB_RED(*thePixel) ; finG = (INT32)RGB_GREEN(*thePixel) ; finB = (INT32)RGB_BLUE(*thePixel) ; if (hng64_tcram[0x00000007] != 0x00000000) { finR -= darkR ; finG -= darkG ; finB -= darkB ; } if (hng64_tcram[0x0000000a] != 0x00000000) { finR += brigR ; finG += brigG ; finB += brigB ; } if (finR > 255) finR = 255 ; if (finG > 255) finG = 255 ; if (finB > 255) finB = 255 ; if (finR < 0) finR = 0 ; if (finG < 0) finG = 0 ; if (finB < 0) finB = 0 ; *thePixel = MAKE_ARGB(255, (UINT8)finR, (UINT8)finG, (UINT8)finB) ; } } } }
[ "static", "void", "transition_control", "(", "bitmap_t", "*", "bitmap", ",", "const", "rectangle", "*", "cliprect", ")", "{", "int", "i", ",", "j", ";", "INT32", "finR", ",", "finG", ",", "finB", ";", "INT32", "darkR", ",", "darkG", ",", "darkB", ";", "INT32", "brigR", ",", "brigG", ",", "brigB", ";", "if", "(", "hng64_tcram", "[", "0x00000007", "]", "!=", "0x00000000", "||", "hng64_tcram", "[", "0x0000000a", "]", "!=", "0x00000000", ")", "{", "darkR", "=", "(", "INT32", ")", "(", "hng64_tcram", "[", "0x00000007", "]", "&", "0xff", ")", ";", "darkG", "=", "(", "INT32", ")", "(", "(", "hng64_tcram", "[", "0x00000007", "]", ">>", "8", ")", "&", "0xff", ")", ";", "darkB", "=", "(", "INT32", ")", "(", "(", "hng64_tcram", "[", "0x00000007", "]", ">>", "16", ")", "&", "0xff", ")", ";", "brigR", "=", "(", "INT32", ")", "(", "hng64_tcram", "[", "0x0000000a", "]", "&", "0xff", ")", ";", "brigG", "=", "(", "INT32", ")", "(", "(", "hng64_tcram", "[", "0x0000000a", "]", ">>", "8", ")", "&", "0xff", ")", ";", "brigB", "=", "(", "INT32", ")", "(", "(", "hng64_tcram", "[", "0x0000000a", "]", ">>", "16", ")", "&", "0xff", ")", ";", "for", "(", "i", "=", "cliprect", "->", "min_x", ";", "i", "<", "cliprect", "->", "max_x", ";", "i", "++", ")", "{", "for", "(", "j", "=", "cliprect", "->", "min_y", ";", "j", "<", "cliprect", "->", "max_y", ";", "j", "++", ")", "{", "UINT32", "*", "thePixel", "=", "BITMAP_ADDR32", "(", "bitmap", ",", "j", ",", "i", ")", ";", "finR", "=", "(", "INT32", ")", "RGB_RED", "(", "*", "thePixel", ")", ";", "finG", "=", "(", "INT32", ")", "RGB_GREEN", "(", "*", "thePixel", ")", ";", "finB", "=", "(", "INT32", ")", "RGB_BLUE", "(", "*", "thePixel", ")", ";", "if", "(", "hng64_tcram", "[", "0x00000007", "]", "!=", "0x00000000", ")", "{", "finR", "-=", "darkR", ";", "finG", "-=", "darkG", ";", "finB", "-=", "darkB", ";", "}", "if", "(", "hng64_tcram", "[", "0x0000000a", "]", "!=", "0x00000000", ")", "{", "finR", "+=", "brigR", ";", "finG", "+=", "brigG", ";", "finB", "+=", "brigB", ";", "}", "if", "(", "finR", ">", "255", ")", "finR", "=", "255", ";", "if", "(", "finG", ">", "255", ")", "finG", "=", "255", ";", "if", "(", "finB", ">", "255", ")", "finB", "=", "255", ";", "if", "(", "finR", "<", "0", ")", "finR", "=", "0", ";", "if", "(", "finG", "<", "0", ")", "finG", "=", "0", ";", "if", "(", "finB", "<", "0", ")", "finB", "=", "0", ";", "*", "thePixel", "=", "MAKE_ARGB", "(", "255", ",", "(", "UINT8", ")", "finR", ",", "(", "UINT8", ")", "finG", ",", "(", "UINT8", ")", "finB", ")", ";", "}", "}", "}", "}" ]
Transition_Control Memory Region Map
[ "Transition_Control", "Memory", "Region", "Map" ]
[ "// float colorScaleR, colorScaleG, colorScaleB ;", "// float finR, finG, finB ;", "// If either of the fading memory regions is non-zero...", "/*\n // Apply the darkening pass (0x07)...\n colorScaleR = 1.0f - (float)( hng64_tcram[0x00000007] & 0xff) / 255.0f ;\n colorScaleG = 1.0f - (float)((hng64_tcram[0x00000007] >> 8) & 0xff) / 255.0f ;\n colorScaleB = 1.0f - (float)((hng64_tcram[0x00000007] >> 16) & 0xff) / 255.0f ;\n\n finR = ((float)RGB_RED(*thePixel) * colorScaleR) ;\n finG = ((float)RGB_GREEN(*thePixel) * colorScaleG) ;\n finB = ((float)RGB_BLUE(*thePixel) * colorScaleB) ;\n\n\n // Apply the lightening pass (0x0a)...\n colorScaleR = 1.0f + (float)( hng64_tcram[0x0000000a] & 0xff) / 255.0f ;\n colorScaleG = 1.0f + (float)((hng64_tcram[0x0000000a] >> 8) & 0xff) / 255.0f ;\n colorScaleB = 1.0f + (float)((hng64_tcram[0x0000000a] >> 16) & 0xff) / 255.0f ;\n\n finR *= colorScaleR ;\n finG *= colorScaleG ;\n finB *= colorScaleB ;\n\n\n // Clamp\n if (finR > 255.0f) finR = 255.0f ;\n if (finG > 255.0f) finG = 255.0f ;\n if (finB > 255.0f) finB = 255.0f ;\n */", "// Subtractive fading", "// Additive fading", "// Clamp the high end", "// Clamp the low end" ]
[ { "param": "bitmap", "type": "bitmap_t" }, { "param": "cliprect", "type": "rectangle" } ]
{ "returns": [], "raises": [], "params": [ { "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": [] }
9f140e3a8f65f2ee11782deb2ab437d01209d881
lofunz/mieme
Reloaded/trunk/src/mame/drivers/tnzs.c
[ "Unlicense" ]
C
irqhandler
void
static void irqhandler( running_device *device, int irq ) { tnzs_state *state = device->machine->driver_data<tnzs_state>(); cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE); }
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
handler called by the 2203 emulator when the internal timers cause an IRQ
[ "handler", "called", "by", "the", "2203", "emulator", "when", "the", "internal", "timers", "cause", "an", "IRQ" ]
static void irqhandler( running_device *device, int irq ) { tnzs_state *state = device->machine->driver_data<tnzs_state>(); cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE); }
[ "static", "void", "irqhandler", "(", "running_device", "*", "device", ",", "int", "irq", ")", "{", "tnzs_state", "*", "state", "=", "device", "->", "machine", "->", "driver_data", "<", "tnzs_state", ">", "(", "", ")", ";", "cpu_set_input_line", "(", "state", "->", "audiocpu", ",", "INPUT_LINE_NMI", ",", "irq", "?", "ASSERT_LINE", ":", "CLEAR_LINE", ")", ";", "}" ]
handler called by the 2203 emulator when the internal timers cause an IRQ
[ "handler", "called", "by", "the", "2203", "emulator", "when", "the", "internal", "timers", "cause", "an", "IRQ" ]
[]
[ { "param": "device", "type": "running_device" }, { "param": "irq", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "running_device", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "irq", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
13bed2a727d63a65fcc03f7849ee0844fb52ac6d
lofunz/mieme
Reloaded/trunk/src/mame/drivers/deco156.c
[ "Unlicense" ]
C
draw_sprites
void
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) { UINT32 *spriteram = machine->generic.spriteram.u32; int offs; flip_screen_set_no_update(machine, 1); for (offs = (0x1400 / 4) - 4; offs >= 0; offs -= 4) // 0x1400 for charlien { int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri; sprite = spriteram[offs + 1] & 0xffff; y = spriteram[offs] & 0xffff; flash = y & 0x1000; if (flash && (machine->primary_screen->frame_number() & 1)) continue; x = spriteram[offs + 2] & 0xffff; colour = (x >> 9) & 0x1f; pri = (x & 0xc000); // 2 bits or 1? switch (pri & 0xc000) { case 0x0000: pri = 0; break; case 0x4000: pri = 0xf0; break; case 0x8000: pri = 0xf0 | 0xcc; break; case 0xc000: pri = 0xf0 | 0xcc; break; /* or 0xf0|0xcc|0xaa ? */ } fx = y & 0x2000; fy = y & 0x4000; multi = (1 << ((y & 0x0600) >> 9)) - 1; /* 1x, 2x, 4x, 8x height */ x = x & 0x01ff; y = y & 0x01ff; if (x >= 320) x -= 512; if (y >= 256) y -= 512; y = 240 - y; x = 304 - x; if (x > 320) continue; sprite &= ~multi; if (fy) inc = -1; else { sprite += multi; inc = 1; } if (flip_screen_x_get(machine)) { y = 240 - y; x = 304 - x; if (fx) fx = 0; else fx = 1; if (fy) fy = 0; else fy = 1; mult = 16; } else mult = -16; while (multi >= 0) { pdrawgfx_transpen(bitmap,cliprect,machine->gfx[2], sprite - multi * inc, colour, fx,fy, x,y + mult * multi, machine->priority_bitmap,pri,0); multi--; } } }
/* spriteram is really 16-bit.. this can be changed to use 16-bit ram like the tilemaps its the same sprite chip Data East used on many, many 16-bit era titles */
spriteram is really 16-bit.. this can be changed to use 16-bit ram like the tilemaps its the same sprite chip Data East used on many, many 16-bit era titles
[ "spriteram", "is", "really", "16", "-", "bit", "..", "this", "can", "be", "changed", "to", "use", "16", "-", "bit", "ram", "like", "the", "tilemaps", "its", "the", "same", "sprite", "chip", "Data", "East", "used", "on", "many", "many", "16", "-", "bit", "era", "titles" ]
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) { UINT32 *spriteram = machine->generic.spriteram.u32; int offs; flip_screen_set_no_update(machine, 1); for (offs = (0x1400 / 4) - 4; offs >= 0; offs -= 4) { int x, y, sprite, colour, multi, fx, fy, inc, flash, mult, pri; sprite = spriteram[offs + 1] & 0xffff; y = spriteram[offs] & 0xffff; flash = y & 0x1000; if (flash && (machine->primary_screen->frame_number() & 1)) continue; x = spriteram[offs + 2] & 0xffff; colour = (x >> 9) & 0x1f; pri = (x & 0xc000); switch (pri & 0xc000) { case 0x0000: pri = 0; break; case 0x4000: pri = 0xf0; break; case 0x8000: pri = 0xf0 | 0xcc; break; case 0xc000: pri = 0xf0 | 0xcc; break; } fx = y & 0x2000; fy = y & 0x4000; multi = (1 << ((y & 0x0600) >> 9)) - 1; x = x & 0x01ff; y = y & 0x01ff; if (x >= 320) x -= 512; if (y >= 256) y -= 512; y = 240 - y; x = 304 - x; if (x > 320) continue; sprite &= ~multi; if (fy) inc = -1; else { sprite += multi; inc = 1; } if (flip_screen_x_get(machine)) { y = 240 - y; x = 304 - x; if (fx) fx = 0; else fx = 1; if (fy) fy = 0; else fy = 1; mult = 16; } else mult = -16; while (multi >= 0) { pdrawgfx_transpen(bitmap,cliprect,machine->gfx[2], sprite - multi * inc, colour, fx,fy, x,y + mult * multi, machine->priority_bitmap,pri,0); multi--; } } }
[ "static", "void", "draw_sprites", "(", "running_machine", "*", "machine", ",", "bitmap_t", "*", "bitmap", ",", "const", "rectangle", "*", "cliprect", ")", "{", "UINT32", "*", "spriteram", "=", "machine", "->", "generic", ".", "spriteram", ".", "u32", ";", "int", "offs", ";", "flip_screen_set_no_update", "(", "machine", ",", "1", ")", ";", "for", "(", "offs", "=", "(", "0x1400", "/", "4", ")", "-", "4", ";", "offs", ">=", "0", ";", "offs", "-=", "4", ")", "{", "int", "x", ",", "y", ",", "sprite", ",", "colour", ",", "multi", ",", "fx", ",", "fy", ",", "inc", ",", "flash", ",", "mult", ",", "pri", ";", "sprite", "=", "spriteram", "[", "offs", "+", "1", "]", "&", "0xffff", ";", "y", "=", "spriteram", "[", "offs", "]", "&", "0xffff", ";", "flash", "=", "y", "&", "0x1000", ";", "if", "(", "flash", "&&", "(", "machine", "->", "primary_screen", "->", "frame_number", "(", ")", "&", "1", ")", ")", "continue", ";", "x", "=", "spriteram", "[", "offs", "+", "2", "]", "&", "0xffff", ";", "colour", "=", "(", "x", ">>", "9", ")", "&", "0x1f", ";", "pri", "=", "(", "x", "&", "0xc000", ")", ";", "switch", "(", "pri", "&", "0xc000", ")", "{", "case", "0x0000", ":", "pri", "=", "0", ";", "break", ";", "case", "0x4000", ":", "pri", "=", "0xf0", ";", "break", ";", "case", "0x8000", ":", "pri", "=", "0xf0", "|", "0xcc", ";", "break", ";", "case", "0xc000", ":", "pri", "=", "0xf0", "|", "0xcc", ";", "break", ";", "}", "fx", "=", "y", "&", "0x2000", ";", "fy", "=", "y", "&", "0x4000", ";", "multi", "=", "(", "1", "<<", "(", "(", "y", "&", "0x0600", ")", ">>", "9", ")", ")", "-", "1", ";", "x", "=", "x", "&", "0x01ff", ";", "y", "=", "y", "&", "0x01ff", ";", "if", "(", "x", ">=", "320", ")", "x", "-=", "512", ";", "if", "(", "y", ">=", "256", ")", "y", "-=", "512", ";", "y", "=", "240", "-", "y", ";", "x", "=", "304", "-", "x", ";", "if", "(", "x", ">", "320", ")", "continue", ";", "sprite", "&=", "~", "multi", ";", "if", "(", "fy", ")", "inc", "=", "-1", ";", "else", "{", "sprite", "+=", "multi", ";", "inc", "=", "1", ";", "}", "if", "(", "flip_screen_x_get", "(", "machine", ")", ")", "{", "y", "=", "240", "-", "y", ";", "x", "=", "304", "-", "x", ";", "if", "(", "fx", ")", "fx", "=", "0", ";", "else", "fx", "=", "1", ";", "if", "(", "fy", ")", "fy", "=", "0", ";", "else", "fy", "=", "1", ";", "mult", "=", "16", ";", "}", "else", "mult", "=", "-16", ";", "while", "(", "multi", ">=", "0", ")", "{", "pdrawgfx_transpen", "(", "bitmap", ",", "cliprect", ",", "machine", "->", "gfx", "[", "2", "]", ",", "sprite", "-", "multi", "*", "inc", ",", "colour", ",", "fx", ",", "fy", ",", "x", ",", "y", "+", "mult", "*", "multi", ",", "machine", "->", "priority_bitmap", ",", "pri", ",", "0", ")", ";", "multi", "--", ";", "}", "}", "}" ]
spriteram is really 16-bit.. this can be changed to use 16-bit ram like the tilemaps its the same sprite chip Data East used on many, many 16-bit era titles
[ "spriteram", "is", "really", "16", "-", "bit", "..", "this", "can", "be", "changed", "to", "use", "16", "-", "bit", "ram", "like", "the", "tilemaps", "its", "the", "same", "sprite", "chip", "Data", "East", "used", "on", "many", "many", "16", "-", "bit", "era", "titles" ]
[ "// 0x1400 for charlien\r", "// 2 bits or 1?\r", "/* or 0xf0|0xcc|0xaa ? */", "/* 1x, 2x, 4x, 8x height */" ]
[ { "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": [] }