From 761ea33f98ccc2b2a60d0cb7e7a551fb66ed1935 Mon Sep 17 00:00:00 2001 From: Reinhard Schu Date: Wed, 21 Aug 2024 21:53:53 +0100 Subject: [PATCH] Fix relative addressing mode in disassembler Fix calculation of the effective address in relative addressing mode in the disassembler by casting to a signed int8 --- Part#2 - CPU/olc6502.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Part#2 - CPU/olc6502.cpp b/Part#2 - CPU/olc6502.cpp index d3db41c..6815ff1 100644 --- a/Part#2 - CPU/olc6502.cpp +++ b/Part#2 - CPU/olc6502.cpp @@ -1577,7 +1577,8 @@ std::map olc6502::disassemble(uint16_t nStart, uint16_t n else if (lookup[opcode].addrmode == &olc6502::REL) { value = bus->read(addr, true); addr++; - sInst += "$" + hex(value, 2) + " [$" + hex(addr + value, 4) + "] {REL}"; + int8_t rel_value = (int8_t)value; + sInst += "$" + hex(value, 2) + " [$" + hex(addr + rel_value, 4) + "] {REL}"; } // Add the formed string to a std::map, using the instruction's