64kramsystem / 64kramsystem/ghidra-vice-connector
Import symbols from VICE label files and assembler debug output
- Lenguaje dominante
- Python
- Estrellas
- 1
- Forks
- 0
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
## Summary
Import labels and source-line mappings from common C64 assembler output formats into the Ghidra program database. Many C64 games have published community disassemblies with label files; being able to import them instantly bootstraps analysis.
Source: IceBroLite (auto-loads .dbg, .sym, .vs); 64tass `--vice-labels` output; Kick Assembler `.dbg` files.
---
## Format 1: VICE label format (`.vs` / `.sym`)
Used by: VICE monitor `save_labels`, 64tass `--vice-labels`, CBM prg Studio symbol export.
```
al C:0800 .game_start
al C:1234 .irq_handler
al C:FFEE .CHROUT
```
Parsing: `re.findall(r'al C:([0-9a-fA-F]{4})\s+\.(\S+)', text)` → `(hex_addr, label_name)`.
### 2: Kick Assembler `.dbg` format
XML file output by KickAssembler (`-debugdump` flag). Structure (confirmed from vscode-kickass-studio `sourceMap.ts`):
```xml
0800,,0,10,0
0803,,0,11,0
```
Labels field: comma-separated `_,addr_hex,name`.
---
## Implementation
A Ghidra script `ImportC64Labels.java` in `data/ghidra-scripts/`:
```java
// Prompt for file, detect format by extension or content
File f = askFile("Select label file", "Import");
String text = new String(Files.readAllBytes(f.toPath()));
if (text.contains("")) {
// Parse XML .dbg format
} else {
// Parse VICE .vs format: lines matching /al C:([0-9a-fA-F]{4}) \.(\S+)/
Pattern p = Pattern.compile("al C:([0-9a-fA-F]{4}) \\.([\\S]+)");
Matcher m = p.matcher(text);
while (m.find()) {
long addr = Long.parseLong(m.group(1), 16);
String name = m.group(2);
createLabel(toAddr(addr), name, true, SourceType.IMPORTED);
}
}
```
For `.dbg` files, also map source lines to addresses using Ghidra's `SourceFile` / `LineNumber` APIs to enable source-level display.
---
## Files to create/change
- `data/ghidra-scripts/ImportC64Labels.java` — new script
- `README.md` — mention in setup section
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.