From 3ab3b3214c6468b388c8eff8a96948a585ec6567 Mon Sep 17 00:00:00 2001 From: sql-hkr Date: Thu, 13 Nov 2025 00:10:34 +0900 Subject: [PATCH] fix: terminal highlight (#30) --- src/tiny8/cpu.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tiny8/cpu.py b/src/tiny8/cpu.py index 82aa267..447752c 100644 --- a/src/tiny8/cpu.py +++ b/src/tiny8/cpu.py @@ -353,6 +353,7 @@ def step(self) -> bool: self.running = False return False + pre_exec_pc = self.pc instr, operands = self.program[self.pc] # Build textual form of the instruction for tracing (uppercase mnemonic @@ -396,11 +397,12 @@ def fmt_op(o): # record step trace after execution (post-state) self.step_count += 1 - source_line = self.pc_to_line.get(self.pc, -1) + + source_line = self.pc_to_line.get(pre_exec_pc, -1) self.step_trace.append( { "step": self.step_count, - "pc": self.pc, + "pc": pre_exec_pc, "instr": instr_text, "regs": regs_snapshot, "mem": mem_snapshot,