Files
starcells b654bd644d Add a live memory view for the tape
The machine can now hand a hook the whole execution, and rot8_viz draws
what it sees: the 256 cell tape as a hex map, the cell under the pointer
with its eight bits, the program counter and the values OUT produced.

    rot8_test --live tapes/wave.rot8     # redraw in place while it runs
    rot8_test --dump tapes/and.rot8      # one static snapshot at the end

Frames are plain ASCII, so the view survives pipes, ssh and logs; colour
is ANSI and only used when the terminal can take it.  Running without
--live or --dump behaves exactly as before: the tape just runs.

rot8.h gains rot8_run_hooked() plus read-only accessors for the tape,
the program counter and the step count, so that tools do not have to
reach into rot8_iter.  read_tape() now reports a missing file and stops
at the end of the buffer instead of writing past it.  Also fixes the
ROR/FLB opcode comments, which had the BF characters the wrong way round.

tapes/wave.rot8 is a small demo: it walks a single set bit across 240
cells, which looks like a wave moving over the tape.
2026-11-05 21:25:42 +08:00

2 lines
1.3 KiB
Plaintext

# wave tape: cell i holds bit (i mod 8) one row per 16 cells
->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+>->-+++++++>-++++++>-+++++>-++++>-+++>-++>-+