Metadata-Version: 2.4
Name: deity-informant
Version: 0.46.0
Summary: NMOS 6510 illegal-opcode toolkit: a standalone 6510 -> raw-P-Code lifter + pure-Python P-Code VM, and a 6510 Ghidra/pypcode SLEIGH processor module.
Author-email: Josh Bailey <josh@overlyspecific.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/anarkiwi/deity-informant
Project-URL: Repository, https://github.com/anarkiwi/deity-informant
Keywords: 6502,6510,ghidra,sleigh,pcode,illegal-opcodes,decompiler
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: POSIX :: Linux
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Software Development :: Disassemblers
Classifier: Topic :: System :: Emulators
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jennings>=0.26.1
Requires-Dist: numpy
Requires-Dist: networkx
Requires-Dist: tqdm
Requires-Dist: dd==0.6.0
Requires-Dist: wayward-eagle>=0.5.12
Provides-Extra: ghidra
Requires-Dist: pypcode; extra == "ghidra"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-xdist; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest-timeout; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Requires-Dist: py65; extra == "dev"
Requires-Dist: pypcode; extra == "dev"
Requires-Dist: maturin; extra == "dev"
Requires-Dist: pebble; extra == "dev"
Requires-Dist: vagrant-moses[cpu]>=0.20.0; extra == "dev"
Requires-Dist: pysidtracker>=0.65.0; extra == "dev"
Requires-Dist: pylibresidfp>=0.6.1; extra == "dev"
Requires-Dist: zstandard; extra == "dev"
Requires-Dist: pyelftools; extra == "dev"
Requires-Dist: pysayme>=0.2.0; extra == "dev"
Dynamic: license-file

# deity-informant

An NMOS 6510 toolkit. It has a 6510 to P-Code lifter with every documented illegal opcode, a
P-Code VM, and a SLEIGH module for Ghidra. It also lifts whole programs to native code, and
translates C64 machine code (SID players) to structured C99, checked against a reference
interpreter.

## Install

```bash
pip install deity-informant                  # from PyPI
pip install -e ".[dev]" && maturin develop --profile dev-release   # from a checkout, with the native extension
```

## Use

```bash
deity-informant disasm IMAGE --org 0x1000    # illegal-aware disassembly; see docs/lifter.md
python -m deity_informant.cgen tune.bin --org 0x1000 --entry 0x1003:play --volatile 0xD400-0xD41D -o tune.c
```

```python
from deity_informant import cgen

c, h, info = cgen.translate(image, [(0x1003, "play")], volatile=[(0xD400, 0xD41D)])
```

## Components

| Component | What it is | Doc |
|---|---|---|
| `lifter`, `vm`, `cli`, `sleigh/` | instruction lifter, P-Code VM, console script, SLEIGH module | [lifter](docs/lifter.md) |
| `crates/`, `_native` | Rust P-Code IR and reference interpreter | [native](docs/native.md) |
| `wholeprog`, `trace`, `c64` | whole-program lifting to native code | [wholeprog](docs/wholeprog.md) |
| `cgen/` | machine code as structured C99 | [cgen](docs/cgen.md) |
| `cgen.facts`, `tools/startfacts.py` | run facts the C generator is given, and their producer | [certified](docs/certified.md) |
| `layout` | memory layout recovery and Ghidra export | [layout](docs/layout.md) |
| `tools/pcode2c.py` and others | a lift as C, MLIR and structured C | [structured](docs/structured.md) |
| `smc/` | self-modifying code scenarios and oracles | [smc-scenarios](docs/smc-scenarios.md) |
| `tools/wpcorpus.py`, `tools/sidcmp.py` | HVSC corpus runs and SID comparison | [corpus](docs/corpus.md) |
| `tools/vtools.py` and others | layout-validation references | [validation](docs/validation.md) |

## Tests

```bash
pytest tests/ -n auto --cov=deity_informant --cov-fail-under=85
```

Lint, the native build and the test guards are in [testing](docs/testing.md).

## References

Illegal-opcode semantics and cycles: "No More Secrets — NMOS 6510 Unintended Opcodes"
([csdb.dk/release/?id=258111](https://csdb.dk/release/?id=258111)).
