Files
ROT-8-viz/tests
dsh 5a23ffd64d Any cell width, any tape length, and the frame follows both
The previous commit still treated the geometry as a small menu: 8/16/32 bits and
a grid whose column count was hard wired per width.  ROT-8 does not work that
way -- the tape is a ring of any length and a cell is a ring of any width -- so
both are open now:

    --cell 1 .. 32     (any value, not just 8/16/32)
    --mem  1 .. 1048576 (any value, not just powers of two)

What had to change for that:

* A cell needs ceil(bits/4) hex digits, at least one, so a 1 bit cell prints
  "0x1" instead of nothing and a 12 bit cell prints three digits.
* The number of cells per dump row is computed from the space the gutter leaves
  (VIZ_INNER - addr_digits - 5) divided by one cell's field width, capped at 16.
  Every geometry therefore lays out inside the 56 character frame: 16 columns at
  8 bits, 9 at 16, 5 at 32, 12 at 12 bits, and a ragged last row just ends early.
* rot8_config_apply accepts any cell_bits in 1..32 instead of three values.

Live mode needed nothing beyond that, but it is worth stating why it stays
stable: the frame height depends only on the geometry -- rows are
min(ceil(cells/cols), 16), the window line exists exactly when the tape is taller
than that, and the caret row is always drawn because the pointer is always on the
tape (it is a ring).  So every frame of a run is the same height and the in place
redraw cannot smear.  Width is capped at 58 characters for the same reason.

Checked: --dump for and, or, full_adder, wave and test is still byte identical to
the build before any of this, and -++++ gives 0x10 / 0x1000 / 0x100 / 0x10000000
at 8 / 16 / 12 / 32 bits.
2026-11-07 10:38:56 +08:00
..