Skip to main content

Cenbe's Commodore 64 Disk Image Library

Project description

This project is a Python library for writing programs to explore Commodore 64 disk images; my Disk Wrangler (q.v.) is based on it. It's particularly good at dissecting GEOS disks. Here's how to get started:

Create a DiskImage object. Just pass a Path to the constructor; he'll detect the image type (or raise an Exception if it's not one):

from pathlib import Path
from d64py.DiskImage import DiskImage
from d64py.Constants import CharSet

path = Path("/your/image/here.d64")
image = DiskImage(path)

Now you can read the directory:

dirEntries = image.getDirectory()
for dirEntry in dirEntries:
    print(f"{dirEntry.getDisplayFileName()}")

If you have a GEOS file, you can access the fields in the file header:

    if dirEntry.isGeosFile():
        geosFileHeader = dirEntry.getGeosFileHeader()
        print(f"permanent name string: {geosFileHeader.getPermanentNameString()}")

Say there's a geoWrite file on the disk, and you'd like to quickly see what's in it. We can ask the disk image to find the directory entry for us (if we specify CharSet.PETSCII, the filename will be translated to PETSCII first). All the routines that return lines of text return TextLine objects, which is just a helper class that includes a line of text and an error flag (for e.g. printing in red). geoWrite files return a list of pages, each of which is a list of TextLines.

dirEntry = image.findDirEntry("firstBootSrc", CharSet.ASCII)
pages = image.getGeoWriteFileAsLines(dirEntry)
for page in pages:
    for line in page:
        print(line.text)

Don't forget to release the image's resources when you're through with it (the entire image gets memory-mapped):

image.close()

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

d64py-3.2.1.tar.gz (256.5 kB view details)

Uploaded Source

Built Distribution

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

d64py-3.2.1-py3-none-any.whl (258.4 kB view details)

Uploaded Python 3

File details

Details for the file d64py-3.2.1.tar.gz.

File metadata

  • Download URL: d64py-3.2.1.tar.gz
  • Upload date:
  • Size: 256.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for d64py-3.2.1.tar.gz
Algorithm Hash digest
SHA256 0cb8166d7d08e716c7f9481eb19693c50384a1c596c361e80c6134c43f4cf0c4
MD5 d6704937646ed91030cd3f4617457af1
BLAKE2b-256 f605caa9cf5152500fd1826dc327ca6ed3f3d1322e4ebdf5e0a688eb4d1f08d7

See more details on using hashes here.

File details

Details for the file d64py-3.2.1-py3-none-any.whl.

File metadata

  • Download URL: d64py-3.2.1-py3-none-any.whl
  • Upload date:
  • Size: 258.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for d64py-3.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5032648631dd4033ab59ce635ac2e09dfc6a0ff1f665b5be4cf984375d4da6f4
MD5 ef402a5b3970207c9f3c2acbe19f917d
BLAKE2b-256 cea356cb857e0f40517b68af64bfa03694cd3e0bbb8797ce00984ad471638d46

See more details on using hashes here.

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