EMIT is a device service: a character sent to the console node. The mesh and its ports are development step 2 and the memory map is open (D-4), so the single-node model now stands in for the console with one memory-mapped register, so that printing words can be run and their output compared with v3's. v4_node_console_attach(n, addr): after it, a store to word address `addr` appends the low 8 bits of the value to a buffer on the node (V4_CONSOLE_CAP characters, 4096 by default) and does not write memory; a load from `addr` reads the memory word as before. Characters past the capacity are counted in console_dropped and discarded. The hook is in v4_node_store, which all four store opcodes use. It is off by default: v4_node_reset detaches the console (address -1) and empties the capture, so the ISA's behaviour and every existing test are unchanged unless a console is attached. The address is the caller's choice. New test v4/tests/test_console.c, 22 checks per width: direct stores, !b, ! and !+ through the executor printing "Hi!", memory at and around the register untouched, the low byte only, overflow, detach, a console at word 0, and reset. At 32- and 64-bit cells, optimised and ASan+UBSan (`make test`, `make sanitize`); all other v4 tests still pass. Four mutations of the hook each fail. DECOMPOSITION.md section 7 gains the CONSOLE-TX row. No printing word is defined here; EMIT and the words on it are still to do. Test results on the amd64 host only. This is a development check, not acceptance (JUSTIFICATION.md section 16). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1.0 KiB
v4/
StarForth v4: the 32-instruction F18-derived core. The design lives in
docs/v4.0.0/JUSTIFICATION.md (why) and docs/v4.0.0/DECOMPOSITION.md
(every v3 word mapped to a v4 fate).
The first deliverable is the hosted C99 golden model (JUSTIFICATION.md §10,
step 1). It must pass POST and hold K≡1.0 with 32- and 64-bit cells on all
three host ISAs.
Acceptance (JUSTIFICATION.md §16): v4 must be equivalent to v3 at any point
in time, with the same vocabularies and behaviour, on the F18-derived engine;
and every ISA, hosted and bare metal, must still reach its ok prompt.
make -C v4 test passing is a development check, not acceptance.
What exists so far is the single node: registers, circular stacks, memory, all
32 opcodes, per-opcode and per-call-target heat, and a console capture
register (CONSOLE-TX) standing in for the console node until the mesh exists. make -C v4 test builds
and runs the tests at both cell widths; make -C v4 sanitize repeats them
under ASan and UBSan. There is no compiler capsule, no POST and no K
measurement yet.