Skip to main content

Read and write Commodore disk images

Project description

d64

This Python module enables access to disk image files (.d64, .d71, .d81) 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
  • support for .d81 subdirectories
  • support for .d81 relative files
  • 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-0.19.tar.gz (43.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-0.19-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: d64-0.19.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9

File hashes

Hashes for d64-0.19.tar.gz
Algorithm Hash digest
SHA256 57150f2a0492c7c3f26b0aca8ef0b7f972510b383d7ecf61afb77c5b91dbb6ab
MD5 16c03b3576bd347a15b487d269f9db60
BLAKE2b-256 6ba81aa289c79f621cbd92b6cdb3d2ae8f2f89d08da11d94abff15a97b6d9993

See more details on using hashes here.

File details

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

File metadata

  • Download URL: d64-0.19-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9

File hashes

Hashes for d64-0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 1e33d030eeea10bb146c4b84e3b6a673f019219e8ec622bb44e06e65ff9d0939
MD5 849c43dc6bb0bd5b0c6c657c33a344db
BLAKE2b-256 278bef665f77d49fc67fc018c48ae115989e3375e3905feceefa8abf768b1a18

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