Skip to main content

Python automation framework for driving asid-vice (a binmon-extended C64 emulator) — protocol client, key matrix + chord typing, screen scrape, container management, code-coverage harness.

Project description

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_dockerViceContainer 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.expectExpect 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vice_driver-0.4.0.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vice_driver-0.4.0-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

Details for the file vice_driver-0.4.0.tar.gz.

File metadata

  • Download URL: vice_driver-0.4.0.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vice_driver-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f8168240dcb599a3440f27375dca1f6698d04c31df2a0f5a9d353e0fa71ca7a4
MD5 8c77a920cc02814b48c56c4f7f4fcbb6
BLAKE2b-256 9a3ddc7547b18d05a5cd23df7acc9afe01bd17a904ccae2380b8e5ec5d074b88

See more details on using hashes here.

Provenance

The following attestation bundles were made for vice_driver-0.4.0.tar.gz:

Publisher: publish.yml on anarkiwi/vice-driver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vice_driver-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: vice_driver-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 38.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vice_driver-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abdec1441f2b9335e047a4892b77e12568d8187a57792a2aca79d62b8d33a6c2
MD5 b4f45095048cedcc8ad9f9a23cedb3b3
BLAKE2b-256 621c98fa16ff9448990efef1a87763833bf052f346d49935ea168b4dba937da1

See more details on using hashes here.

Provenance

The following attestation bundles were made for vice_driver-0.4.0-py3-none-any.whl:

Publisher: publish.yml on anarkiwi/vice-driver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page