Debugger: Fixed relative branch disassembly address
This commit is contained in:
parent
8c39c03311
commit
46663e8e53
2 changed files with 6 additions and 5 deletions
|
@ -40,7 +40,9 @@ void DisassemblyInfo::GetDisassembly(string &out, uint32_t memoryAddr)
|
||||||
FastString operand;
|
FastString operand;
|
||||||
if(_opSize > 1) {
|
if(_opSize > 1) {
|
||||||
operand.Write('$');
|
operand.Write('$');
|
||||||
if(_opSize == 2) {
|
if(_addrMode == AddrMode::Rel || _addrMode == AddrMode::RelLng) {
|
||||||
|
operand.Write(HexUtilities::ToHex24(opAddr));
|
||||||
|
} else if(_opSize == 2) {
|
||||||
operand.Write(HexUtilities::ToHex((uint8_t)opAddr));
|
operand.Write(HexUtilities::ToHex((uint8_t)opAddr));
|
||||||
} else if(_opSize == 3) {
|
} else if(_opSize == 3) {
|
||||||
operand.Write(HexUtilities::ToHex((uint16_t)opAddr));
|
operand.Write(HexUtilities::ToHex((uint16_t)opAddr));
|
||||||
|
@ -100,11 +102,11 @@ uint32_t DisassemblyInfo::GetOperandAddress(uint32_t memoryAddr)
|
||||||
opAddr = _byteCode[1] | (_byteCode[2] << 8) | (_byteCode[3] << 16);
|
opAddr = _byteCode[1] | (_byteCode[2] << 8) | (_byteCode[3] << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_addrMode == AddrMode::Rel) {
|
if(_addrMode == AddrMode::Rel || _addrMode == AddrMode::RelLng) {
|
||||||
if(_opSize == 2) {
|
if(_opSize == 2) {
|
||||||
opAddr = (int8_t)opAddr + memoryAddr + 2;
|
opAddr = (memoryAddr & 0xFF0000) | (((int8_t)opAddr + memoryAddr + 2) & 0xFFFF);
|
||||||
} else {
|
} else {
|
||||||
opAddr = (int16_t)opAddr + memoryAddr + 2;
|
opAddr = (memoryAddr & 0xFF0000) | (((int16_t)opAddr + memoryAddr + 2) & 0xFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ class DisassemblyInfo
|
||||||
public:
|
public:
|
||||||
static string OpName[256];
|
static string OpName[256];
|
||||||
static AddrMode OpMode[256];
|
static AddrMode OpMode[256];
|
||||||
static uint8_t OpSize[256];
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _byteCode[4];
|
uint8_t _byteCode[4];
|
||||||
|
|
Loading…
Add table
Reference in a new issue