summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2011-10-04 12:38:52 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2011-10-04 12:38:52 +0000
commiteea7bacd204b4c1f21e2e58ef90a34e417eafbbe (patch)
tree14d99ef7a19333e1b185021391eac572a723e018 /src/emu
parentb829e84ac6c456cc3949a6d61d80949149f66302 (diff)
Made disassembler view show in octal if cpu core is specified like that, for now address and data values (no whatsnew)
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/debug/debugvw.c7
-rw-r--r--src/emu/debug/debugvw.h2
-rw-r--r--src/emu/debug/dvdisasm.c21
3 files changed, 19 insertions, 11 deletions
diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c
index a0eb13452d2..49f98c44c9c 100644
--- a/src/emu/debug/debugvw.c
+++ b/src/emu/debug/debugvw.c
@@ -62,8 +62,13 @@
debug_view_source::debug_view_source(const char *name, device_t *device)
: m_next(NULL),
m_name(name),
- m_device(device)
+ m_device(device),
+ m_is_octal(false)
{
+ device_execute_interface *intf;
+ if (device->interface(intf))
+ m_is_octal = intf->is_octal();
+
}
diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h
index 2d2bde6c4c5..b77f8eff607 100644
--- a/src/emu/debug/debugvw.h
+++ b/src/emu/debug/debugvw.h
@@ -145,12 +145,14 @@ public:
const char *name() const { return m_name; }
debug_view_source *next() const { return m_next; }
device_t *device() const { return m_device; }
+ bool is_octal() const { return m_is_octal; }
private:
// internal state
debug_view_source * m_next; // link to next item
astring m_name; // name of the source item
device_t * m_device; // associated device (if applicable)
+ bool m_is_octal; // is view in octal or hex
};
diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c
index ccd1616f1e2..ac3a89a8803 100644
--- a/src/emu/debug/dvdisasm.c
+++ b/src/emu/debug/dvdisasm.c
@@ -318,21 +318,21 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs)
void debug_view_disasm::generate_bytes(offs_t pcbyte, int numbytes, int minbytes, char *string, int maxchars, bool encrypted)
{
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
-
+ int char_num = source.is_octal() ? 3 : 2;
// output the first value
int offset = 0;
- if (maxchars >= 2 * minbytes)
- offset = sprintf(string, "%s", core_i64_hex_format(debug_read_opcode(source.m_space, pcbyte, minbytes, FALSE), minbytes * 2));
+ if (maxchars >= char_num * minbytes)
+ offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_space, pcbyte, minbytes, FALSE), minbytes * char_num, source.is_octal()));
// output subsequent values
int byte;
- for (byte = minbytes; byte < numbytes && offset + 1 + 2 * minbytes < maxchars; byte += minbytes)
- offset += sprintf(&string[offset], " %s", core_i64_hex_format(debug_read_opcode(source.m_space, pcbyte + byte, minbytes, encrypted), minbytes * 2));
+ for (byte = minbytes; byte < numbytes && offset + 1 + char_num * minbytes < maxchars; byte += minbytes)
+ offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(source.m_space, pcbyte + byte, minbytes, encrypted), minbytes * char_num, source.is_octal()));
// if we ran out of room, indicate more
string[maxchars - 1] = 0;
- if (byte < numbytes && maxchars > 3)
- string[maxchars - 2] = string[maxchars - 3] = string[maxchars - 4] = '.';
+ if (byte < numbytes && maxchars > (char_num*2 -1))
+ string[maxchars - char_num] = string[maxchars - char_num - 1] = string[maxchars - char_num -2] = '.';
}
@@ -345,9 +345,10 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
{
bool changed = false;
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
+ int char_num = source.is_octal() ? 3 : 2;
// determine how many characters we need for an address and set the divider
- m_divider1 = 1 + source.m_space->logaddrchars() + 1;
+ m_divider1 = 1 + (source.m_space->logaddrchars()/2*char_num) + 1;
// assume a fixed number of characters for the disassembly
m_divider2 = m_divider1 + 1 + m_dasm_width + 1;
@@ -363,7 +364,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED)
{
int maxbytes_clamped = MIN(maxbytes, DASM_MAX_BYTES);
- m_total.x = m_divider2 + 1 + 2 * maxbytes_clamped + (maxbytes_clamped / minbytes - 1) + 1;
+ m_total.x = m_divider2 + 1 + char_num * maxbytes_clamped + (maxbytes_clamped / minbytes - 1) + 1;
}
else if (m_right_column == DASM_RIGHTCOL_COMMENTS)
m_total.x = m_divider2 + 1 + 50; // DEBUG_COMMENT_MAX_LINE_LENGTH
@@ -400,7 +401,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
// convert back and set the address of this instruction
m_byteaddress[instr] = pcbyte;
- sprintf(&destbuf[0], " %s ", core_i64_hex_format(source.m_space->byte_to_address(pcbyte), source.m_space->logaddrchars()));
+ sprintf(&destbuf[0], " %s ", core_i64_format(source.m_space->byte_to_address(pcbyte), source.m_space->logaddrchars()/2*char_num, source.is_octal()));
// make sure we can translate the address, and then disassemble the result
char buffer[100];