diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-12 04:45:57 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-12 07:03:05 -0300 |
| commit | 4907e35bc45d12102d0e09380994814fc2e0a369 (patch) | |
| tree | 7cfd90224653d73b63fbadaf2881fa0e6ba92860 /anim/src/rows.zig | |
| parent | ebdebe04a76f0302aeb24c1ac08fa9217b1a8257 (diff) | |
| download | computeranim-4907e35bc45d12102d0e09380994814fc2e0a369.tar.gz computeranim-4907e35bc45d12102d0e09380994814fc2e0a369.zip | |
canim: the introduction, from the review
The introduction records the plain build (clang -O0, no instrumentation),
so reverse's frame is the compiler's own push, mov and sub. The stack
chapter says its convention once and keeps four free words over rsp so
a push moves the pin and nothing else; reverse's rows stand under main's
and are stepped, each touching its word, the call before the push, the
aim drawn head first to the row it returns to. The close-up frames the
bytes and the stack together with their 128 bytes marked. Nothing is
named before it is shown; offsets are written in hex as the operands are;
the dump folds into its tag; the map is announced before it is shown.
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 | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/anim/src/rows.zig b/anim/src/rows.zig index 08f1fb2..bdf9454 100644 --- a/anim/src/rows.zig +++ b/anim/src/rows.zig @@ -326,9 +326,20 @@ pub fn slot(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, addr: u64, from_ return chain(u, at, y, moment, held, room, lead); } +/// The stack panel's offsets written with `0x` while it draws its rows +/// (`Levels.introduction`), where hex and decimal differ (10 and over), as +/// an instruction's operands and a value are (`-8`, `-0x18`). +pub var prefixed = false; + +/// `0x` in front of `n` (`prefixed`), or nothing. +pub fn hexMark(n: u64) []const u8 { + return if (prefixed and n >= 10) "0x" else ""; +} + /// A slot's offset from rsp, `from_rsp` bytes: hex, faint, ranged right to 172. fn offset(u: ui.Ui, y: f32, from_rsp: i64) void { - const text = if (from_rsp < 0) u.print("-{x}", .{@as(u64, @intCast(-from_rsp))}) else u.print("+{x}", .{@as(u64, @intCast(from_rsp))}); + const p = hexMark(@abs(from_rsp)); + const text = if (from_rsp < 0) u.print("-{s}{x}", .{ p, @as(u64, @intCast(-from_rsp)) }) else u.print("+{s}{x}", .{ p, @as(u64, @intCast(from_rsp)) }); u.text(.mono, size, theme.metric.slot.offset - u.width(.mono, size, text), baseline(y), text, t.faint); } |
