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.0.tar.gz (255.9 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.0-py3-none-any.whl (257.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: d64py-3.2.0.tar.gz
  • Upload date:
  • Size: 255.9 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.0.tar.gz
Algorithm Hash digest
SHA256 7bae5171227b736d3ed995140016ef668d96af3c832bf74a1d53c4b12c763b2b
MD5 79751d5c76f9d780be84d31073b9368b
BLAKE2b-256 a47c6c671461327157b714b1750cf1cecbb6b86d75a34beddcc89430b482aa54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: d64py-3.2.0-py3-none-any.whl
  • Upload date:
  • Size: 257.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c1d4af9a1c19abbba63d43484c7d412e358d2be33ec46dd8175d72f0899ac0f
MD5 4fdd24b3f4c26eabd664a8617dd87997
BLAKE2b-256 1875abf7ce1d283133580b897d74837b891a496abdecde439c4b30aec79c555a

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