summaryrefslogtreecommitdiff
path: root/anim/scenes/intro_memory.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-12 01:44:59 -0300
committerGabriel Schneider <[email protected]>2026-11-12 03:17:32 -0300
commitbf0dfa135319f8c7ca49eace4d1f81152ebfd23e (patch)
tree9c80ade769dc9a741c9d00f63770d34dc1769ced /anim/scenes/intro_memory.zig
parentaefde257db6e7cf683b923498c0d471885ab67a9 (diff)
downloadcomputeranim-bf0dfa135319f8c7ca49eace4d1f81152ebfd23e.tar.gz
computeranim-bf0dfa135319f8c7ca49eace4d1f81152ebfd23e.zip
canim: the introduction, three chapters
From the user: a first-principles showcase that builds the views. I, memory: the stack's bytes, words read low byte first, the address space to true scale with each cluster enlarged and every band's addresses and size, the bytes tied to their place, ink and chains. II, the stack: the words become the stack panel, a real push, the return address aimed at the row it returns to, rbp and the frame, the registers. III, code: an instruction's bytes decoded into one listing of lines and addresses, then two columns, then the working frame assembled and the map. Recorded from main's call of reverse with record --until. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/scenes/intro_memory.zig')
-rw-r--r--anim/scenes/intro_memory.zig26
1 files changed, 7 insertions, 19 deletions
diff --git a/anim/scenes/intro_memory.zig b/anim/scenes/intro_memory.zig
index 07e694a..7aec267 100644
--- a/anim/scenes/intro_memory.zig
+++ b/anim/scenes/intro_memory.zig
@@ -1,8 +1,8 @@
//! The introduction, chapter I: memory (design/motion.md, "A scene: the
//! introduction", I1 to I10; mocks 29, 30, 34, 37). The frame built from
-//! its bytes up, on the `list` recording stopped in `reverse`'s prologue,
-//! at its first call (line 17: the push chapter II walks; the 128 bytes at
-//! rsp then are the load's but for `prev`, not yet stored), each part in
+//! its bytes up, on the `intro` recording (the list program from main's
+//! call of `reverse`) at reverse's first instruction, its `push rbp` (the
+//! push chapter II walks; rsp holds the way back to main), each part in
//! the place it keeps: the 128 bytes at the top
//! of the stack where the stack panel will stand, under the camera at x2;
//! made words (`regroup`); three of them addresses; then the address space
@@ -36,22 +36,10 @@ fn start(s: *anim.Frame, v: anim.Value, frames: f32) void {
s.cursor = at;
}
-/// The first moment from `from` whose instruction reads `text`.
-fn on(rec: *canim.Recording, from: u64, text: []const u8) u64 {
- var buf: [256]u8 = undefined;
- var i = from;
- while (i < rec.end()) : (i += 1) if (rec.instruction(i, rec.register(i, "rip"), &buf)) |here| if (std.mem.indexOf(u8, here.text, text) != null) return i;
- return from;
-}
-
fn frame(s: *anim.Frame) void {
- const rec = canim.open(recordings.list);
- const reverse = rec.call("reverse", 0);
- // reverse's first call (line 17, the tracer's `__zt_var` for its first
- // local): the push chapter II walks. The recording begins after
- // reverse's own `push rbp` (`--from` breaks past the prologue), so it is
- // the first push of reverse's that the recording has.
- const moment = on(rec, reverse.enter, "call");
+ const rec = canim.open(recordings.intro);
+ // reverse's first instruction (its call's first moment): its `push rbp`, which chapter II walks.
+ const moment = rec.call("reverse", 0).enter;
const ui = canim.ui;
const at = canim.regroup.at;
@@ -121,7 +109,7 @@ fn frame(s: *anim.Frame) void {
const clusters = @min(l.space.clusters.len, 6);
var top_end: usize = 0;
while (top_end < clusters and l.space.clusters[top_end].lo > canim.segments.user_end / 2) top_end += 1;
- asides.say(s, "Enlarged, the top end: the stack, the libraries and the tracer's ring, each band with its addresses and size.", column_x, l.boxes[0].y + 12);
+ asides.say(s, "Enlarged, the top end: the stack, then the libraries, each band with its addresses and size.", column_x, l.boxes[0].y + 12);
for (0..top_end) |i| {
start(s, space.rides[i], 6 + 72 + 90 + 2 * 12 + 12);
s.wait(f(78));