Metadata-Version: 2.4
Name: vagrant-moses
Version: 0.18.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Emulators
Requires-Dist: deity-informant>=0.10.0 ; extra == 'cgen'
Requires-Dist: tqdm>=4 ; extra == 'cli'
Requires-Dist: jennings>=0.10.0 ; extra == 'cpu'
Requires-Dist: tqdm>=4 ; extra == 'dev'
Requires-Dist: jennings>=0.10.0 ; extra == 'dev'
Requires-Dist: numpy>=1.23 ; extra == 'dev'
Requires-Dist: pylibresidfp>=0.5.0 ; extra == 'dev'
Requires-Dist: deity-informant>=0.10.0 ; extra == 'dev'
Requires-Dist: pyelftools ; extra == 'dev'
Requires-Dist: black>=24 ; extra == 'dev'
Requires-Dist: pylint>=3 ; extra == 'dev'
Requires-Dist: pytest>=7 ; extra == 'dev'
Requires-Dist: pytest-cov>=4 ; extra == 'dev'
Requires-Dist: pytest-xdist>=3 ; extra == 'dev'
Requires-Dist: numpy>=1.23 ; extra == 'sidorder'
Requires-Dist: pylibresidfp>=0.5.0 ; extra == 'sidorder'
Requires-Dist: tqdm ; extra == 'sidorder'
Provides-Extra: cgen
Provides-Extra: cli
Provides-Extra: cpu
Provides-Extra: dev
Provides-Extra: sidorder
License-File: LICENSE
Summary: Standalone C64 machine model: memory map, banked bus and ROMs, VIC-II and CIAs over a two-phase scheduler, a cycle-exact 6510 machine, KERNAL traps, IRQ dispatch, and native d64/d71/d81/t64 media extraction
Keywords: c64,6510,mos6510,c64k,irq,interrupt,sid,retrocomputing,d64,d81,t64
Author: Josh Bailey
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/anarkiwi/vagrant-moses
Project-URL: Issues, https://github.com/anarkiwi/vagrant-moses/issues
Project-URL: Source, https://github.com/anarkiwi/vagrant-moses

# vagrant-moses

A standalone C64 machine model: the memory map, the `$01`-banked bus and ROMs
(sidplayfp's ROM-less set, or the real ones fetched and SHA-256 verified into a cache),
the VIC-II and two CIAs over a shared two-phase event scheduler, a cycle-exact 6510
machine matching libsidplayfp, an optional 17xx REU matching VICE, KERNAL file/keyboard traps, the power-on RAM, the
installed-interrupt-vector discovery, the ROM-free IRQ dispatch path, and native
extraction of files from release media (zip/gzip, d64/d71/d81, t64, p00).

Pure Python with no runtime dependencies (wheels also carry a native Rust `Machine`); the CPU-driven parts (`Machine`, `flat_mpu`,
`KernalHost`) run on jennings via the `cpu` extra; the media CLI's progress bar
needs the `cli` extra. The SID's audio model is not implemented here: `sidorder` judges
envelopes through the optional pylibresidfp (the `sidorder` extra). SID-file knowledge
(PSID/RSID containers, subtune headers, drivers) is deliberately not here.

## Install

```bash
pip install -e ".[cpu]"            # add ".[sidorder]" / ".[cgen]" for sidorder / cgen
```

## Use

```python
from vagrant_moses import Cia, Machine, Scheduler, Vic, c64

mem = bytearray(c64.poweron_ram())                       # 64 KiB power-on image
vec, kernal = c64.installed_vector(mem, written, (lo, hi))
entry_pc = c64.install_irq_entry(vm, vec, kernal, img=(lo, hi))

sched = Scheduler()
vic = Vic(sched, ntsc=False, irq=lambda on: ..., set_ba=lambda on: ...)
cia = Cia(sched, interrupt=lambda on: ..., new=False)

machine = Machine(sids={0xD400: sid_device})            # cycle-exact C64
machine = Machine(reu=512)                               # with a 1750 REU at $DF00
machine = Machine(roms={0xE000: kernal})                 # a real KERNAL, ROM-less elsewhere
machine.ram[0x1000:0x1000 + len(code)] = code
machine.run(machine.reset(0x1000) + 985248)              # one PAL second
machine.set_key(1, 2, True)                              # hold A (PA1/PB2, VICE keyarr order)
fork = machine.clone()                                   # independent, cycle-identical copy
```

```python
from vagrant_moses import iter_prgs

for path, prg in iter_prgs("release.zip", blob):        # zip -> d64.gz -> d64 -> PRG
    ...
```

```bash
pip install "vagrant-moses[cli]"
vagrant-moses media extract dl/ -o prg/                 # prints sha256 size $load path
```

## Docs

- [The machine model: memory map, bus, ROMs, chips, machine, REU, KERNAL and IRQ dispatch](docs/c64.md)
- [The native machine: Rust port, hooks, clone, the SMC recorder, native call queue and interrupt frames with budgets, threading, verification](docs/native.md)
- [SID write order and hard restart: event patterns, the order cover, the settled hard restart](docs/sidorder.md)
- [C64 programs as C: the I/O model and host over deity-informant's 6502 → C translator](docs/cgen.md)
- [Release media: nested containers, disk geometries, tapes, and the CLI](docs/media.md)

## Develop

```bash
pip install -e ".[dev]"
black --check src tests scripts && pylint src tests scripts && pytest
```

