Debugger: Fixed relative branch disassembly address

This commit is contained in:
Sour 2019-03-07 21:30:16 -05:00
parent 8c39c03311
commit 46663e8e53
2 changed files with 6 additions and 5 deletions

View file

@ -40,7 +40,9 @@ void DisassemblyInfo::GetDisassembly(string &out, uint32_t memoryAddr)
FastString operand;
if(_opSize > 1) {
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));
} else if(_opSize == 3) {
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);
}
if(_addrMode == AddrMode::Rel) {
if(_addrMode == AddrMode::Rel || _addrMode == AddrMode::RelLng) {
if(_opSize == 2) {
opAddr = (int8_t)opAddr + memoryAddr + 2;
opAddr = (memoryAddr & 0xFF0000) | (((int8_t)opAddr + memoryAddr + 2) & 0xFFFF);
} else {
opAddr = (int16_t)opAddr + memoryAddr + 2;
opAddr = (memoryAddr & 0xFF0000) | (((int16_t)opAddr + memoryAddr + 2) & 0xFFFF);
}
}

View file

@ -13,7 +13,6 @@ class DisassemblyInfo
public:
static string OpName[256];
static AddrMode OpMode[256];
static uint8_t OpSize[256];
private:
uint8_t _byteCode[4];