summaryrefslogtreecommitdiff
path: root/examples/manual.zig
Commit message (Collapse)AuthorAge
* examples: manual's second slide, ADD's row 80 /0 ib becomes SUB's 80 /5 ibGabriel Schneider3 hours
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The manual example is a talk in two slides now: Figure 2-1 as before, then, once it clears, page 132 of the SDM's Vol. 2 (ADD) fades in with its opcode table taken out; the table is written back row by row (the column rules drawn down, then each row with the rule above it); the camera goes to 80 /0 ib ADD r/m8, imm8 as the rest greys; its opcode cell is tinted; closer in, the 0 after the slash morphs into the 5 of SUB's row from page 1400 while 80, / and ib hold still; then the rest of the row follows (ADD into SUB, Add into Subtract, to into from, imm8 and r/m8. sliding to their places) and the page around it becomes page 1400; at the end ADD's row comes back over SUB's, what differs is marked, and a line says why (one opcode byte, the ModR/M reg field picks the operation). Seven steps; the talk is 66 s exported. The pages and rows are checked against the PDF (pdftotext): ADD is page 132, SUB page 1400, and the rows' word boxes and the page's own rule shapes give the rectangles, in points, turned into the page's units by one function. Page 1400 stands 20 units higher, so its row (182-197 pt) lies on ADD's (167-182). The page draws a table's text row by row, left to right, and its rules after all of its text, so a row part writes in reading order. The column rules run the whole table, so their centres all fall in one row (83 /0 ib, at 265 pt): a band a point high through 265 takes the seven of them first, and nothing else. Each row is cut in the same eight pieces on both pages (the digit, the rest of the opcode, the instruction, the three short columns, the description word by word) and each piece morphs into its own: a morph pairs shapes by index, so the whole row (44 shapes into 51) would send every glyph after Add across the row. test/manual.script goes on through slide 2 with pixel checks (the table gone and back, the cell's tint, a step back to the exact picture before the digit's morph, the marks at the end) and checks three more exported frames of it, the same in both exports. The bench now times pages 132 and 1400 too (2118 and 2040 shapes: parse 10.0 and 10.3 ms, CPU draw 2.8, GPU record 1.2, in budget). The README's examples list and the manual's paragraphs say so, and how a table's column rules are taken. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* examples: manual, Figure 2-1 of the Intel SDM comes alive, as a talkGabriel Schneider3 hours
examples/manual.zig is a live scene with pauses, played by the stock player: page 31 of the SDM's Vol. 2 (Typst's import of the PDF, every glyph a shape) fades in on paper beside a title; the camera closes on Figure 2-1, the instruction format, while the rest of the page greys and its footnotes go; each field (Prefixes, Opcode, ModR/M, SIB, Displacement, Immediate) is tinted and glows in turn; 83 C0 01, add eax, 1, is written below; each byte flies into its field as the fields it has none for fade; C0 morphs down the arrow into the ModR/M byte's boxes as 11000000, which splits into 11, 000 and 000 over Mod, Reg and R/M, each with what it says (direct, /0 ADD, EAX); and the camera goes back to the page, filled in. Twelve steps, 18 s played straight. The labels, the ModR/M boxes, the figure and its footnotes are parts of the page, by rectangles in the page's units read off pdftotext -bbox (points to units: (pt - 306) * 4/3, (pt - 396) * 4/3) and checked with the guides; each tint is the s.rect of its label's rectangle. The bits are parts of a Typst object, cut by character (0.6 em of DejaVu Sans Mono at 14 pt). The PDF is never committed. build.zig's -Dmanual names it, by default ~/01-resources/intel-devref-ii.pdf; when the file is not there the scene is one line saying how to build with it. zig build manual plays it in a window. test/manual.script, run by zig build test (and test-manual) only when the file is there, steps through the talk with pixel checks (the paper, a tint where it should be and not where it should not, a step back) and exports it twice at 10 fps, the same frames both times. zig build bench also times the manual's page (its one #image source, when the build has the PDF), with a budget of its own for a drawing of over 1000 shapes: parse under 25 ms, CPU draw under 10, GPU record under 4, at 1280x720. Measured: 6.4, 1.9 and 0.77 ms on a quiet run; 14.8, 3.5 and 1.4 at load average 34; once 28.6 ms to parse, at that load, which failed it (the simple objects' 1 ms is as sensitive: 0.87 ms then). The manual's simple objects are not benched: a two-glyph 83 fitted to the whole canvas takes 1.1-1.2 ms on the CPU. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T