Skip to content

Commit fc6f7b3

Browse files
authored
Merge pull request #31 from sql-hkr/fix/terminal-highlight
fix: terminal highlight (#30)
2 parents f16199d + 3ab3b32 commit fc6f7b3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/tiny8/cpu.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ def step(self) -> bool:
353353
self.running = False
354354
return False
355355

356+
pre_exec_pc = self.pc
356357
instr, operands = self.program[self.pc]
357358

358359
# Build textual form of the instruction for tracing (uppercase mnemonic
@@ -396,11 +397,12 @@ def fmt_op(o):
396397

397398
# record step trace after execution (post-state)
398399
self.step_count += 1
399-
source_line = self.pc_to_line.get(self.pc, -1)
400+
401+
source_line = self.pc_to_line.get(pre_exec_pc, -1)
400402
self.step_trace.append(
401403
{
402404
"step": self.step_count,
403-
"pc": self.pc,
405+
"pc": pre_exec_pc,
404406
"instr": instr_text,
405407
"regs": regs_snapshot,
406408
"mem": mem_snapshot,

0 commit comments

Comments
 (0)