64kramsystem / 64kramsystem/ghidra-vice-connector

Annotate C64 zero-page and system variable addresses

未关闭
#22 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
priority: medium
主要语言
Python
星标
1
派生
0
PR 合并指标
30 天内没有已合并 PR

描述

## Summary

Apply labels and comments to the ~300 well-known C64 KERNAL/BASIC zero-page and system variable addresses in the Ghidra program database. This complements issue #13 (hardware registers) which covers $D000–$DFFF; this issue covers $0000–$03FF.

Sources: [pagetable.com Ultimate C64 Reference](https://www.pagetable.com/c64ref/c64mem/), [sta.c64.org memory map](http://sta.c64.org/cbm64mem.html).

---

## Key address ranges

| Range | Contents |
|-------|----------|
| $0000–$0001 | CPU I/O port direction / data (6510-specific) |
| $0002–$00FF | KERNAL/BASIC zero-page workspace |
| $00FB–$00FE | Free zero-page for user programs |
| $0100–$01FF | 6502 hardware stack |
| $0200–$02FF | BASIC input buffer, KERNAL workspace |
| $0300–$0314 | KERNAL vectors (overridable soft vectors) |
| $0314–$0333 | IRQ/NMI/BRK/RESET vectors (RAM-based) — see also issue #14 |
| $033C–$03FB | Cassette buffer (often used as free scratch RAM by games) |

Notable zero-page addresses:
- `$01` — processor port (bank switching config)
- `$2B`/`$2C` — start of BASIC text
- `$90` — KERNAL status byte
- `$A7`–`$C5` — floating point accumulator
- `$C5`/`$C6` — current key / key count

---

## Implementation

A Ghidra script (Java or Python, alongside `RebaseToC64Load.java` in `data/ghidra-scripts/`) that iterates a built-in table and calls:

```java
// Java (GhidraScript)
Address addr = toAddr(0x0090);
createLabel(addr, "KERNAL_STATUS", true, SourceType.IMPORTED);
setPlateComment(addr, "KERNAL I/O status byte (ST)");
```

The table should be a static list in the script — no external file dependency.

**Run condition:** check `currentProgram.getLanguage().getLanguageID().toString().contains("6502")` before applying, so the script is safe to run against any Ghidra program.

**Integration:** mention in README as a companion script to run after import, alongside `RebaseToC64Load.java`.

---

## Reference data

Full address tables:
- https://www.pagetable.com/c64ref/c64mem/ (machine-readable JSON available)
- http://sta.c64.org/cbm64mem.html

The pagetable.com reference has a JSON export that could be used to generate the label table automatically.

---

## Files to create/change

- `data/ghidra-scripts/LabelC64SystemAddresses.java` — new script (companion to `RebaseToC64Load.java`)
- `README.md` — mention the script in the setup section

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。