/* test_terminal.c -- EMIT, CR, SPACE, TYPE, KEY and ?TERMINAL, executed. * * DECOMPOSITION.md 5.10. EMIT is a device service; on the single-node model * it is a store to the CONSOLE-TX capture register (node.h), so what these * words print can be read back and compared with v3. * * v3 (v3/src/word_source/io_words.c): EMIT prints the low byte of the cell; * CR prints character 10; SPACE prints a blank; TYPE ( addr u -- ) prints u * bytes, nothing for u = 0, and for u < 0 prints nothing and raises its error * flag. v4 sets NODE-ERROR in that last case, as D-13 does for HOLD. * * KEY ( -- c ) and ?TERMINAL ( -- flag ) are device services too; on the * single-node model they read the CONSOLE-RX and CONSOLE-STATUS registers * (node.h), which hand out characters the test feeds. v3: KEY is the next * character of input, waiting for one; ?TERMINAL is -1 when one is ready and * 0 when not. At the end of its input v3's KEY returns -1; here there is no * end of input, and KEY waits. * * Three transcripts of the real v3 binary are recorded below as expected * output. They were taken on 2026-10-03 from * printf '