64kramsystem / 64kramsystem/ghidra-vice-connector

CPU execution history: show last N instructions on stop

未關閉
#19 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
priority: high
主要語言
Python
星號
1
分支
0
PR 合併指標
30 天內沒有已合併 PR

描述

## Summary

After hitting a breakpoint, display the last N instructions that were executed — PC, register snapshot, and clock cycle for each. This is critical for understanding how execution arrived at a given point, especially in interrupt-driven game code.

Source: VICE BMP `CPU History` command (0x86), also used by RetroDebugger's "Rewind" view.

---

## BMP protocol details

**Command:** `CMD_CPU_HISTORY = 0x86`

**Request payload:**
```
num_instructions (2 LE) — how many history entries to return
```

**Response:** one `RESP_CPU_HISTORY` (0x86) frame per instruction (most recent last), each entry:
```
cycle_count (8 bytes LE) — CPU clock cycle at the time
addr (2 LE) — PC value
op (1) — opcode byte
p (1) — processor status (FL)
sp (1) — stack pointer
a (1)
x (1)
y (1)
```

(Format confirmed from VICE source `src/monitor/monitor_binary.c` `monitor_binary_response_cpu_history`.)

The terminal frame is `RESP_CPU_HISTORY_END` (0x87).

---

## Implementation plan

### 1. `util.py`

```python
CMD_CPU_HISTORY = 0x86
RESP_CPU_HISTORY = 0x86
RESP_CPU_HISTORY_END = 0x87

def cpu_history(self, count: int = 256) -> list[dict]:
frames = self._command_multi(
CMD_CPU_HISTORY,
struct.pack('

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。