Skip to content

[docs] The jtrm-*.md files cite source code as their source — the authority chain is circular #522

Description

@JoeMatt

Found during the #513/#514 controller spike (PR #521), which hit it directly: the spike needed TR10's joystick-matrix section, went to docs/jtrm-jerry.md §"Joystick Interface" as CLAUDE.md instructs, and found it cites src/jerry/joystick.c as its source.

The problem

CLAUDE.md makes two claims about these files:

Authoritative hardware reference: The Jaguar Technical Reference Manual (JTRM) is the ground-truth spec for all emulation decisions.
docs/jtrm-*.md — synthesized from the Jaguar Technical Reference Manual... Read these before making hardware-accuracy decisions. They supersede comments in source code.

And warns, correctly, that source comments in this tree have been wrong for years at a time — the PIT clock rate being the standing example.

But 21 of the 23 Source: lines across docs/jtrm-*.md cite source files, not the manual:

file cites source code
jtrm-jerry.md 10 / 10
jtrm-gpu-dsp.md 5 / 5
jtrm-clocks-timing.md 3 / 4
jtrm-object-processor.md 2 / 2
jtrm-blitter.md 1 / 2

So for most sections the authority chain is circular: the doc that is supposed to validate the implementation was derived from the implementation. A wrong constant in jerry.c would be faithfully copied into jtrm-jerry.md and then cited back as the manual's word — which is exactly the failure mode the JTRM-over-comments rule exists to prevent.

This is not hypothetical. The spike found that docs/lightgun-design.md had recorded a Team Tap assumption as "plausible, not TR10-confirmed", and reading TR10 directly showed the assumption was backwards (the adapter wire-ORs the B0/LP line rather than isolating it). Direct manual reads change answers.

What is not wrong

The content may well be correct — much of it probably is, and jtrm-register-map.md has no Source: lines at all. The defect is provenance, not necessarily accuracy. Nothing here should be deleted on suspicion.

Suggested fix, cheapest first

  1. Relabel honestly. Change Source: src/foo.c to something that does not claim manual authority — e.g. Derived from: src/foo.c (NOT verified against the JTRM). Pure documentation change, no research, and it immediately stops the docs from over-claiming.
  2. Verify the load-bearing sections against the PDFs and upgrade those citations to page references, the way jtrm-blitter.md:85 and jtrm-clocks-timing.md:62 already do (JTRM v8 pp. 66, 70-71, JTRM Rev 10 p.8). Those two lines are the model.
  3. Prioritise by risk: clocks/timing and the interrupt/register sections are the ones an accuracy decision actually turns on.

Read the PDF pages as rendered images where a table is involved. The spike found pdftotext reorders columns in TR10's 16-row matrix table, which would have produced a confidently wrong transcription.

Note for agents and sessions

Until this is fixed, "the JTRM docs say X" is not by itself sufficient grounds for a hardware-accuracy change when the relevant Source: line points at source code. Check which kind of citation you are standing on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accuracyHardware-accuracy divergence (timing, register, or ISA behaviour)documentationDocs, site, wiki, release notesno-codeDocumentation-only change, no codesize: MEstimate: medium (~2-4 days)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions