QString SpimView::formatMemoryContents(mem_addr from, mem_addr to) { mem_addr i = ROUND_UP(from, BYTES_PER_WORD); QString windowContents = formatPartialQuadWord(i, to); i = ROUND_UP(i, BYTES_PER_LINE); // Next quadword for ( ; i < to; ) { mem_word val; /* Count consecutive zero words */ int j; for (j = 0; (i + (uint32) j * BYTES_PER_WORD) < to; j += 1) { val = read_mem_word(i + (uint32) j * BYTES_PER_WORD); if (val != 0) { break; } } if (j >= 4) { /* Block of 4 or more zero memory words: */ windowContents += QString("[") % formatAddress(i) % QString("]..[") % formatAddress(i + (uint32) j * BYTES_PER_WORD - 1) % QString("]") % nnbsp(2) % QString("00000000<br>"); i = i + (uint32) j * BYTES_PER_WORD; windowContents += formatPartialQuadWord(i, to); i = ROUND_UP(i, BYTES_PER_LINE); // Next quadword } else { /* Fewer than 4 zero words, print them on a single line: */ windowContents += QString("[") % formatAddress(i) % "]" % nnbsp(2); mem_addr j = i; do { val = read_mem_word(i); windowContents += nnbsp(2) % formatWord(val, st_dataSegmentDisplayBase); i += BYTES_PER_WORD; } while ((i % BYTES_PER_LINE) != 0 && i < to); windowContents += nnbsp(2) % formatAsChars(j, i) % QString("<br>"); } } return windowContents; }
void format_mem (str_stream *ss, mem_addr from, mem_addr to) { mem_word val; mem_addr i = ROUND_UP (from, BYTES_PER_WORD); int j; i = format_partial_line (ss, i); for ( ; i < to; ) { /* Count consecutive zero words */ for (j = 0; (i + (uint32) j * BYTES_PER_WORD) < to; j += 1) { val = read_mem_word (i + (uint32) j * BYTES_PER_WORD); if (val != 0) { break; } } if (j >= 4) { /* Block of 4 or more zero memory words: */ ss_printf (ss, "[0x%08x]...[0x%08x] 0x00000000\n", i, i + (uint32) j * BYTES_PER_WORD); i = i + (uint32) j * BYTES_PER_WORD; i = format_partial_line (ss, i); } else { /* Fewer than 4 zero words, print them on a single line: */ ss_printf (ss, "[0x%08x] ", i); do { val = read_mem_word (i); ss_printf (ss, " 0x%08x", (unsigned int)val); i += BYTES_PER_WORD; } while (i % BYTES_PER_LINE != 0); ss_printf (ss, "\n"); } } }
static void nec_interrupt(nec_state_t *nec_state, unsigned int_num, INTSOURCES source) { UINT32 dest_seg, dest_off; i_pushf(nec_state); nec_state->TF = nec_state->IF = 0; if (source == INT_IRQ) /* get vector */ int_num = (*nec_state->irq_callback)(nec_state->device, 0); dest_off = read_mem_word(int_num*4); dest_seg = read_mem_word(int_num*4+2); PUSH(Sreg(PS)); PUSH(nec_state->ip); nec_state->ip = (WORD)dest_off; Sreg(PS) = (WORD)dest_seg; CHANGE_PC; }
void nec_common_device::nec_interrupt(unsigned int_num, int/*INTSOURCES*/ source) { UINT32 dest_seg, dest_off; i_pushf(); m_TF = m_IF = 0; if (source == INT_IRQ) /* get vector */ int_num = (standard_irq_callback)(0); dest_off = read_mem_word(int_num*4); dest_seg = read_mem_word(int_num*4+2); PUSH(Sreg(PS)); PUSH(m_ip); m_ip = (WORD)dest_off; Sreg(PS) = (WORD)dest_seg; CHANGE_PC; }
static mem_addr format_partial_line (str_stream *ss, mem_addr addr) { if ((addr % BYTES_PER_LINE) != 0) { ss_printf (ss, "[0x%08x] ", addr); for (; (addr % BYTES_PER_LINE) != 0; addr += BYTES_PER_WORD) { mem_word val = read_mem_word (addr); ss_printf (ss, " 0x%08x", (unsigned int)val); } ss_printf (ss, "\n"); } return addr; }
QString SpimView::formatPartialQuadWord(mem_addr from, mem_addr to) { QString windowContents = QString(""); if ((from % BYTES_PER_LINE) != 0 && from < to) { windowContents += QString("[") % formatAddress(from) % QString("]") % nnbsp(2); mem_addr a; for (a = from; (a % BYTES_PER_LINE) != 0; a += BYTES_PER_WORD) { mem_word val = read_mem_word(a); windowContents += nnbsp(2) % formatWord(val, st_dataSegmentDisplayBase); } windowContents += formatAsChars(from, a) % QString("<br>"); } return windowContents; }