# SPDX-License-Identifier: MIT """Census of the Oric firmware and software lists we hold, read in place. python -I scripts/census.py firmware # $MAME_ROMPATH sets (and $FRONTEND_BIOS/Oric if set) python -I scripts/census.py softlist # $MAME_HASHPATH/oric1_cass.xml (CC0) python -I scripts/census.py sets # which No-Intro / TOSEC Oric sets exist Nothing is copied or written except the report on stdout. `firmware` hashes every image in MAME's Oric sets by SHA-1 and names the known ones; FRONTEND_BIOS (optional) names a front-end BIOS folder whose Oric/ subfolder is hashed too. `softlist` counts MAME's cassette list (CC0-1.0 data). `sets` reports that No-Intro has no Oric set and looks for a TOSEC "Tangerine" folder under TOSEC_DIR. Where things live is an environment variable, never a path in this repository. """ from __future__ import annotations import argparse import collections import hashlib import os import sys import xml.etree.ElementTree as ET import zipfile from pathlib import Path # `mame -listroms oric1 orica telstrat prav8d oric_microdisc oric_jasmin` (MAME 0.285, # 2026-11-26), by SHA-1. Role and set. The "_le" names are MAME's own; their meaning is # not documented in anything read here (U-list in docs/handoff-brief.md). KNOWN = { "333116e6884d85aaa4dfc7578a91cceeea66d016": "Oric-1 BASIC 1.0 (oric1; MAME default)", "84759cc8faae53070f1c8ce8408982a0edcb0796": "Oric-1 BASIC 1.0, UK (oric1)", "9451a1a09d8f75944dbd6f91193fc360f1de80ac": "Atmos BASIC 1.1b (orica; MAME default)", "845e1a893de3dc0f856fdf2f69c3b73770b4094f": "BASIC 1.2 (orica option; third-party)", "b727d5c3bbc8cb1d510f224eb1e0d90d609e8506": "BASIC 1.21 (orica option; third-party)", "9ab6dc47b6e9dc65a4137ce0f0f12fc2b6ca8442": "BASIC 1.22 (orica option; third-party)", "b01cabb1a21980a6785a2fe37a8f8572c892123f": "BASIC 1.1, German (orica option)", "4fdbadd68db9ab8ad1cd56b4e5cbe51a9c3f11ae": "BASIC 1.1, Spanish (orica option)", "2a4583df3b59ca454d67d5631f242c96ec4cf99a": "BASIC 1.1, French (orica option)", "ce53acf84baec6ab5cbac9f9cefa71b3efeb2ead": "BASIC 1.1, Swedish (orica option)", "589ff66fac8e06d65af3369491faa67a71f1322a": "BASIC 1.1, UK (orica option)", "35f92a0477a88f5cf564971125047ffcfa02ec10": "Telestrat Telematic (telstrat)", "9e9af51dae3199cccf49ab3f0d47e2b9be4ba97d": "Telestrat Teleass (telstrat)", "f5f70a0eb59f8cd6c261e179ae78ef906f68ed63": "Telestrat Hyper-BASIC (telstrat)", "86fc8dc0932f983efa199e31ae05a4424772f959": "Telestrat Telemon 2.4 (telstrat)", "7afc276cb118adff72e4f16698f94bf3b2c64146": "Pravetz 8D ROM (prav8d)", "0d2ef6e67322f48f4b7e08d8bbe68827e2074561": "Microdisc EPROM, 8 KB (oric_microdisc)", "70e59b8abd67092f050462abc6cb5271e4c15f01": "Jasmin boot ROM, 2 KB (oric_jasmin)", } MAME_SETS = ("oric1", "orica", "telstrat", "prav8d", "oric_microdisc", "oric_jasmin") def record(name: str, data: bytes, seen: dict[str, list[str]]) -> None: seen.setdefault(hashlib.sha1(data).hexdigest(), []).append(name) def firmware(_: argparse.Namespace) -> int: seen: dict[str, list[str]] = {} rompath = os.environ.get("MAME_ROMPATH") if rompath: for name in MAME_SETS: path = Path(rompath) / f"{name}.zip" if not path.exists(): print(f"MAME set missing: {name}.zip") continue with zipfile.ZipFile(path) as archive: for member in archive.namelist(): record(f"{name}.zip:{member}", archive.read(member), seen) bios = os.environ.get("FRONTEND_BIOS") if bios: for path in sorted((Path(bios) / "Oric").glob("*")): if path.is_file(): record(f"FRONTEND_BIOS/Oric/{path.name}", path.read_bytes(), seen) print(f"known images held: {sum(sha in seen for sha in KNOWN)} of {len(KNOWN)}") for sha, role in KNOWN.items(): print(f" {'have' if sha in seen else 'MISSING':7} {sha} {role}") others = {sha: where for sha, where in seen.items() if sha not in KNOWN} print(f"other images (not named above): {len(others)}") for sha, where in sorted(others.items(), key=lambda item: item[1][0]): print(f" {sha} {where[0]}" + (f" (+{len(where) - 1})" if len(where) > 1 else "")) return 0 def softlist(_: argparse.Namespace) -> int: hashes = os.environ.get("MAME_HASHPATH") if not hashes: print("set MAME_HASHPATH to MAME's hash/ folder", file=sys.stderr) return 2 root = ET.parse(Path(hashes) / "oric1_cass.xml").getroot() entries = list(root.iter("software")) support = collections.Counter(s.get("supported", "yes") for s in entries) publishers = collections.Counter((s.findtext("publisher") or "?") for s in entries) years = collections.Counter((s.findtext("year") or "?") for s in entries) print(f"oric1_cass.xml: {len(entries)} entries; supported: {dict(support)}") print(" years:", dict(sorted(years.items()))) print(" top publishers:", dict(publishers.most_common(8))) return 0 def sets(_: argparse.Namespace) -> int: base = os.environ.get("NO_INTRO_DIR") if base: hits = [p.name for p in Path(base).iterdir() if "oric" in p.name.lower() or "tangerine" in p.name.lower()] print("No-Intro Oric folders:", hits or "none (No-Intro has no Oric set)") tosec = os.environ.get("TOSEC_DIR") if not tosec: print("TOSEC: TOSEC_DIR unset; this machine's mirror holds no Tangerine TOSEC set (2026-11-26)") else: hits = [p for p in Path(tosec).rglob("*") if p.is_dir() and "oric" in p.name.lower()][:20] print("TOSEC Oric folders:", [str(p.relative_to(tosec)) for p in hits] or "none") return 0 def main() -> int: parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) sub = parser.add_subparsers(dest="command", required=True) for name, func in (("firmware", firmware), ("softlist", softlist), ("sets", sets)): sub.add_parser(name).set_defaults(func=func) args = parser.parse_args() return args.func(args) if __name__ == "__main__": sys.exit(main())