Skip to main content

vice-driver

CI License: Apache 2.0

vice-driver is a Python automation framework for driving asid-vice, an extension of the VICE C64 emulator that exposes a binary monitor with key-matrix tap and screen-scrape opcodes.

It is application-agnostic: use it to drive any C64 program inside a binmon-extended VICE container. (The companion defmon-driver package builds defMON-specific automation on top of this library.)

The driver itself is pure-Python with no runtime dependencies beyond the standard library. It speaks the asid-vice binary monitor protocol over a single TCP socket per connection.

Capabilities

  • vice_driver.binmon — wire-level binary-monitor client. Handles framing, request/response matching by id, asynchronous events (STOPPED / RESUMED / JAM), checkpoints (CHECK_EXEC / CHECK_LOAD / CHECK_STORE), cpuhistory, mem_get / mem_set, register get/set, keymatrix tap + set + get, SCREEN_GET.
  • vice_driver.keys — symbolic C64 key-matrix names (case-insensitive with aliases) + ASCII → chord conversion for typing text into programs that read the matrix directly.
  • vice_driver.screen — SCREEN_GET response parser + screencode → PETSCII → ASCII rendering with find_text().
  • vice_driver.display — DISPLAY_GET / PALETTE_GET parser + true-colour framebuffer extraction (DisplaySnapshot.to_rgb() / .save_png()) with a stdlib-only PNG writer. Grabs VICE's own rendered display (border, sprites, raster effects, any video mode), not just text-mode screen codes.
  • vice_driver.vice_docker — ViceContainer context manager that spins up a one-shot asid-vice Docker container with the right binmon binding, sound dump, SID configuration, and disk mounts.
  • vice_driver.coverage — per-action 6502 code-coverage harness built on CHECK_EXEC checkpoints + cpuhistory drains. Byte- or page-granularity.
  • vice_driver.expect — Expect dataclass + verify() polling helper for "did this byte change to X within T seconds" assertions.

Requirements

  • Python ≥ 3.10
  • Docker. The default image is the published anarkiwi/asid-vice:latest (pulled automatically on first run, or docker pull anarkiwi/asid-vice:latest). It is the full GTK3 (X11) build; its entrypoint auto-starts Xvfb, so binmon driving works with no host X server. Point ViceContainer(image=...) at a locally built image to override.
  • A C64 .d64 (or PRG / TAP) image to autostart.

Installation

pip install vice-driver

For development:

git clone https://github.com/anarkiwi/vice-driver
cd vice-driver
pip install -e ".[dev]"
pytest

Quick start

import logging

from vice_driver import BinMon, DiskMount, ViceContainer

logging.basicConfig(level=logging.INFO)

container = ViceContainer(
    autostart="/work/program.d64",
    mounts=[DiskMount("/host/path/to/program.d64", "/work/program.d64", read_only=True)],
)

with container:
    bm = BinMon("127.0.0.1", 6502)
    bm.connect(timeout=10.0, attempts=80, retry_delay=0.25)
    # Drain the initial halt and resume the CPU.
    bm.exit()

    # ... drive the program: bm.keymatrix_tap, bm.mem_get/set, bm.screen_get ...

    bm.close()

Testing

pytest                      # runs unit tests + lint + format gates
pytest --cov-report=html    # open htmlcov/index.html for the line-level report

CI enforces:

  • ruff check (lint)
  • ruff format --check (format)
  • black --check (format, redundant with ruff format but explicit)
  • pytest (unit tests)
  • Coverage ≥ 85% over vice_driver/

Run individual gates locally:

ruff check vice_driver tests
ruff format --check vice_driver tests
black --check vice_driver tests
pytest --cov=vice_driver --cov-fail-under=85

License

Apache 2.0 — see LICENSE.

Metadata

Release files for vice-driver 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vice-driver 0.5.0
File Size Uploaded
vice_driver-0.5.0.tar.gz 39.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vice-driver 0.5.0
File Interpreter ABI Platform
vice_driver-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 78.4 kB

Release files / vice_driver-0.5.0.tar.gz

Download URL vice_driver-0.5.0.tar.gz
Size 39.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dbf8196bfb23724ba4dc0d25c9e3576a80c420406e95e437c5feb852168cb8b6
BLAKE2b-256 checksum
How to use checksums
2916d8e65f8e5d7c7bfac203e3627e6609636252853b809aa0ad4b7e1fd77c64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.

Transparency log

Release files / vice_driver-0.5.0-py3-none-any.whl

Download URL vice_driver-0.5.0-py3-none-any.whl
Size 38.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de25bb93d523900ac82f827ace365b81eaef25e7b371136d39839d44e5cbf57c
BLAKE2b-256 checksum
How to use checksums
45a372791377539b4c195b54420b65b78bf1c3df2e327745c995a580b413c917
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page