Skip to main content

A Python assembler and disassembler for the Signetics 2650 microprocessor

Project description

pyvacs

A Python assembler and disassembler for the Signetics/Philips 2650 microprocessor family.

pyvacs is a clean-room Python reimplementation of the classic VACS 1.24 assembler by A.C. Verschueren and W.H. Taphoorn (later ported to Windows by D.D. Spreen). It targets the same 2650 instruction set and opcode encodings, and adds a round-trip-safe disassembler so you can take a ROM image apart and put it back together byte-for-byte.

The 2650 powered consoles such as the Emerson Arcadia 2001 and its international clones — including the Australian-market Fountain Force 2 — as well as the Interton VC 4000 and a number of arcade boards.

Features

  • Full 2650 instruction set with every addressing mode (inherent, register, immediate, relative, absolute, zero-page branch, and absolute-indexed with auto-increment/decrement).
  • Two-pass assembler with labels, EQU/SET, expressions, and the ORG, DB/BYTE, DW/WORD, DD, DS, DBX, DBFILL directives.
  • VACS-style number literals ($1F, %1010, &17, 0FFh, 1010b) and a full expression evaluator (+ - * / MOD, shifts, bitwise, comparisons, HI/LO, $ location counter, character constants).
  • Predefined condition symbols (eq, gt, lt, un, plus z/p/n).
  • Round-trip-safe disassembler: any byte it cannot decode as a faithful instruction is emitted as a db, guaranteeing reassembly reproduces the original bytes.
  • Two command-line tools and a small importable API.

Install

pip install pyvacs

Or from a checkout:

pip install -e ".[dev]"

Command line

Assemble source to a binary:

pyvacs-asm program.asm -o program.bin

Disassemble a binary (with an address/hex listing):

pyvacs-dasm program.bin --listing

Disassemble to reassemblable source loaded at a given address:

pyvacs-dasm game.bin --origin 0x0000 -o game.asm

Library

from pyvacs import assemble, to_source

binary = assemble("""
        org $0000
start:  eorz r0
        bctr,un start
        end start
""").to_bytes()

source = to_source(binary, origin=0)   # round-trips back to `binary`

Example

        org $0000
start:  eorz  r0              ; clear register 0
        bctr,un go
        retc,un
go:     lodi,r0 $00
        loda,r0 msg,r1,+      ; load, auto-increment index r1
        comi,r0 $ff
        bcfr,eq done
        bcta,un go
done:   nop
msg:    db    $21,$1e,$ff
        end   start

Development

pip install -e ".[dev]"
pytest                 # tests + coverage (>85% enforced)
black --check src tests
pylint src/pyvacs

ROM test fixtures

The test-suite round-trips real Fountain Force 2 / Arcadia 2001 cartridge ROMs through the disassembler and assembler. The ROM images are not checked into this repository: on first run the tests download the TOSEC Arcadia 2001 set from the Internet Archive and cache it under tests/.romcache/ (git-ignored). If the download is unavailable the ROM-dependent tests skip automatically, so the core suite still runs offline. Set PYVACS_SKIP_ROM_TESTS=1 to skip them explicitly.

License

Apache License 2.0. See LICENSE.

The 2650 instruction encodings are derived by inspection of the public-domain VACS sources; no VACS code is included here.

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

pyvacs-0.1.0.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

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

pyvacs-0.1.0-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file pyvacs-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for pyvacs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0b8fe70a9fd033a64410d44c45c9396ec2e60d4e09ade8faa4406c518178daeb
MD5 6139aeba4688fccfb4a2843ae39aad5e
BLAKE2b-256 16361a9f164c06c6991109643306f0c94fed9c566f53edfad094d9462994f663

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvacs-0.1.0.tar.gz:

Publisher: publish.yml on anarkiwi/pyvacs

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

File details

Details for the file pyvacs-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pyvacs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30f3c08531e4a738e92475f5235a496d95ac4f81bdeb6eda920d5d5364dcdb60
MD5 8c93183cc0a31e02dca7ed9c18ca1716
BLAKE2b-256 b3a504cf668a8b129d8cbbe460fdf572807be8c16cbc41b36753ecb91292f8f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvacs-0.1.0-py3-none-any.whl:

Publisher: publish.yml on anarkiwi/pyvacs

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