summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcpu.cpp
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2017-12-03 16:55:38 +0100
committer Olivier Galibert <galibert@pobox.com>2017-12-03 16:55:38 +0100
commit3555ce616ecbf8df1ccfa1dc229a0f81c1c1ea7f (patch)
treeeaed5de8773b2332df469de7e3a2f9b3b6291c68 /src/emu/debug/debugcpu.cpp
parent4f90cbd74460a5fb124056f7ae61115a8b54554c (diff)
More fixes and simplifications (nw)
Diffstat (limited to 'src/emu/debug/debugcpu.cpp')
-rw-r--r--src/emu/debug/debugcpu.cpp86
1 files changed, 23 insertions, 63 deletions
diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp
index eab6f7771e7..9a1b35cf210 100644
--- a/src/emu/debug/debugcpu.cpp
+++ b/src/emu/debug/debugcpu.cpp
@@ -389,34 +389,20 @@ u8 debugger_cpu::read_byte(address_space &space, offs_t address, bool apply_tran
u16 debugger_cpu::read_word(address_space &space, offs_t address, bool apply_translation)
{
+ device_memory_interface &memory = space.device().memory();
+
/* mask against the logical byte mask */
address &= space.logaddrmask();
u16 result;
- if (!WORD_ALIGNED(address))
- { /* if this is misaligned read, or if there are no word readers, just read two bytes */
- u8 byte0 = read_byte(space, address + 0, apply_translation);
- u8 byte1 = read_byte(space, address + 1, apply_translation);
-
- /* based on the endianness, the result is assembled differently */
- if (space.endianness() == ENDIANNESS_LITTLE)
- result = byte0 | (byte1 << 8);
- else
- result = byte1 | (byte0 << 8);
+ /* translate if necessary; if not mapped, return 0xffff */
+ if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
+ {
+ result = 0xffff;
}
else
- { /* otherwise, this proceeds like the byte case */
- device_memory_interface &memory = space.device().memory();
-
- /* translate if necessary; if not mapped, return 0xffff */
- if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
- {
- result = 0xffff;
- }
- else
- { /* otherwise, call the byte reading function for the translated address */
- result = space.read_word(address);
- }
+ { /* otherwise, call the byte reading function for the translated address */
+ result = space.read_word_unaligned(address);
}
return result;
@@ -430,33 +416,20 @@ u16 debugger_cpu::read_word(address_space &space, offs_t address, bool apply_tra
u32 debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_translation)
{
+ device_memory_interface &memory = space.device().memory();
+
/* mask against the logical byte mask */
address &= space.logaddrmask();
u32 result;
- if (!DWORD_ALIGNED(address))
- { /* if this is a misaligned read, or if there are no dword readers, just read two words */
- u16 word0 = read_word(space, address + 0, apply_translation);
- u16 word1 = read_word(space, address + 2, apply_translation);
- /* based on the endianness, the result is assembled differently */
- if (space.endianness() == ENDIANNESS_LITTLE)
- result = word0 | (word1 << 16);
- else
- result = word1 | (word0 << 16);
+ if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
+ { /* translate if necessary; if not mapped, return 0xffffffff */
+ result = 0xffffffff;
}
else
- { /* otherwise, this proceeds like the byte case */
- device_memory_interface &memory = space.device().memory();
-
- if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
- { /* translate if necessary; if not mapped, return 0xffffffff */
- result = 0xffffffff;
- }
- else
- { /* otherwise, call the byte reading function for the translated address */
- result = space.read_dword(address);
- }
+ { /* otherwise, call the byte reading function for the translated address */
+ result = space.read_dword_unaligned(address);
}
return result;
@@ -470,34 +443,21 @@ u32 debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_tr
u64 debugger_cpu::read_qword(address_space &space, offs_t address, bool apply_translation)
{
+ device_memory_interface &memory = space.device().memory();
+
/* mask against the logical byte mask */
address &= space.logaddrmask();
u64 result;
- if (!QWORD_ALIGNED(address))
- { /* if this is a misaligned read, or if there are no qword readers, just read two dwords */
- u32 dword0 = read_dword(space, address + 0, apply_translation);
- u32 dword1 = read_dword(space, address + 4, apply_translation);
- /* based on the endianness, the result is assembled differently */
- if (space.endianness() == ENDIANNESS_LITTLE)
- result = dword0 | (u64(dword1) << 32);
- else
- result = dword1 | (u64(dword0) << 32);
+ /* translate if necessary; if not mapped, return 0xffffffffffffffff */
+ if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
+ {
+ result = ~u64(0);
}
else
- { /* otherwise, this proceeds like the byte case */
- device_memory_interface &memory = space.device().memory();
-
- /* translate if necessary; if not mapped, return 0xffffffffffffffff */
- if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
- {
- result = ~u64(0);
- }
- else
- { /* otherwise, call the byte reading function for the translated address */
- result = space.read_qword(address);
- }
+ { /* otherwise, call the byte reading function for the translated address */
+ result = space.read_qword_unaligned(address);
}
return result;