mirror of
https://github.com/holub/mame
synced 2025-06-05 12:26:35 +03:00
Merge pull request #1036 from ajrhacker/disasm
Consolidate disassemble functions (nw)
This commit is contained in:
commit
09b6b311ff
@ -39,7 +39,7 @@ const size_t debugger_commands::MAX_GLOBALS = 1000;
|
|||||||
|
|
||||||
bool debugger_commands::cheat_address_is_valid(address_space &space, offs_t address)
|
bool debugger_commands::cheat_address_is_valid(address_space &space, offs_t address)
|
||||||
{
|
{
|
||||||
return m_cpu.translate(space, TRANSLATE_READ, &address) && (space.get_write_ptr(address) != nullptr);
|
return space.device().memory().translate(space.spacenum(), TRANSLATE_READ, address) && (space.get_write_ptr(address) != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1727,7 +1727,7 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[])
|
|||||||
if (i + j <= endoffset)
|
if (i + j <= endoffset)
|
||||||
{
|
{
|
||||||
offs_t curaddr = i + j;
|
offs_t curaddr = i + j;
|
||||||
if (m_cpu.translate(*space, TRANSLATE_READ_DEBUG, &curaddr))
|
if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr))
|
||||||
{
|
{
|
||||||
UINT64 value = m_cpu.read_memory(*space, i + j, width, TRUE);
|
UINT64 value = m_cpu.read_memory(*space, i + j, width, TRUE);
|
||||||
util::stream_format(output, " %0*X", width * 2, value);
|
util::stream_format(output, " %0*X", width * 2, value);
|
||||||
@ -1748,7 +1748,7 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[])
|
|||||||
for (UINT64 j = 0; j < 16 && (i + j) <= endoffset; j++)
|
for (UINT64 j = 0; j < 16 && (i + j) <= endoffset; j++)
|
||||||
{
|
{
|
||||||
offs_t curaddr = i + j;
|
offs_t curaddr = i + j;
|
||||||
if (m_cpu.translate(*space, TRANSLATE_READ_DEBUG, &curaddr))
|
if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr))
|
||||||
{
|
{
|
||||||
UINT8 byte = m_cpu.read_byte(*space, i + j, TRUE);
|
UINT8 byte = m_cpu.read_byte(*space, i + j, TRUE);
|
||||||
util::stream_format(output, "%c", (byte >= 32 && byte < 127) ? byte : '.');
|
util::stream_format(output, "%c", (byte >= 32 && byte < 127) ? byte : '.');
|
||||||
@ -2379,7 +2379,7 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[])
|
|||||||
|
|
||||||
/* make sure we can translate the address */
|
/* make sure we can translate the address */
|
||||||
tempaddr = pcbyte;
|
tempaddr = pcbyte;
|
||||||
if (m_cpu.translate(*space, TRANSLATE_FETCH_DEBUG, &tempaddr))
|
if (space->device().memory().translate(space->spacenum(), TRANSLATE_FETCH_DEBUG, tempaddr))
|
||||||
{
|
{
|
||||||
UINT8 opbuf[64], argbuf[64];
|
UINT8 opbuf[64], argbuf[64];
|
||||||
|
|
||||||
@ -2391,7 +2391,7 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* disassemble the result */
|
/* disassemble the result */
|
||||||
i += numbytes = space->device().debug()->disassemble(disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
i += numbytes = dasmintf->disassemble(disasm, offset + i, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print the bytes */
|
/* print the bytes */
|
||||||
@ -2544,7 +2544,12 @@ void debugger_commands::execute_history(int ref, int params, const char *param[]
|
|||||||
|
|
||||||
/* loop over lines */
|
/* loop over lines */
|
||||||
device_disasm_interface *dasmintf;
|
device_disasm_interface *dasmintf;
|
||||||
int maxbytes = space->device().interface(dasmintf) ? dasmintf->max_opcode_bytes() : 1;
|
if (!space->device().interface(dasmintf))
|
||||||
|
{
|
||||||
|
m_console.printf("No disassembler available for %s\n", space->device().name());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int maxbytes = dasmintf->max_opcode_bytes();
|
||||||
for (int index = 0; index < (int) count; index++)
|
for (int index = 0; index < (int) count; index++)
|
||||||
{
|
{
|
||||||
offs_t pc = debug->history_pc(-index);
|
offs_t pc = debug->history_pc(-index);
|
||||||
@ -2559,7 +2564,7 @@ void debugger_commands::execute_history(int ref, int params, const char *param[]
|
|||||||
}
|
}
|
||||||
|
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
debug->disassemble(buffer, pc, opbuf, argbuf);
|
dasmintf->disassemble(buffer, pc, opbuf, argbuf);
|
||||||
|
|
||||||
m_console.printf("%0*X: %s\n", space->logaddrchars(), pc, buffer);
|
m_console.printf("%0*X: %s\n", space->logaddrchars(), pc, buffer);
|
||||||
}
|
}
|
||||||
@ -2761,7 +2766,7 @@ void debugger_commands::execute_map(int ref, int params, const char *param[])
|
|||||||
{
|
{
|
||||||
static const char *const intnames[] = { "Read", "Write", "Fetch" };
|
static const char *const intnames[] = { "Read", "Write", "Fetch" };
|
||||||
taddress = space->address_to_byte(address) & space->bytemask();
|
taddress = space->address_to_byte(address) & space->bytemask();
|
||||||
if (m_cpu.translate(*space, intention, &taddress))
|
if (space->device().memory().translate(space->spacenum(), intention, taddress))
|
||||||
{
|
{
|
||||||
const char *mapname = space->get_handler_string((intention == TRANSLATE_WRITE_DEBUG) ? ROW_WRITE : ROW_READ, taddress);
|
const char *mapname = space->get_handler_string((intention == TRANSLATE_WRITE_DEBUG) ? ROW_WRITE : ROW_READ, taddress);
|
||||||
m_console.printf(
|
m_console.printf(
|
||||||
|
@ -348,24 +348,6 @@ bool debugger_cpu::comment_load(bool is_inline)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
MEMORY AND DISASSEMBLY HELPERS
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
|
||||||
translate - return the physical address
|
|
||||||
corresponding to the given logical address
|
|
||||||
-------------------------------------------------*/
|
|
||||||
|
|
||||||
bool debugger_cpu::translate(address_space &space, int intention, offs_t *address)
|
|
||||||
{
|
|
||||||
device_memory_interface *memory;
|
|
||||||
if (space.device().interface(memory))
|
|
||||||
return memory->translate(space.spacenum(), intention, *address);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
DEBUGGER MEMORY ACCESSORS
|
DEBUGGER MEMORY ACCESSORS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -377,6 +359,8 @@ bool debugger_cpu::translate(address_space &space, int intention, offs_t *addres
|
|||||||
|
|
||||||
UINT8 debugger_cpu::read_byte(address_space &space, offs_t address, int apply_translation)
|
UINT8 debugger_cpu::read_byte(address_space &space, offs_t address, int apply_translation)
|
||||||
{
|
{
|
||||||
|
device_memory_interface &memory = space.device().memory();
|
||||||
|
|
||||||
/* mask against the logical byte mask */
|
/* mask against the logical byte mask */
|
||||||
address &= space.logbytemask();
|
address &= space.logbytemask();
|
||||||
|
|
||||||
@ -387,11 +371,11 @@ UINT8 debugger_cpu::read_byte(address_space &space, offs_t address, int apply_tr
|
|||||||
/* translate if necessary; if not mapped, return 0xff */
|
/* translate if necessary; if not mapped, return 0xff */
|
||||||
UINT64 custom;
|
UINT64 custom;
|
||||||
UINT8 result;
|
UINT8 result;
|
||||||
if (apply_translation && !translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
result = 0xff;
|
result = 0xff;
|
||||||
}
|
}
|
||||||
else if (space.device().memory().read(space.spacenum(), address, 1, custom))
|
else if (memory.read(space.spacenum(), address, 1, custom))
|
||||||
{ /* if there is a custom read handler, and it returns true, use that value */
|
{ /* if there is a custom read handler, and it returns true, use that value */
|
||||||
result = custom;
|
result = custom;
|
||||||
}
|
}
|
||||||
@ -431,6 +415,7 @@ UINT16 debugger_cpu::read_word(address_space &space, offs_t address, int apply_t
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* otherwise, this proceeds like the byte case */
|
{ /* otherwise, this proceeds like the byte case */
|
||||||
|
device_memory_interface &memory = space.device().memory();
|
||||||
|
|
||||||
/* all accesses from this point on are for the debugger */
|
/* all accesses from this point on are for the debugger */
|
||||||
m_debugger_access = true;
|
m_debugger_access = true;
|
||||||
@ -438,11 +423,11 @@ UINT16 debugger_cpu::read_word(address_space &space, offs_t address, int apply_t
|
|||||||
|
|
||||||
/* translate if necessary; if not mapped, return 0xffff */
|
/* translate if necessary; if not mapped, return 0xffff */
|
||||||
UINT64 custom;
|
UINT64 custom;
|
||||||
if (apply_translation && !translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
result = 0xffff;
|
result = 0xffff;
|
||||||
}
|
}
|
||||||
else if (space.device().memory().read(space.spacenum(), address, 2, custom))
|
else if (memory.read(space.spacenum(), address, 2, custom))
|
||||||
{ /* if there is a custom read handler, and it returns true, use that value */
|
{ /* if there is a custom read handler, and it returns true, use that value */
|
||||||
result = custom;
|
result = custom;
|
||||||
}
|
}
|
||||||
@ -484,17 +469,18 @@ UINT32 debugger_cpu::read_dword(address_space &space, offs_t address, int apply_
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* otherwise, this proceeds like the byte case */
|
{ /* otherwise, this proceeds like the byte case */
|
||||||
|
device_memory_interface &memory = space.device().memory();
|
||||||
|
|
||||||
/* all accesses from this point on are for the debugger */
|
/* all accesses from this point on are for the debugger */
|
||||||
m_debugger_access = true;
|
m_debugger_access = true;
|
||||||
space.set_debugger_access(true);
|
space.set_debugger_access(true);
|
||||||
|
|
||||||
UINT64 custom;
|
UINT64 custom;
|
||||||
if (apply_translation && !translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
|
||||||
{ /* translate if necessary; if not mapped, return 0xffffffff */
|
{ /* translate if necessary; if not mapped, return 0xffffffff */
|
||||||
result = 0xffffffff;
|
result = 0xffffffff;
|
||||||
}
|
}
|
||||||
else if (space.device().memory().read(space.spacenum(), address, 4, custom))
|
else if (memory.read(space.spacenum(), address, 4, custom))
|
||||||
{ /* if there is a custom read handler, and it returns true, use that value */
|
{ /* if there is a custom read handler, and it returns true, use that value */
|
||||||
result = custom;
|
result = custom;
|
||||||
}
|
}
|
||||||
@ -536,6 +522,7 @@ UINT64 debugger_cpu::read_qword(address_space &space, offs_t address, int apply_
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* otherwise, this proceeds like the byte case */
|
{ /* otherwise, this proceeds like the byte case */
|
||||||
|
device_memory_interface &memory = space.device().memory();
|
||||||
|
|
||||||
/* all accesses from this point on are for the debugger */
|
/* all accesses from this point on are for the debugger */
|
||||||
m_debugger_access = true;
|
m_debugger_access = true;
|
||||||
@ -543,11 +530,11 @@ UINT64 debugger_cpu::read_qword(address_space &space, offs_t address, int apply_
|
|||||||
|
|
||||||
/* translate if necessary; if not mapped, return 0xffffffffffffffff */
|
/* translate if necessary; if not mapped, return 0xffffffffffffffff */
|
||||||
UINT64 custom;
|
UINT64 custom;
|
||||||
if (apply_translation && !translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
result = ~(UINT64)0;
|
result = ~(UINT64)0;
|
||||||
}
|
}
|
||||||
else if (space.device().memory().read(space.spacenum(), address, 8, custom))
|
else if (memory.read(space.spacenum(), address, 8, custom))
|
||||||
{ /* if there is a custom read handler, and it returns true, use that value */
|
{ /* if there is a custom read handler, and it returns true, use that value */
|
||||||
result = custom;
|
result = custom;
|
||||||
}
|
}
|
||||||
@ -591,6 +578,8 @@ UINT64 debugger_cpu::read_memory(address_space &space, offs_t address, int size,
|
|||||||
|
|
||||||
void debugger_cpu::write_byte(address_space &space, offs_t address, UINT8 data, int apply_translation)
|
void debugger_cpu::write_byte(address_space &space, offs_t address, UINT8 data, int apply_translation)
|
||||||
{
|
{
|
||||||
|
device_memory_interface &memory = space.device().memory();
|
||||||
|
|
||||||
/* mask against the logical byte mask */
|
/* mask against the logical byte mask */
|
||||||
address &= space.logbytemask();
|
address &= space.logbytemask();
|
||||||
|
|
||||||
@ -599,11 +588,11 @@ void debugger_cpu::write_byte(address_space &space, offs_t address, UINT8 data,
|
|||||||
space.set_debugger_access(true);
|
space.set_debugger_access(true);
|
||||||
|
|
||||||
/* translate if necessary; if not mapped, we're done */
|
/* translate if necessary; if not mapped, we're done */
|
||||||
if (apply_translation && !translate(space, TRANSLATE_WRITE_DEBUG, &address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||||
;
|
;
|
||||||
|
|
||||||
/* if there is a custom write handler, and it returns true, use that */
|
/* if there is a custom write handler, and it returns true, use that */
|
||||||
else if (space.device().memory().write(space.spacenum(), address, 1, data))
|
else if (memory.write(space.spacenum(), address, 1, data))
|
||||||
;
|
;
|
||||||
|
|
||||||
/* otherwise, call the byte reading function for the translated address */
|
/* otherwise, call the byte reading function for the translated address */
|
||||||
@ -646,16 +635,18 @@ void debugger_cpu::write_word(address_space &space, offs_t address, UINT16 data,
|
|||||||
/* otherwise, this proceeds like the byte case */
|
/* otherwise, this proceeds like the byte case */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
device_memory_interface &memory = space.device().memory();
|
||||||
|
|
||||||
/* all accesses from this point on are for the debugger */
|
/* all accesses from this point on are for the debugger */
|
||||||
m_debugger_access = true;
|
m_debugger_access = true;
|
||||||
space.set_debugger_access(true);
|
space.set_debugger_access(true);
|
||||||
|
|
||||||
/* translate if necessary; if not mapped, we're done */
|
/* translate if necessary; if not mapped, we're done */
|
||||||
if (apply_translation && !translate(space, TRANSLATE_WRITE_DEBUG, &address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||||
;
|
;
|
||||||
|
|
||||||
/* if there is a custom write handler, and it returns true, use that */
|
/* if there is a custom write handler, and it returns true, use that */
|
||||||
else if (space.device().memory().write(space.spacenum(), address, 2, data))
|
else if (memory.write(space.spacenum(), address, 2, data))
|
||||||
;
|
;
|
||||||
|
|
||||||
/* otherwise, call the byte reading function for the translated address */
|
/* otherwise, call the byte reading function for the translated address */
|
||||||
@ -699,15 +690,17 @@ void debugger_cpu::write_dword(address_space &space, offs_t address, UINT32 data
|
|||||||
/* otherwise, this proceeds like the byte case */
|
/* otherwise, this proceeds like the byte case */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
device_memory_interface &memory = space.device().memory();
|
||||||
|
|
||||||
/* all accesses from this point on are for the debugger */
|
/* all accesses from this point on are for the debugger */
|
||||||
space.set_debugger_access(m_debugger_access = true);
|
space.set_debugger_access(m_debugger_access = true);
|
||||||
|
|
||||||
/* translate if necessary; if not mapped, we're done */
|
/* translate if necessary; if not mapped, we're done */
|
||||||
if (apply_translation && !translate(space, TRANSLATE_WRITE_DEBUG, &address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||||
;
|
;
|
||||||
|
|
||||||
/* if there is a custom write handler, and it returns true, use that */
|
/* if there is a custom write handler, and it returns true, use that */
|
||||||
else if (space.device().memory().write(space.spacenum(), address, 4, data))
|
else if (memory.write(space.spacenum(), address, 4, data))
|
||||||
;
|
;
|
||||||
|
|
||||||
/* otherwise, call the byte reading function for the translated address */
|
/* otherwise, call the byte reading function for the translated address */
|
||||||
@ -751,16 +744,18 @@ void debugger_cpu::write_qword(address_space &space, offs_t address, UINT64 data
|
|||||||
/* otherwise, this proceeds like the byte case */
|
/* otherwise, this proceeds like the byte case */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
device_memory_interface &memory = space.device().memory();
|
||||||
|
|
||||||
/* all accesses from this point on are for the debugger */
|
/* all accesses from this point on are for the debugger */
|
||||||
m_debugger_access = true;
|
m_debugger_access = true;
|
||||||
space.set_debugger_access(true);
|
space.set_debugger_access(true);
|
||||||
|
|
||||||
/* translate if necessary; if not mapped, we're done */
|
/* translate if necessary; if not mapped, we're done */
|
||||||
if (apply_translation && !translate(space, TRANSLATE_WRITE_DEBUG, &address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||||
;
|
;
|
||||||
|
|
||||||
/* if there is a custom write handler, and it returns true, use that */
|
/* if there is a custom write handler, and it returns true, use that */
|
||||||
else if (space.device().memory().write(space.spacenum(), address, 8, data))
|
else if (memory.write(space.spacenum(), address, 8, data))
|
||||||
;
|
;
|
||||||
|
|
||||||
/* otherwise, call the byte reading function for the translated address */
|
/* otherwise, call the byte reading function for the translated address */
|
||||||
@ -800,6 +795,8 @@ void debugger_cpu::write_memory(address_space &space, offs_t address, UINT64 dat
|
|||||||
|
|
||||||
UINT64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size)
|
UINT64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size)
|
||||||
{
|
{
|
||||||
|
device_memory_interface &memory = space.device().memory();
|
||||||
|
|
||||||
UINT64 result = ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size)), result2;
|
UINT64 result = ~(UINT64)0 & (~(UINT64)0 >> (64 - 8*size)), result2;
|
||||||
|
|
||||||
/* keep in logical range */
|
/* keep in logical range */
|
||||||
@ -808,8 +805,7 @@ UINT64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size)
|
|||||||
/* return early if we got the result directly */
|
/* return early if we got the result directly */
|
||||||
m_debugger_access = true;
|
m_debugger_access = true;
|
||||||
space.set_debugger_access(true);
|
space.set_debugger_access(true);
|
||||||
device_memory_interface *memory;
|
if (memory.readop(address, size, result2))
|
||||||
if (space.device().interface(memory) && memory->readop(address, size, result2))
|
|
||||||
{
|
{
|
||||||
m_debugger_access = false;
|
m_debugger_access = false;
|
||||||
space.set_debugger_access(false);
|
space.set_debugger_access(false);
|
||||||
@ -830,7 +826,7 @@ UINT64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* translate to physical first */
|
/* translate to physical first */
|
||||||
if (!translate(space, TRANSLATE_FETCH_DEBUG, &address))
|
if (!memory.translate(space.spacenum(), TRANSLATE_FETCH_DEBUG, address))
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
/* keep in physical range */
|
/* keep in physical range */
|
||||||
@ -1976,36 +1972,6 @@ void device_debug::set_instruction_hook(debug_instruction_hook_func hook)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
|
||||||
// disassemble - disassemble a line at a given
|
|
||||||
// PC on a given device
|
|
||||||
//-------------------------------------------------
|
|
||||||
|
|
||||||
offs_t device_debug::disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) const
|
|
||||||
{
|
|
||||||
if (m_disasm == nullptr)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// if we have a disassembler, run it
|
|
||||||
offs_t result = m_disasm->disassemble(buffer, pc, oprom, opram, 0);
|
|
||||||
|
|
||||||
// make sure we get good results
|
|
||||||
assert((result & DASMFLAG_LENGTHMASK) != 0);
|
|
||||||
#ifdef MAME_DEBUG
|
|
||||||
if (m_memory != nullptr)
|
|
||||||
{
|
|
||||||
address_space &space = m_memory->space(AS_PROGRAM);
|
|
||||||
int bytes = space.address_to_byte(result & DASMFLAG_LENGTHMASK);
|
|
||||||
assert(bytes >= m_disasm->min_opcode_bytes());
|
|
||||||
assert(bytes <= m_disasm->max_opcode_bytes());
|
|
||||||
(void) bytes; // appease compiler
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// ignore - ignore/observe a given device
|
// ignore - ignore/observe a given device
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -2653,10 +2619,14 @@ UINT32 device_debug::compute_opcode_crc32(offs_t pc) const
|
|||||||
argbuf[numbytes] = m_device.machine().debugger().cpu().read_opcode(space, pcbyte + numbytes, 1);
|
argbuf[numbytes] = m_device.machine().debugger().cpu().read_opcode(space, pcbyte + numbytes, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// disassemble to our buffer
|
UINT32 numbytes = maxbytes;
|
||||||
char diasmbuf[200];
|
if (m_disasm != nullptr)
|
||||||
memset(diasmbuf, 0x00, 200);
|
{
|
||||||
UINT32 numbytes = disassemble(diasmbuf, pc, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
// disassemble to our buffer
|
||||||
|
char diasmbuf[200];
|
||||||
|
memset(diasmbuf, 0x00, 200);
|
||||||
|
numbytes = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||||
|
}
|
||||||
|
|
||||||
// return a CRC of the exact count of opcode bytes
|
// return a CRC of the exact count of opcode bytes
|
||||||
return core_crc32(0, opbuf, numbytes);
|
return core_crc32(0, opbuf, numbytes);
|
||||||
@ -3054,7 +3024,7 @@ UINT32 device_debug::dasm_wrapped(std::string &buffer, offs_t pc)
|
|||||||
// disassemble to our buffer
|
// disassemble to our buffer
|
||||||
char diasmbuf[200];
|
char diasmbuf[200];
|
||||||
memset(diasmbuf, 0x00, 200);
|
memset(diasmbuf, 0x00, 200);
|
||||||
UINT32 result = disassemble(diasmbuf, pc, opbuf, argbuf);
|
UINT32 result = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf);
|
||||||
buffer.assign(diasmbuf);
|
buffer.assign(diasmbuf);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -185,9 +185,6 @@ public:
|
|||||||
// hooks into our operations
|
// hooks into our operations
|
||||||
void set_instruction_hook(debug_instruction_hook_func hook);
|
void set_instruction_hook(debug_instruction_hook_func hook);
|
||||||
|
|
||||||
// disassembly
|
|
||||||
offs_t disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) const;
|
|
||||||
|
|
||||||
// debugger focus
|
// debugger focus
|
||||||
void ignore(bool ignore = true);
|
void ignore(bool ignore = true);
|
||||||
bool observing() const { return ((m_flags & DEBUG_FLAG_OBSERVING) != 0); }
|
bool observing() const { return ((m_flags & DEBUG_FLAG_OBSERVING) != 0); }
|
||||||
@ -511,9 +508,6 @@ public:
|
|||||||
|
|
||||||
/* ----- debugger memory accessors ----- */
|
/* ----- debugger memory accessors ----- */
|
||||||
|
|
||||||
/* return the physical address corresponding to the given logical address */
|
|
||||||
bool translate(address_space &space, int intention, offs_t *address);
|
|
||||||
|
|
||||||
/* return a byte from the specified memory space */
|
/* return a byte from the specified memory space */
|
||||||
UINT8 read_byte(address_space &space, offs_t address, int apply_translation);
|
UINT8 read_byte(address_space &space, offs_t address, int apply_translation);
|
||||||
|
|
||||||
|
@ -269,10 +269,10 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs)
|
|||||||
|
|
||||||
// get the disassembly, but only if mapped
|
// get the disassembly, but only if mapped
|
||||||
instlen = 1;
|
instlen = 1;
|
||||||
if (machine().debugger().cpu().translate(source.m_space, TRANSLATE_FETCH, &physpcbyte))
|
if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH, physpcbyte))
|
||||||
{
|
{
|
||||||
char dasmbuffer[100];
|
char dasmbuffer[100];
|
||||||
instlen = source.device()->debug()->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK;
|
instlen = source.m_disasmintf->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// count this one
|
// count this one
|
||||||
@ -395,7 +395,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
|||||||
char buffer[100];
|
char buffer[100];
|
||||||
int numbytes = 0;
|
int numbytes = 0;
|
||||||
offs_t physpcbyte = pcbyte;
|
offs_t physpcbyte = pcbyte;
|
||||||
if (machine().debugger().cpu().translate(source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte))
|
if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH_DEBUG, physpcbyte))
|
||||||
{
|
{
|
||||||
UINT8 opbuf[64], argbuf[64];
|
UINT8 opbuf[64], argbuf[64];
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// disassemble the result
|
// disassemble the result
|
||||||
pc += numbytes = source.device()->debug()->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
pc += numbytes = source.m_disasmintf->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strcpy(buffer, "<unmapped>");
|
strcpy(buffer, "<unmapped>");
|
||||||
|
@ -74,5 +74,19 @@ offs_t device_disasm_interface::disassemble(char *buffer, offs_t pc, const UINT8
|
|||||||
if (result == 0)
|
if (result == 0)
|
||||||
result = disasm_disassemble(buffer, pc, oprom, opram, options);
|
result = disasm_disassemble(buffer, pc, oprom, opram, options);
|
||||||
|
|
||||||
|
// make sure we get good results
|
||||||
|
assert((result & DASMFLAG_LENGTHMASK) != 0);
|
||||||
|
#ifdef MAME_DEBUG
|
||||||
|
device_memory_interface *memory;
|
||||||
|
if (device().interface(memory))
|
||||||
|
{
|
||||||
|
address_space &space = memory->space(AS_PROGRAM);
|
||||||
|
int bytes = space.address_to_byte(result & DASMFLAG_LENGTHMASK);
|
||||||
|
assert(bytes >= min_opcode_bytes());
|
||||||
|
assert(bytes <= max_opcode_bytes());
|
||||||
|
(void) bytes; // appease compiler
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,6 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info.
|
|||||||
#include "video/poly.h"
|
#include "video/poly.h"
|
||||||
#include "debug/debugcon.h"
|
#include "debug/debugcon.h"
|
||||||
#include "debug/debugcmd.h"
|
#include "debug/debugcmd.h"
|
||||||
#include "debug/debugcpu.h"
|
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "includes/chihiro.h"
|
#include "includes/chihiro.h"
|
||||||
#include "includes/xbox.h"
|
#include "includes/xbox.h"
|
||||||
@ -506,7 +505,7 @@ St. Instr. Comment
|
|||||||
void chihiro_state::jamtable_disasm(address_space &space, UINT32 address, UINT32 size) // 0xff000080 == fff00080
|
void chihiro_state::jamtable_disasm(address_space &space, UINT32 address, UINT32 size) // 0xff000080 == fff00080
|
||||||
{
|
{
|
||||||
offs_t addr = (offs_t)address;
|
offs_t addr = (offs_t)address;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &addr))
|
if (!space.device().memory().translate(space.spacenum(), TRANSLATE_READ_DEBUG, addr))
|
||||||
{
|
{
|
||||||
machine().debugger().console().printf("Address is unmapped.\n");
|
machine().debugger().console().printf("Address is unmapped.\n");
|
||||||
return;
|
return;
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "cpu/nec/nec.h"
|
#include "cpu/nec/nec.h"
|
||||||
#include "cpu/z80/z80.h"
|
#include "cpu/z80/z80.h"
|
||||||
#include "debug/debugcpu.h"
|
|
||||||
#include "machine/i8255.h"
|
#include "machine/i8255.h"
|
||||||
#include "machine/pic8259.h"
|
#include "machine/pic8259.h"
|
||||||
#include "machine/pit8253.h"
|
#include "machine/pit8253.h"
|
||||||
|
@ -406,7 +406,6 @@
|
|||||||
|
|
||||||
#include "debug/debugcon.h"
|
#include "debug/debugcon.h"
|
||||||
#include "debug/debugcmd.h"
|
#include "debug/debugcmd.h"
|
||||||
#include "debug/debugcpu.h"
|
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
|
|
||||||
#define TIMEKEEPER_TAG "timekpr"
|
#define TIMEKEEPER_TAG "timekpr"
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include "debug/debugcon.h"
|
#include "debug/debugcon.h"
|
||||||
#include "debug/debugcmd.h"
|
#include "debug/debugcmd.h"
|
||||||
#include "debug/debugcpu.h"
|
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "includes/chihiro.h"
|
#include "includes/chihiro.h"
|
||||||
#include "includes/xbox.h"
|
#include "includes/xbox.h"
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "machine/applefdc.h"
|
#include "machine/applefdc.h"
|
||||||
#include "machine/sonydriv.h"
|
#include "machine/sonydriv.h"
|
||||||
#include "includes/macpci.h"
|
#include "includes/macpci.h"
|
||||||
#include "debug/debugcpu.h"
|
|
||||||
#include "machine/ram.h"
|
#include "machine/ram.h"
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "debug/debugcon.h"
|
#include "debug/debugcon.h"
|
||||||
#include "debug/debugcmd.h"
|
#include "debug/debugcmd.h"
|
||||||
#include "debug/debugcpu.h"
|
|
||||||
#include "includes/chihiro.h"
|
#include "includes/chihiro.h"
|
||||||
#include "includes/xbox.h"
|
#include "includes/xbox.h"
|
||||||
#include "includes/xbox_usb.h"
|
#include "includes/xbox_usb.h"
|
||||||
@ -35,7 +34,7 @@ void xbox_base_state::dump_string_command(int ref, int params, const char **para
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
offs_t address = (offs_t)addr;
|
offs_t address = (offs_t)addr;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
machine().debugger().console().printf("Address is unmapped.\n");
|
machine().debugger().console().printf("Address is unmapped.\n");
|
||||||
return;
|
return;
|
||||||
@ -47,7 +46,7 @@ void xbox_base_state::dump_string_command(int ref, int params, const char **para
|
|||||||
machine().debugger().console().printf("Length %d word\n", length);
|
machine().debugger().console().printf("Length %d word\n", length);
|
||||||
machine().debugger().console().printf("MaximumLength %d word\n", maximumlength);
|
machine().debugger().console().printf("MaximumLength %d word\n", maximumlength);
|
||||||
machine().debugger().console().printf("Buffer %08X byte* ", buffer);
|
machine().debugger().console().printf("Buffer %08X byte* ", buffer);
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &buffer))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, buffer))
|
||||||
{
|
{
|
||||||
machine().debugger().console().printf("\nBuffer is unmapped.\n");
|
machine().debugger().console().printf("\nBuffer is unmapped.\n");
|
||||||
return;
|
return;
|
||||||
@ -76,7 +75,7 @@ void xbox_base_state::dump_process_command(int ref, int params, const char **par
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
offs_t address = (offs_t)addr;
|
offs_t address = (offs_t)addr;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
machine().debugger().console().printf("Address is unmapped.\n");
|
machine().debugger().console().printf("Address is unmapped.\n");
|
||||||
return;
|
return;
|
||||||
@ -113,7 +112,7 @@ void xbox_base_state::dump_list_command(int ref, int params, const char **param)
|
|||||||
|
|
||||||
UINT64 start = addr;
|
UINT64 start = addr;
|
||||||
offs_t address = (offs_t)addr;
|
offs_t address = (offs_t)addr;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
machine().debugger().console().printf("Address is unmapped.\n");
|
machine().debugger().console().printf("Address is unmapped.\n");
|
||||||
return;
|
return;
|
||||||
@ -137,7 +136,7 @@ void xbox_base_state::dump_list_command(int ref, int params, const char **param)
|
|||||||
if (addr == old)
|
if (addr == old)
|
||||||
break;
|
break;
|
||||||
address = (offs_t)addr;
|
address = (offs_t)addr;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +153,7 @@ void xbox_base_state::dump_dpc_command(int ref, int params, const char **param)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
offs_t address = (offs_t)addr;
|
offs_t address = (offs_t)addr;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
machine().debugger().console().printf("Address is unmapped.\n");
|
machine().debugger().console().printf("Address is unmapped.\n");
|
||||||
return;
|
return;
|
||||||
@ -181,7 +180,7 @@ void xbox_base_state::dump_timer_command(int ref, int params, const char **param
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
offs_t address = (offs_t)addr;
|
offs_t address = (offs_t)addr;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
machine().debugger().console().printf("Address is unmapped.\n");
|
machine().debugger().console().printf("Address is unmapped.\n");
|
||||||
return;
|
return;
|
||||||
@ -204,7 +203,7 @@ void xbox_base_state::curthread_command(int ref, int params, const char **param)
|
|||||||
|
|
||||||
UINT64 fsbase = m_maincpu->state_int(44);
|
UINT64 fsbase = m_maincpu->state_int(44);
|
||||||
offs_t address = (offs_t)fsbase + 0x28;
|
offs_t address = (offs_t)fsbase + 0x28;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
machine().debugger().console().printf("Address is unmapped.\n");
|
machine().debugger().console().printf("Address is unmapped.\n");
|
||||||
return;
|
return;
|
||||||
@ -214,14 +213,14 @@ void xbox_base_state::curthread_command(int ref, int params, const char **param)
|
|||||||
machine().debugger().console().printf("Current thread is %08X\n", kthrd);
|
machine().debugger().console().printf("Current thread is %08X\n", kthrd);
|
||||||
|
|
||||||
address = (offs_t)kthrd + 0x1c;
|
address = (offs_t)kthrd + 0x1c;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UINT32 topstack = space.read_dword_unaligned(address);
|
UINT32 topstack = space.read_dword_unaligned(address);
|
||||||
machine().debugger().console().printf("Current thread stack top is %08X\n", topstack);
|
machine().debugger().console().printf("Current thread stack top is %08X\n", topstack);
|
||||||
|
|
||||||
address = (offs_t)kthrd + 0x28;
|
address = (offs_t)kthrd + 0x28;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UINT32 tlsdata = space.read_dword_unaligned(address);
|
UINT32 tlsdata = space.read_dword_unaligned(address);
|
||||||
@ -229,7 +228,7 @@ void xbox_base_state::curthread_command(int ref, int params, const char **param)
|
|||||||
address = (offs_t)topstack - 0x210 - 8;
|
address = (offs_t)topstack - 0x210 - 8;
|
||||||
else
|
else
|
||||||
address = (offs_t)tlsdata - 8;
|
address = (offs_t)tlsdata - 8;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, address))
|
||||||
return;
|
return;
|
||||||
machine().debugger().console().printf("Current thread function is %08X\n", space.read_dword_unaligned(address));
|
machine().debugger().console().printf("Current thread function is %08X\n", space.read_dword_unaligned(address));
|
||||||
}
|
}
|
||||||
@ -325,7 +324,7 @@ void xbox_base_state::vprogdis_command(int ref, int params, const char **param)
|
|||||||
if (type == 1)
|
if (type == 1)
|
||||||
{
|
{
|
||||||
offs_t addr = (offs_t)address;
|
offs_t addr = (offs_t)address;
|
||||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &addr))
|
if (!m_maincpu->translate(AS_PROGRAM, TRANSLATE_READ_DEBUG, addr))
|
||||||
return;
|
return;
|
||||||
instruction[0] = space.read_dword_unaligned(address);
|
instruction[0] = space.read_dword_unaligned(address);
|
||||||
instruction[1] = space.read_dword_unaligned(address + 4);
|
instruction[1] = space.read_dword_unaligned(address + 4);
|
||||||
|
@ -11,10 +11,6 @@
|
|||||||
#include "machine/idectrl.h"
|
#include "machine/idectrl.h"
|
||||||
#include "video/poly.h"
|
#include "video/poly.h"
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include "debugger.h"
|
|
||||||
#include "debug/debugcon.h"
|
|
||||||
#include "debug/debugcmd.h"
|
|
||||||
#include "debug/debugcpu.h"
|
|
||||||
#include "includes/chihiro.h"
|
#include "includes/chihiro.h"
|
||||||
#include "includes/xbox.h"
|
#include "includes/xbox.h"
|
||||||
#include "includes/xbox_usb.h"
|
#include "includes/xbox_usb.h"
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "debug/debugcpu.h"
|
|
||||||
#include "debug/debugcon.h"
|
#include "debug/debugcon.h"
|
||||||
#include "includes/rmnimbus.h"
|
#include "includes/rmnimbus.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user