Shared base for pure-Python C64 SID tracker parsers: PSID/RSID container, loaded-image model, and packed/relocating playroutine detection
Project description
pysidtracker
Shared base for the pure-Python C64 SID tracker parsers (pygoattracker, pysidwizard, pydmcsid, pyfuturecomposer, pymusicassembler, pydefmon, pyjch).
Provides one implementation of the pieces every format parser duplicated:
parse_sid_header/SidHeader— PSID/RSID container header parsing.SidImage— a loaded 64 KiB C64 memory image with absolute-addressed accessors, from a.sidcontainer or a bare.prg.read_bytes— path /bytes/ file-like source dispatch.SidErrorhierarchy —SidParseError,SidFormatError,EmulatorUnavailable.detect_playroutine/PlayroutineKind— the untrustworthy-header detector: static signature recognition first, then an emulated init run to classifyDIRECT/RELOCATED/PACKED/UNKNOWNplayroutines.BaseSidParser— the class each format subclasses for a consistentread/parse/detectAPI.CodePattern/find_code_all/find_code_first— masked 6502 code-fragment search with operand capture: locate a player fingerprint by its opcode skeleton (per-tune operand bytes wildcarded) and read the captured immediate/address. The one primitive every relocatable player's reader needs.registers— documented C64 hardware register map (SID/CIA/VIC, IRQ/NMI and CPU vectors) with predicates (is_sid_reg,is_cia_timer, …) andfind_register_stores, a scanner for absolute stores to a set of addresses.trace_init/InitTrace— run a tune's init in py65 under a write observer and report where it programs the CIA timer latch (cadence) and the IRQ/NMI vectors (the real play routine an IRQ-driven header hides).
Install
pip install pysidtracker # core (stdlib only)
pip install pysidtracker[emu] # + py65, to unpack packed/relocating tunes
pip install pysidtracker[fast] # + numpy, to accelerate the image scan
Usage
from pysidtracker import BaseSidParser, PlayroutineKind
class MyParser(BaseSidParser):
def recognize(self, image):
return image.find(b"MYSIG") # truthy anchor when found
def parse(self, data, **kw):
image = self.load_image(data)
... # decode image.mem into a model
det = MyParser().detect("tune.sid")
if det.kind is PlayroutineKind.PACKED:
... # header was not trustworthy
See docs/design.md for the detection model and how the format packages consume this base.
Development
pip install -e ".[dev]"
pytest --cov=pysidtracker
Apache-2.0 licensed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysidtracker-0.2.0.tar.gz.
File metadata
- Download URL: pysidtracker-0.2.0.tar.gz
- Upload date:
- Size: 35.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6abbb5b112fe7f8e0d4aaa5644617e5a437902e10b2e065c17ce00c6f6bc7819
|
|
| MD5 |
c4e39f65d99c6d6f8d54b60a10c9a80f
|
|
| BLAKE2b-256 |
c70c7fc217675920ef41cc2c80396124b20b337d74bd7c5ff3c8e9ef0a196246
|
Provenance
The following attestation bundles were made for pysidtracker-0.2.0.tar.gz:
Publisher:
publish.yml on anarkiwi/pysidtracker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysidtracker-0.2.0.tar.gz -
Subject digest:
6abbb5b112fe7f8e0d4aaa5644617e5a437902e10b2e065c17ce00c6f6bc7819 - Sigstore transparency entry: 2126308062
- Sigstore integration time:
-
Permalink:
anarkiwi/pysidtracker@8d117d2f468895bade452b6d1aa17d6a51c13b18 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/anarkiwi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8d117d2f468895bade452b6d1aa17d6a51c13b18 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pysidtracker-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pysidtracker-0.2.0-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd4362654a3b1ab79295bd213243bc8189f1842afb8d716ace83e2ff163e73ea
|
|
| MD5 |
11d31e83652074fa51519d32d055c573
|
|
| BLAKE2b-256 |
fecbdf4f18a264a020d071bb6914d4bf6dad8e59759942d82d298158154048ba
|
Provenance
The following attestation bundles were made for pysidtracker-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on anarkiwi/pysidtracker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysidtracker-0.2.0-py3-none-any.whl -
Subject digest:
bd4362654a3b1ab79295bd213243bc8189f1842afb8d716ace83e2ff163e73ea - Sigstore transparency entry: 2126308344
- Sigstore integration time:
-
Permalink:
anarkiwi/pysidtracker@8d117d2f468895bade452b6d1aa17d6a51c13b18 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/anarkiwi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8d117d2f468895bade452b6d1aa17d6a51c13b18 -
Trigger Event:
release
-
Statement type: