achan1989 / ghidra-65816

WDC 65816 processor module for Ghidra
MIT License
22 stars 3 forks source link
65816 ghidra

This repo is no longer maintained, and I'm unlikely to come back to it in the future.


ghidra-65816

This is a WDC 65816 processor module for Ghidra.

This is an early release. I've not used it much yet, so expect bugs. Feedback and pull requests are welcome!

Disassembly is probably correct. Data flow analysis is probably mostly correct. Decompilation is probably unusable.

Install and Usage

Rename the root folder to 65816 and copy it to Ghidra/Processors.

I've only tried to use this processor module with a raw binary so far.

  1. Import a file using the "Raw Binary" format, "65816" language.
  2. Open it in the code browser. When asked if you want to analyse it now choose "no".
  3. Set up your memory map.
  4. For each entry point:
    1. Identify the mode that the processor will be running in.
    2. Right-click the first instruction byte and choose "Processor Options..." to set the MF, XF, and EF flags.
    3. Right-click the first instruction byte and choose "Set Register Values..." to set the DBR (data bank), DF (decimal flag), DP (direct page), PBR (program bank), and SP (stack pointer) registers. Perhaps others, if you're feeling keen.
    4. Cross fingers and disassemble. Watch out for limitations and unknowns.

Limitations

Unknowns

I don't know how well Ghidra will pick up on changes to the processor modes. If it requires a lot of manual intervention then a custom analyser might be necessary to make it usable.

The following implemented behaviours are my interpretation of ambiguous documentation, which is likely to be wrong.