64kramsystem / 64kramsystem/ghidra-vice-connector

Illegal opcode support for 6510

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
priority: medium
Dominant language
Python
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Many C64 games use undocumented/illegal 6510 opcodes that Ghidra's stock \`6502:LE:16:default\` language does not recognise, causing misparse and broken disassembly chains.

Common illegals used in games:

| Opcode | Mnemonic | Effect |
|--------|----------|--------|
| \$A3/\$A7/\$AF/\$B3/\$B7/\$BF | LAX | LDA + LDX |
| \$83/\$87/\$8F/\$97 | SAX | A AND X → mem |
| \$C3/\$C7/\$CF/\$D3/\$D7/\$DB/\$DF | DCP | DEC + CMP |
| \$03/\$07/\$0F/\$13/\$17/\$1B/\$1F | SLO | ASL + ORA |
| \$23/\$27/\$2F/\$33/\$37/\$3B/\$3F | RLA | ROL + AND |
| \$EB | USBC/SBC | same as \$E9 SBC imm |

Options (increasing effort):

1. **SLEIGH patch** — extend the existing `6502.slaspec` with illegal opcode patterns. Requires rebuilding the language module.
2. **Custom language module** — fork the Ghidra 6502 processor module as `6510`, add illegals, publish as a separate extension.
3. **Pre-analysis script** — scan for known illegal bytes and convert to `??` data + comment before disassembly, limiting breakage to those sites.

Option 2 gives first-class support and is the correct long-term solution for a C64-focused tool.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.