64kramsystem / 64kramsystem/ghidra-vice-connector

CPU execution history: show last N instructions on stop

Đang mở
#19 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
priority: high
Ngôn ngữ chính
Python
Star
1
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## 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('

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.