Skip to main content

Python codecs for PETSCII encodings

Project description

Introduction

The cbmcodecs package provides a number of encodings for handling text from Commodore 8-bit systems. Much of the credit for this package must go to Linus Walleij of Triad, as these codecs were built from his PETSCII to Unicode mappings which can be found at http://www.df.lth.se/~triad/krad/recode/petscii.html The screencodes codec was created by hand later and borrows from them.

Usage

Currently there are four codecs defined for variations of the PETSCII encoding:

petscii-c64en-lc

The English version of the Commodore 64 mixed-case character set

petscii-c64en-uc

The English version of the Commodore 64 upper-case/graphics character set

petscii-vic20en-lc

The English version of the VIC-20 mixed-case character set

petscii-vic20en-uc

The English version of the VIC-20 upper-case/graphics character set

There are two codecs defined to handle the Screencode (POKE) encoding:

screencode-c64-lc

Mixed-case mapping to screencodes (POKE) used by the Commodore 64 and Vic20

screencode-c64-uc

Upper-case/graphics mapping to screencodes (POKE) used by the Commodore 64 and Vic20

Simply import the cbmcodecs package and you will then be able to use them as with any of the encodings from the standard library:

import cbmcodecs


with open('file.seq', encoding='petscii-c64en-lc') as f:
    for line in f:
        print(line)

Python Version Note

Currently only Python 3 is supported (tested on 3.5+). May or may not work on older versions.

License

As with the original PETSCII to Unicode mapping files, the cbmcodecs package is Licensed under the GNU GPL Version 2, see the LICENSE.txt file for the full text.

Unicode symbols used

Aside from the regular alphanumerics and symbols, the unicode mapping uses the following unicode block drawing and other symbols to mimic a bunch of PETSCII characters:

£ π ✓ ← ↑ ─ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼ ╭ ╮ ╯ ╰ ╱ ╲ ╳ ▁ ▂ ▃ ▄ ▌ ▍ ▎ ▏ ▒ ▔ ▕ ▖ ▗ ▘ ▚ ▝ ○ ● ◤ ◥ ♠ ♣ ♥ ♦

Credits

Linus Walleij - Original C64 and VIC-20 mappings Dan Johnson - Translation of C64 & VIC-20 mappings to python codecs Irmen de Jong - Screencode mappings, bug fixes and unit tests.

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

cbmcodecs-0.2.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

cbmcodecs-0.2.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file cbmcodecs-0.2.0.tar.gz.

File metadata

  • Download URL: cbmcodecs-0.2.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cbmcodecs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7a0e33dcfcc24d7b21bd43bafe848057757ffe853375df7bae4d8bb1c9559ac7
MD5 38b04ba0db87e3d37907d1afb5d43d51
BLAKE2b-256 cdd944c058899527feff7f25e95975146d583165b37cb455f1bebac4f3d97ea9

See more details on using hashes here.

File details

Details for the file cbmcodecs-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cbmcodecs-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3d72f147b580712b671f8e4fe81d2df38e91a3c2bccef0fd6297226a9a0db5a
MD5 c9c1e5abff3fd993bdbe8840c538fcee
BLAKE2b-256 3038336b26aa75744357bff0711d68b1638d0315c9231e53191f9baee8006e99

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page