Skip to main content

An OOP approach to represent nametables on the NES

Project description

nametable serves to bridge the gap between Nintendo Entertainment System's Picture Processing Unit's nametables and Python.

Its main goal is to create an Object Oriented approach to represent a nametable on the NES.

It provides the ability to create instances of Pattern and Block directly from memory and inserts them into PatternTable and Nametable, respectively.

    >>> import nametable

    >>> pattern = nametable.PatternMeta(bytes.fromhex("41 C2 44 48 10 20 40 80 01 02 04 08 16 21 42 87"))
    >>> pattern.numpy_array
    array(
        [
            [0, 1, 0, 0, 0, 0, 0, 3],
            [1, 1, 0, 0, 0, 0, 3, 0],
            [0, 1, 0, 0, 0, 3, 0, 0],
            [0, 1, 0, 0, 3, 0, 0, 0],
            [0, 0, 0, 3, 0, 2, 2, 0],
            [0, 0, 3, 0, 0, 0, 0, 2],
            [0, 3, 0, 0, 0, 0, 2, 0],
            [3, 0, 0, 0, 0, 2, 2, 2],
        ],
        dtype=ubyte,
    )

    >>> pattern_table = nametable.PatternTable((nametable.Pattern(pattern),))
    >>> block = nametable.Block(pattern_table, (0, 0, 0, 0))
    >>> block.numpy_array
    array(
        [
            [0, 1, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 0, 0, 3],
            [1, 1, 0, 0, 0, 0, 3, 0, 1, 1, 0, 0, 0, 0, 3, 0],
            [0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0],
            [0, 1, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0],
            [0, 0, 0, 3, 0, 2, 2, 0, 0, 0, 0, 3, 0, 2, 2, 0],
            [0, 0, 3, 0, 0, 0, 0, 2, 0, 0, 3, 0, 0, 0, 0, 2],
            [0, 3, 0, 0, 0, 0, 2, 0, 0, 3, 0, 0, 0, 0, 2, 0],
            [3, 0, 0, 0, 0, 2, 2, 2, 3, 0, 0, 0, 0, 2, 2, 2],
            [0, 1, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 0, 0, 3],
            [1, 1, 0, 0, 0, 0, 3, 0, 1, 1, 0, 0, 0, 0, 3, 0],
            [0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0],
            [0, 1, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0],
            [0, 0, 0, 3, 0, 2, 2, 0, 0, 0, 0, 3, 0, 2, 2, 0],
            [0, 0, 3, 0, 0, 0, 0, 2, 0, 0, 3, 0, 0, 0, 0, 2],
            [0, 3, 0, 0, 0, 0, 2, 0, 0, 3, 0, 0, 0, 0, 2, 0],
            [3, 0, 0, 0, 0, 2, 2, 2, 3, 0, 0, 0, 0, 2, 2, 2],
        ],
        dtype=ubyte,
    )

    >>> nametable.Nametable((block,))
    Nametable(Block(PatternTable((Pattern(PatternMeta(...)),)), (0, 0, 0, 0)),)

Getting Help

Please use the python-nametable tag on StackOverflow to get help.

Aiding others and answers questions is a fantastic way to help!

Project Information

nametable is released under the GPL3 license. Its documentation is hosted on Github and the repository is hosted on Github. The latest release is hosted on PyPI.

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

nametable-0.2.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

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

nametable-0.2.0-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nametable-0.2.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.13

File hashes

Hashes for nametable-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e6ddf64f04835faccc4941d8f15e049cbd56fe23c9cc04da40d66ea5509ead54
MD5 cffccae75ab8372232b2ee79534d39a3
BLAKE2b-256 a809076021a2d5e8ea6483529bcbc164eadde4049d4620bad3a0bb9cd5aa1407

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nametable-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.13

File hashes

Hashes for nametable-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa7712156c44b22adce0e37c72850f4cd486c10878f8dd112ff93ba2cc1c3d88
MD5 c26253637c59d0203356fcbb70773c1f
BLAKE2b-256 c405dd2e28ddcb91758dcf84f9bdd4c7dc74efdae7e36c1703a96a5b05a08bbd

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