mirror of
https://github.com/holub/mame
synced 2025-06-08 22:03:55 +03:00
More fixes and simplifications (nw)
This commit is contained in:
parent
4f90cbd744
commit
3555ce616e
@ -389,25 +389,12 @@ 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)
|
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 */
|
/* mask against the logical byte mask */
|
||||||
address &= space.logaddrmask();
|
address &= space.logaddrmask();
|
||||||
|
|
||||||
u16 result;
|
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);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ /* otherwise, this proceeds like the byte case */
|
|
||||||
device_memory_interface &memory = space.device().memory();
|
|
||||||
|
|
||||||
/* translate if necessary; if not mapped, return 0xffff */
|
/* translate if necessary; if not mapped, return 0xffff */
|
||||||
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
|
||||||
{
|
{
|
||||||
@ -415,8 +402,7 @@ u16 debugger_cpu::read_word(address_space &space, offs_t address, bool apply_tra
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* otherwise, call the byte reading function for the translated address */
|
{ /* otherwise, call the byte reading function for the translated address */
|
||||||
result = space.read_word(address);
|
result = space.read_word_unaligned(address);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -430,24 +416,12 @@ 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)
|
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 */
|
/* mask against the logical byte mask */
|
||||||
address &= space.logaddrmask();
|
address &= space.logaddrmask();
|
||||||
|
|
||||||
u32 result;
|
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);
|
|
||||||
}
|
|
||||||
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))
|
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 */
|
||||||
@ -455,8 +429,7 @@ u32 debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_tr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* otherwise, call the byte reading function for the translated address */
|
{ /* otherwise, call the byte reading function for the translated address */
|
||||||
result = space.read_dword(address);
|
result = space.read_dword_unaligned(address);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -470,24 +443,12 @@ 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)
|
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 */
|
/* mask against the logical byte mask */
|
||||||
address &= space.logaddrmask();
|
address &= space.logaddrmask();
|
||||||
|
|
||||||
u64 result;
|
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);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ /* otherwise, this proceeds like the byte case */
|
|
||||||
device_memory_interface &memory = space.device().memory();
|
|
||||||
|
|
||||||
/* translate if necessary; if not mapped, return 0xffffffffffffffff */
|
/* translate if necessary; if not mapped, return 0xffffffffffffffff */
|
||||||
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
|
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
|
||||||
@ -496,8 +457,7 @@ u64 debugger_cpu::read_qword(address_space &space, offs_t address, bool apply_tr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* otherwise, call the byte reading function for the translated address */
|
{ /* otherwise, call the byte reading function for the translated address */
|
||||||
result = space.read_qword(address);
|
result = space.read_qword_unaligned(address);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user