Files
ROT-8-viz/tapes/serial_echo.rot8
T
dsh 593e1c3b70 Serial ASCII mode: OUT writes one character, INP reads one
-s / --serial switches INP and OUT from decimal numbers to characters.  The
character is the low 7 bits of the cell, so the 8th bit stays the tape's own:
INP writes bits 0..6 and leaves everything from bit 7 up untouched, which is
where a flag, a length or a counter can live without the I/O trampling it.
Checked by hand: a cell preset to 0x80 that then reads 'A' ends at 0xC1, at 8
and at 11 bits per cell.

  * include/rot8/rot8_io.h, src/rot8_io.c: the mode itself, plus
    rot8_io_wrote_serial() so the CLI can close the line (a serial OUT writes
    no newline, that is the point); stdin is read as characters as well, and
    EOF feeds 0 instead of blocking.
  * src/rot8_viz.c: the frame shows characters in this mode -- the out/in
    boxes list them, the console prints output> 'R' 82, unprintables become
    \x0A so a frame stays one line of ASCII, and the live prompt takes the
    first character typed instead of parsing a number.
  * tests/vm_test.c: -s/--serial, a cell_size < 8 check (a 7 bit character
    plus a flag does not fit in fewer bits), --input becomes the text itself
    (one INP per character, which is why the arguments are now collected and
    pushed after the whole command line is known), and one trailing newline
    at the end because serial OUT has none.
  * tapes/serial_echo.rot8: ,.,.,. -- read three characters, echo them.
  * README: what the mode does, the bit 7 rule, and three ways to run it.

Decimal mode is unchanged: --input 7,5 still prints 7 and the existing demos
still print their numbers.
2026-11-07 15:58:06 +08:00

1 line
6 B
Plaintext