feat(v4): HEAT-OP[0..31] and ANTICLOCK, read by HEAT-OP@ and ANTICLOCK@
#189 -- Captain Bob, 2026-11-12: "Add HEAT-OP. If it's a huge performance hit, we'll revert it. If not ... it stands"; a full 33-cell array, as DECOMPOSITION.md section 7 draws it; the Stadium feed is Phase 1's. - node.h/node.c: v4_node_heat_regs_attach; a data fetch from base+k gives opcode k's count, base+32 the anti-clock (the low cell at 32 bits); a store changes nothing. Reset detaches them. - host_map.h: HEAT_REG at word 13824, in what was free between the dictionary space and SEND_TEXT; the compile-time check covers it. Nothing moved. map-*.f18: HEAT-OP 13824, ANTICLOCK 13856. - image.h/image.c/mkmap.c: the image carries the address; v4_image_born attaches the node's own counts. - system.f18: HEAT-OP@ ( op -- n ), op mod 32; ANTICLOCK@ ( -- n ). word_count 318 -> 320 (hosted 317 -> 319): dict_hash changes. - v4-dictionary.tsv: both words; DECOMPOSITION.md 7 records the build. Also in this batch: - Makefile: make init installs qemu-user -- hosted-check needs it (Captain Bob: "Add to make init now"). - .claude/memory/rules.md, rule 5: stop and ask when something comes up (Captain Bob: "you are supposed to stop and ask"). Tests first (logs/20261113-005047/heat-op): test_node did not compile; test_host_quit 3 of 1337 failed. Suite: 199 programs, 7448554 checks, 0 failures; hosted-check, the three alike. Timing: no measurable cost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -332,6 +332,7 @@ static void boot_with(unsigned depth)
|
||||
v4_node_console_input_attach(&n, CONSOLE_RX, CONSOLE_ST);
|
||||
v4_node_fault_attach(&n, w_fault);
|
||||
v4_node_error_attach(&n, NODE_ERROR);
|
||||
v4_node_heat_regs_attach(&n, HEAT_REG, h.op, &es.anticlock); /* HEAT-OP[0..31] and ANTICLOCK (#189) */
|
||||
v4_dstack_reset(&n.ds);
|
||||
v4_rstack_reset(&n.rs);
|
||||
v4_exec_reset(&es);
|
||||
@@ -962,6 +963,15 @@ int main(void)
|
||||
CHECK(is(say(" SHOW\n"), "88 ok\nok> "), "and then all of it is read");
|
||||
CHECK(canary_under_expect(), "the data stack is as it was at switch-on");
|
||||
|
||||
/* ---- the heat registers (#189; Captain Bob, 2026-11-12: "Add HEAT-OP"): HEAT-OP@ ( op -- n ) and
|
||||
* ANTICLOCK@ ( -- n ) read the node's counts as they are now ---- */
|
||||
boot();
|
||||
CHECK(is(say(": T1 ANTICLOCK@ ANTICLOCK@ < IF 89 EMIT THEN ; T1\n"), "Y ok\nok> "), "ANTICLOCK@ goes forward: one tick per instruction");
|
||||
CHECK(is(say(": T2 20 HEAT-OP@ 1 1 + DROP 20 HEAT-OP@ SWAP - 0> IF 89 EMIT THEN ; T2\n"), "Y ok\nok> "),
|
||||
"HEAT-OP@ of + (opcode 20) counts the + between the two reads");
|
||||
CHECK(is(say(": T3 24 HEAT-OP@ 56 HEAT-OP@ = IF 89 EMIT THEN ; T3\n"), "Y ok\nok> "),
|
||||
"an opcode number is taken mod 32: 56 reads dup's count (opcode 24), with no dup between");
|
||||
|
||||
/* ---- a definition over several lines, and an error in the middle of one ---- */
|
||||
boot();
|
||||
CHECK(is(say(": LONG\n"), " ok\nok> ") && n.mem[STATE] != 0, "a line that leaves a definition open still says ok");
|
||||
|
||||
Reference in New Issue
Block a user