64kramsystem / 64kramsystem/ghidra-vice-connector

CPU execution history: show last N instructions on stop

Abierto
#19 0 comentarios 0 reacciones 0 asignados Ver en GitHub
priority: high
Lenguaje dominante
Python
Estrellas
1
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.