Skip to main content

Read and write Commodore disk images

Project description

d64

This Python module enables access to disk image files (.d64, .d71, .d80, .d81, .d82) used by various Commodore microcomputer emulators and tools.

It provides familiar interfaces for developers to read and write program and data files within an image.

In addition it contains tools useful to inspect and modify images, for example a script to check the integrity of an image.

Examples

Classes and functions reside in the d64 module, the whole module may be imported or just those definitions referenced by the user.

Displaying an image contents

To perform a directory list

from d64 import DiskImage

with DiskImage('squadron.d64') as image:
    for line in image.directory():
        print(line)

This prints out

0 "SQUADRON        " Q9 2A
15   "SQUADRON PAL"     PRG
15   "SQUADRON NTSC"    PRG
634 BLOCKS FREE.

Copying a file from an image

To extract, for example, a BASIC program and write it to a file

from d64 import DiskImage

with DiskImage('test.d64') as image:
    with image.path(b'METEOR'.open() as in_f:
        with open('meteor.prg'), 'wb') as out_f:
	    out_f.write(in_f.read())

TODO

  • detailed documentation
  • checking support for .d81 subdirectories
  • better docstrings
  • more examples

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

d64-1.3.tar.gz (54.1 kB view details)

Uploaded Source

Built Distribution

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

d64-1.3-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

Details for the file d64-1.3.tar.gz.

File metadata

  • Download URL: d64-1.3.tar.gz
  • Upload date:
  • Size: 54.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.9

File hashes

Hashes for d64-1.3.tar.gz
Algorithm Hash digest
SHA256 deb5557466aef2c574945d7d4e3e18cdf5f9804c9afe4a8d1f64ddc8c5b84e66
MD5 88f3f5dbcf63cde5847e9d7e07330f44
BLAKE2b-256 8937f3a3050b297851689ae087d94ffbe0e092078506ab3c7f4e47bb6e5363e6

See more details on using hashes here.

File details

Details for the file d64-1.3-py3-none-any.whl.

File metadata

  • Download URL: d64-1.3-py3-none-any.whl
  • Upload date:
  • Size: 47.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.9

File hashes

Hashes for d64-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5a2a304031fc93141cd824d44a3610b5703fa2fa60c33195906e59e62b833bf0
MD5 56a0825ddba0508133808700864c5170
BLAKE2b-256 391a0d9316aa1a28791c139349199169e4bcbcbc138fced40002ded975acd743

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