summaryrefslogtreecommitdiff
path: root/design/mock/context.py
diff options
context:
space:
mode:
Diffstat (limited to 'design/mock/context.py')
-rw-r--r--design/mock/context.py34
1 files changed, 31 insertions, 3 deletions
diff --git a/design/mock/context.py b/design/mock/context.py
index 31a54f6..b35abd5 100644
--- a/design/mock/context.py
+++ b/design/mock/context.py
@@ -301,12 +301,40 @@ def bracket(g, x, y0, y1, ink, sw=2, serif=5, side=1):
# ---- the state column ---------------------------------------------------------------
-def registers(g, y, regs, flags, marks):
+QUIET_PITCH = 285 # a quiet register's cell: three to a row
+
+
+def reg_rows(quiet):
+ """The registers panel's rows: one a register the scene moves (and rsp, rbp, rip), a row of three the rest."""
+ return 17 - len(quiet) + (len(quiet) + 2) // 3
+
+
+def registers(g, y, regs, flags, marks, quiet=()):
+ """quiet: the registers no step of the scene changes, folded three to a row over rip: each its name and its
+ value in its ink, a pointer's chain cut to `more` at once (the map has it whole)."""
legend = [("stack", STACK, False), ("heap", HEAP, False), ("code", CODE, False), ("data", DATA, False),
("rwx", DATA, True), ("read-only", VELLUM, False)]
- y0 = panel(g, RX, y, CW, 17, "registers", note=legend)
+ y0 = panel(g, RX, y, CW, reg_rows(quiet), "registers", note=legend)
where = {}
- for i, (name, links, end) in enumerate(regs):
+ full = [r for r in regs if r[0] not in quiet]
+ if quiet:
+ qy = y0 + (len(full) - 1) * ROW
+ g.rect(RX + 2, qy, CW - 4, 2, RULE)
+ for k, (name, links, end) in enumerate(r for r in regs if r[0] in quiet):
+ xx, yy = RX + 12 + (k % 3) * QUIET_PITCH, qy + (k // 3) * ROW
+ where[name] = yy
+ g.t(xx, b(yy), name, S, FAINT, MONO)
+ if links:
+ x = addr(g, xx + 48, yy, links[0][0], links[0][1])
+ if len(links) > 1 or end is not None:
+ more(g, x, yy)
+ else:
+ integer(g, xx + 48, yy, end[1])
+ full = full[:-1] + [None] * ((len(quiet) + 2) // 3) + full[-1:]
+ for i, r in enumerate(full):
+ if r is None:
+ continue
+ name, links, end = r
yy = y0 + i * ROW
if name == "rip":
g.t(RX + 12, b(yy), name, S, current_row(g, RX + 2, yy, CW - 4, 54), BOLD)