Files
R8Forge/examples
dsh 55ab5dfebd examples: the terminal tape -- prompt, echo, newline, backspace, EOF
examples/term.r8asm is the "type at it and it answers" program: it prints "> ", then
echoes every character the machine reads, prints a fresh prompt after each newline,
and answers a backspace with space + backspace so the cursor erases the glyph.
EOF (the 0 that inp returns when the input is gone) erases the loop quota, so the
loop ends and the tape runs off its end after one final newline.

  tape 3467 characters, 4743 steps for a two line session (the calculator is 62585)

Measured (derive and tape_run, then the reference machine's serial output):

    in  hi            out 62 32 104 105 10                       "> hi\n"
    in  hi<LF>ok      out 62 32 104 105 10 62 32 111 107 10      two prompts
    in  h<BS>i        out 62 32 104 8 32 8 105 10                the 8 32 8 pair

All three character streams agree with ROT-8-viz byte for byte (bar CRLF).
r8forge_examples_test passes all 18 examples.

One thing worth recording: my brief for this said "a body entered on LSB==0 needs no
clear" -- that is backwards, `[` *jumps* on LSB==0, so bodies are entered on LSB==1.
Following it inverted the dispatch (EOF fired with C=0x68) and it took a
`tape_run --trace` to see it; the file now documents the real rule next to the loop.
2026-11-17 20:31:36 +08:00
..