docs(reference): five diagrams - #207
Merged
Merged
Conversation
Nothing in the Programmer's Reference Guide was drawn, while the book
carried a twelve-step pipeline, a six-mode attribute story and a 64 KB
memory map that are all inherently spatial. Five figures, one per thing
that prose was doing badly:
fig-1-1-ladder the five precedence layers, with the rung an
ensemble run inserts between the per-system file
and the command line
fig-3-1-pipeline the twelve steps, and the setting that enters at
each one, bracketed where the frame stops being
full colour
fig-3-2-cells one hardware cell in each of the four picture
modes, with the attribute bytes and their addresses
fig-4-1-audio the DAC path against the sampler path, and what
each costs the 6510
fig-5-1-memory the 64 KB during a bitmap scene, isometric: four
16 KB windows on one memory, colour RAM outside
all of them
Drawn by scripts/make_reference_diagrams.py with Pillow and the vendored
faces, in the template's own palette, so a diagram sits in the same type
and the same blue as the page around it. Deliberately not Typst
drawings: a Typst figure is invisible on github.com, and the Markdown is
the book. Deliberately not the guide's cv2.putText path either, whose
Hershey stroke font next to Jost reads as a screenshot of a different
document.
Committed, like the generated appendices and for the same reason: the
release renders the books with `uv run --no-project` and cannot
regenerate anything that imports c64cast. `make reference-figures`
redraws them.
Two things about the drawing worth keeping. The banks are solid slabs
with the used regions coloured as sections of the bar, rather than
blocks standing on a flat plate -- drawn the second way each region
reads as an L hovering over nothing. And the banks are spaced further
apart than a slab's own projected height, because a rhombus overlaps a
copy of itself shifted up by any less than that, which had every bank
crossing the one below it.
Type is sized from where the figure lands: the template places it at
78% of a 4.60in measure, so 1500px across is ~420dpi and a 7pt label is
40px, not the 20px that looks right on screen. A must_fit() guard
refuses to draw a line that would run off its box, since a figure is
looked at once and a silently clipped label is exactly what ships.
tests/test_reference_diagrams.py holds the script's copy of the palette
to template.typ, checks every figure is committed at the size the script
draws it, that each is referenced by a chapter and that none is
orphaned, and that the shot list is fresh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Last of the eight. The Programmer's Reference Guide had no figures at all, while carrying a twelve-step pipeline, a six-mode attribute story and a 64 KB memory map that are all inherently spatial. Five diagrams, one per thing prose was doing badly.
fig-1-1-ladderfig-3-1-pipelinefig-3-2-cellsfig-4-1-audiofig-5-1-memoryThe plan listed the cells figure first and the pipeline second; they are numbered here in reading order instead, because From Frame to Screen comes first in the chapter and a caption that disagrees with its filename is a trap for the next person.
How they are drawn
A new
scripts/make_reference_diagrams.py, Pillow, the vendored faces indocs/shared/fonts/and the template's own palette — so a diagram sits in the same type and the same blue as the page around it.cv2.putTextpath. A Hershey stroke font next to Jost reads as a screenshot of a different document.capture_guide_figure.py's PIL path was the better model but reads a user-installed font, which makes the output depend on the machine that drew it.uv run --no-projectand cannot regenerate anything that importsc64cast.make reference-figuresredraws them.Two things about the isometric map worth keeping:
(len + depth)·sin30 + h), because a rhombus overlaps a copy of itself shifted up by any less than that. At a smaller rise every bank crossed the one below it and the whole thing came out an Escher staircase.Type is sized from where the figure lands rather than from how it looks on screen: the template places a figure at 78% of a 4.60in measure, so 1500px across is ~420dpi and a 7pt label is 40px. A
must_fit()guard refuses to draw a line that would run off its box — a figure is looked at once, and a silently clipped label is exactly the kind of thing that ships.Also
pillownamed in the dev group. It already resolved transitively through matplotlib, but this script imports it directly.make reference-figures, besideguide-figures, in.PHONYand inhelp.docs/reference/img/README.mdshot list, generated by the script, as the guide'simg/has.Tests
tests/test_reference_diagrams.pyholds the script's copy of the palette totemplate.typ(the same tricktest_book_build.pyuses for the duplicated book basenames), checks every figure is committed at the size the script draws it, that each is referenced by a chapter and that none is orphaned, and that the shot list is fresh. Pixels are deliberately not compared: Pillow's rasteriser is not stable across versions, so a byte-for-byte drift test would fail on an unrelated dependency bump.test_book_build.py::test_every_referenced_figure_existspicks these up for free.Verification
All offline, no hardware.
make check— lint,mypy --strict+ pyright, 3336 tests, green.make reference-appendices && git diff --exit-code docs/— no drift.--checkon all three books, thenmake books.