diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-11 20:08:07 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-11 21:45:12 -0300 |
| commit | 15de88cf82c187635c1989e91bfa639a10304066 (patch) | |
| tree | 16fa83854258c0c6aec1dff7f70ebabf5fd64c09 /anim/src/rows.zig | |
| parent | 0ec2376cae2fdfc50e90d930ebc86c7a5b7f5594 (diff) | |
| download | computeranim-15de88cf82c187635c1989e91bfa639a10304066.tar.gz computeranim-15de88cf82c187635c1989e91bfa639a10304066.zip | |
canim: a column of text as an experiment; the disassembly tied to the stack
From the user. A scene may set its text in a column beside the panes a
beat is about: col.beat names the panes and their rows, where the text
is placed (beside, below, above, or on a drawing) and what it is level
with; panes the beat leaves out fold to their title bars on a shelf,
their changes struck there. Tried as two scenes beside the originals:
the call followed down (column) and a bubble on sort's rings
(column_sort).
annotation = .tied names the word an instruction touched and draws a
touch to its stack row; offsets count from the frame's base; rsp's pin
travels with its amount before the stack follows; .whole keeps the full
chain. carry = .arrow draws a value's way between memory and a register.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/rows.zig')
| -rw-r--r-- | anim/src/rows.zig | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/anim/src/rows.zig b/anim/src/rows.zig index 03c5898..08f1fb2 100644 --- a/anim/src/rows.zig +++ b/anim/src/rows.zig @@ -59,6 +59,8 @@ pub const Marks = struct { /// How much the hops after the first show: they fade out as the memory /// they read is about to change (`Now.following`). hops: f32 = 1, + /// How many hops at most: a `tied` annotation's register is its first value (`rax 405010`). + most: usize = 6, }; /// `chain` of a memory access narrower than a word: its address, then what @@ -117,7 +119,7 @@ pub fn chain(u: ui.Ui, x: f32, y: f32, moment: Recording.Moment, value: u64, roo const mid = y + row_h / 2; var hops: Hops = .{}; var at = x; - for (links, 0..) |link, i| { + for (links[0..@min(links.len, marks.most)], 0..) |link, i| { const pointer = link.region != .none; const shown = ui.Value.of(link.value, pointer); const w = shown.width(); @@ -278,7 +280,7 @@ fn ripFlag(u: ui.Ui, x: f32, y: f32, flag: Flag, set: bool) void { } /// A slot's role as it was before the step, and how far (0 to 1) the role it has now has come in over it. -pub const Role = struct { name: []const u8, local: bool = false, going: f32 = 1, from_rsp: ?i64 = null }; +pub const Role = struct { name: []const u8, local: bool = false, going: f32 = 1, from_rsp: ?i64 = null, offset_going: ?f32 = null }; /// `slot`: a word of the stack: a lane to 112 for `row` pins (`pins`, the /// registers that hold its address); its offset from rsp (`from_rsp` @@ -292,9 +294,9 @@ pub fn slot(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, addr: u64, from_ const s = theme.metric.slot; if (pins.len > 0 and pin_shows > 0) u.faded(pin_shows).pinRow(s.lane, y, pins, theme.color.region.stack); // An offset that changes with rsp (the window held, or moved by more than the slide) crossfades as a role does. - if (was) |o| if (o.from_rsp) |old| if (old != from_rsp and o.going < 1) { - offset(u.faded(1 - o.going), y, old); - offset(u.faded(o.going), y, from_rsp); + if (was) |o| if (o.from_rsp) |old| if (old != from_rsp and (o.offset_going orelse o.going) < 1) { + offset(u.faded(1 - (o.offset_going orelse o.going)), y, old); + offset(u.faded(o.offset_going orelse o.going), y, from_rsp); } else offset(u, y, from_rsp) else offset(u, y, from_rsp) else offset(u, y, from_rsp); var lead = marks; lead.first = .none; @@ -333,10 +335,14 @@ fn offset(u: ui.Ui, y: f32, from_rsp: i64) void { /// `slot` `free`: a word above rsp the stack has not reached, shown while /// the window is held for the camera: its offset, its address at 60%, its /// word faint, no chain, no pin. -pub fn free(u: ui.Ui, y: f32, moment: Recording.Moment, addr: u64, from_rsp: i64, lead: usize) void { +pub fn free(u: ui.Ui, y: f32, moment: Recording.Moment, addr: u64, from_rsp: i64, lead: usize, was: ?Role) void { const s = theme.metric.slot; const base = baseline(y); - offset(u, y, from_rsp); + // An offset whose base the step moves crossfades, as a slot's does. + if (was) |o| if (o.from_rsp) |old| if (old != from_rsp and o.going < 1) { + offset(u.faded(1 - o.going), y, old); + offset(u.faded(o.going), y, from_rsp); + } else offset(u, y, from_rsp) else offset(u, y, from_rsp) else offset(u, y, from_rsp); const end = u.address(s.address, base, addr, .{ .ink = ui.mix(theme.color.region.stack, theme.color.page, theme.metric.context.lead_alpha), .lead = lead }); const word = (Recording.word(moment, addr, 8) catch null) orelse return u.unknown(.{ .x = end + m.arrow_w, .y = y, .w = 24, .h = row_h }); u.text(.mono, size, end + m.arrow_w, base, u.print("{x}", .{word}), t.faint); |
